Skip to content

Commit

Permalink
Merged Android/Fire TV command for running process
Browse files Browse the repository at this point in the history
  • Loading branch information
mano3m committed Jan 7, 2024
1 parent 1b478c4 commit 089cd7b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
5 changes: 1 addition & 4 deletions androidtv/basetv/basetv.py
Expand Up @@ -324,10 +324,7 @@ def _cmd_running_apps(self):
if constants.CUSTOM_RUNNING_APPS in self._custom_commands:
return self._custom_commands[constants.CUSTOM_RUNNING_APPS]

if self.DEVICE_ENUM == constants.DeviceEnum.FIRETV:
return constants.CMD_RUNNING_APPS_FIRETV

return constants.CMD_RUNNING_APPS_ANDROIDTV
return constants.CMD_RUNNING_APPS

def _cmd_turn_off(self):
"""Get the command used to turn off this device.
Expand Down
7 changes: 2 additions & 5 deletions androidtv/constants.py
Expand Up @@ -205,11 +205,8 @@ class DeviceEnum(IntEnum):
#: Determine the current app and get the state from ``dumpsys media_session`` for a Google TV device
CMD_CURRENT_APP_MEDIA_SESSION_STATE_GOOGLE_TV = CMD_CURRENT_APP_GOOGLE_TV + " && " + CMD_MEDIA_SESSION_STATE

#: Get the running apps for an Android TV device
CMD_RUNNING_APPS_ANDROIDTV = "ps -A | grep u0_a"

#: Get the running apps for a Fire TV device
CMD_RUNNING_APPS_FIRETV = "ps | grep u0_a"
#: Get the running apps for an Android/Fire TV device
CMD_RUNNING_APPS = "ps -A | grep u0_a"

#: Get installed apps
CMD_INSTALLED_APPS = "pm list packages"
Expand Down
7 changes: 2 additions & 5 deletions tests/test_constants.py
Expand Up @@ -212,11 +212,8 @@ def test_constants(self):
# CMD_MODEL
self.assertCommand(constants.CMD_MODEL, r"getprop ro.product.model")

# CMD_RUNNING_APPS_ANDROIDTV
self.assertCommand(constants.CMD_RUNNING_APPS_ANDROIDTV, r"ps -A | grep u0_a")

# CMD_RUNNING_APPS_FIRETV
self.assertCommand(constants.CMD_RUNNING_APPS_FIRETV, r"ps | grep u0_a")
# CMD_RUNNING_APPS
self.assertCommand(constants.CMD_RUNNING_APPS, r"ps -A | grep u0_a")

# CMD_SCREEN_ON
self.assertCommand(
Expand Down

0 comments on commit 089cd7b

Please sign in to comment.