CVE-2026-55262 AI-generated analysis
platform/frameworks/base, NotificationManagerService (notification listener access management)
The component-name length limit in NotificationManagerService.setNotificationListenerAccessGrantedForUser is now enforced on the encoded byte length of the flattened ComponentName (getBytes().length) instead of its Java char count (length()).
Root cause
In services/core/java/com/android/server/notification/NotificationManagerService.java, setNotificationListenerAccessGrantedForUser rejected a grant when listener.flattenToString().length() exceeded NotificationManager.MAX_SERVICE_COMPONENT_NAME_LENGTH. String.length() counts UTF-16 code units, so a component name made of multi-byte characters (e.g. U+4E2D is 3 bytes in UTF-8, per the test comment) could pass the check while its encoded form was far longer than the intended limit. The flattened name is then passed on to mListeners.setPackageOrComponentEnabled and mConditionProviders.setPackageOrComponentEnabled, so the limit the check was meant to enforce was not actually honoured for the stored value.
How the fix works
- services/core/java/com/android/server/notification/NotificationManagerService.java : setNotificationListenerAccessGrantedForUser - the condition `granted && listener.flattenToString().length() > MAX_SERVICE_COMPONENT_NAME_LENGTH` is changed to `granted && listener.flattenToString().getBytes().length > MAX_SERVICE_COMPONENT_NAME_LENGTH`, so the limit is compared against the encoded byte count. The IllegalArgumentException and the rest of the method are unchanged.
- services/tests/uiservicestests/src/com/android/server/notification/NotificationManagerServiceTest.java - adds testSetListenerAccessForUser_grantWithByteLengthTooLong_throws, which builds a ComponentName whose class name is 180 copies of U+4E2D (540 bytes in UTF-8) and asserts IllegalArgumentException from setNotificationListenerAccessGrantedForUser with granted=true.
- getBytes() with no argument uses the platform default charset, which is UTF-8 on Android (general platform knowledge).
Completeness
- Covers only the grant path (granted == true) of setNotificationListenerAccessGrantedForUser; setNotificationListenerAccessGranted reaches the same code since it delegates to the ForUser variant.
- The revoke path (granted == false) is intentionally not length-checked, as confirmed by the existing test testSetListenerAccessForUser_revokeWithNameTooLong_okay.
- The material does not show whether setNotificationAssistantAccessGrantedForUser or other ManagedServices entry points apply a comparable length check, so their status cannot be judged from the diff.
- The existing char-based test (150 x 'Blah', 600 chars) remains valid since byte length is at least char length for any string.
Behavior changes
- Stricter validation: grant requests whose flattened component name is at most MAX_SERVICE_COMPONENT_NAME_LENGTH chars but exceeds it in encoded bytes now throw IllegalArgumentException("Component name too long: ...") instead of being accepted.
- ASCII-only component names are unaffected (char count equals byte count).
Per major
- Android 14: same fix: platform/frameworks/base dc19b329d865 in android-security-14.0.0_r29; identical one-line change at a different line (~5633, method lacks the INTERACT_ACROSS_USERS block), same test added.
- Android 15: same fix: platform/frameworks/base d71cc08e7ad0 in android-security-15.0.0_r17; one-line change at ~6216 plus the new test; the fixed line is present at android-security-15.0.0_r19.
- Android 16: same fix: platform/frameworks/base c47530a0f8f4 in android-security-16.0.0_r8; identical one-line change at ~6953 (method has an early-return block before checkNotificationListenerAccess), same test added.
- Android 17: same fix: platform/frameworks/base c54a3ee92fa2 in android-security-17.0.0_r1; identical one-line change at ~1232 where the method lives at a different indentation level/location in the file, same test added.
Unknowns
- The material does not show what downstream consumer of the stored flattened name enforces a byte-based limit, nor the concrete EoP consequence of exceeding it.
- Whether sibling entry points (e.g. setNotificationAssistantAccessGrantedForUser) perform any equivalent length check is not shown.