Skip to content

Commit 4256ef6

Browse files
authored
Merge branch 'kivy:develop' into develop
2 parents 8935234 + 5330267 commit 4256ef6

24 files changed

Lines changed: 110 additions & 54 deletions

File tree

ci/makefiles/android.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Downloads and installs the Android SDK depending on supplied platform: darwin or linux
22

33
# Those android NDK/SDK variables can be override when running the file
4-
ANDROID_NDK_VERSION ?= 25b
4+
ANDROID_NDK_VERSION ?= 28c
55
ANDROID_NDK_VERSION_LEGACY ?= 21e
66
ANDROID_SDK_TOOLS_VERSION ?= 6514223
77
ANDROID_SDK_BUILD_TOOLS_VERSION ?= 29.0.3
88
ANDROID_HOME ?= $(HOME)/.android
9-
ANDROID_API_LEVEL ?= 27
9+
ANDROID_API_LEVEL ?= 36
1010

1111
# per OS dictionary-like
1212
UNAME_S := $(shell uname -s)

doc/source/quickstart.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ named ``tools``, and you will need to run extra commands to install
119119
the SDK packages needed.
120120

121121
For Android NDK, note that modern releases will only work on a 64-bit
122-
operating system. **The minimal, and recommended, NDK version to use is r25b:**
122+
operating system. **The minimal, and recommended, NDK version to use is r28c:**
123123

124124
- `Go to ndk downloads page <https://developer.android.com/ndk/downloads/>`_
125125
- Windows users should create a virtual machine with an GNU Linux os
@@ -154,7 +154,7 @@ variables necessary for building on android::
154154
# Adjust the paths!
155155
export ANDROIDSDK="$HOME/Documents/android-sdk-27"
156156
export ANDROIDNDK="$HOME/Documents/android-ndk-r23b"
157-
export ANDROIDAPI="27" # Target API version of your application
157+
export ANDROIDAPI="36" # Target API version of your application
158158
export NDKAPI="21" # Minimum supported API version of your application
159159
export ANDROIDNDKVER="r10e" # Version of the NDK you installed
160160

doc/source/testing_pull_requests.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Using python-for-android commands directly from the pull request files
118118
--requirements=sdl2,pyjnius,kivy,python3,pycryptodome \
119119
--ndk-dir=/media/DEVEL/Android/android-ndk-r20 \
120120
--sdk-dir=/media/DEVEL/Android/android-sdk-linux \
121-
--android-api=27 \
121+
--android-api=36 \
122122
--arch=arm64-v8a \
123123
--permission=VIBRATE \
124124
--debug
@@ -175,7 +175,7 @@ Installing python-for-android using the github's branch of the pull request
175175
python3 setup.py apk \
176176
--ndk-dir=/media/DEVEL/Android/android-ndk-r20 \
177177
--sdk-dir=/media/DEVEL/Android/android-sdk-linux \
178-
--android-api=27 \
178+
--android-api=36 \
179179
--arch=arm64-v8a \
180180
--debug
181181

pythonforandroid/bootstraps/common/build/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-all.zip

pythonforandroid/bootstraps/common/build/templates/build.tmpl.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22
buildscript {
33
repositories {
44
google()
5-
jcenter()
5+
mavenCentral()
66
}
77
dependencies {
8-
classpath 'com.android.tools.build:gradle:8.1.1'
8+
classpath 'com.android.tools.build:gradle:8.11.0'
99
}
1010
}
1111

