CVE-2026-28580 AI-generated analysis
platform/frameworks/base, core/java/android/app/NotificationChannel.java (notification channel parceling and XML persistence)
NotificationChannel drops the parcel-size heuristic for oversized VibrationEffects. On unparceling it now tries to crop the effect and keeps it if it cannot be cropped, and at XML serialization it skips the ATT_VIBRATION_EFFECT attribute when the serialized string is longer than MAX_SERIALIZED_VIBRATION_LENGTH.
Root cause
The NotificationChannel(Parcel) constructor tried to detect a "too large" VibrationEffect approximately. It compared in.dataAvail() (the parcel bytes left before reading the effect) against MAX_SERIALIZED_VIBRATION_LENGTH. The fix applies that same constant to the length of the XML serialized string. This heuristic also required the vibration effect to be the last field in the parcel (see the removed "must remain at the end" comments). On Android 17, fields gated by Flags.nmContextualDisplay() already come after it. On Android 16 the heuristic was also gated by Flags.notifChannelEstimateEffectSize(), with a fallback to getTrimmedVibrationEffect(). During XML serialization, the effect was passed unconditionally to out.attribute(null, ATT_VIBRATION_EFFECT, vibrationToString(getVibrationEffect())) with no length check. So an effect that got past the approximate unparcel check could be written to the channel XML with a serialized value longer than MAX_SERIALIZED_VIBRATION_LENGTH.
How the fix works
- core/java/android/app/NotificationChannel.java, NotificationChannel(Parcel in): removes the largeEffect = (in.dataAvail() > MAX_SERIALIZED_VIBRATION_LENGTH) estimate, the Flags.notifChannelEstimateEffectSize() branch and the getTrimmedVibrationEffect() fallback. If mVibrationEffect != null, it now always calls mVibrationEffect.cropToLengthOrNull(MAX_VIBRATION_LENGTH); on 16 this is still gated by Flags.notifChannelCropVibrationEffects(), on 17 it is unconditional. A non-null result replaces the effect. Otherwise the effect is kept as-is for the exact check at serialization.
- core/java/android/app/NotificationChannel.java, writeToParcel: only removes the comment requiring the vibration effect to be the last parcel entry. The write order does not change.
- core/java/android/app/NotificationChannel.java, XML serialization method (the hunk that emits ATT_VIBRATION_EFFECT): computes String serializedVibrationEffect = vibrationToString(getVibrationEffect()) and calls out.attribute(null, ATT_VIBRATION_EFFECT, ...) only if serializedVibrationEffect.length() <= MAX_SERIALIZED_VIBRATION_LENGTH. On 16 the check sits inside the existing condition (!Flags.notifChannelCropVibrationEffects() || getVibrationPattern() == null), so it applies whatever that flag's value. On 17 it sits inside getVibrationPattern() == null.
- core/java/android/app/NotificationChannel.java, vibrationToString: annotated @NonNull.
- core/tests/coretests/src/android/app/NotificationChannelTest.java: drops FLAG_NOTIF_CHANNEL_ESTIMATE_EFFECT_SIZE from the tests (16) and renames two tests to setVibrationEffect_* names. It adds testVibrationEffect_tooLongForSerialization_droppedWhenWritingXml, which uses reflection to inject a repeating effect that cannot be cropped, checks that the effect survives parceling, and checks that it is gone after backUpAndRestore.
Completeness
- The exact bound is now enforced where the XML is written. A VibrationEffect whose vibrationToString() form is longer than MAX_SERIALIZED_VIBRATION_LENGTH is never written, whatever the parcel layout or field order.
- On Android 16, unparcel-time cropping is still gated by Flags.notifChannelCropVibrationEffects(). With that flag off, nothing is cropped at unparcel time, but the XML length check still applies. The unparcel read of the effect is gated by Flags.notificationChannelVibrationEffectApi() on both 16 and 17.
- A large effect that cannot be cropped is no longer dropped at unparcel time. It stays in the in-memory NotificationChannel object (the new test asserts it is 'Still here!' after parceling) and is only left out of the XML. The fix does not limit the in-memory size of an effect received over Binder.
- The mVibrationPattern path (Arrays.copyOf to MAX_VIBRATION_LENGTH) is unchanged. The setVibrationEffect() enforcement mentioned by the comment and the tests is not part of this diff, so its exact behavior is not shown.
- vibrationToString() still runs on every XML write for a channel with an effect. The fix moves the cost to serialization instead of removing it.
Behavior changes
- A channel whose VibrationEffect serializes to more than MAX_SERIALIZED_VIBRATION_LENGTH characters silently loses the effect on XML persistence or backup (the restored channel has getVibrationEffect() == null).
- On unparceling, croppable effects longer than MAX_VIBRATION_LENGTH are now always cropped (on 16 only while the crop flag is on). Before, this happened only when the parcel-size estimate flagged them, or through getTrimmedVibrationEffect on 16 with the estimate flag off. Large effects that cannot be cropped are now kept rather than set to null at unparcel time.
- NotificationChannel no longer checks the Flags.notifChannelEstimateEffectSize() flag, and the parcel layout no longer requires the vibration effect to be the last field.
Per major
- Android 14: Not affected per the bulletin. android-security-14.0.0_r31 has 2/8 lines of the patched region.
- Android 15: Not affected per the bulletin. android-security-15.0.0_r19 has 4/8 lines of the patched region. No fix listed.
- Android 16: Same fix (this commit, 80828212c318) in android-security-16.0.0_r7. Unparcel cropping stays gated by Flags.notifChannelCropVibrationEffects(), and the Flags.notifChannelEstimateEffectSize() branch is removed. The code at android-security-16.0.0_r10 shows the patched constructor in place.
- Android 17: Adapted fix (0d553960b63e) in android-security-17.0.0_r3. The logic is the same, but the crop and estimate flags were already gone on 17: the dataAvail heuristic was unconditional, and the cropping is now unconditional. The XML check sits inside getVibrationPattern() == null. On 17, fields gated by Flags.nmContextualDisplay() already came after the vibration effect in the parcel.
Unknowns
- The diff headers do not show the name of the XML serialization method that contains the ATT_VIBRATION_EFFECT hunk.
- The material does not show the concrete consequence of writing an over-long ATT_VIBRATION_EFFECT attribute; the bulletin only rates the issue High EoP.
- The material does not show the exact pre-fix condition under which an oversized effect reached the XML writer.
- The material does not show which caller path (for example, apps creating channels through NotificationManager) delivers attacker-supplied channels to the persisting process.
- The material does not show the values of MAX_SERIALIZED_VIBRATION_LENGTH and MAX_VIBRATION_LENGTH, the behavior of the removed getTrimmedVibrationEffect(), or the enforcement inside setVibrationEffect().
- The material does not show which flags are enabled on shipping Android 16 builds.