docs(sensor): name where the Current App name chain comes from (t55)

The Current App sensor already resolved through the shared
`resolve_app_name` chain, so the package-id live symptom was never a
missing tier — it was the label path being silenced (fix in the previous
commit). Its docstrings now say so explicitly: `_package` is the app on
screen (protocol push → ADB mResumedActivity → recents as a last resort)
and `native_value` resolves exactly that package's map entry or cached
device label, which is why the label fetch must be driven off it. The
behaviour is unchanged; the comment is what was missing.
This commit is contained in:
James Mackay committed 2026-10-12 06:53:13 +01:00
1 parent 0c7e405108
commit 85e96f3c60
1 file changed
+12 -2
+12 -2
View File
@@ -93,10 +93,13 @@ class NvidiaShieldCurrentAppSensor(NvidiaShieldSensorBase):
self.async_write_ha_state() self.async_write_ha_state()
def _package(self) -> str | None: def _package(self) -> str | None:
"""The raw foreground package from the manager's store (t41). """The raw package of the app that is on screen (t41, t55).
StateStore priority chain (P3-3c): protocol current_app push → ADB StateStore priority chain (P3-3c): protocol current_app push → ADB
mResumedActivity → ADB recents. mResumedActivity (both via ``manager.foreground_app``) → the most
recent visible ADB recent task. The recents tier is a last resort for
a moment when neither live signal has reported yet; it keeps the
sensor from going None while ADB is still warming up.
""" """
manager = self._manager() manager = self._manager()
if manager is None: if manager is None:
@@ -117,6 +120,13 @@ class NvidiaShieldCurrentAppSensor(NvidiaShieldSensorBase):
``resolve_app_name``: apps map → cached manifest label → the package ``resolve_app_name``: apps map → cached manifest label → the package
text itself. A bare or unknown package shows its package text rather text itself. A bare or unknown package shows its package text rather
than None, like the media player's app_name. than None, like the media player's app_name.
This is why ``_package`` must be the CURRENT app and the label fetch
must be driven off it (t55): the device-manifest label is resolved on
demand for exactly the package passed here, so a live run showing a
package id means the label tier never answered — see
``ShieldConnectionManager.app_label`` for the caching rule that makes
a miss retry instead of being stamped as an eternal "no label".
""" """
manager = self._manager() manager = self._manager()
return resolve_app_name( return resolve_app_name(