Implements --manifest-orientation
and changes how --orientation
works so we can now pass the setting to the SDL orientation hint
#2739
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As discussed on issue #2724 , when targeting API 31 and above, on Android 12 and above, the attribute
android:screenOrientation
is ignored, as the activity will run in multi-window mode.This PR takes advantage of changes made on SDL side which have been applied as a patch to
python-for-android
SDL build: #2730.After these changes, orientation can be controlled in two ways:
--orientation
will control the allowed orientations (portrait
,landscape
,portrait-reverse
,landscape-reverse
). The allowed orientations list is then set toKIVY_ORIENTATION
, which is used during window setup time to populate theSDL_HINT_ORIENTATIONS
value, as we're doing for other platforms.--manifest-orientation
has been added to keep theandroid:screenOrientation
personalisation functionality, even if Android will be likely deprecate this attribute in future. Valid values can be find here.If
--manifest-orientation
is not set, and only (one of multiple)--orientation
options are passed, the value forandroid:screenOrientation
is guessed and synthesised from the--orientation
option. Sinceandroid:screenOrientation
accepts only 1 value, if multiple--orientation
are given,android:screenOrientation
will be set tounspecified
.A
buildozer
PR will follow.P.S. : I'm slowly changing
pythonforandroid/bootstraps/common/build/build.py
in order to make it deeply testable, so some changes may seem to be unrelated, but are needed in order to actually test the code.--orientation sensor
or--orientation user
are not valid anymore, and an error will be raised, and the user will be forced to migrate.