Skip to content
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

Closed
hyangah opened this issue Jul 16, 2015 · 4 comments
Closed

x/mobile/app: config.Event delivery is not reliable (android) #11741

hyangah opened this issue Jul 16, 2015 · 4 comments

Comments

@hyangah
Copy link
Contributor

hyangah commented Jul 16, 2015

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

@crawshaw
Copy link
Member

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.

@crawshaw
Copy link
Member

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.

@crawshaw
Copy link
Member

onNativeWindowResized is flaky. Not a safe source of rotation events.

@gopherbot
Copy link

CL https://golang.org/cl/12381 mentions this issue.

@golang golang locked and limited conversation to collaborators Aug 5, 2016
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 10, 2021
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>
imWildCat pushed a commit to imWildCat/go-mobile that referenced this issue Apr 11, 2021
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>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants