Skip to content

Notification panel constraint#2150

Open
keymapper-ai wants to merge 1 commit into
developfrom
claude/issue-1980-notification-panel-constraint
Open

Notification panel constraint#2150
keymapper-ai wants to merge 1 commit into
developfrom
claude/issue-1980-notification-panel-constraint

Conversation

@keymapper-ai
Copy link
Copy Markdown
Collaborator

Closes #1980

Summary

  • Added two new constraints: "Notification panel is showing" and "Notification panel is not showing", placed in the Display category.
  • Detection is implemented in BaseAccessibilityService via the getWindows() API: the service checks whether any TYPE_SYSTEM accessibility window has a root node belonging to com.android.systemui and visible to the user. This fires on every TYPE_WINDOWS_CHANGED accessibility event.
  • The detection state is exposed as isNotificationShadeExpanded: Flow<Boolean> on IAccessibilityService, integrated into LazyConstraintSnapshot, and wired up as a new NOTIFICATION_PANEL_STATE dependency.
  • Strings, icons (Notifications / NotificationsOff), entity constants, mapper, comparator, and TestConstraintSnapshot all updated to cover the new entries.

Known limitations / areas for human review

  • Best-effort detection: As noted in the issue discussion with @sds100, there is no 100% reliable way to detect the notification panel on all devices. On stock Android the approach works well, but heavily customised OEMs (e.g. Samsung OneUI) may expose additional TYPE_SYSTEM windows from com.android.systemui that cause a false positive even when the shade is collapsed. Manual testing on target devices is recommended.
  • The constraint is labelled generically ("Notification panel is showing") to cover both the notification shade and quick-settings panel, consistent with the direction agreed in the issue.
  • The onDependencyChanged(NOTIFICATION_PANEL_STATE) path is wired up but, like other dependencies, is currently only exercised if a caller subscribes to it.

Test plan

  • Build and install a debug APK on a stock Android device
  • Create a key map with the "Notification panel is showing" constraint and verify it only triggers when the shade is expanded
  • Create a key map with the "Notification panel is not showing" constraint and verify it triggers when the shade is closed
  • Verify no regression on existing constraints (screen on/off, keyboard showing, lock screen)
  • Test on at least one Samsung device to check for false positives from OEM customisation

Generated by Claude Code

Add two new constraints — "Notification panel is showing" and "Notification panel is not
showing" — that allow key maps to be conditional on whether the Android status bar /
notification shade is expanded.

Detection is implemented via the AccessibilityService window list: a TYPE_SYSTEM window
whose root node belongs to com.android.systemui and is visible to the user is treated as
evidence that the notification shade is expanded. This is a best-effort heuristic;
accuracy may vary across OEMs and Android versions, as acknowledged in issue discussion.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Notification panel constraint

2 participants