1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-09-01 17:41:54 +01:00

devlib/target: Enable screen stay-on mode:

Adds the ability to set the android global setting
``stay_on_while_plugged_in``.

This setting has 4 main modes:
- 0: never stay on
- 1: stay on when plugged in to AC charger
- 2: stay on when plugged in to USB charger
- 4: stay on when wirelessly charged

These values can be OR-ed together to produce combinations.
This commit is contained in:
Jonathan Paynter
2020-08-11 12:08:40 +01:00
committed by Marc Bonnici
parent f2b5f85dab
commit b2950686a7
2 changed files with 45 additions and 0 deletions

View File

@@ -672,6 +672,26 @@ Android Target
Returns ``True`` if the targets auto brightness is currently
enabled and ``False`` otherwise.
.. method:: AndroidTarget.set_stay_on_never()
Sets the stay-on mode to ``0``, where the screen will turn off
as standard after the timeout.
.. method:: AndroidTarget.set_stay_on_while_powered()
Sets the stay-on mode to ``7``, where the screen will stay on
while the device is charging
.. method:: AndroidTarget.set_stay_on_mode(mode)
Sets the stay-on mode to the specified number between ``0`` and
``7`` (inclusive).
.. method:: AndroidTarget.get_stay_on_mode()
Returns an integer between ``0`` and ``7`` representing the current
stay-on mode of the device.
.. method:: AndroidTarget.ensure_screen_is_off(verify=True)
Checks if the devices screen is on and if so turns it off.
@@ -685,6 +705,11 @@ Android Target
If ``verify`` is set to ``True`` then a ``TargetStableError``
will be raise if the display cannot be turned on.
.. method:: AndroidTarget.ensure_screen_is_on_and_stays(verify=True, mode=7)
Calls ``AndroidTarget.ensure_screen_is_on(verify)`` then additionally
sets the screen stay on mode to ``mode``.
.. method:: AndroidTarget.is_screen_on()
Returns ``True`` if the targets screen is currently on and ``False``