diff options
| author | 2023-12-14 12:47:41 +0000 | |
|---|---|---|
| committer | 2023-12-14 16:18:58 +0000 | |
| commit | 8f8d6e26bde81fcadd1858d9cd7b4529103cf142 (patch) | |
| tree | 0ef5aea4896e3323e7688cde3da5ad90e1f193fc | |
| parent | 185ece07b97cca02c779b30f9278f2ffaf6df7ef (diff) | |
Add simulate extra notifications measure delay debug flag
Adds a flag to debuggable builds to add extra delay
when measuring notification rows.
Flag: (systemui) enable_notifications_simulate_slow_measure DISABLED
Bug: 293824309
Test: manual
Change-Id: Ic68abe0a459780c87c050fa4b86cf8df160b25fb
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/flags/Flags.kt | 7 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java | 25 |
2 files changed, 32 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt index b1d4587c20d8..b43f54de4b2a 100644 --- a/packages/SystemUI/src/com/android/systemui/flags/Flags.kt +++ b/packages/SystemUI/src/com/android/systemui/flags/Flags.kt @@ -564,6 +564,13 @@ object Flags { val ENABLE_UNFOLD_STATUS_BAR_ANIMATIONS = unreleasedFlag("enable_unfold_status_bar_animations") + // TODO(b/316157842): Tracking Bug + // Adds extra delay to notifications measure + @Keep + @JvmField + val ENABLE_NOTIFICATIONS_SIMULATE_SLOW_MEASURE = + unreleasedFlag("enable_notifications_simulate_slow_measure") + // TODO(b259590361): Tracking bug val EXPERIMENTAL_FLAG = unreleasedFlag("exp_flag_release") diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index b6d4dedfe6f7..5872840913f4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -38,6 +38,7 @@ import android.graphics.drawable.AnimationDrawable; import android.graphics.drawable.Drawable; import android.os.Build; import android.os.Bundle; +import android.os.SystemProperties; import android.os.Trace; import android.util.AttributeSet; import android.util.FloatProperty; @@ -272,6 +273,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView private final RefactorFlag mInlineReplyAnimation = RefactorFlag.forView(Flags.NOTIFICATION_INLINE_REPLY_ANIMATION); + private static final boolean mSimulateSlowMeasure = Compile.IS_DEBUG && RefactorFlag.forView( + Flags.ENABLE_NOTIFICATIONS_SIMULATE_SLOW_MEASURE).isEnabled(); + private static final String SLOW_MEASURE_SIMULATE_DELAY_PROPERTY = + "persist.notifications.extra_measure_delay_ms"; + private static final int SLOW_MEASURE_SIMULATE_DELAY_MS = mSimulateSlowMeasure ? + SystemProperties.getInt(SLOW_MEASURE_SIMULATE_DELAY_PROPERTY, 150) : 0; + // Listener will be called when receiving a long click event. // Use #setLongPressPosition to optionally assign positional data with the long press. private LongPressListener mLongPressListener; @@ -1879,9 +1887,26 @@ public class ExpandableNotificationRow extends ActivatableNotificationView + "heightMeasureSpec=" + MeasureSpec.toString(heightMeasureSpec) + ")"); } super.onMeasure(widthMeasureSpec, heightMeasureSpec); + + if (Compile.IS_DEBUG && mSimulateSlowMeasure) { + simulateExtraMeasureDelay(); + } Trace.endSection(); } + private void simulateExtraMeasureDelay() { + // Add extra delay in a notification row instead of NotificationStackScrollLayout + // to make sure that when the measure cache is used we won't add this delay + try { + Trace.beginSection("ExtraDebugMeasureDelay"); + Thread.sleep(SLOW_MEASURE_SIMULATE_DELAY_MS); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } finally { + Trace.endSection(); + } + } + /** * Generates and appends "(MessagingStyle)" type tag to passed string for tracing. */ |