gh-71042: Add platform.android_ver (#116674)

This commit is contained in:
Malcolm Smith 2024-03-27 16:53:27 +00:00 committed by GitHub
parent ce00de4c8c
commit 74c8568d07
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 164 additions and 16 deletions

View file

@ -301,3 +301,39 @@ Linux Platforms
return ids
.. versionadded:: 3.10
Android Platform
----------------
.. function:: android_ver(release="", api_level=0, manufacturer="", \
model="", device="", is_emulator=False)
Get Android device information. Returns a :func:`~collections.namedtuple`
with the following attributes. Values which cannot be determined are set to
the defaults given as parameters.
* ``release`` - Android version, as a string (e.g. ``"14"``).
* ``api_level`` - API level of the running device, as an integer (e.g. ``34``
for Android 14). To get the API level which Python was built against, see
:func:`sys.getandroidapilevel`.
* ``manufacturer`` - `Manufacturer name
<https://developer.android.com/reference/android/os/Build#MANUFACTURER>`__.
* ``model`` - `Model name
<https://developer.android.com/reference/android/os/Build#MODEL>`__
typically the marketing name or model number.
* ``device`` - `Device name
<https://developer.android.com/reference/android/os/Build#DEVICE>`__
typically the model number or a codename.
* ``is_emulator`` - ``True`` if the device is an emulator; ``False`` if it's
a physical device.
Google maintains a `list of known model and device names
<https://storage.googleapis.com/play_public/supported_devices.html>`__.
.. versionadded:: 3.13

View file

@ -753,7 +753,9 @@ always available.
.. function:: getandroidapilevel()
Return the build time API version of Android as an integer.
Return the build-time API level of Android as an integer. This represents the
minimum version of Android this build of Python can run on. For runtime
version information, see :func:`platform.android_ver`.
.. availability:: Android.