waydroid / waydroid

Waydroid uses a container-based approach to boot a full Android system on a regular GNU/Linux system like Ubuntu.
https://waydro.id
GNU General Public License v3.0
7.87k stars 323 forks source link

Going landscape the window dont resize and dont go to landscape - [Pinephone] #248

Open paju1986 opened 2 years ago

paju1986 commented 2 years ago

The issue happens for me on Manjaro plasma mobile. With autorotate enabled when going from portrait to landscape the waydroid window dont resize properly nor the underlaying android system realize that shoud go to landscape mode, making unusable any waydroid app in landscape mode, this is important for example for watching videos apps etc...

primeFunction commented 2 years ago

If you download and run Device Info HW, you'll discover that none of the sensors responsible for spatial orientation are active. In order for Waydroid to make use of landscape mode, calls to hardware such as the accelerometer, magnetometer and/or gyroscope need to be made available inside the container.

I don't know how to go about implementing that, but assumedly someone is working on it.

jsommr commented 2 years ago

The problem will likely persist even if those features are implemented. If Waydroid is run within a DE that rotates, Waydroid will still have the same physical size (can be seen in waydroid shell then wm size), and reversing that value won't work because the window is not going to go beyond the physical size. The only way I've found is to run the full UI in a different tty in Weston, not controlled by gnome or kde, and then call wm set-user-rotation from the host when rotation is detected. This way the physical size remains the same and Waydroid is correctly rotated.

primeFunction commented 2 years ago

Waydroid will still have the same physical size (can be seen in waydroid shell then wm size), and reversing that value won't work because the window is not going to go beyond the physical size

Y'know what, that does make sense. When you rotate KDE or GNOME, the UI elements have be reoriented to accommodate the change in aspect priority, but I never thought about that as mechanical change to the shape of the UI "box". In a similar fashion, I was thinking of Waydroid as a container for the Android partition, in that it is logically separated from the rest of the system, but I failed to considered the idea that it could also be a physical box, with fixed parameters, for the UI as well.

How difficult would such a containerized, co-compositor be to implement?

PhilDevProg commented 1 year ago

Waydroid seems to get the information which size the window has to be when the session starts because if you first rotate and then start the session, the window has the right size. Maybe Waydroid could check if there's a change in rotation and resize the window? Would that be possible?

Talkless commented 1 year ago

Same issue on Volla Phone X with Ubuntu Touch.

ermyril commented 8 months ago

Weird, it seems like there is a waydroid-sensors, but still accelerometer doesn't seem to be seen by the android https://github.com/waydroid/waydroid-sensors

I've found a way to rotate the screen via adb shell settings put system user_rotation 3

If nothing helps I think it's possible to create a small util to monitor iio-sensor-proxy and then emit adb commands with rotation. Definitely not an ideal way but should work

Also we should probably separate the issue of autoresize of the window (which might not be possible without the session restart) and not proxying accelerometer events to the waydroid

X-m7 commented 8 months ago

While the adb shell settings put system user_rotation 3 trick might work for most apps, there are still some that just end up still showing in portrait while the rest of the UI is in landscape mode, resulting in huge black bars at the sides (like the launcher if waydroid show-full-ui is used), or otherwise refuses to use the full screen space (like the Bad Piggies game for example, it ends up only using about 1/4 of the available screen area).

Restarting the Waydroid container and session while making sure that the phone is in landscape mode does make those apps use all the screen area, but of course that in turn makes using Waydroid apps while the phone is in portrait mode problematic without another Waydroid restart.

Jarige commented 3 weeks ago

This issue doesn't just occur on the PinePhone, it occurs on any device that is able to rotate the screen. So for a example, it happens on Microsoft Surface tablets and laptops as well. It makes Waydroid quite useless to me, sadly. I hardly make use of it because of this screen rotation issue.

badrihippo commented 2 weeks ago

I had this same problem on my Poco F1 (running Mobian). Found the answer in #70 which asks the opposite question: how to rotate apps the right way up on desktop?

The relevant comment by @Xtr126 at https://github.com/waydroid/waydroid/issues/70#issuecomment-991671850:

I fixed this with adb shell wm set-fix-to-user-rotation enabled

Since we have the opposite issue, I tried

adb shell wm set-fix-to-user-rotation disabled

...and et voilà, it worked!

View screenshot ![d6d01796_287b8fa7-7c2e-4a2d-873d-4f392e66aee7](https://github.com/user-attachments/assets/50a65ec6-e2bc-4c67-af1b-32af9fee4e90)

(Context for the screenshot: Duolingo normally runs in portrait mode, but for music lessons they switch to landscape. Before running the above command, the "landscape" was a very tiny rectangle in portrait mode with large black bars on the top and bottom, but as you can see from the picture that is no longer the case :tada:)