Merge "Create a private flag to control shouldOptimizeMeasure" into tm-qpr-dev

This commit is contained in:
Tiger Huang
2023-01-18 05:25:14 +00:00
committed by Android (Google) Code Review
3 changed files with 18 additions and 1 deletions

View File

@@ -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_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_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_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_ADJUST_RESIZE;
import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST; import static android.view.WindowManager.LayoutParams.SOFT_INPUT_MASK_ADJUST;
import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING;
@@ -2766,7 +2767,7 @@ public final class ViewRootImpl implements ViewParent,
* TODO(b/260382739): Apply this to all windows. * TODO(b/260382739): Apply this to all windows.
*/ */
private static boolean shouldOptimizeMeasure(final WindowManager.LayoutParams lp) { 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() { private Rect getWindowBoundsInsetSystemBars() {

View File

@@ -2579,6 +2579,15 @@ public interface WindowManager extends ViewManager {
* {@hide} */ * {@hide} */
public static final int PRIVATE_FLAG_SYSTEM_ERROR = 0x00000100; 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. * Flag that prevents the wallpaper behind the current window from receiving touch events.
* *
@@ -2781,6 +2790,7 @@ public interface WindowManager extends ViewManager {
PRIVATE_FLAG_NO_MOVE_ANIMATION, PRIVATE_FLAG_NO_MOVE_ANIMATION,
PRIVATE_FLAG_COMPATIBLE_WINDOW, PRIVATE_FLAG_COMPATIBLE_WINDOW,
PRIVATE_FLAG_SYSTEM_ERROR, PRIVATE_FLAG_SYSTEM_ERROR,
PRIVATE_FLAG_OPTIMIZE_MEASURE,
PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS, PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR, PRIVATE_FLAG_FORCE_SHOW_STATUS_BAR,
PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT, PRIVATE_FLAG_LAYOUT_SIZE_EXTENDED_BY_CUTOUT,
@@ -2840,6 +2850,10 @@ public interface WindowManager extends ViewManager {
mask = PRIVATE_FLAG_SYSTEM_ERROR, mask = PRIVATE_FLAG_SYSTEM_ERROR,
equals = PRIVATE_FLAG_SYSTEM_ERROR, equals = PRIVATE_FLAG_SYSTEM_ERROR,
name = "SYSTEM_ERROR"), name = "SYSTEM_ERROR"),
@ViewDebug.FlagToString(
mask = PRIVATE_FLAG_OPTIMIZE_MEASURE,
equals = PRIVATE_FLAG_OPTIMIZE_MEASURE,
name = "OPTIMIZE_MEASURE"),
@ViewDebug.FlagToString( @ViewDebug.FlagToString(
mask = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS, mask = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,
equals = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS, equals = PRIVATE_FLAG_DISABLE_WALLPAPER_TOUCH_EVENTS,

View File

@@ -19,6 +19,7 @@ package com.android.systemui.shade;
import static android.view.WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE; 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.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_BEHAVIOR_CONTROLLED; 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.DejankUtils.whitelistIpcs;
import static com.android.systemui.statusbar.NotificationRemoteInputManager.ENABLE_REMOTE_INPUT; import static com.android.systemui.statusbar.NotificationRemoteInputManager.ENABLE_REMOTE_INPUT;
@@ -251,6 +252,7 @@ public class NotificationShadeWindowControllerImpl implements NotificationShadeW
mLp.setTitle("NotificationShade"); mLp.setTitle("NotificationShade");
mLp.packageName = mContext.getPackageName(); mLp.packageName = mContext.getPackageName();
mLp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; 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 // We use BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE here, however, there is special logic in
// window manager which disables the transient show behavior. // window manager which disables the transient show behavior.