mastodon-android icon indicating copy to clipboard operation
mastodon-android copied to clipboard

Optimizing for Waterfall Displays?

Open morta5 opened this issue 2 years ago • 17 comments

I just opened the app for the first time(in fullscreen) on my Moto Edge Plus and noticed it's not optimized for Waterfall Displays. I can use it normally after disabling the edge screen but it would of course be better if optimized. See the attached screenshots Screenshot_20220413-194748 Screenshot_20220413-194733 Screenshot_20220413-194727 Screenshot_20220413-194730 Screenshot_20220413-194704 Screenshot_20220413-194424-599 Screenshot_20220413-194419

morta5 avatar Apr 13 '22 17:04 morta5

TIL that this device exists. It looks pretty similar to the Galaxy S9 I mostly debug the app on.

But, things getting beneath the status bar is something I'd like to avoid. Do they do something special with the window insets (it feels like they do)? Do they have any developer docs about that?

grishka avatar Apr 13 '22 18:04 grishka

https://developer.android.com/reference/android/view/DisplayCutout.html#getWaterfallInsets()

morta5 avatar Apr 13 '22 18:04 morta5

That's about the edges, but doesn't explain why systemWindowInsets seemingly aren't returned correctly 🤔

grishka avatar Apr 13 '22 18:04 grishka

Not sure but after tapping on the settings-icon and going back it is getting displayed correctly Screenshot_20220413-210513 Edit: the screenshot I uploaded doesn't include the waterfall-area, which was in #282c37 when I made this screenshot. I think my device just disabled the waterfall.

morta5 avatar Apr 13 '22 19:04 morta5

Okay. Does it also fix itself if you rotate the screen? And it's Android 11 and stock ROM, right?

It might well be that my handling of window insets isn't 100% correct, so for now I'll wait to see if this issue happens on any other devices. In particular, I only have one device with a screen cutout (Pixel 4a), so my testing in this area is somewhat limited.

grishka avatar Apr 13 '22 19:04 grishka

No, it doesn't fix itself when rotating and yes, it's the stock Android 11 rom. Btw can't you just emulate the waterfall in developer settings? Screenshot_20220413-211748

morta5 avatar Apr 13 '22 19:04 morta5

Indeed I can, but I still can't reproduce the "toolbar ends up behind the status bar" thing 🤔 (this is an emulator with android 12) screenshot

grishka avatar Apr 13 '22 19:04 grishka

It does only happen when using the "fullscreen" option to open the app, which should enable(or force idk.) the waterfall area. Screenshot_20220413-212928-327

morta5 avatar Apr 13 '22 19:04 morta5

I'm leaning towards this being something Motorola did that can't be reproduced on AOSP/Pixel, but as I said, I'd like to collect more reports to see how many, and which, devices are affected, if any.

It does only happen when using the "fullscreen" option to open the app, which should enable(or force idk.) the waterfall area.

It does look like an OEM addition. There's no such thing on the emulator.

screenshot

grishka avatar Apr 13 '22 19:04 grishka

Sure, but do you also have (black)/#282c37/unused bars at the right and left of the screen on your S9 and are these intended? The toolbar thing wasn't actually why I opened this issue, it was about the unused waterfall area(which is probably why this sometimes happens).

morta5 avatar Apr 13 '22 20:04 morta5

Sure, but do you also have (black)/#282c37/unused bars at the right and left of the screen on your S9 and are these intended?

Nope. But then it runs Android 9, and waterfall insets were only added in 10.

grishka avatar Apr 13 '22 20:04 grishka

Anyway, I was bored and I wanted something similar for quite some time, so I made a simple app that visualizes the window insets in an easy to understand form. Could you please install it and take screenshots in both modes?

For those curious, here it is running on different devices

screenshot

screenshot

screenshot

screenshot

app-debug.apk.zip (remove .zip after downloading because github is picky about file types)

grishka avatar Apr 13 '22 22:04 grishka

Sure. Here are all screenshots in both modes (but there doesn't seem to be any difference between fullscreen and normal): Screenshot_20220414-011002 Screenshot_20220414-010955 Screenshot_20220414-010937 Screenshot_20220414-010919 Screenshot_20220414-010906 Screenshot_20220414-010850 Screenshot_20220414-010813 Screenshot_20220414-010732

morta5 avatar Apr 13 '22 23:04 morta5

Thanks!

Setting LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS was probably not a good idea (and the Mastodon app doesn't do it). Try this one, there should be a difference in those modes with the checkbox unchecked: app-debug.apk.zip

grishka avatar Apr 13 '22 23:04 grishka

Those marked with "F" were made in fullscreen mode Screenshot_20220414-013154-272 Screenshot_20220414-013139-551 Screenshot_20220414-013110 Screenshot_20220414-013104 Screenshot_20220414-013049 Screenshot_20220414-013041 Screenshot_20220414-013030-241 Screenshot_20220414-013016-580 Edit: The screenshot of the last picture(fullscreen, no LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS) doesn't include the waterfall area which I can see. The visualisation in the background doesn't make a difference in fullscreen when checking and unchecking the box(for me, on the screen).

morta5 avatar Apr 13 '22 23:04 morta5

Hm. Yes it does look like I expect it to (the top system inset is there), the toolbar getting behind the status bar must be a bug in the way I handle insets then. Also strange how no DisplayCutout is returned at all when you don't set that layout mode 🤔

grishka avatar Apr 13 '22 23:04 grishka

Also strange how no DisplayCutout is returned at all when you don't set that layout mode 🤔

That seems to be a bug. I tried it a second time and now I am seeing the display cutout. Screenshot_20220414-015013~2 Screenshot_20220414-015055 Edit: If fullscreen is enabled before opening it the first time after force-closing, you'll always get the cutout. If it was disabled, you only get it if this layout-mode is set.

morta5 avatar Apr 13 '22 23:04 morta5