Skip to content

Commit

Permalink
Android support display cutout (#1894)
Browse files Browse the repository at this point in the history
* Support of display-cutout for android devices
  • Loading branch information
kuzeyron authored Feb 24, 2025
1 parent 83ebc8e commit abc2d7e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions buildozer/default.spec
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,12 @@ android.allow_backup = True
# (str) The format used to package the app for debug mode (apk or aar).
# android.debug_artifact = apk

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

#
# Python for android (p4a) specific
#
Expand Down
7 changes: 7 additions & 0 deletions buildozer/targets/android.py
Original file line number Diff line number Diff line change
Expand Up @@ -870,6 +870,13 @@ def execute_build_package(self, build_cmd):
if self.buildozer.config.getbooldefault('app', 'android.home_app', False):
cmd.append("--home-app")

# Enable display-cutout for Android devices
display_cutout = self.buildozer.config.getdefault('app', 'android.display_cutout', 'never').lower()
if display_cutout in {'default', 'shortedges'}:
if display_cutout == 'shortedges':
display_cutout = 'shortEdges'
cmd.append("--display-cutout={}".format(display_cutout))

# support for recipes in a local directory within the project
if local_recipes:
cmd.append('--local-recipes')
Expand Down
3 changes: 3 additions & 0 deletions docs/source/specifications.rst
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,6 @@ Section [app]

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

- `display_cutout`: String, display-cutout mode to be used.

Defaults to `never`. Application will render around the cutout (notch) if set to either `default`, `shortEdges`.

0 comments on commit abc2d7e

Please sign in to comment.