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

Commit 6b281d6d authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Remove explicit creation of SurfaceSession in WMS" into main

parents f9a8c06b 05b04234
Loading
Loading
Loading
Loading
+5 −14
Original line number Diff line number Diff line
@@ -235,7 +235,6 @@ import android.view.Surface;
import android.view.Surface.Rotation;
import android.view.SurfaceControl;
import android.view.SurfaceControl.Transaction;
import android.view.SurfaceSession;
import android.view.WindowInsets;
import android.view.WindowInsets.Type.InsetsType;
import android.view.WindowManager;
@@ -572,8 +571,6 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp

    boolean mWallpaperMayChange = false;

    private final SurfaceSession mSession = new SurfaceSession();

    /**
     * A perf hint session which will boost the refresh rate for the display and change sf duration
     * to handle larger workloads.
@@ -1284,7 +1281,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
     * @param transaction as part of which to perform the configuration
     */
    private void configureSurfaces(Transaction transaction) {
        final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(mSession)
        final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder()
                .setOpaque(true)
                .setContainerLayer()
                .setCallsite("DisplayContent");
@@ -4597,7 +4594,7 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        // removed on the task.
        removeImeSurfaceImmediately();
        mImeScreenshot = new ImeScreenshot(
                mWmService.mSurfaceControlFactory.apply(null), imeTarget);
                mWmService.mSurfaceControlFactory.get(), imeTarget);
        // If the caller requests to hide IME, then allow to show IME snapshot for any target task.
        // So IME won't look like suddenly disappeared. It usually happens when turning off screen.
        mImeScreenshot.attachAndShow(t, hideImeWindow /* anyTargetTask */);
@@ -5429,15 +5426,9 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
        }
    }

    @Override
    SurfaceSession getSession() {
        return mSession;
    }

    @Override
    SurfaceControl.Builder makeChildSurface(WindowContainer child) {
        SurfaceSession s = child != null ? child.getSession() : getSession();
        final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder(s).setContainerLayer();
        final SurfaceControl.Builder b = mWmService.makeSurfaceBuilder().setContainerLayer();
        if (child == null) {
            return b;
        }
@@ -5453,12 +5444,12 @@ class DisplayContent extends RootDisplayArea implements WindowManagerPolicy.Disp
     * and other potpourii.
     */
    SurfaceControl.Builder makeOverlay() {
        return mWmService.makeSurfaceBuilder(mSession).setParent(getOverlayLayer());
        return mWmService.makeSurfaceBuilder().setParent(getOverlayLayer());
    }

    @Override
    public SurfaceControl.Builder makeAnimationLeash() {
        return mWmService.makeSurfaceBuilder(mSession).setParent(mSurfaceControl)
        return mWmService.makeSurfaceBuilder().setParent(mSurfaceControl)
                .setContainerLayer();
    }

+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ class DragState {
     */
    private CompletableFuture<Void> showInputSurface() {
        if (mInputSurface == null) {
            mInputSurface = mService.makeSurfaceBuilder(mDisplayContent.getSession())
            mInputSurface = mService.makeSurfaceBuilder()
                    .setContainerLayer()
                    .setName("Drag and Drop Input Consumer")
                    .setCallsite("DragState.showInputSurface")
+1 −2
Original line number Diff line number Diff line
@@ -77,8 +77,7 @@ class InputConsumerImpl implements IBinder.DeathRecipient {
        mWindowHandle.scaleFactor = 1.0f;
        mWindowHandle.inputConfig = InputConfig.NOT_FOCUSABLE;

        mInputSurface = mService.makeSurfaceBuilder(
                        mService.mRoot.getDisplayContent(displayId).getSession())
        mInputSurface = mService.makeSurfaceBuilder()
                .setContainerLayer()
                .setName("Input Consumer " + name)
                .setCallsite("InputConsumerImpl")
+1 −1
Original line number Diff line number Diff line
@@ -281,7 +281,7 @@ final class InputManagerCallback implements InputManagerService.WindowManagerCal
                        + " - Input overlay layer is not initialized.");
                return null;
            }
            return mService.makeSurfaceBuilder(dc.getSession())
            return mService.makeSurfaceBuilder()
                    .setContainerLayer()
                    .setName(name)
                    .setCallsite("createSurfaceForGestureMonitor")
+4 −17
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
import static android.view.WindowManager.LayoutParams.isSystemAlertWindowType;

import static com.android.internal.protolog.ProtoLogGroup.WM_DEBUG_IME;
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.TAG_WM;

@@ -72,7 +71,6 @@ import android.view.InputChannel;
import android.view.InsetsSourceControl;
import android.view.InsetsState;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
import android.view.View;
import android.view.View.FocusDirection;
import android.view.WindowInsets;
@@ -108,7 +106,6 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
    @NonNull
    final WindowProcessController mProcess;
    private final String mStringName;
    SurfaceSession mSurfaceSession;
    private final ArrayList<WindowState> mAddedWindows = new ArrayList<>();
    /** Set of visible alert/app-overlay windows connected to this session. */
    private final ArraySet<WindowState> mAlertWindows = new ArraySet<>();
@@ -719,12 +716,10 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
            mPackageName = mProcess.mInfo.packageName;
            mRelayoutTag = "relayoutWindow: " + mPackageName;
        }
        if (mSurfaceSession == null) {
        if (mProcess.mWindowSession == null) {
            if (DEBUG) {
                Slog.v(TAG_WM, "First window added to " + this + ", creating SurfaceSession");
                Slog.v(TAG_WM, "First window added to " + mProcess);
            }
            mSurfaceSession = new SurfaceSession();
            ProtoLog.i(WM_SHOW_TRANSACTIONS, "  NEW SURFACE SESSION %s", mSurfaceSession);
            mService.mSessions.add(this);
            if (mLastReportedAnimatorScale != mService.getCurrentAnimatorScale()) {
                mService.dispatchNewAnimatorScaleLocked(this);
@@ -821,18 +816,11 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
        }

        mService.mSessions.remove(this);
        if (mSurfaceSession == null) {
        if (mProcess.mWindowSession == null) {
            return;
        }

        ProtoLog.i(WM_SHOW_TRANSACTIONS, "  KILL SURFACE SESSION %s", mSurfaceSession);
        try {
            mSurfaceSession.kill();
        } catch (Exception e) {
            Slog.w(TAG_WM, "Exception thrown when killing surface session " + mSurfaceSession
                    + " in session " + this + ": " + e.toString());
        }
        mSurfaceSession = null;
        mProcess.mWindowSession = null;
        mAddedWindows.clear();
        mAlertWindows.clear();
        setHasOverlayUi(false);
@@ -857,7 +845,6 @@ class Session extends IWindowSession.Stub implements IBinder.DeathRecipient {
                pw.print(" mCanAddInternalSystemWindow="); pw.print(mCanAddInternalSystemWindow);
                pw.print(" mAlertWindows="); pw.print(mAlertWindows);
                pw.print(" mClientDead="); pw.print(mClientDead);
                pw.print(" mSurfaceSession="); pw.println(mSurfaceSession);
        pw.print(prefix); pw.print("mPackageName="); pw.println(mPackageName);
        if (isSatellitePointingUiPackage()) {
            pw.print(prefix); pw.println("mIsSatellitePointingUiPackage=true");
Loading