androidtv.constants module

Constants used in the BaseTV, AndroidTV, and FireTV classes.

Links

androidtv.constants.CMD_AUDIO_STATE = "dumpsys audio | grep -v 'Buffer Queue' | grep -q paused && echo -e '1\\c' || (dumpsys audio | grep -v 'Buffer Queue' | grep -q started && echo '2\\c' || echo '0\\c')"

Get the audio state

androidtv.constants.CMD_AWAKE = 'dumpsys power | grep mWakefulness | grep -q Awake'

Determine whether the device is awake

androidtv.constants.CMD_CURRENT_APP = 'CURRENT_APP=$(dumpsys window windows | grep mCurrentFocus) && CURRENT_APP=${CURRENT_APP#*{* * } && CURRENT_APP=${CURRENT_APP%%/*} && echo $CURRENT_APP'

Get the current app

androidtv.constants.CMD_MEDIA_SESSION_STATE = "dumpsys media_session | grep -A 100 'Sessions Stack' | grep -A 100 $CURRENT_APP | grep -m 1 'state=PlaybackState {'"

Get the state from dumpsys media_session; this assumes that the variable CURRENT_APP has been defined

androidtv.constants.CMD_MEDIA_SESSION_STATE_FULL = "CURRENT_APP=$(dumpsys window windows | grep mCurrentFocus) && CURRENT_APP=${CURRENT_APP#*{* * } && CURRENT_APP=${CURRENT_APP%%/*} && echo $CURRENT_APP && dumpsys media_session | grep -A 100 'Sessions Stack' | grep -A 100 $CURRENT_APP | grep -m 1 'state=PlaybackState {'"

Determine the current app and get the state from dumpsys media_session

androidtv.constants.CMD_RUNNING_APPS = 'ps | grep u0_a'

Get the running apps

androidtv.constants.CMD_SCREEN_ON = "dumpsys power | grep 'Display Power' | grep -q 'state=ON'"

Determine if the device is on

androidtv.constants.CMD_WAKE_LOCK_SIZE = "dumpsys power | grep Locks | grep 'size='"

Get the wake lock size

androidtv.constants.MEDIA_SESSION_STATES = {0: None, 1: 'stopped', 2: 'paused', 3: 'playing'}

States for the media_session_state property

androidtv.constants.VALID_CONDITIONS = ('audio_state', 'media_session_state', 'wake_lock_size')

Conditions that can be checked by the _conditions_are_true() method

androidtv.constants.VALID_PROPERTIES = ('audio_state', 'media_session_state')

Properties that can be used to determine the current state

androidtv.constants.VALID_STATES = ('idle', 'off', 'playing', 'paused', 'standby')

States that are valid (used by the _custom_state_detection() method)