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

Basic android event loop 2.0 #1328

Closed
wants to merge 7 commits into from
Closed

Conversation

dvc94ch
Copy link
Member

@dvc94ch dvc94ch commented Dec 21, 2019

  • Tested on all platforms changed
  • Compilation warnings were addressed
  • cargo fmt has been run on this branch
  • cargo doc builds successfully
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created or updated an example program if it would help users understand this functionality
  • Updated feature matrix, if new features were added or implemented

@goddessfreya goddessfreya added DS - android C - waiting on maintainer A maintainer must review this code labels Dec 22, 2019
@goddessfreya
Copy link
Contributor

r? @philip-alldredge

@katyo
Copy link

katyo commented Dec 24, 2019

@dvc94ch Curiously, but sometimes instant is less than start, so panic occurs here.
https://github.com/dvc94ch/winit/blob/a6ad0f75669b60f4752cf3b665eafa5098866da0/src/platform_impl/android/mod.rs#L217-L218
In particular it occurs after suspending the app. It seems android's scheduler throttles the app's time or it related to looper operation. In any case we need some work around here.
When I changed this piece to:

let duration = if instant <= start { Duration::default() } else { instant - start };
first_event = convert(looper.poll_all_timeout(duration).unwrap());

the demo runs fine.

@katyo
Copy link

katyo commented Dec 24, 2019

@dvc94ch It still has troubles with orientation change. Sometimes window size given in resize event is unusual (like 720x720, 1280x1280) and also several resize events happens on single orientation change. It seems we need workaround like delaying resize event from the moment when it actually happened.
I record screencast.

@dvc94ch
Copy link
Member Author

dvc94ch commented Dec 24, 2019

@katyo I'm having the same problem, it's driving me nuts :)

@dvc94ch
Copy link
Member Author

dvc94ch commented Dec 24, 2019

@katyo I think I've fixed it, can you check if it works for you now? On a ConfigChange we rerender 10x in a 10ms interval and that works on my phone.

@katyo
Copy link

katyo commented Dec 24, 2019

@dvc94ch I tested on three different devices on from api level 16 to 28. Orientation change works fine everywhere!

@dvc94ch
Copy link
Member Author

dvc94ch commented Dec 30, 2019

I think this will probably need changes in the future, but it's enough of an improvement on the status quo that it should be merged before it gets stale.

@katyo
Copy link

katyo commented Dec 30, 2019

@dvc94ch Unfortunately it still work too buggy. In particular after recent commit.
Sometime it has missing first redraw. Also the problem with orientation change appeared again.
I will try find some time in a new year weekend to play around it.

@Osspial
Copy link
Contributor

Osspial commented Dec 30, 2019

Going forward, who's going to be responsible for maintaining the Android backend? There aren't any listed maintainers in the wiki document, and having a backend without active developers working on it makes it difficult for Winit's API to evolve.

@dvc94ch
Copy link
Member Author

dvc94ch commented Dec 30, 2019

It's my intention of maintaining it, I'm just currently distracted with https://github.com/flutter-rs/cargo-flutter and will get back to this in a couple of days.

@katyo
Copy link

katyo commented Dec 30, 2019

Also I in a process of implementing some missing features related to user interaction.
But it little bit hard because I need JNI for some things and I have really strange problems with it (SIGABRT).

@dvc94ch
Copy link
Member Author

dvc94ch commented Jan 6, 2020

@katyo did you resolve the SIGABRT issue? I'm having the same problem when trying to call jni.AttachCurrentThread. I'm begining to think that the android-ndk + native-app-glue doesn't work very well and that we might need a java entrypoint.

@katyo
Copy link

katyo commented Jan 7, 2020

@dvc94ch: I don't sure, but, it seems, SIGABRT gone away after I fixed pointer to activity object.

@dvc94ch
Copy link
Member Author

dvc94ch commented Feb 5, 2020

Closing in favor of goddessfreya#2

@dvc94ch dvc94ch closed this Feb 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C - waiting on maintainer A maintainer must review this code DS - android
Development

Successfully merging this pull request may close these issues.

4 participants