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

python-for-android packages wrong manifest for ANDROIDAPI="19", doesn't include configChanges="...|screenSize" which leads to app crash on rotation #1342

Closed
ghost opened this issue Aug 26, 2018 · 3 comments

Comments

@ghost
Copy link

ghost commented Aug 26, 2018

python-for-android packages the wrong manifest for me for my specified ANDROIDAPI="19" version: the included AndroidManifest.xml specifies android:configChanges="keyboardHidden|orientation and missing "screenSize", which leads to app crash on rotation. When manually editing /usr/local/lib/python3.6/dist-packages/pythonforandroid/bootstraps/sdl2/build/templates/AndroidManifest.tmpl.xml to take out the conditional and hardcoding "screenSize" into the android:configChanges=... value, then it works. So it seems something is bugged with how that template is being handled.

To reproduce, try a p4a build line with --requirements=python3crystax,pysdl2,sdl2 --orientation user --window and any simple SDL2 code, e.g. the one in that comment here: #1338 (comment)

@ghost
Copy link
Author

ghost commented Sep 4, 2018

This may or may not be caused by this issue: #1352 seems like in general, the whole handling of the minimum API version is just broken.

@ghost
Copy link
Author

ghost commented Sep 5, 2018

Ok I am taking a wild guess here, but maybe this happens:

  1. ANDROIDAPI="19" sets target API to 19, but doesn't change the minimum level
  2. The minimum API appears to default to something low, maybe 12 or something even less, where screenSize in the manifest is not a valid option - therefore, AndroidManifest.tmpl.xml is written in such a way that it won't be included with that low API level
  3. For an app with the API target level (not minimum level) 19, the Android system will possibly expect it to be aware of configChanges and somehow expect it to set screenSize as an option at runtime, but the p4a/kivy wrapper doesn't appear to be designed to do this. It probably assumes the manifest will take care of everything, which may simply not be possible with minlevel=<superlow> and targetlevel=19 in combination.

As a result, configChanges doesn't include screenSize when defining ANDROIDAPI=19 and nothing is done about this at runtime, such that a screenSize change event will be handled as activity abort() (which is the default when not explicitly changed to be handled as config change). Therefore, the app terminates with --orientation=user and any orientation change.

However, at no point p4a gives a warning about this, so this seems like quite an oversight!

I suggest that either, 1. enabling orientation changes with that combination of minimum and target API level should just work, or 2. it should raise the minimum level automatically to something that works if it's not specified, or 3. p4a should abort with an error if that combination of target and minimum levels is used.

@ghost
Copy link
Author

ghost commented Jan 15, 2019

Minimum target API level is 21 now so this is somewhat outdated / accidentally solved

@ghost ghost closed this as completed Jan 15, 2019
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants