Limit the size of vibration effects stored on a NotificationChannel

This change adds a cropToLengthOrNull() @hide method to the VibrationEffect interface, implemented only by compositions, to provide a best-effort crop of the number of segments involved in a vibration effect.

For notification channels, changes the max vibration length to 500 from 1000. We probably don't need that much space, and serializing vibration effects means that the data ends up taking up a lot more space than just the array for the vibration pattern.

Adds android.app.notif_channel_crop_vibration_effects bugfix flag that limits when we attempt to crop the vibration effects.

Bug: 345881518
Test: manual with flag on/off; NotificationChannelTest; VibrationEffectTest
Flag: android.app.notif_channel_crop_vibration_effects (inlined for security backport)
(cherry picked from commit 1181fd1b6769e6f093cd409e2b9f7aa0f91d7ed9)
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:dd6c8b4b334af950f7c26d7b8be2e052b2667ea6)
Merged-In: I885f733112af89fe9f255db626fcdc297b1a18c8
Change-Id: I885f733112af89fe9f255db626fcdc297b1a18c8
4 files changed