Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1dcbcc84 authored by Chris Li's avatar Chris Li
Browse files

Cleanup window_session_relayout_info

Cleanup bug fix flag after 4 weeks.

Bug: 335601427
Test: pass existing
Flag: EXEMPT flag cleanup
Change-Id: Ia761111d04b4a64fee71dd598ede15ca3b079d3e
parent c894f791
Loading
Loading
Loading
Loading
+4 −18
Original line number Diff line number Diff line
@@ -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);
            }
        }
    }
+4 −15
Original line number Diff line number Diff line
@@ -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,
                    final int 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 Rect outMaxBounds = mMergedConfiguration.getMergedConfiguration()
                            .windowConfiguration.getMaxBounds();
                    if (!outMaxBounds.equals(maxBounds)) {
+0 −22
Original line number Diff line number Diff line
@@ -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,
@@ -84,16 +72,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
+12 −42
Original line number Diff line number Diff line
@@ -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);
            }
            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;
            }
+0 −13
Original line number Diff line number Diff line
@@ -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;
@@ -348,18 +347,6 @@ public class WindowlessWindowManager implements IWindowSession {
        return s.mSurfaceControl;
    }

    @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,
Loading