(Android) Screen orientation issue when returning from lock screen on HTC One M8

Reproduction steps:

  • Deploy a project which is set to landscape orientation to device (such as most of the templates, no changes needed)
  • While the game is running lock the screen (either due to time-out or pressing the power button)
  • Unlock the screen to return to the game
  • The view is now distorted and touch events are not handled at the correct location (see attached screenshots for comparison)

It seems like the game handles touch events and rendering as if it is in portrait view but then rotates and stretches the final portrait image to match a landscape view.

Note that this does not happen on all devices. The issue always happens on a HTC One M8 running the currently latest software updates available. (based on Android 6.0) However, testing on other devices does not cause the same issue. Other devices tested are a Oneplus One and a HTS One S.

Bugged perspective:

Expected view:

Hey

I have checked this on a phone that is similar to the HTC One, the . I did not run into the squished screen orientation like you have. I even upgraded to 6.0.1 Android to see if that was part of the issue. I also checked on the Nvidia Shield tablet and was also unable to reproduce.

I set the project up as: Target Hardware Mobile/Tablet and Scalable 3D or 2D.

Looking forward to hearing back from you, thanks!

Maybe it is related to specific adjustments done to android by HTC? As stated, I also tested a Oneplus One which has exactly the same Snapdragon 801 processor and it doesn’t exhibit the issue.

It happens consistently and repeatably on the HTC One M8 though. As long as the project is set to run in landscape orientation, other settings don’t seem to influence it at all.

I can add that I also experienced this bug on this model phone months back on an older android and UE4 version. As I wasn’t doing any serious Android development at the time I never got around to reporting it then, but that seems to indicate that it has been around for a while.

Is there anything else I can test to help you find the cause of this issue?

Possibly. I’m going to need for you to provide me the logs from your mobile device.

  • Attach your phone to the computer
  • Go here: C:\android-sdk-windows\tools
  • Open up Monitor.bat
  • Launch the program and save the logs

If you cannot get Monitor.bat to open, please go to:

  • C:\android-sdk-windows\tools\lib\monitor-x86
  • Open up Monitor.exe
  • Follow the instructions above

Make sure that you highlight all of the logs, because they do not save unless they’re highlighted.

Thank you!

Here’s the [log file][1]. I simply started the app, turned off the screen, turned it back on and unlocked to see the squashed screen.

88468-log.txt (192 KB)

Thank you for your patience. The logs state that “App is running in Landscape” at startup. Which means that the phone switched to the orientation set in the manifest properly and it did “setting width=1280 and height=720”.

If you look further into your logs, you’ll see that it says: “App is running in Portrait” with the setting width=720 and height=1280.

It needs to be set to width=1280 and height=720 like it was earlier. Your specific device seems not to tell the new orientation after the lock has been pressed.

  • Have you tried flipping your phone to different lengths to see if an orientation will change?
  • Does locking it and unlocking it fix it?
  • Does this happen only during launch or during a packaged project too?
  • Did you ever change any of the orientation information within the project itself?

Thanks!

  • Have you tried flipping your phone to different lengths to see if an orientation will change?

When the orientation setting is set to “sensor landscape” it will change between normal and inverted landscape like normal, but the image stays squashed.

  • Does locking it and unlocking it fix it?

No, locking and unlocking again does not fix it. Switching to another app and switching back does fix it though, even if the other app (like the lock screen) runs in portrait mode.

  • Does this happen only during launch or during a packaged project too?

This happens in both editor launched and packaged projects.

  • Did you ever change any of the orientation information within the project itself?

I’ve tried various settings. As stated above, landscape sensor causes the image to stay squashed but rotate along with the sensor. Any setting that also allows portrait mode will cause the screen to reset to correct proportions when switching between a landscape and portrait orientation.

All other applications that support landscape orientation that I’ve tested on this device did not exhibit this bug, so it seems to be caused by a specific interaction between how the device and UE4 handle orientation. However, I have only tested on a limited number of devices so there might be more out there that exhibit this behaviour.

Hope that helps to track down the cause. Let me know if I can test anything else.

Thanks for being so thorough with your answers. I went ahead and spent some additional time on this issue. I tested the orientation with the following settings:

Mobile/Tablet project with maximum quality. I then went ahead and tested the landscape, sensor landscape and full sensor options with a password on the lock screen and without the sensor on the lock screen. I used both the Nvidia Shield and the . Neither one of the devices replicated what you’re describing. The only time I saw squished orientation was for a split second and it completely corrected itself.

Without being able to fully replicate the issue that you’re describing, I am unable to put a bug in. I do believe that you’re experiencing this issue, but it seems to be directly related to your specific phone.

If you would like, you could upload your sample project that you’re definitely having this issue with on your device. I will then thoroughly test the devices that I have available and hopefully one will run into the orientation issue.

:slight_smile:

Hey

We have not heard back from you in a few days, so we are marking this post as Resolved for tracking purposes. If you are still experiencing the issue you reported, please respond to this message with additional information and we will offer further assistance.

Thank you!