Skip to content

Commit abc2d7e

Browse files
authored
Android support display cutout (#1894)
* Support of display-cutout for android devices
1 parent 83ebc8e commit abc2d7e

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

buildozer/default.spec

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,12 @@ android.allow_backup = True
318318
# (str) The format used to package the app for debug mode (apk or aar).
319319
# android.debug_artifact = apk
320320

321+
# (str) A display cutout is an area on some devices that extends into the display surface.
322+
# It allows for an edge-to-edge experience while providing space for important sensors on the front of the device.
323+
# Available options for Android API >= 28 are "default, shortEdges, never" and defaults to never.
324+
# Android documentation: https://developer.android.com/develop/ui/views/layout/display-cutout
325+
#android.display_cutout = never
326+
321327
#
322328
# Python for android (p4a) specific
323329
#

buildozer/targets/android.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -870,6 +870,13 @@ def execute_build_package(self, build_cmd):
870870
if self.buildozer.config.getbooldefault('app', 'android.home_app', False):
871871
cmd.append("--home-app")
872872

873+
# Enable display-cutout for Android devices
874+
display_cutout = self.buildozer.config.getdefault('app', 'android.display_cutout', 'never').lower()
875+
if display_cutout in {'default', 'shortedges'}:
876+
if display_cutout == 'shortedges':
877+
display_cutout = 'shortEdges'
878+
cmd.append("--display-cutout={}".format(display_cutout))
879+
873880
# support for recipes in a local directory within the project
874881
if local_recipes:
875882
cmd.append('--local-recipes')

docs/source/specifications.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,3 +145,6 @@ Section [app]
145145

146146
Defaults to false, your application will be listed as a Home App (launcher app) if true.
147147

148+
- `display_cutout`: String, display-cutout mode to be used.
149+
150+
Defaults to `never`. Application will render around the cutout (notch) if set to either `default`, `shortEdges`.

0 commit comments

Comments
 (0)