1212
allprojects {
1313
repositories {
1414
google()
15-
jcenter()
15+
mavenCentral()
1616
{%- for repo in args.gradle_repositories %}
1717
{{repo}}
1818
{%- endfor %}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
APP_PLATFORM := $(NDK_API)
2+
APP_ABI := $(ARCH)

pythonforandroid/bootstraps/webview/build/jni/Application.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55

66
# APP_ABI := armeabi armeabi-v7a x86
77
APP_ABI := $(ARCH)
8+
APP_PLATFORM := $(NDK_API)

pythonforandroid/recipe.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ class Recipe(metaclass=RecipeMeta):
155155
starting from NDK r18 the `gnustl_shared` lib has been deprecated.
156156
'''
157157

158+
min_ndk_api_support = 20
159+
'''
160+
Minimum ndk api recipe will support.
161+
'''
162+
158163
def get_stl_library(self, arch):
159164
return join(
160165
arch.ndk_lib_dir,
@@ -375,6 +380,9 @@ def get_recipe_dir(self):
375380
# Public Recipe API to be subclassed if needed
376381

377382
def download_if_necessary(self):
383+
if self.ctx.ndk_api < self.min_ndk_api_support:
384+
error(f"In order to build '{self.name}', you must set minimum ndk api (minapi) to `{self.min_ndk_api_support}`.\n")
385+
exit(1)
378386
info_main('Downloading {}'.format(self.name))
379387
user_dir = environ.get('P4A_{}_DIR'.format(self.name.lower()))
380388
if user_dir is not None:

pythonforandroid/recipes/android/src/android/display_cutout.py

Lines changed: 38 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
from android import mActivity
55

66
__all__ = ('get_cutout_pos', 'get_cutout_size', 'get_width_of_bar',
7-
'get_height_of_bar', 'get_size_of_bar')
7+
'get_height_of_bar', 'get_size_of_bar', 'get_width_of_bar',
8+
'get_cutout_mode')
89

910

1011
def _core_cutout():
@@ -15,20 +16,20 @@ def _core_cutout():
1516

1617

1718
def get_cutout_pos():
18-
""" Get position of the display-cutout.
19-
Returns integer for each positions (xy)
19+
"""Get position of the display-cutout.
20+
Returns integer for each positions (xy)
2021
"""
2122
try:
2223
cutout = _core_cutout()
23-
return int(cutout.left), Window.height - int(cutout.height())
24+
return int(cutout.left), int(Window.height - cutout.height())
2425
except Exception:
2526
# Doesn't have a camera builtin with the display
2627
return 0, 0
2728

2829

2930
def get_cutout_size():
30-
""" Get the size (xy) of the front camera.
31-
Returns size with float values
31+
"""Get the size (xy) of the front camera.
32+
Returns size with float values
3233
"""
3334
try:
3435
cutout = _core_cutout()
@@ -39,8 +40,8 @@ def get_cutout_size():
3940

4041

4142
def get_height_of_bar(bar_target=None):
42-
""" Get the height of either statusbar or navigationbar
43-
bar_target = status or navigation and defaults to status
43+
"""Get the height of either statusbar or navigationbar
44+
bar_target = status or navigation and defaults to status
4445
"""
4546
bar_target = bar_target or 'status'
4647

@@ -61,12 +62,38 @@ def get_height_of_bar(bar_target=None):
6162

6263

6364
def get_width_of_bar(bar_target=None):
64-
" Get the width of the bar "
65+
"""Get the width of the bar"""
6566
return Window.width
6667

6768

6869
def get_size_of_bar(bar_target=None):
69-
""" Get the size of either statusbar or navigationbar
70-
bar_target = status or navigation and defaults to status
70+
"""Get the size of either statusbar or navigationbar
71+
bar_target = status or navigation and defaults to status
7172
"""
7273
return get_width_of_bar(), get_height_of_bar(bar_target)
74+
75+
76+
def get_heights_of_both_bars():
77+
"""Return heights of both bars"""
78+
return get_height_of_bar('status'), get_height_of_bar('navigation')
79+
80+
81+
def get_cutout_mode():
82+
"""Return mode for cutout supported applications"""
83+
BuildVersion = autoclass('android.os.Build$VERSION')
84+
cutout_modes = {}
85+
86+
if BuildVersion.SDK_INT >= 28:
87+
LayoutParams = autoclass('android.view.WindowManager$LayoutParams')
88+
window = mActivity.getWindow()
89+
layout_params = window.getAttributes()
90+
cutout_mode = layout_params.layoutInDisplayCutoutMode
91+
cutout_modes.update({LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT: 'default',
92+
LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES: 'shortEdges'})
93+
94+
if BuildVersion.SDK_INT >= 30:
95+
cutout_modes[LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS] = 'always'
96+
97+
return cutout_modes.get(cutout_mode, 'never')
98+
99+
return None

pythonforandroid/recipes/kivy/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ class KivyRecipe(PyProjectRecipe):
3434
# WARNING: Remove this patch when a new Kivy version is released.
3535
patches = [("sdl-gl-swapwindow-nogil.patch", is_kivy_affected_by_deadlock_issue), "use_cython.patch"]
3636

37+
@property
38+
def need_stl_shared(self):
39+
if "sdl3" in self.ctx.recipe_build_order:
40+
return True
41+
else:
42+
return False
43+
3744
def get_recipe_env(self, arch, **kwargs):
3845
env = super().get_recipe_env(arch, **kwargs)
3946

0 commit comments

Comments
 (0)