-
Notifications
You must be signed in to change notification settings - Fork 18k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
x/mobile/app: config.Event delivery is not reliable (android) #11741
Comments
The documentation is not clear on what we should be using. Non-NativeActivity users talk about listening for onSurfaceChanged, which seems to translate into onNativeWindowResized, onNativeWindowCreated, and onNativeWindowDestroyed. Right now we listen for onNativeWindowRedrawNeeded, which is onSurfaceRedrawNeeded. Tomorrow I'll try to replicate the missing events, and see if switching to listening for onNativeWindowResized helps. |
I put some logging into example/basic, and what I'm seeing (on a Galaxy Nexus) is reliable event delivery, but sometimes the width/height are not updated. Also following the NativeActivity source through to the platform docs suggests onNativeWindowRedrawNeeded should be called for orientation changes, so it's a safe place to listen. Not sure yet what's wrong with querySurfaceWidthAndHeight. |
onNativeWindowResized is flaky. Not a safe source of rotation events. |
CL https://golang.org/cl/12381 mentions this issue. |
EGL is a poor source of window dimensions. On some fraction of rotations, it reported the old dimensions. Switch to extracting the data from ANativeWindow, which appears to be more reliable. While here, plumb through orientation, and follow the recommendation in the Android platform docs to block onNativeWindowRedrawNeeded until the draw is complete. Fixes golang/go#11741. Change-Id: I6b29b6a1e5743c612c9af2a8cce4260c5d7e9ca6 Reviewed-on: https://go-review.googlesource.com/12381 Reviewed-by: Nigel Tao <nigeltao@golang.org>
EGL is a poor source of window dimensions. On some fraction of rotations, it reported the old dimensions. Switch to extracting the data from ANativeWindow, which appears to be more reliable. While here, plumb through orientation, and follow the recommendation in the Android platform docs to block onNativeWindowRedrawNeeded until the draw is complete. Fixes golang/go#11741. Change-Id: I6b29b6a1e5743c612c9af2a8cce4260c5d7e9ca6 Reviewed-on: https://go-review.googlesource.com/12381 Reviewed-by: Nigel Tao <nigeltao@golang.org>
I slightly modified the basic app https://go-review.googlesource.com/#/c/12330/
to demonstrate this problem.
Background color is red if Width > Height.
Background color is white otherwise.
Keep rotating and touching the device. It's somewhat non-deterministic.
This prevents correct screen geometry computation.
go version devel +adb1e03 Thu Jul 16 20:56:23 2015 +0000 darwin/amd64
golang.org/x/mobile: 136fa9bb
test devices: android nexus 7 (android 4.4.4 cyanogenMod), moto X (android 4.4.4)
@crawshaw @nigeltao
The text was updated successfully, but these errors were encountered: