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

Commit 82520fcb authored by Tiger Huang's avatar Tiger Huang
Browse files

Window Manager Flag Migration (8/n)

Dispatch the copied insets states and controls if the client and the
server are in the same process. Otherwise, changing them at the server
side will affect ones at the client side, and vice versa.

Bug: 118118435
Test: atest InsetsSourceProviderTest InsetsStateControllerTest
            InsetsPolicyTest WindowStateTests CommandQueueTest
            RegisterStatusBarResultTest InsetsFlagsTest
            LightBarControllerTest RegisterStatusBarResultTest
            ViewRootImplTest DisplayPolicyLayoutTests
            DisplayPolicyInsetsTests DisplayPolicyTests
            TaskSnapshotSurfaceTest NavigationBarColorTest
Change-Id: Iabe9fb1f345f576f08b156f32aa9bd3989911149
parent e18ba47b
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -39,6 +39,17 @@ public class InsetsSourceControl implements Parcelable {
        mSurfacePosition = surfacePosition;
    }

    public InsetsSourceControl(InsetsSourceControl other) {
        mType = other.mType;
        if (other.mLeash != null) {
            mLeash = new SurfaceControl();
            mLeash.copyFrom(other.mLeash);
        } else {
            mLeash = null;
        }
        mSurfacePosition = new Point(other.mSurfacePosition);
    }

    public int getType() {
        return mType;
    }
+11 −0
Original line number Diff line number Diff line
@@ -7619,11 +7619,22 @@ public final class ViewRootImpl implements ViewParent,
    }

    private void dispatchInsetsChanged(InsetsState insetsState) {
        if (Binder.getCallingPid() == android.os.Process.myPid()) {
            insetsState = new InsetsState(insetsState, true /* copySource */);
        }
        mHandler.obtainMessage(MSG_INSETS_CHANGED, insetsState).sendToTarget();
    }

    private void dispatchInsetsControlChanged(InsetsState insetsState,
            InsetsSourceControl[] activeControls) {
        if (Binder.getCallingPid() == android.os.Process.myPid()) {
            insetsState = new InsetsState(insetsState, true /* copySource */);
            if (activeControls != null) {
                for (int i = activeControls.length - 1; i >= 0; i--) {
                    activeControls[i] = new InsetsSourceControl(activeControls[i]);
                }
            }
        }
        SomeArgs args = SomeArgs.obtain();
        args.arg1 = insetsState;
        args.arg2 = activeControls;
+1 −1
Original line number Diff line number Diff line
@@ -1878,7 +1878,7 @@ public class DisplayPolicy {
            final Rect dfu = displayFrames.mUnrestricted;
            Insets insets = Insets.of(0, 0, 0, 0);
            for (int i = types.size() - 1; i >= 0; i--) {
                insets = Insets.max(insets, mDisplayContent.getInsetsStateController()
                insets = Insets.max(insets, mDisplayContent.getInsetsPolicy()
                        .getInsetsForDispatch(win).getSource(types.valueAt(i))
                        .calculateInsets(dfu, attrs.getFitIgnoreVisibility()));
            }
+4 −2
Original line number Diff line number Diff line
@@ -1651,7 +1651,8 @@ public class WindowManagerService extends IWindowManager.Stub
                    outFrame, outContentInsets, outStableInsets, outDisplayCutout)) {
                res |= WindowManagerGlobal.ADD_FLAG_ALWAYS_CONSUME_SYSTEM_BARS;
            }
            outInsetsState.set(displayContent.getInsetsPolicy().getInsetsForDispatch(win));
            outInsetsState.set(displayContent.getInsetsPolicy().getInsetsForDispatch(win),
                    win.mClient instanceof IWindow.Stub /* copySource */);

            if (mInTouchMode) {
                res |= WindowManagerGlobal.ADD_FLAG_IN_TOUCH_MODE;
@@ -2335,7 +2336,8 @@ public class WindowManagerService extends IWindowManager.Stub
                    outStableInsets);
            outCutout.set(win.getWmDisplayCutout().getDisplayCutout());
            outBackdropFrame.set(win.getBackdropFrame(win.getFrameLw()));
            outInsetsState.set(displayContent.getInsetsPolicy().getInsetsForDispatch(win));
            outInsetsState.set(displayContent.getInsetsPolicy().getInsetsForDispatch(win),
                    win.mClient instanceof IWindow.Stub /* copySource */);
            if (DEBUG) {
                Slog.v(TAG_WM, "Relayout given client " + client.asBinder()
                        + ", requestedWidth=" + requestedWidth
+1 −1
Original line number Diff line number Diff line
@@ -767,7 +767,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
        mPowerManagerWrapper = powerManagerWrapper;
        mForceSeamlesslyRotate = token.mRoundedCornerOverlay;
        mClientInsetsState =
                getDisplayContent().getInsetsStateController().getInsetsForDispatch(this);
                getDisplayContent().getInsetsPolicy().getInsetsForDispatch(this);
        if (DEBUG) {
            Slog.v(TAG, "Window " + this + " client=" + c.asBinder()
                            + " token=" + token + " (" + mAttrs.token + ")" + " params=" + a);
Loading