diff options
11 files changed, 35 insertions, 417 deletions
diff --git a/apct-tests/perftests/windowmanager/src/android/wm/RelayoutPerfTest.java b/apct-tests/perftests/windowmanager/src/android/wm/RelayoutPerfTest.java index d80d3c8d9301..b955032ff8e4 100644 --- a/apct-tests/perftests/windowmanager/src/android/wm/RelayoutPerfTest.java +++ b/apct-tests/perftests/windowmanager/src/android/wm/RelayoutPerfTest.java @@ -18,11 +18,8 @@ package android.wm; import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation; -import static com.android.window.flags.Flags.windowSessionRelayoutInfo; - import android.app.Activity; import android.content.Context; -import android.os.Bundle; import android.os.RemoteException; import android.perftests.utils.BenchmarkState; import android.perftests.utils.PerfStatusReporter; @@ -131,7 +128,6 @@ public class RelayoutPerfTest extends WindowManagerPerfTestBase final MergedConfiguration mOutMergedConfiguration = new MergedConfiguration(); final InsetsState mOutInsetsState = new InsetsState(); final InsetsSourceControl.Array mOutControls = new InsetsSourceControl.Array(); - final Bundle mOutBundle = windowSessionRelayoutInfo() ? null : new Bundle(); final WindowRelayoutResult mOutRelayoutResult; final IWindow mWindow; final View mView; @@ -152,26 +148,16 @@ public class RelayoutPerfTest extends WindowManagerPerfTestBase mHeight = mView.getMeasuredHeight(); mOutSurfaceControl = mView.getViewRootImpl().getSurfaceControl(); mViewVisibility = visibilitySupplier; - mOutRelayoutResult = windowSessionRelayoutInfo() - ? new WindowRelayoutResult(mOutFrames, mOutMergedConfiguration, - mOutSurfaceControl, mOutInsetsState, mOutControls) - : null; + mOutRelayoutResult = new WindowRelayoutResult(mOutFrames, mOutMergedConfiguration, + mOutSurfaceControl, mOutInsetsState, mOutControls); } void runBenchmark(BenchmarkState state) throws RemoteException { final IWindowSession session = WindowManagerGlobal.getWindowSession(); while (state.keepRunning()) { mRelayoutSeq++; - if (windowSessionRelayoutInfo()) { - session.relayout(mWindow, mParams, mWidth, mHeight, - mViewVisibility.getAsInt(), mFlags, mRelayoutSeq, 0 /* lastSyncSeqId */, - mOutRelayoutResult); - } else { - session.relayoutLegacy(mWindow, mParams, mWidth, mHeight, - mViewVisibility.getAsInt(), mFlags, mRelayoutSeq, 0 /* lastSyncSeqId */, - mOutFrames, mOutMergedConfiguration, mOutSurfaceControl, - mOutInsetsState, mOutControls, mOutBundle); - } + session.relayout(mWindow, mParams, mWidth, mHeight, mViewVisibility.getAsInt(), + mFlags, mRelayoutSeq, 0 /* lastSyncSeqId */, mOutRelayoutResult); } } } diff --git a/core/java/android/service/wallpaper/WallpaperService.java b/core/java/android/service/wallpaper/WallpaperService.java index 8271caf57353..3161ff1e4c00 100644 --- a/core/java/android/service/wallpaper/WallpaperService.java +++ b/core/java/android/service/wallpaper/WallpaperService.java @@ -31,7 +31,6 @@ import static com.android.window.flags.Flags.FLAG_OFFLOAD_COLOR_EXTRACTION; import static com.android.window.flags.Flags.noConsecutiveVisibilityEvents; import static com.android.window.flags.Flags.noVisibilityEventOnDisplayStateChange; import static com.android.window.flags.Flags.offloadColorExtraction; -import static com.android.window.flags.Flags.windowSessionRelayoutInfo; import android.animation.AnimationHandler; import android.animation.Animator; @@ -302,13 +301,10 @@ public abstract class WallpaperService extends Service { final InsetsState mInsetsState = new InsetsState(); final InsetsSourceControl.Array mTempControls = new InsetsSourceControl.Array(); final MergedConfiguration mMergedConfiguration = new MergedConfiguration(); - final Bundle mSyncSeqIdBundle = windowSessionRelayoutInfo() ? null : new Bundle(); SurfaceControl mSurfaceControl = new SurfaceControl(); - WindowRelayoutResult mRelayoutResult = windowSessionRelayoutInfo() - ? new WindowRelayoutResult(mWinFrames, mMergedConfiguration, mSurfaceControl, - mInsetsState, mTempControls) - : null; + WindowRelayoutResult mRelayoutResult = new WindowRelayoutResult( + mWinFrames, mMergedConfiguration, mSurfaceControl, mInsetsState, mTempControls); private final Point mSurfaceSize = new Point(); private final Point mLastSurfaceSize = new Point(); @@ -1277,15 +1273,8 @@ public abstract class WallpaperService extends Service { } else { mLayout.surfaceInsets.set(0, 0, 0, 0); } - final int relayoutResult; - if (windowSessionRelayoutInfo()) { - relayoutResult = mSession.relayout(mWindow, mLayout, mWidth, mHeight, - View.VISIBLE, 0, 0, 0, mRelayoutResult); - } else { - relayoutResult = mSession.relayoutLegacy(mWindow, mLayout, mWidth, mHeight, - View.VISIBLE, 0, 0, 0, mWinFrames, mMergedConfiguration, - mSurfaceControl, mInsetsState, mTempControls, mSyncSeqIdBundle); - } + final int relayoutResult = mSession.relayout(mWindow, mLayout, mWidth, mHeight, + View.VISIBLE, 0, 0, 0, mRelayoutResult); final Rect outMaxBounds = mMergedConfiguration.getMergedConfiguration() .windowConfiguration.getMaxBounds(); if (!outMaxBounds.equals(maxBounds)) { diff --git a/core/java/android/view/IWindowSession.aidl b/core/java/android/view/IWindowSession.aidl index e3e4fc04098b..070d33bb9be6 100644 --- a/core/java/android/view/IWindowSession.aidl +++ b/core/java/android/view/IWindowSession.aidl @@ -49,18 +49,6 @@ import java.util.List; */ interface IWindowSession { - /** - * Bundle key to store the latest sync seq id for the relayout configuration. - * @see #relayout - */ - const String KEY_RELAYOUT_BUNDLE_SEQID = "seqid"; - /** - * Bundle key to store the latest ActivityWindowInfo associated with the relayout configuration. - * Will only be set if the relayout window is an activity window. - * @see #relayout - */ - const String KEY_RELAYOUT_BUNDLE_ACTIVITY_WINDOW_INFO = "activity_window_info"; - int addToDisplay(IWindow window, in WindowManager.LayoutParams attrs, in int viewVisibility, in int layerStackId, int requestedVisibleTypes, out InputChannel outInputChannel, out InsetsState insetsState, @@ -85,16 +73,6 @@ interface IWindowSession { void remove(IBinder clientToken); /** - * @deprecated - */ - int relayoutLegacy(IWindow window, in WindowManager.LayoutParams attrs, - int requestedWidth, int requestedHeight, int viewVisibility, - int flags, int seq, int lastSyncSeqId, out ClientWindowFrames outFrames, - out MergedConfiguration outMergedConfiguration, out SurfaceControl outSurfaceControl, - out InsetsState insetsState, out InsetsSourceControl.Array activeControls, - out Bundle bundle); - - /** * Change the parameters of a window. You supply the * new parameters, it returns the new frame of the window on screen (the * position should be ignored) and surface of the window. The surface diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java index 9f4d7e2f3338..d594ca53171a 100644 --- a/core/java/android/view/ViewRootImpl.java +++ b/core/java/android/view/ViewRootImpl.java @@ -25,8 +25,6 @@ import static android.os.Trace.TRACE_TAG_VIEW; import static android.view.Display.DEFAULT_DISPLAY; import static android.view.Display.INVALID_DISPLAY; import static android.view.DragEvent.ACTION_DRAG_LOCATION; -import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_APP_PROGRESS_GENERATION_ALLOWED; -import static android.view.flags.Flags.sensitiveContentPrematureProtectionRemovedFix; import static android.view.InputDevice.SOURCE_CLASS_NONE; import static android.view.InsetsSource.ID_IME; import static android.view.Surface.FRAME_RATE_CATEGORY_DEFAULT; @@ -90,6 +88,7 @@ import static android.view.WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS; import static android.view.WindowManager.LayoutParams.LAST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS; import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; +import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_APP_PROGRESS_GENERATION_ALLOWED; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_EDGE_TO_EDGE_ENFORCED; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FIT_INSETS_CONTROLLED; import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY; @@ -114,6 +113,7 @@ import static android.view.accessibility.Flags.forceInvertColor; import static android.view.accessibility.Flags.reduceWindowContentChangedEventThrottle; import static android.view.flags.Flags.addSchandleToVriSurface; import static android.view.flags.Flags.sensitiveContentAppProtection; +import static android.view.flags.Flags.sensitiveContentPrematureProtectionRemovedFix; import static android.view.flags.Flags.toolkitFrameRateFunctionEnablingReadOnly; import static android.view.flags.Flags.toolkitFrameRateTypingReadOnly; import static android.view.flags.Flags.toolkitFrameRateVelocityMappingReadOnly; @@ -124,12 +124,11 @@ import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodCl import static android.view.inputmethod.InputMethodEditorTraceProto.InputMethodClientsTraceProto.ClientSideProto.INSETS_CONTROLLER; import static com.android.internal.annotations.VisibleForTesting.Visibility.PACKAGE; +import static com.android.text.flags.Flags.disableHandwritingInitiatorForIme; import static com.android.window.flags.Flags.activityWindowInfoFlag; import static com.android.window.flags.Flags.enableBufferTransformHintFromDisplay; import static com.android.window.flags.Flags.insetsControlChangedItem; import static com.android.window.flags.Flags.setScPropertiesInClient; -import static com.android.window.flags.Flags.windowSessionRelayoutInfo; -import static com.android.text.flags.Flags.disableHandwritingInitiatorForIme; import android.Manifest; import android.accessibilityservice.AccessibilityService; @@ -1138,7 +1137,7 @@ public final class ViewRootImpl implements ViewParent, */ /** - * A temporary object used so relayoutWindow can return the latest SyncSeqId + * Object for relayoutWindow to return the latest window info, including the SyncSeqId * system. The SyncSeqId system was designed to work without synchronous relayout * window, and actually synchronous relayout window presents a problem. We could have * a sequence like this: @@ -1152,14 +1151,8 @@ public final class ViewRootImpl implements ViewParent, * we get rid of synchronous relayout, until then, we use this bundle to channel the * integer back over relayout. */ - private final Bundle mRelayoutBundle = windowSessionRelayoutInfo() - ? null - : new Bundle(); - - private final WindowRelayoutResult mRelayoutResult = windowSessionRelayoutInfo() - ? new WindowRelayoutResult(mTmpFrames, mPendingMergedConfiguration, mSurfaceControl, - mTempInsets, mTempControls) - : null; + private final WindowRelayoutResult mRelayoutResult = new WindowRelayoutResult( + mTmpFrames, mPendingMergedConfiguration, mSurfaceControl, mTempInsets, mTempControls); private static volatile boolean sAnrReported = false; static BLASTBufferQueue.TransactionHangCallback sTransactionHangCallback = @@ -9261,42 +9254,19 @@ public final class ViewRootImpl implements ViewParent, insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0, mRelayoutSeq, mLastSyncSeqId); } else { - if (windowSessionRelayoutInfo()) { - relayoutResult = mWindowSession.relayout(mWindow, params, - requestedWidth, requestedHeight, viewVisibility, - insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0, - mRelayoutSeq, mLastSyncSeqId, mRelayoutResult); - } else { - relayoutResult = mWindowSession.relayoutLegacy(mWindow, params, - requestedWidth, requestedHeight, viewVisibility, - insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0, - mRelayoutSeq, mLastSyncSeqId, mTmpFrames, mPendingMergedConfiguration, - mSurfaceControl, mTempInsets, mTempControls, mRelayoutBundle); - } + relayoutResult = mWindowSession.relayout(mWindow, params, + requestedWidth, requestedHeight, viewVisibility, + insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0, + mRelayoutSeq, mLastSyncSeqId, mRelayoutResult); mRelayoutRequested = true; if (activityWindowInfoFlag() && mPendingActivityWindowInfo != null) { - ActivityWindowInfo outInfo = null; - if (windowSessionRelayoutInfo()) { - outInfo = mRelayoutResult != null ? mRelayoutResult.activityWindowInfo : null; - } else { - try { - outInfo = mRelayoutBundle.getParcelable( - IWindowSession.KEY_RELAYOUT_BUNDLE_ACTIVITY_WINDOW_INFO, - ActivityWindowInfo.class); - mRelayoutBundle.remove( - IWindowSession.KEY_RELAYOUT_BUNDLE_ACTIVITY_WINDOW_INFO); - } catch (IllegalStateException e) { - Log.e(TAG, "Failed to get ActivityWindowInfo from relayout Bundle", e); - } - } + final ActivityWindowInfo outInfo = mRelayoutResult.activityWindowInfo; if (outInfo != null) { mPendingActivityWindowInfo.set(outInfo); } } - final int maybeSyncSeqId = windowSessionRelayoutInfo() - ? mRelayoutResult.syncSeqId - : mRelayoutBundle.getInt(IWindowSession.KEY_RELAYOUT_BUNDLE_SEQID); + final int maybeSyncSeqId = mRelayoutResult.syncSeqId; if (maybeSyncSeqId > 0) { mSyncSeqId = maybeSyncSeqId; } diff --git a/core/java/android/view/WindowlessWindowManager.java b/core/java/android/view/WindowlessWindowManager.java index d7d764b6ce75..55f22a631c3b 100644 --- a/core/java/android/view/WindowlessWindowManager.java +++ b/core/java/android/view/WindowlessWindowManager.java @@ -23,7 +23,6 @@ import android.content.res.Configuration; import android.graphics.PixelFormat; import android.graphics.Rect; import android.graphics.Region; -import android.os.Bundle; import android.os.IBinder; import android.os.RemoteCallback; import android.os.RemoteException; @@ -349,18 +348,6 @@ public class WindowlessWindowManager implements IWindowSession { } @Override - public int relayoutLegacy(IWindow window, WindowManager.LayoutParams inAttrs, - int requestedWidth, int requestedHeight, int viewFlags, int flags, int seq, - int lastSyncSeqId, ClientWindowFrames outFrames, - MergedConfiguration outMergedConfiguration, SurfaceControl outSurfaceControl, - InsetsState outInsetsState, InsetsSourceControl.Array outActiveControls, - Bundle outSyncSeqIdBundle) { - return relayoutInner(window, inAttrs, requestedWidth, requestedHeight, viewFlags, flags, - seq, lastSyncSeqId, outFrames, outMergedConfiguration, outSurfaceControl, - outInsetsState, outActiveControls); - } - - @Override public int relayout(IWindow window, WindowManager.LayoutParams inAttrs, int requestedWidth, int requestedHeight, int viewFlags, int flags, int seq, int lastSyncSeqId, WindowRelayoutResult outRelayoutResult) { diff --git a/core/java/android/window/flags/windowing_sdk.aconfig b/core/java/android/window/flags/windowing_sdk.aconfig index d54ec5cdbe19..8cd2a3ed124e 100644 --- a/core/java/android/window/flags/windowing_sdk.aconfig +++ b/core/java/android/window/flags/windowing_sdk.aconfig @@ -103,17 +103,6 @@ flag { flag { namespace: "windowing_sdk" - name: "window_session_relayout_info" - description: "Pass an out RelayoutInfo instead of Bundle to fix the Parcel recycle bug" - bug: "335601427" - is_fixed_read_only: true - metadata { - purpose: PURPOSE_BUGFIX - } -} - -flag { - namespace: "windowing_sdk" name: "fix_pip_restore_to_overlay" description: "Restore exit-pip activity back to ActivityEmbedding overlay" bug: "297887697" 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 66b3553bea09..8fc54edcbd4b 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 @@ -21,8 +21,6 @@ import static android.graphics.Color.WHITE; import static android.os.Trace.TRACE_TAG_WINDOW_MANAGER; import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_STARTING; -import static com.android.window.flags.Flags.windowSessionRelayoutInfo; - import android.annotation.BinderThread; import android.annotation.NonNull; import android.annotation.Nullable; @@ -30,7 +28,6 @@ import android.app.ActivityManager; import android.app.ActivityManager.TaskDescription; import android.graphics.Paint; import android.graphics.Rect; -import android.os.Bundle; import android.os.IBinder; import android.os.RemoteException; import android.os.Trace; @@ -139,16 +136,10 @@ public class TaskSnapshotWindow { } try { Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, "TaskSnapshot#relayout"); - if (windowSessionRelayoutInfo()) { - final WindowRelayoutResult outRelayoutResult = new WindowRelayoutResult(tmpFrames, - tmpMergedConfiguration, surfaceControl, tmpInsetsState, tmpControls); - session.relayout(window, layoutParams, -1, -1, View.VISIBLE, 0, 0, 0, - outRelayoutResult); - } else { - session.relayoutLegacy(window, layoutParams, -1, -1, View.VISIBLE, 0, 0, 0, - tmpFrames, tmpMergedConfiguration, surfaceControl, tmpInsetsState, - tmpControls, new Bundle()); - } + final WindowRelayoutResult outRelayoutResult = new WindowRelayoutResult(tmpFrames, + tmpMergedConfiguration, surfaceControl, tmpInsetsState, tmpControls); + session.relayout(window, layoutParams, -1, -1, View.VISIBLE, 0, 0, 0, + outRelayoutResult); Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); } catch (RemoteException e) { snapshotSurface.clearWindowSynced(); diff --git a/services/core/java/com/android/server/wm/Session.java b/services/core/java/com/android/server/wm/Session.java index 3b3eeb496ab7..4a0239bc29b2 100644 --- a/services/core/java/com/android/server/wm/Session.java +++ b/services/core/java/com/android/server/wm/Session.java @@ -41,7 +41,6 @@ import static com.android.internal.protolog.ProtoLogGroup.WM_SHOW_TRANSACTIONS; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG; import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_TASK_POSITIONING; import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM; -import static com.android.window.flags.Flags.windowSessionRelayoutInfo; import android.annotation.NonNull; import android.annotation.Nullable; @@ -64,7 +63,6 @@ import android.os.Trace; import android.os.UserHandle; import android.text.TextUtils; import android.util.ArraySet; -import android.util.MergedConfiguration; import android.util.Slog; import android.view.IWindow; import android.view.IWindowId; @@ -81,7 +79,6 @@ import android.view.WindowInsets; import android.view.WindowInsets.Type.InsetsType; import android.view.WindowManager; import android.view.WindowRelayoutResult; -import android.window.ClientWindowFrames; import android.window.InputTransferToken; import android.window.OnBackInvokedCallbackInfo; @@ -290,37 +287,12 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient { return res; } - /** @deprecated */ - @Deprecated - @Override - public int relayoutLegacy(IWindow window, WindowManager.LayoutParams attrs, - int requestedWidth, int requestedHeight, int viewFlags, int flags, int seq, - int lastSyncSeqId, ClientWindowFrames outFrames, - MergedConfiguration mergedConfiguration, SurfaceControl outSurfaceControl, - InsetsState outInsetsState, InsetsSourceControl.Array outActiveControls, - Bundle outBundle) { - Trace.traceBegin(TRACE_TAG_WINDOW_MANAGER, mRelayoutTag); - int res = mService.relayoutWindow(this, window, attrs, - requestedWidth, requestedHeight, viewFlags, flags, seq, - lastSyncSeqId, outFrames, mergedConfiguration, outSurfaceControl, outInsetsState, - outActiveControls, outBundle); - Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER); - return res; - } - @Override public void relayoutAsync(IWindow window, WindowManager.LayoutParams attrs, int requestedWidth, int requestedHeight, int viewFlags, int flags, int seq, int lastSyncSeqId) { - if (windowSessionRelayoutInfo()) { - relayout(window, attrs, requestedWidth, requestedHeight, viewFlags, flags, seq, - lastSyncSeqId, null /* outRelayoutResult */); - } else { - relayoutLegacy(window, attrs, requestedWidth, requestedHeight, viewFlags, flags, seq, - lastSyncSeqId, null /* outFrames */, null /* mergedConfiguration */, - null /* outSurfaceControl */, null /* outInsetsState */, - null /* outActiveControls */, null /* outSyncIdBundle */); - } + relayout(window, attrs, requestedWidth, requestedHeight, viewFlags, flags, seq, + lastSyncSeqId, null /* outRelayoutResult */); } @Override diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 2b375e16e5b4..72ec05847973 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -2292,32 +2292,7 @@ public class WindowManagerService extends IWindowManager.Stub outInsetsState = null; outActiveControls = null; } - return relayoutWindowInner(session, client, attrs, requestedWidth, requestedHeight, - viewVisibility, flags, seq, lastSyncSeqId, outFrames, outMergedConfiguration, - outSurfaceControl, outInsetsState, outActiveControls, null /* outBundle */, - outRelayoutResult); - } - /** @deprecated */ - @Deprecated - public int relayoutWindow(Session session, IWindow client, LayoutParams attrs, - int requestedWidth, int requestedHeight, int viewVisibility, int flags, int seq, - int lastSyncSeqId, ClientWindowFrames outFrames, - MergedConfiguration outMergedConfiguration, SurfaceControl outSurfaceControl, - InsetsState outInsetsState, InsetsSourceControl.Array outActiveControls, - Bundle outBundle) { - return relayoutWindowInner(session, client, attrs, requestedWidth, requestedHeight, - viewVisibility, flags, seq, lastSyncSeqId, outFrames, outMergedConfiguration, - outSurfaceControl, outInsetsState, outActiveControls, outBundle, - null /* outRelayoutResult */); - } - - private int relayoutWindowInner(Session session, IWindow client, LayoutParams attrs, - int requestedWidth, int requestedHeight, int viewVisibility, int flags, int seq, - int lastSyncSeqId, ClientWindowFrames outFrames, - MergedConfiguration outMergedConfiguration, SurfaceControl outSurfaceControl, - InsetsState outInsetsState, InsetsSourceControl.Array outActiveControls, - Bundle outBundle, WindowRelayoutResult outRelayoutResult) { if (outActiveControls != null) { outActiveControls.set(null, false /* copyControls */); } @@ -2649,14 +2624,8 @@ public class WindowManagerService extends IWindowManager.Stub } if (outFrames != null && outMergedConfiguration != null) { - final boolean shouldReportActivityWindowInfo; - if (Flags.windowSessionRelayoutInfo()) { - shouldReportActivityWindowInfo = outRelayoutResult != null - && win.mLastReportedActivityWindowInfo != null; - } else { - shouldReportActivityWindowInfo = outBundle != null + final boolean shouldReportActivityWindowInfo = outRelayoutResult != null && win.mLastReportedActivityWindowInfo != null; - } final ActivityWindowInfo outActivityWindowInfo = shouldReportActivityWindowInfo ? new ActivityWindowInfo() : null; @@ -2665,13 +2634,7 @@ public class WindowManagerService extends IWindowManager.Stub outActivityWindowInfo, false /* useLatestConfig */, shouldRelayout); if (shouldReportActivityWindowInfo) { - if (Flags.windowSessionRelayoutInfo()) { - outRelayoutResult.activityWindowInfo = outActivityWindowInfo; - } else { - outBundle.putParcelable( - IWindowSession.KEY_RELAYOUT_BUNDLE_ACTIVITY_WINDOW_INFO, - outActivityWindowInfo); - } + outRelayoutResult.activityWindowInfo = outActivityWindowInfo; } // Set resize-handled here because the values are sent back to the client. @@ -2702,28 +2665,16 @@ public class WindowManagerService extends IWindowManager.Stub win.isVisible() /* visible */, false /* removed */); } - if (Flags.windowSessionRelayoutInfo()) { - if (outRelayoutResult != null) { - if (win.syncNextBuffer() && viewVisibility == View.VISIBLE - && win.mSyncSeqId > lastSyncSeqId) { - outRelayoutResult.syncSeqId = win.shouldSyncWithBuffers() - ? win.mSyncSeqId - : -1; - win.markRedrawForSyncReported(); - } else { - outRelayoutResult.syncSeqId = -1; - } - } - } else if (outBundle != null) { - final int maybeSyncSeqId; + if (outRelayoutResult != null) { if (win.syncNextBuffer() && viewVisibility == View.VISIBLE && win.mSyncSeqId > lastSyncSeqId) { - maybeSyncSeqId = win.shouldSyncWithBuffers() ? win.mSyncSeqId : -1; + outRelayoutResult.syncSeqId = win.shouldSyncWithBuffers() + ? win.mSyncSeqId + : -1; win.markRedrawForSyncReported(); } else { - maybeSyncSeqId = -1; + outRelayoutResult.syncSeqId = -1; } - outBundle.putInt(IWindowSession.KEY_RELAYOUT_BUNDLE_SEQID, maybeSyncSeqId); } if (configChanged) { diff --git a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java index 24ebad60a191..fcf7a3fe79c1 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowManagerServiceTests.java @@ -78,7 +78,6 @@ import android.app.IApplicationThread; import android.content.pm.ActivityInfo; import android.graphics.Rect; import android.os.Binder; -import android.os.Bundle; import android.os.IBinder; import android.os.InputConfig; import android.os.Process; @@ -94,7 +93,6 @@ import android.util.ArraySet; import android.util.MergedConfiguration; import android.view.ContentRecordingSession; import android.view.IWindow; -import android.view.IWindowSession; import android.view.InputChannel; import android.view.InsetsSourceControl; import android.view.InsetsState; @@ -265,69 +263,7 @@ public class WindowManagerServiceTests extends WindowTestsBase { } @Test - public void testRelayoutExitingWindow_legacy() { - mSetFlagsRule.disableFlags(Flags.FLAG_WINDOW_SESSION_RELAYOUT_INFO); - - final WindowState win = createWindow(null, TYPE_BASE_APPLICATION, "appWin"); - final WindowSurfaceController surfaceController = mock(WindowSurfaceController.class); - win.mWinAnimator.mSurfaceController = surfaceController; - win.mWinAnimator.mDrawState = WindowStateAnimator.HAS_DRAWN; - doReturn(true).when(surfaceController).hasSurface(); - spyOn(win.mTransitionController); - doReturn(true).when(win.mTransitionController).isShellTransitionsEnabled(); - doReturn(true).when(win.mTransitionController).inTransition( - eq(win.mActivityRecord)); - win.mViewVisibility = View.VISIBLE; - win.mHasSurface = true; - win.mActivityRecord.mAppStopped = true; - mWm.mWindowMap.put(win.mClient.asBinder(), win); - spyOn(mWm.mWindowPlacerLocked); - // Skip unnecessary operations of relayout. - doNothing().when(mWm.mWindowPlacerLocked).performSurfacePlacement(anyBoolean()); - final int w = 100; - final int h = 200; - final ClientWindowFrames outFrames = new ClientWindowFrames(); - final MergedConfiguration outConfig = new MergedConfiguration(); - final SurfaceControl outSurfaceControl = new SurfaceControl(); - final InsetsState outInsetsState = new InsetsState(); - final InsetsSourceControl.Array outControls = new InsetsSourceControl.Array(); - final Bundle outBundle = new Bundle(); - mWm.relayoutWindow(win.mSession, win.mClient, win.mAttrs, w, h, View.GONE, 0, 0, 0, - outFrames, outConfig, outSurfaceControl, outInsetsState, outControls, outBundle); - // The window is in transition, so its destruction is deferred. - assertTrue(win.mAnimatingExit); - assertFalse(win.mDestroying); - assertTrue(win.mTransitionController.mAnimatingExitWindows.contains(win)); - - win.mAnimatingExit = false; - win.mViewVisibility = View.VISIBLE; - win.mActivityRecord.setVisibleRequested(false); - win.mActivityRecord.setVisible(false); - mWm.relayoutWindow(win.mSession, win.mClient, win.mAttrs, w, h, View.GONE, 0, 0, 0, - outFrames, outConfig, outSurfaceControl, outInsetsState, outControls, outBundle); - // Because the window is already invisible, it doesn't need to apply exiting animation - // and WMS#tryStartExitingAnimation() will destroy the surface directly. - assertFalse(win.mAnimatingExit); - assertFalse(win.mHasSurface); - assertNull(win.mWinAnimator.mSurfaceController); - - // Invisible requested activity should not get the last config even if its view is visible. - mWm.relayoutWindow(win.mSession, win.mClient, win.mAttrs, w, h, View.VISIBLE, 0, 0, 0, - outFrames, outConfig, outSurfaceControl, outInsetsState, outControls, outBundle); - assertEquals(0, outConfig.getMergedConfiguration().densityDpi); - // Non activity window can still get the last config. - win.mActivityRecord = null; - win.fillClientWindowFramesAndConfiguration(outFrames, outConfig, - null /* outActivityWindowInfo*/, false /* useLatestConfig */, - true /* relayoutVisible */); - assertEquals(win.getConfiguration().densityDpi, - outConfig.getMergedConfiguration().densityDpi); - } - - @Test public void testRelayoutExitingWindow() { - mSetFlagsRule.enableFlags(Flags.FLAG_WINDOW_SESSION_RELAYOUT_INFO); - final WindowState win = createWindow(null, TYPE_BASE_APPLICATION, "appWin"); final WindowSurfaceController surfaceController = mock(WindowSurfaceController.class); win.mWinAnimator.mSurfaceController = surfaceController; @@ -483,15 +419,8 @@ public class WindowManagerServiceTests extends WindowTestsBase { win.mRelayoutSeq = 1; seq = 2; } - if (Flags.windowSessionRelayoutInfo()) { - mWm.relayoutWindow(win.mSession, win.mClient, newParams, 100, 200, View.VISIBLE, 0, seq, - 0, new WindowRelayoutResult()); - } else { - mWm.relayoutWindow(win.mSession, win.mClient, newParams, 100, 200, View.VISIBLE, 0, seq, - 0, new ClientWindowFrames(), new MergedConfiguration(), - new SurfaceControl(), new InsetsState(), new InsetsSourceControl.Array(), - new Bundle()); - } + mWm.relayoutWindow(win.mSession, win.mClient, newParams, 100, 200, View.VISIBLE, 0, seq, + 0, new WindowRelayoutResult()); ArgumentCaptor<Integer> changedFlags = ArgumentCaptor.forClass(Integer.class); ArgumentCaptor<Integer> changedPrivateFlags = ArgumentCaptor.forClass(Integer.class); @@ -1364,70 +1293,8 @@ public class WindowManagerServiceTests extends WindowTestsBase { } @Test - public void testRelayout_appWindowSendActivityWindowInfo_legacy() { - mSetFlagsRule.enableFlags(Flags.FLAG_ACTIVITY_WINDOW_INFO_FLAG); - mSetFlagsRule.disableFlags(Flags.FLAG_WINDOW_SESSION_RELAYOUT_INFO); - - // Skip unnecessary operations of relayout. - spyOn(mWm.mWindowPlacerLocked); - doNothing().when(mWm.mWindowPlacerLocked).performSurfacePlacement(anyBoolean()); - - final Task task = createTask(mDisplayContent); - final WindowState win = createAppWindow(task, ACTIVITY_TYPE_STANDARD, "appWindow"); - mWm.mWindowMap.put(win.mClient.asBinder(), win); - - final int w = 100; - final int h = 200; - final ClientWindowFrames outFrames = new ClientWindowFrames(); - final MergedConfiguration outConfig = new MergedConfiguration(); - final SurfaceControl outSurfaceControl = new SurfaceControl(); - final InsetsState outInsetsState = new InsetsState(); - final InsetsSourceControl.Array outControls = new InsetsSourceControl.Array(); - final Bundle outBundle = new Bundle(); - - final ActivityRecord activity = win.mActivityRecord; - final ActivityWindowInfo expectedInfo = new ActivityWindowInfo(); - expectedInfo.set(true, new Rect(0, 0, 1000, 2000), new Rect(0, 0, 500, 2000)); - doReturn(expectedInfo).when(activity).getActivityWindowInfo(); - activity.setVisibleRequested(false); - activity.setVisible(false); - - mWm.relayoutWindow(win.mSession, win.mClient, win.mAttrs, w, h, View.VISIBLE, 0, 0, 0, - outFrames, outConfig, outSurfaceControl, outInsetsState, outControls, outBundle); - - // No latest reported value, so return empty when activity is invisible - final ActivityWindowInfo activityWindowInfo = outBundle.getParcelable( - IWindowSession.KEY_RELAYOUT_BUNDLE_ACTIVITY_WINDOW_INFO, ActivityWindowInfo.class); - assertEquals(new ActivityWindowInfo(), activityWindowInfo); - - activity.setVisibleRequested(true); - activity.setVisible(true); - - mWm.relayoutWindow(win.mSession, win.mClient, win.mAttrs, w, h, View.VISIBLE, 0, 0, 0, - outFrames, outConfig, outSurfaceControl, outInsetsState, outControls, outBundle); - - // Report the latest when activity is visible. - final ActivityWindowInfo activityWindowInfo2 = outBundle.getParcelable( - IWindowSession.KEY_RELAYOUT_BUNDLE_ACTIVITY_WINDOW_INFO, ActivityWindowInfo.class); - assertEquals(expectedInfo, activityWindowInfo2); - - expectedInfo.set(false, new Rect(0, 0, 1000, 2000), new Rect(0, 0, 1000, 2000)); - activity.setVisibleRequested(false); - activity.setVisible(false); - - mWm.relayoutWindow(win.mSession, win.mClient, win.mAttrs, w, h, View.VISIBLE, 0, 0, 0, - outFrames, outConfig, outSurfaceControl, outInsetsState, outControls, outBundle); - - // Report the last reported value when activity is invisible. - final ActivityWindowInfo activityWindowInfo3 = outBundle.getParcelable( - IWindowSession.KEY_RELAYOUT_BUNDLE_ACTIVITY_WINDOW_INFO, ActivityWindowInfo.class); - assertEquals(activityWindowInfo2, activityWindowInfo3); - } - - @Test public void testRelayout_appWindowSendActivityWindowInfo() { mSetFlagsRule.enableFlags(Flags.FLAG_ACTIVITY_WINDOW_INFO_FLAG); - mSetFlagsRule.enableFlags(Flags.FLAG_WINDOW_SESSION_RELAYOUT_INFO); // Skip unnecessary operations of relayout. spyOn(mWm.mWindowPlacerLocked); 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 b152c3e5355f..e13376b34e7b 100644 --- a/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/WindowStateTests.java @@ -86,7 +86,6 @@ import android.content.res.Configuration; import android.graphics.Matrix; import android.graphics.Point; import android.graphics.Rect; -import android.os.Bundle; import android.os.IBinder; import android.os.InputConfig; import android.os.RemoteException; @@ -114,7 +113,6 @@ import androidx.test.filters.SmallTest; import com.android.server.testutils.StubTransaction; import com.android.server.wm.SensitiveContentPackages.PackageInfo; -import com.android.window.flags.Flags; import org.junit.After; import org.junit.Test; @@ -1369,67 +1367,7 @@ public class WindowStateTests extends WindowTestsBase { @SetupWindows(addWindows = {W_INPUT_METHOD}) @Test - public void testImeTargetChangeListener_OnImeTargetOverlayVisibilityChanged_legacy() { - mSetFlagsRule.disableFlags(Flags.FLAG_WINDOW_SESSION_RELAYOUT_INFO); - - final TestImeTargetChangeListener listener = new TestImeTargetChangeListener(); - mWm.mImeTargetChangeListener = listener; - - // Scenario 1: test addWindow/relayoutWindow to add Ime layering overlay window as visible. - final WindowToken windowToken = createTestWindowToken(TYPE_APPLICATION_OVERLAY, - mDisplayContent); - final IWindow client = new TestIWindow(); - final Session session = getTestSession(); - final ClientWindowFrames outFrames = new ClientWindowFrames(); - final MergedConfiguration outConfig = new MergedConfiguration(); - final SurfaceControl outSurfaceControl = new SurfaceControl(); - final InsetsState outInsetsState = new InsetsState(); - final InsetsSourceControl.Array outControls = new InsetsSourceControl.Array(); - final Bundle outBundle = new Bundle(); - final WindowManager.LayoutParams params = new WindowManager.LayoutParams( - TYPE_APPLICATION_OVERLAY); - params.setTitle("imeLayeringTargetOverlay"); - params.token = windowToken.token; - params.flags = FLAG_NOT_FOCUSABLE | FLAG_ALT_FOCUSABLE_IM; - - mWm.addWindow(session, client, params, View.VISIBLE, DEFAULT_DISPLAY, - 0 /* userUd */, WindowInsets.Type.defaultVisible(), null, new InsetsState(), - new InsetsSourceControl.Array(), new Rect(), new float[1]); - mWm.relayoutWindow(session, client, params, 100, 200, View.VISIBLE, 0, 0, 0, - outFrames, outConfig, outSurfaceControl, outInsetsState, outControls, outBundle); - waitHandlerIdle(mWm.mH); - - final WindowState imeLayeringTargetOverlay = mDisplayContent.getWindow( - w -> w.mClient.asBinder() == client.asBinder()); - assertThat(imeLayeringTargetOverlay.isVisible()).isTrue(); - assertThat(listener.mImeTargetToken).isEqualTo(client.asBinder()); - assertThat(listener.mIsRemoved).isFalse(); - assertThat(listener.mIsVisibleForImeTargetOverlay).isTrue(); - - // Scenario 2: test relayoutWindow to let the Ime layering target overlay window invisible. - mWm.relayoutWindow(session, client, params, 100, 200, View.GONE, 0, 0, 0, - outFrames, outConfig, outSurfaceControl, outInsetsState, outControls, outBundle); - waitHandlerIdle(mWm.mH); - - assertThat(imeLayeringTargetOverlay.isVisible()).isFalse(); - assertThat(listener.mImeTargetToken).isEqualTo(client.asBinder()); - assertThat(listener.mIsRemoved).isFalse(); - assertThat(listener.mIsVisibleForImeTargetOverlay).isFalse(); - - // Scenario 3: test removeWindow to remove the Ime layering target overlay window. - mWm.removeClientToken(session, client.asBinder()); - waitHandlerIdle(mWm.mH); - - assertThat(listener.mImeTargetToken).isEqualTo(client.asBinder()); - assertThat(listener.mIsRemoved).isTrue(); - assertThat(listener.mIsVisibleForImeTargetOverlay).isFalse(); - } - - @SetupWindows(addWindows = {W_INPUT_METHOD}) - @Test public void testImeTargetChangeListener_OnImeTargetOverlayVisibilityChanged() { - mSetFlagsRule.enableFlags(Flags.FLAG_WINDOW_SESSION_RELAYOUT_INFO); - final TestImeTargetChangeListener listener = new TestImeTargetChangeListener(); mWm.mImeTargetChangeListener = listener; |