diff options
| author | 2023-07-03 12:26:16 +0000 | |
|---|---|---|
| committer | 2023-07-03 12:26:16 +0000 | |
| commit | fc183a1243b4b55b4ba99ab443b89fe26cd5efa8 (patch) | |
| tree | 5e85097a7bc8938b142776580494bfdc350fca75 | |
| parent | 4fe06aab3aa86b44becc8d6dffd05d34aa6d4b82 (diff) | |
| parent | 77b347352204b9f208a7ad490fe68e1ae0f369d2 (diff) | |
Merge "Clean up alwaysConsumeSystemBars" into udc-qpr-dev am: 77b3473522
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23844763
Change-Id: Ia4d12c84ef121b1ca19053885cd0d7eee7c2cc75
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
24 files changed, 66 insertions, 141 deletions
diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index dbc1be141571..8eb02a16350d 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -432,8 +432,7 @@ public abstract class WallpaperService extends Service { @Override public void resized(ClientWindowFrames frames, boolean reportDraw, MergedConfiguration mergedConfiguration, InsetsState insetsState, - boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, - int syncSeqId, boolean dragResizing) { + boolean forceLayout, int displayId, int syncSeqId, boolean dragResizing) { Message msg = mCaller.obtainMessageIO(MSG_WINDOW_RESIZED, reportDraw ? 1 : 0, mergedConfiguration); @@ -1287,9 +1286,9 @@ public abstract class WallpaperService extends Service { visibleFrame.intersect(mInsetsState.getDisplayFrame()); WindowInsets windowInsets = mInsetsState.calculateInsets(visibleFrame, null /* ignoringVisibilityState */, config.isScreenRound(), - false /* alwaysConsumeSystemBars */, mLayout.softInputMode, - mLayout.flags, SYSTEM_UI_FLAG_VISIBLE, mLayout.type, - config.windowConfiguration.getWindowingMode(), null /* idSideMap */); + mLayout.softInputMode, mLayout.flags, SYSTEM_UI_FLAG_VISIBLE, + mLayout.type, config.windowConfiguration.getWindowingMode(), + null /* idSideMap */); if (!fixedSize) { final Rect padding = mIWallpaperEngine.mDisplayPadding; diff --git a/core/java/android/view/IWindow.aidl b/core/java/android/view/IWindow.aidl index d554514349c3..33edc27118f2 100644 --- a/core/java/android/view/IWindow.aidl +++ b/core/java/android/view/IWindow.aidl @@ -56,8 +56,7 @@ oneway interface IWindow { void resized(in ClientWindowFrames frames, boolean reportDraw, in MergedConfiguration newMergedConfiguration, in InsetsState insetsState, - boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, - int syncSeqId, boolean dragResizing); + boolean forceLayout, int displayId, int syncSeqId, boolean dragResizing); /** * Called when this window retrieved control over a specified set of insets sources. diff --git a/core/java/android/view/IWindowManager.aidl b/core/java/android/view/IWindowManager.aidl index 6d96bb9423c5..8813c397b1e4 100644 --- a/core/java/android/view/IWindowManager.aidl +++ b/core/java/android/view/IWindowManager.aidl @@ -737,10 +737,8 @@ interface IWindowManager /** * Called to get the expected window insets. - * - * @return {@code true} if system bars are always consumed. */ - boolean getWindowInsets(int displayId, in IBinder token, out InsetsState outInsetsState); + void getWindowInsets(int displayId, in IBinder token, out InsetsState outInsetsState); /** * Returns a list of {@link android.view.DisplayInfo} for the logical display. This is not diff --git a/core/java/android/view/InsetsAnimationControlImpl.java b/core/java/android/view/InsetsAnimationControlImpl.java index 6c5f195ba2a0..4c50858b13b2 100644 --- a/core/java/android/view/InsetsAnimationControlImpl.java +++ b/core/java/android/view/InsetsAnimationControlImpl.java @@ -40,6 +40,7 @@ import static android.view.InsetsState.ISIDE_LEFT; import static android.view.InsetsState.ISIDE_RIGHT; import static android.view.InsetsState.ISIDE_TOP; import static android.view.WindowInsets.Type.ime; +import static android.view.WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION; import static android.view.inputmethod.ImeTracker.DEBUG_IME_VISIBILITY; import static android.view.inputmethod.ImeTracker.TOKEN_NONE; @@ -63,7 +64,6 @@ import android.view.InsetsState.InternalInsetsSide; import android.view.SyncRtSurfaceTransactionApplier.SurfaceParams; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowInsetsAnimation.Bounds; -import android.view.WindowManager.LayoutParams; import android.view.animation.Interpolator; import android.view.inputmethod.ImeTracker; @@ -401,8 +401,7 @@ public class InsetsAnimationControlImpl implements InternalInsetsAnimationContro private Insets getInsetsFromState(InsetsState state, Rect frame, @Nullable @InternalInsetsSide SparseIntArray idSideMap) { return state.calculateInsets(frame, null /* ignoringVisibilityState */, - false /* isScreenRound */, false /* alwaysConsumeSystemBars */, - LayoutParams.SOFT_INPUT_ADJUST_RESIZE /* legacySoftInputMode*/, + false /* isScreenRound */, SOFT_INPUT_ADJUST_RESIZE /* legacySoftInputMode */, 0 /* legacyWindowFlags */, 0 /* legacySystemUiFlags */, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, idSideMap).getInsets(mTypes); } diff --git a/core/java/android/view/InsetsController.java b/core/java/android/view/InsetsController.java index 0abad6c76c2e..e5d031b7a51c 100644 --- a/core/java/android/view/InsetsController.java +++ b/core/java/android/view/InsetsController.java @@ -797,9 +797,9 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } WindowInsets insets = state.calculateInsets(mFrame, mState /* ignoringVisibilityState*/, - mLastInsets.isRound(), false /* alwaysConsumeSystemBars */, - mLastLegacySoftInputMode, mLastLegacyWindowFlags, mLastLegacySystemUiFlags, - mWindowType, mLastWindowingMode, null /* idSideMap */); + mLastInsets.isRound(), mLastLegacySoftInputMode, mLastLegacyWindowFlags, + mLastLegacySystemUiFlags, mWindowType, mLastWindowingMode, + null /* idSideMap */); mHost.dispatchWindowInsetsAnimationProgress(insets, Collections.unmodifiableList(runningAnimations)); if (DEBUG) { @@ -955,21 +955,20 @@ public class InsetsController implements WindowInsetsController, InsetsAnimation } /** - * @see InsetsState#calculateInsets(Rect, InsetsState, boolean, boolean, int, int, int, int, - * int, android.util.SparseIntArray) + * @see InsetsState#calculateInsets(Rect, InsetsState, boolean, int, int, int, int, int, + * android.util.SparseIntArray) */ @VisibleForTesting - public WindowInsets calculateInsets(boolean isScreenRound, boolean alwaysConsumeSystemBars, - int windowType, int windowingMode, int legacySoftInputMode, int legacyWindowFlags, - int legacySystemUiFlags) { + public WindowInsets calculateInsets(boolean isScreenRound, int windowType, int windowingMode, + int legacySoftInputMode, int legacyWindowFlags, int legacySystemUiFlags) { mWindowType = windowType; mLastWindowingMode = windowingMode; mLastLegacySoftInputMode = legacySoftInputMode; mLastLegacyWindowFlags = legacyWindowFlags; mLastLegacySystemUiFlags = legacySystemUiFlags; mLastInsets = mState.calculateInsets(mFrame, null /* ignoringVisibilityState*/, - isScreenRound, alwaysConsumeSystemBars, legacySoftInputMode, legacyWindowFlags, - legacySystemUiFlags, windowType, windowingMode, null /* idSideMap */); + isScreenRound, legacySoftInputMode, legacyWindowFlags, legacySystemUiFlags, + windowType, windowingMode, null /* idSideMap */); return mLastInsets; } diff --git a/core/java/android/view/InsetsState.java b/core/java/android/view/InsetsState.java index c13b9ab0abd1..828938b99e8f 100644 --- a/core/java/android/view/InsetsState.java +++ b/core/java/android/view/InsetsState.java @@ -40,6 +40,7 @@ import android.annotation.IntDef; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.WindowConfiguration; +import android.app.WindowConfiguration.WindowingMode; import android.graphics.Insets; import android.graphics.Rect; import android.os.Parcel; @@ -136,9 +137,8 @@ public class InsetsState implements Parcelable { * @return The calculated insets. */ public WindowInsets calculateInsets(Rect frame, @Nullable InsetsState ignoringVisibilityState, - boolean isScreenRound, boolean alwaysConsumeSystemBars, - int legacySoftInputMode, int legacyWindowFlags, int legacySystemUiFlags, - int windowType, @WindowConfiguration.WindowingMode int windowingMode, + boolean isScreenRound, int legacySoftInputMode, int legacyWindowFlags, + int legacySystemUiFlags, int windowType, @WindowingMode int windowingMode, @Nullable @InternalInsetsSide SparseIntArray idSideMap) { Insets[] typeInsetsMap = new Insets[Type.SIZE]; Insets[] typeMaxInsetsMap = new Insets[Type.SIZE]; diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 8a65d0465601..b8c3742566ee 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -30748,13 +30748,6 @@ public class View implements Drawable.Callback, KeyEvent.Callback, final Rect mCaptionInsets = new Rect(); /** - * In multi-window we force show the system bars. Because we don't want that the surface - * size changes in this mode, we instead have a flag whether the system bars sizes should - * always be consumed, so the app is treated like there are no virtual system bars at all. - */ - boolean mAlwaysConsumeSystemBars; - - /** * The internal insets given by this window. This value is * supplied by the client (through * {@link ViewTreeObserver.OnComputeInternalInsetsListener}) and will diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index bef28b2789b8..ef76f4ad77fb 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -82,7 +82,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_TOAST; import static android.view.WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY; import static android.view.WindowManager.PROPERTY_COMPAT_ALLOW_SANDBOXING_VIEW_BOUNDS_APIS; import static android.view.WindowManagerGlobal.RELAYOUT_RES_CANCEL_AND_REDRAW; -import static android.view.WindowManagerGlobal.RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS; import static android.view.WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED; import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.IME_FOCUS_CONTROLLER; import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.INSETS_CONTROLLER; @@ -741,7 +740,6 @@ public final class ViewRootImpl implements ViewParent, final Rect mPendingBackDropFrame = new Rect(); - boolean mPendingAlwaysConsumeSystemBars; private int mRelayoutSeq; private final Rect mWinFrameInScreen = new Rect(); private final InsetsState mTempInsets = new InsetsState(); @@ -1366,9 +1364,6 @@ public final class ViewRootImpl implements ViewParent, } } - mAttachInfo.mAlwaysConsumeSystemBars = - (res & WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS) != 0; - mPendingAlwaysConsumeSystemBars = mAttachInfo.mAlwaysConsumeSystemBars; mInsetsController.onStateChanged(mTempInsets); mInsetsController.onControlsChanged(mTempControls.get()); final InsetsState state = mInsetsController.getState(); @@ -1882,8 +1877,8 @@ public final class ViewRootImpl implements ViewParent, final MergedConfiguration mergedConfiguration = (MergedConfiguration) args.arg2; CompatibilityInfo.applyOverrideScaleIfNeeded(mergedConfiguration); final boolean forceNextWindowRelayout = args.argi1 != 0; - final int displayId = args.argi3; - final boolean dragResizing = args.argi5 != 0; + final int displayId = args.argi2; + final boolean dragResizing = args.argi4 != 0; final Rect frame = frames.frame; final Rect displayFrame = frames.displayFrame; @@ -1935,8 +1930,7 @@ public final class ViewRootImpl implements ViewParent, } mForceNextWindowRelayout |= forceNextWindowRelayout; - mPendingAlwaysConsumeSystemBars = args.argi2 != 0; - mSyncSeqId = args.argi4 > mSyncSeqId ? args.argi4 : mSyncSeqId; + mSyncSeqId = args.argi3 > mSyncSeqId ? args.argi3 : mSyncSeqId; if (msg == MSG_RESIZED_REPORT) { reportNextDraw("resized"); @@ -2821,8 +2815,8 @@ public final class ViewRootImpl implements ViewParent, if (mLastWindowInsets == null || forceConstruct) { final Configuration config = getConfiguration(); mLastWindowInsets = mInsetsController.calculateInsets( - config.isScreenRound(), mAttachInfo.mAlwaysConsumeSystemBars, - mWindowAttributes.type, config.windowConfiguration.getWindowingMode(), + config.isScreenRound(), mWindowAttributes.type, + config.windowConfiguration.getWindowingMode(), mWindowAttributes.softInputMode, mWindowAttributes.flags, (mWindowAttributes.systemUiVisibility | mWindowAttributes.subtreeSystemUiVisibility)); @@ -3284,8 +3278,6 @@ public final class ViewRootImpl implements ViewParent, surfaceSizeChanged = true; mLastSurfaceSize.set(mSurfaceSize.x, mSurfaceSize.y); } - final boolean alwaysConsumeSystemBarsChanged = - mPendingAlwaysConsumeSystemBars != mAttachInfo.mAlwaysConsumeSystemBars; updateColorModeIfNeeded(lp.getColorMode()); surfaceCreated = !hadSurface && mSurface.isValid(); surfaceDestroyed = hadSurface && !mSurface.isValid(); @@ -3299,10 +3291,6 @@ public final class ViewRootImpl implements ViewParent, if (surfaceReplaced) { mSurfaceSequenceId++; } - if (alwaysConsumeSystemBarsChanged) { - mAttachInfo.mAlwaysConsumeSystemBars = mPendingAlwaysConsumeSystemBars; - dispatchApplyInsets = true; - } if (updateCaptionInsets()) { dispatchApplyInsets = true; } @@ -8301,9 +8289,6 @@ public final class ViewRootImpl implements ViewParent, CompatibilityInfo.applyOverrideScaleIfNeeded(mPendingMergedConfiguration); mInsetsController.onStateChanged(mTempInsets); mInsetsController.onControlsChanged(mTempControls.get()); - - mPendingAlwaysConsumeSystemBars = - (relayoutResult & RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS) != 0; } final int transformHint = SurfaceControl.rotationToBufferTransform( @@ -8926,7 +8911,7 @@ public final class ViewRootImpl implements ViewParent, @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553) private void dispatchResized(ClientWindowFrames frames, boolean reportDraw, MergedConfiguration mergedConfiguration, InsetsState insetsState, boolean forceLayout, - boolean alwaysConsumeSystemBars, int displayId, int syncSeqId, boolean dragResizing) { + int displayId, int syncSeqId, boolean dragResizing) { Message msg = mHandler.obtainMessage(reportDraw ? MSG_RESIZED_REPORT : MSG_RESIZED); SomeArgs args = SomeArgs.obtain(); final boolean sameProcessCall = (Binder.getCallingPid() == android.os.Process.myPid()); @@ -8945,10 +8930,9 @@ public final class ViewRootImpl implements ViewParent, ? new MergedConfiguration(mergedConfiguration) : mergedConfiguration; args.arg3 = insetsState; args.argi1 = forceLayout ? 1 : 0; - args.argi2 = alwaysConsumeSystemBars ? 1 : 0; - args.argi3 = displayId; - args.argi4 = syncSeqId; - args.argi5 = dragResizing ? 1 : 0; + args.argi2 = displayId; + args.argi3 = syncSeqId; + args.argi4 = dragResizing ? 1 : 0; msg.obj = args; mHandler.sendMessage(msg); @@ -10342,12 +10326,11 @@ public final class ViewRootImpl implements ViewParent, @Override public void resized(ClientWindowFrames frames, boolean reportDraw, MergedConfiguration mergedConfiguration, InsetsState insetsState, - boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, int syncSeqId, - boolean dragResizing) { + boolean forceLayout, int displayId, int syncSeqId, boolean dragResizing) { final ViewRootImpl viewAncestor = mViewAncestor.get(); if (viewAncestor != null) { viewAncestor.dispatchResized(frames, reportDraw, mergedConfiguration, insetsState, - forceLayout, alwaysConsumeSystemBars, displayId, syncSeqId, dragResizing); + forceLayout, displayId, syncSeqId, dragResizing); } } diff --git a/core/java/android/view/WindowInsets.java b/core/java/android/view/WindowInsets.java index 57a41619ff8d..7757c256164e 100644 --- a/core/java/android/view/WindowInsets.java +++ b/core/java/android/view/WindowInsets.java @@ -1429,14 +1429,6 @@ public final class WindowInsets { /** @hide */ @NonNull - public Builder setAlwaysConsumeSystemBars(boolean alwaysConsumeSystemBars) { - // TODO (b/277891341): Remove this and related usages. This has been replaced by - // #setForceConsumingTypes. - return this; - } - - /** @hide */ - @NonNull public Builder setForceConsumingTypes(@InsetsType int forceConsumingTypes) { mForceConsumingTypes = forceConsumingTypes; return this; diff --git a/core/java/android/view/WindowManagerGlobal.java b/core/java/android/view/WindowManagerGlobal.java index 99a4f6b41ef3..c9368f16f0ed 100644 --- a/core/java/android/view/WindowManagerGlobal.java +++ b/core/java/android/view/WindowManagerGlobal.java @@ -79,16 +79,9 @@ public final class WindowManagerGlobal { public static final int RELAYOUT_RES_SURFACE_RESIZED = 1 << 2; /** - * In multi-window we force show the system bars. Because we don't want that the surface size - * changes in this mode, we instead have a flag whether the system bar sizes should always be - * consumed, so the app is treated like there is no virtual system bars at all. - */ - public static final int RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS = 1 << 3; - - /** * The window manager has told the window it cannot draw this frame and should retry again. */ - public static final int RELAYOUT_RES_CANCEL_AND_REDRAW = 1 << 4; + public static final int RELAYOUT_RES_CANCEL_AND_REDRAW = 1 << 3; /** * Flag for relayout: the client will be later giving @@ -99,13 +92,7 @@ public final class WindowManagerGlobal { public static final int ADD_FLAG_IN_TOUCH_MODE = 0x1; public static final int ADD_FLAG_APP_VISIBLE = 0x2; - public static final int ADD_FLAG_USE_BLAST = 0x8; - - /** - * Like {@link #RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS}, but as a "hint" when adding the - * window. - */ - public static final int ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS = 0x4; + public static final int ADD_FLAG_USE_BLAST = 0x4; public static final int ADD_OKAY = 0; public static final int ADD_BAD_APP_TOKEN = -1; diff --git a/core/java/android/view/WindowlessWindowManager.java b/core/java/android/view/WindowlessWindowManager.java index 7d3d283a45f2..1efac4d2927f 100644 --- a/core/java/android/view/WindowlessWindowManager.java +++ b/core/java/android/view/WindowlessWindowManager.java @@ -631,8 +631,8 @@ public class WindowlessWindowManager implements IWindowSession { mTmpFrames.displayFrame.set(mTmpFrames.frame); mTmpConfig.setConfiguration(mConfiguration, mConfiguration); s.mClient.resized(mTmpFrames, false /* reportDraw */, mTmpConfig, state, - false /* forceLayout */, false /* alwaysConsumeSystemBars */, s.mDisplayId, - Integer.MAX_VALUE, false /* dragResizing */); + false /* forceLayout */, s.mDisplayId, Integer.MAX_VALUE, + false /* dragResizing */); } catch (RemoteException e) { // Too bad } diff --git a/core/java/android/window/WindowMetricsController.java b/core/java/android/window/WindowMetricsController.java index 2858f0a1a725..d08d5cfaa2b5 100644 --- a/core/java/android/window/WindowMetricsController.java +++ b/core/java/android/window/WindowMetricsController.java @@ -112,15 +112,14 @@ public final class WindowMetricsController { Rect bounds, boolean isScreenRound, int windowingMode) { try { final InsetsState insetsState = new InsetsState(); - final boolean alwaysConsumeSystemBars = WindowManagerGlobal.getWindowManagerService() - .getWindowInsets(displayId, token, insetsState); + WindowManagerGlobal.getWindowManagerService().getWindowInsets( + displayId, token, insetsState); final float overrideInvScale = CompatibilityInfo.getOverrideInvertedScale(); if (overrideInvScale != 1f) { insetsState.scale(overrideInvScale); } return insetsState.calculateInsets(bounds, null /* ignoringVisibilityState */, - isScreenRound, alwaysConsumeSystemBars, SOFT_INPUT_ADJUST_NOTHING, - 0 /* flags */, SYSTEM_UI_FLAG_VISIBLE, + isScreenRound, SOFT_INPUT_ADJUST_NOTHING, 0 /* flags */, SYSTEM_UI_FLAG_VISIBLE, WindowManager.LayoutParams.INVALID_WINDOW_TYPE, windowingMode, null /* idSideMap */); } catch (RemoteException e) { diff --git a/core/java/com/android/internal/view/BaseIWindow.java b/core/java/com/android/internal/view/BaseIWindow.java index 600058e88e4b..0ac7765d4550 100644 --- a/core/java/com/android/internal/view/BaseIWindow.java +++ b/core/java/com/android/internal/view/BaseIWindow.java @@ -53,7 +53,7 @@ public class BaseIWindow extends IWindow.Stub { @Override public void resized(ClientWindowFrames frames, boolean reportDraw, MergedConfiguration mergedConfiguration, InsetsState insetsState, boolean forceLayout, - boolean alwaysConsumeSystemBars, int displayId, int seqId, boolean dragResizing) { + int displayId, int seqId, boolean dragResizing) { if (reportDraw) { try { mSession.finishDrawing(this, null /* postDrawTransaction */, seqId); diff --git a/core/tests/coretests/src/android/view/ImeInsetsSourceConsumerTest.java b/core/tests/coretests/src/android/view/ImeInsetsSourceConsumerTest.java index f45db23ace76..a9c0e41b23bd 100644 --- a/core/tests/coretests/src/android/view/ImeInsetsSourceConsumerTest.java +++ b/core/tests/coretests/src/android/view/ImeInsetsSourceConsumerTest.java @@ -81,7 +81,6 @@ public class ImeInsetsSourceConsumerTest { Insets.of(10, 10, 10, 10), rect, rect, rect, rect)); mController.calculateInsets( false, - false, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, SOFT_INPUT_ADJUST_RESIZE, 0, 0); mImeConsumer = mController.getImeSourceConsumer(); diff --git a/core/tests/coretests/src/android/view/InsetsControllerTest.java b/core/tests/coretests/src/android/view/InsetsControllerTest.java index 06920524acfc..76e4a6bfe2c7 100644 --- a/core/tests/coretests/src/android/view/InsetsControllerTest.java +++ b/core/tests/coretests/src/android/view/InsetsControllerTest.java @@ -171,7 +171,6 @@ public class InsetsControllerTest { mController.onStateChanged(state); mController.calculateInsets( false, - false, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, SOFT_INPUT_ADJUST_RESIZE, 0, 0); mController.onFrameChanged(new Rect(0, 0, 100, 100)); diff --git a/core/tests/coretests/src/android/view/InsetsStateTest.java b/core/tests/coretests/src/android/view/InsetsStateTest.java index fde1a6d7b04c..6b32350c42ed 100644 --- a/core/tests/coretests/src/android/view/InsetsStateTest.java +++ b/core/tests/coretests/src/android/view/InsetsStateTest.java @@ -100,7 +100,7 @@ public class InsetsStateTest { .setVisible(true); SparseIntArray typeSideMap = new SparseIntArray(); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, SOFT_INPUT_ADJUST_RESIZE, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, + SOFT_INPUT_ADJUST_RESIZE, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, typeSideMap); assertEquals(Insets.of(0, 100, 0, 100), insets.getSystemWindowInsets()); assertEquals(Insets.of(0, 100, 0, 100), insets.getInsets(Type.all())); @@ -119,8 +119,7 @@ public class InsetsStateTest { .setFrame(new Rect(0, 100, 100, 300)) .setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, SOFT_INPUT_ADJUST_RESIZE, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, - null); + SOFT_INPUT_ADJUST_RESIZE, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); assertEquals(100, insets.getStableInsetBottom()); assertEquals(Insets.of(0, 0, 0, 100), insets.getInsetsIgnoringVisibility(systemBars())); assertEquals(Insets.of(0, 0, 0, 200), insets.getSystemWindowInsets()); @@ -138,7 +137,7 @@ public class InsetsStateTest { .setFrame(new Rect(80, 0, 100, 300)) .setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, 0, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); + 0, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets()); assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(statusBars())); assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(navigationBars())); @@ -153,7 +152,7 @@ public class InsetsStateTest { .setFrame(new Rect(80, 0, 100, 300)) .setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, 0, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); + 0, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets()); assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(Type.statusBars())); assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(Type.navigationBars())); @@ -168,8 +167,7 @@ public class InsetsStateTest { .setFrame(new Rect(0, 200, 100, 300)) .setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, SOFT_INPUT_ADJUST_NOTHING, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, - null); + SOFT_INPUT_ADJUST_NOTHING, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); assertEquals(0, insets.getSystemWindowInsetBottom()); assertEquals(100, insets.getInsets(ime()).bottom); assertTrue(insets.isVisible(ime())); @@ -184,10 +182,10 @@ public class InsetsStateTest { .setFrame(new Rect(0, 200, 100, 300)) .setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, SOFT_INPUT_ADJUST_NOTHING, 0, SYSTEM_UI_FLAG_LAYOUT_STABLE, TYPE_APPLICATION, + SOFT_INPUT_ADJUST_NOTHING, 0, SYSTEM_UI_FLAG_LAYOUT_STABLE, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); assertEquals(100, insets.getSystemWindowInsetTop()); - insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false, + insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, SOFT_INPUT_ADJUST_NOTHING, 0, 0 /* legacySystemUiFlags */, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); assertEquals(0, insets.getSystemWindowInsetTop()); @@ -199,10 +197,10 @@ public class InsetsStateTest { .setFrame(new Rect(0, 0, 100, 100)) .setVisible(false); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, SOFT_INPUT_ADJUST_NOTHING, FLAG_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_STABLE, + SOFT_INPUT_ADJUST_NOTHING, FLAG_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_STABLE, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); assertEquals(0, insets.getSystemWindowInsetTop()); - insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false, + insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, SOFT_INPUT_ADJUST_NOTHING, 0, 0 /* legacySystemUiFlags */, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); assertEquals(0, insets.getSystemWindowInsetTop()); @@ -214,19 +212,19 @@ public class InsetsStateTest { .setFrame(new Rect(0, 0, 100, 100)) .setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, SOFT_INPUT_ADJUST_NOTHING, FLAG_LAYOUT_NO_LIMITS, + SOFT_INPUT_ADJUST_NOTHING, FLAG_LAYOUT_NO_LIMITS, 0 /* legacySystemUiFlags */, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); assertEquals(0, insets.getSystemWindowInsetTop()); insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, SOFT_INPUT_ADJUST_NOTHING, FLAG_LAYOUT_NO_LIMITS, + SOFT_INPUT_ADJUST_NOTHING, FLAG_LAYOUT_NO_LIMITS, 0 /* legacySystemUiFlags */, TYPE_SYSTEM_ERROR, WINDOWING_MODE_UNDEFINED, null); assertEquals(100, insets.getSystemWindowInsetTop()); insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, SOFT_INPUT_ADJUST_NOTHING, FLAG_LAYOUT_NO_LIMITS, + SOFT_INPUT_ADJUST_NOTHING, FLAG_LAYOUT_NO_LIMITS, 0 /* legacySystemUiFlags */, TYPE_WALLPAPER, WINDOWING_MODE_UNDEFINED, null); assertEquals(100, insets.getSystemWindowInsetTop()); insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, SOFT_INPUT_ADJUST_NOTHING, FLAG_LAYOUT_NO_LIMITS, + SOFT_INPUT_ADJUST_NOTHING, FLAG_LAYOUT_NO_LIMITS, 0 /* legacySystemUiFlags */, TYPE_APPLICATION, WINDOWING_MODE_FREEFORM, null); assertEquals(100, insets.getSystemWindowInsetTop()); } @@ -268,7 +266,7 @@ public class InsetsStateTest { .setFrame(new Rect(80, 0, 100, 300)) .setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, 0, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); + 0, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets()); assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(statusBars())); assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(navigationBars())); @@ -283,7 +281,7 @@ public class InsetsStateTest { .setFrame(new Rect(80, 0, 100, 300)) .setVisible(true); WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, - false, 0, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); + 0, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); assertEquals(Insets.of(0, 100, 20, 0), insets.getSystemWindowInsets()); assertEquals(Insets.of(0, 100, 0, 0), insets.getInsets(statusBars())); assertEquals(Insets.of(0, 0, 20, 0), insets.getInsets(navigationBars())); @@ -298,7 +296,7 @@ public class InsetsStateTest { .setFrame(new Rect(0, 200, 100, 300)) .setVisible(true); mState.removeSource(ID_IME); - WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, false, + WindowInsets insets = mState.calculateInsets(new Rect(0, 0, 100, 300), null, false, SOFT_INPUT_ADJUST_RESIZE, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, null); assertEquals(0, insets.getSystemWindowInsetBottom()); } @@ -530,7 +528,7 @@ public class InsetsStateTest { new Rect(0, 0, 1, 2), new Rect(197, 296, 200, 300), new Rect(197, 296, 200, 300))); - DisplayCutout cutout = mState.calculateInsets(new Rect(1, 1, 199, 300), null, false, false, + DisplayCutout cutout = mState.calculateInsets(new Rect(1, 1, 199, 300), null, false, SOFT_INPUT_ADJUST_UNSPECIFIED, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, new SparseIntArray()).getDisplayCutout(); assertEquals(0, cutout.getSafeInsetLeft()); @@ -556,7 +554,7 @@ public class InsetsStateTest { new RoundedCorner(POSITION_BOTTOM_RIGHT, 20, 180, 380), new RoundedCorner(POSITION_BOTTOM_LEFT, 20, 20, 380))); WindowInsets windowInsets = mState.calculateInsets(new Rect(1, 2, 197, 396), null, false, - false, SOFT_INPUT_ADJUST_UNSPECIFIED, 0, 0, TYPE_APPLICATION, + SOFT_INPUT_ADJUST_UNSPECIFIED, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, new SparseIntArray()); assertEquals(new RoundedCorner(POSITION_TOP_LEFT, 10, 9, 8), windowInsets.getRoundedCorner(POSITION_TOP_LEFT)); @@ -573,7 +571,7 @@ public class InsetsStateTest { mState.setDisplayFrame(new Rect(0, 0, 200, 400)); mState.setDisplayShape(DisplayShape.createDefaultDisplayShape(200, 400, false)); WindowInsets windowInsets = mState.calculateInsets(new Rect(10, 20, 200, 400), null, false, - false, SOFT_INPUT_ADJUST_UNSPECIFIED, 0, 0, TYPE_APPLICATION, + SOFT_INPUT_ADJUST_UNSPECIFIED, 0, 0, TYPE_APPLICATION, WINDOWING_MODE_UNDEFINED, new SparseIntArray()); final DisplayShape expect = diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java index 5e42782431fd..586a794d5020 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/SystemWindows.java @@ -347,8 +347,7 @@ public class SystemWindows { @Override public void resized(ClientWindowFrames frames, boolean reportDraw, MergedConfiguration newMergedConfiguration, InsetsState insetsState, - boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, int syncSeqId, - boolean dragResizing) {} + boolean forceLayout, int displayId, int syncSeqId, boolean dragResizing) {} @Override public void insetsControlChanged(InsetsState insetsState, diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java index c2f15f6cba75..1d879a130848 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/startingsurface/TaskSnapshotWindow.java @@ -214,8 +214,7 @@ public class TaskSnapshotWindow { @Override public void resized(ClientWindowFrames frames, boolean reportDraw, MergedConfiguration mergedConfiguration, InsetsState insetsState, - boolean forceLayout, boolean alwaysConsumeSystemBars, int displayId, int seqId, - boolean dragResizing) { + boolean forceLayout, int displayId, int seqId, boolean dragResizing) { final TaskSnapshotWindow snapshot = mOuter.get(); if (snapshot == null) { return; diff --git a/services/core/java/com/android/server/wm/DisplayPolicy.java b/services/core/java/com/android/server/wm/DisplayPolicy.java index 2717a6a8ab04..98c15dd26013 100644 --- a/services/core/java/com/android/server/wm/DisplayPolicy.java +++ b/services/core/java/com/android/server/wm/DisplayPolicy.java @@ -1284,12 +1284,6 @@ public class DisplayPolicy { return ANIMATION_STYLEABLE; } - // TODO (b/277891341): Remove this and related usages. This has been replaced by - // InsetsSource#FLAG_FORCE_CONSUMING. - public boolean areSystemBarsForcedConsumedLw() { - return false; - } - /** * Computes the frames of display (its logical size, rotation and cutout should already be set) * used to layout window. This method only changes the given display frames, insets state and diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 9be12d7074b8..68a6384bc109 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -1789,9 +1789,6 @@ public class WindowManagerService extends IWindowManager.Stub winAnimator.mEnterAnimationPending = true; winAnimator.mEnteringAnimation = true; - if (displayPolicy.areSystemBarsForcedConsumedLw()) { - res |= WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS; - } if (displayContent.isInTouchMode()) { res |= WindowManagerGlobal.ADD_FLAG_IN_TOUCH_MODE; } @@ -2494,9 +2491,6 @@ public class WindowManagerService extends IWindowManager.Stub if (win.mActivityRecord != null) { win.mActivityRecord.updateReportedVisibilityLocked(); } - if (displayPolicy.areSystemBarsForcedConsumedLw()) { - result |= WindowManagerGlobal.RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS; - } if (!win.isGoneForLayout()) { win.mResizedWhileGone = false; } @@ -9070,7 +9064,7 @@ public class WindowManagerService extends IWindowManager.Stub } @Override - public boolean getWindowInsets(int displayId, IBinder token, InsetsState outInsetsState) { + public void getWindowInsets(int displayId, IBinder token, InsetsState outInsetsState) { final long origId = Binder.clearCallingIdentity(); try { synchronized (mGlobalLock) { @@ -9081,7 +9075,6 @@ public class WindowManagerService extends IWindowManager.Stub } final WindowToken winToken = dc.getWindowToken(token); dc.getInsetsPolicy().getInsetsForWindowMetrics(winToken, outInsetsState); - return dc.getDisplayPolicy().areSystemBarsForcedConsumedLw(); } } finally { Binder.restoreCallingIdentity(origId); diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index 0d4c2d631b2c..ef44702041a5 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -3732,8 +3732,6 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP final boolean isDragResizeChanged = isDragResizeChanged(); final boolean forceRelayout = syncWithBuffers || isDragResizeChanged; final DisplayContent displayContent = getDisplayContent(); - final boolean alwaysConsumeSystemBars = - displayContent.getDisplayPolicy().areSystemBarsForcedConsumedLw(); final int displayId = displayContent.getDisplayId(); if (isDragResizeChanged) { @@ -3745,7 +3743,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP try { mClient.resized(mClientWindowFrames, reportDraw, mLastReportedConfiguration, - getCompatInsetsState(), forceRelayout, alwaysConsumeSystemBars, displayId, + getCompatInsetsState(), forceRelayout, displayId, syncWithBuffers ? mSyncSeqId : -1, isDragResizing); if (drawPending && prevRotation >= 0 && prevRotation != mLastReportedConfiguration .getMergedConfiguration().windowConfiguration.getRotation()) { diff --git a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java index 3db53eb08ea1..2e055e8a665e 100644 --- a/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/ActivityRecordTests.java @@ -3354,8 +3354,7 @@ public class ActivityRecordTests extends WindowTestsBase { // to client if the app didn't request IME visible. assertFalse(app2.mActivityRecord.mImeInsetsFrozenUntilStartInput); verify(app2.mClient, atLeastOnce()).resized(any(), anyBoolean(), any(), - insetsStateCaptor.capture(), anyBoolean(), anyBoolean(), anyInt(), anyInt(), - anyBoolean()); + insetsStateCaptor.capture(), anyBoolean(), anyInt(), anyInt(), anyBoolean()); assertFalse(app2.getInsetsState().isSourceOrDefaultVisible(ID_IME, ime())); } diff --git a/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java b/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java index 3f8acc651110..40f86ddb611c 100644 --- a/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java +++ b/services/tests/wmtests/src/com/android/server/wm/TestIWindow.java @@ -46,8 +46,7 @@ public class TestIWindow extends IWindow.Stub { @Override public void resized(ClientWindowFrames frames, boolean reportDraw, MergedConfiguration mergedConfig, InsetsState insetsState, boolean forceLayout, - boolean alwaysConsumeSystemBars, int displayId, int seqId, boolean dragResizing) - throws RemoteException { + int displayId, int seqId, boolean dragResizing) throws RemoteException { } @Override diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java index 0ddd3135506e..c13c2c3e35d0 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java @@ -778,8 +778,8 @@ public class WindowStateTests extends WindowTestsBase { doThrow(new RemoteException("test")).when(win.mClient).resized(any() /* frames */, anyBoolean() /* reportDraw */, any() /* mergedConfig */, any() /* insetsState */, anyBoolean() /* forceLayout */, - anyBoolean() /* alwaysConsumeSystemBars */, anyInt() /* displayId */, - anyInt() /* seqId */, anyBoolean() /* dragResizing */); + anyInt() /* displayId */, anyInt() /* seqId */, + anyBoolean() /* dragResizing */); } catch (RemoteException ignored) { } win.reportResized(); |