diff options
3 files changed, 18 insertions, 1 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index b470d78364c9..f0a14ae296ba 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -73,6 +73,7 @@ import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FIT_INSETS_CO import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_INSET_PARENT_FRAME_BY_IME; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT; +import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OPTIMIZE_MEASURE; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; @@ -2768,7 +2769,7 @@ public final class ViewRootImpl implements ViewParent, * TODO(b/260382739): Apply this to all windows. */ private static boolean shouldOptimizeMeasure(final WindowManager.LayoutParams lp) { - return lp.type == TYPE_NOTIFICATION_SHADE; + return (lp.privateFlags & PRIVATE_FLAG_OPTIMIZE_MEASURE) != 0; } private Rect getWindowBoundsInsetSystemBars() { diff --git a/core/java/android/view/WindowManager.java b/core/java/android/view/WindowManager.java index abc49266bb19..a37c24499aff 100644 --- a/core/java/android/view/WindowManager.java +++ b/core/java/android/view/WindowManager.java @@ -2580,6 +2580,15 @@ public interface WindowManager extends ViewManager { public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100; /** + * Flag to indicate that the view hierarchy of the window can only be measured when + * necessary. If a window size can be known by the LayoutParams, we can use the size to + * relayout window, and we don't have to measure the view hierarchy before laying out the + * views. This reduces the chances to perform measure. + * {@hide} + */ + public static final int PRIVATE_FLAG_OPTIMIZE_MEASURE = 0x00000200; + + /** * Flag that prevents the wallpaper behind the current window from receiving touch events. * * {@hide} @@ -2781,6 +2790,7 @@ public interface WindowManager extends ViewManager { PRIVATE_FLAG_NO_MOVE_ANIMATION, PRIVATE_FLAG_COMPATIBLE_WINDOW, PRIVATE_FLAG_SYSTEM_ERROR, + PRIVATE_FLAG_OPTIMIZE_MEASURE, PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS, PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR, PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT, @@ -2841,6 +2851,10 @@ public interface WindowManager extends ViewManager { equals = PRIVATE_FLAG_SYSTEM_ERROR, name = "SYSTEM_ERROR"), @ViewDebug.FlagToString( + mask = PRIVATE_FLAG_OPTIMIZE_MEASURE, + equals = PRIVATE_FLAG_OPTIMIZE_MEASURE, + name = "OPTIMIZE_MEASURE"), + @ViewDebug.FlagToString( mask = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS, equals = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS, name = "DISABLE_WALLPAPER_TOUCH_EVENTS"), diff --git a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java index 26f8b6222dc1..a4acf0243080 100644 --- a/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java +++ b/packages/SystemUI/src/com/android/systemui/shade/NotificationShadeWindowControllerImpl.java @@ -19,6 +19,7 @@ package com.android.systemui.shade; import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_BEHAVIOR_CONTROLLED; +import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_OPTIMIZE_MEASURE; import static com.android.systemui.DejankUtils.whitelistIpcs; import static com.android.systemui.statusbar.NotificationRemoteInputManager.ENABLE_REMOTE_INPUT; @@ -251,6 +252,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW mLp.setTitle("NotificationShade"); mLp.packageName = mContext.getPackageName(); mLp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; + mLp.privateFlags |= PRIVATE_FLAG_OPTIMIZE_MEASURE; // We use BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE here, however, there is special logic in // window manager which disables the transient show behavior. |