Skip to content

Chromecast HD on Android 14: current_app is always None (Google TV command greps mResumedActivity, renamed to topResumedActivity) #371

Description

@lazi3b0y

Summary

On a Chromecast HD running Android 14, AndroidTVSync.update() / current_app() always return None for the current app, so Home Assistant's media_player entity for the device never gets app_id, app_name or source.

The cause is in BaseTV._cmd_current_app(): the device matches the "Google Chromecast" special case (manufacturer contains "Google", model contains "Chromecast"), which selects CMD_CURRENT_APP_GOOGLE_TV. That command is dumpsys activity a . | grep mResumedActivity, and Android 14 renamed that line to topResumedActivity, so the grep matches nothing. The special case is checked before the Android 13/14 branch, so the generic CMD_CURRENT_APP13 (which works on this device) is never reached.

PR #368 ("Only use GOOGLE_TV constants for Android <14") fixes exactly this and has been open since 2025-11-30 without review. The corresponding Home Assistant report (home-assistant/core#153778) was closed as stale in 2026-02 without a fix. I am filing this so there is an issue to track it; happy to test a build.

Environment

  • androidtv 0.0.75 (the version pinned by Home Assistant), Python 3.14, adb_shell transport over TCP port 5555
  • Device: Google Chromecast HD, product_id boreal, Android 14, security patch 2025-10-01
  • device_properties: {'manufacturer': 'Google', 'model': 'Chromecast HD', 'sw_version': '14', 'product_id': 'boreal', ...}

Reproduction

With Moonlight (com.limelight) in the foreground:

import os
from androidtv import setup, constants as c

atv = setup("192.168.86.111", 5555, adbkey=os.path.expanduser("~/.android/adbkey"), device_class="androidtv")
print(atv.update())        # ('idle', None, [...running apps...], ...)
print(atv.current_app())   # None

for name in ("CMD_CURRENT_APP", "CMD_CURRENT_APP13", "CMD_CURRENT_APP_GOOGLE_TV"):
    print(name, repr(atv._adb.shell(getattr(c, name))))

Output:

CMD_CURRENT_APP            ''
CMD_CURRENT_APP13          'com.limelight\n'
CMD_CURRENT_APP_GOOGLE_TV  ''

Why the Google TV command is empty on this build:

dumpsys activity a . | grep mResumedActivity      -> (nothing)
dumpsys activity a . | grep topResumedActivity    -> topResumedActivity=ActivityRecord{... u0 com.limelight/.Game t13119}
dumpsys window windows | grep mCurrentFocus       -> (nothing)

The same applies to _cmd_current_app_media_session_state(), which selects CMD_CURRENT_APP_MEDIA_SESSION_STATE_GOOGLE_TV for the same reason (..._STATE13 returns the app correctly).

Possible fixes

  • Merge Only use GOOGLE_TV constants for Android <14 #368 (skip the Chromecast special case when sw_version >= 14), or
  • make CMD_DEFINE_CURRENT_APP_VARIABLE_GOOGLE_TV grep for both spellings: grep -E 'mResumedActivity|topResumedActivity', which keeps the Chromecast path working on older and newer builds.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions