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

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

Merge "Remove explicit creation of SurfaceSession in WM shell" into main

parents 29022957 d4ed15d0
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -29,7 +29,6 @@ import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.TypedValue;
import android.view.SurfaceControl;
import android.view.SurfaceSession;
import android.window.TaskSnapshot;

/**
@@ -75,7 +74,7 @@ public abstract class PipContentOverlay {

        public PipColorOverlay(Context context) {
            mContext = context;
            mLeash = new SurfaceControl.Builder(new SurfaceSession())
            mLeash = new SurfaceControl.Builder()
                    .setCallsite(TAG)
                    .setName(LAYER_NAME)
                    .setColorLayer()
@@ -123,7 +122,7 @@ public abstract class PipContentOverlay {
        public PipSnapshotOverlay(TaskSnapshot snapshot, Rect sourceRectHint) {
            mSnapshot = snapshot;
            mSourceRectHint = new Rect(sourceRectHint);
            mLeash = new SurfaceControl.Builder(new SurfaceSession())
            mLeash = new SurfaceControl.Builder()
                    .setCallsite(TAG)
                    .setName(LAYER_NAME)
                    .build();
@@ -183,7 +182,7 @@ public abstract class PipContentOverlay {

            mBitmap = Bitmap.createBitmap(overlaySize, overlaySize, Bitmap.Config.ARGB_8888);
            prepareAppIconOverlay(appIcon);
            mLeash = new SurfaceControl.Builder(new SurfaceSession())
            mLeash = new SurfaceControl.Builder()
                    .setCallsite(TAG)
                    .setName(LAYER_NAME)
                    .build();
+4 −6
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.wm.shell.common;

import android.view.SurfaceControl;
import android.view.SurfaceSession;

/**
 * Helpers for handling surface.
@@ -25,16 +24,15 @@ import android.view.SurfaceSession;
public class SurfaceUtils {
    /** Creates a dim layer above host surface. */
    public static SurfaceControl makeDimLayer(SurfaceControl.Transaction t, SurfaceControl host,
            String name, SurfaceSession surfaceSession) {
        final SurfaceControl dimLayer = makeColorLayer(host, name, surfaceSession);
            String name) {
        final SurfaceControl dimLayer = makeColorLayer(host, name);
        t.setLayer(dimLayer, Integer.MAX_VALUE).setColor(dimLayer, new float[]{0f, 0f, 0f});
        return dimLayer;
    }

    /** Creates a color layer for host surface. */
    public static SurfaceControl makeColorLayer(SurfaceControl host, String name,
            SurfaceSession surfaceSession) {
        return new SurfaceControl.Builder(surfaceSession)
    public static SurfaceControl makeColorLayer(SurfaceControl host, String name) {
        return new SurfaceControl.Builder()
                .setParent(host)
                .setColorLayer()
                .setName(name)
+1 −2
Original line number Diff line number Diff line
@@ -42,7 +42,6 @@ import android.view.InsetsState;
import android.view.ScrollCaptureResponse;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;
import android.view.SurfaceSession;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
@@ -311,7 +310,7 @@ public class SystemWindows {
        @Override
        protected SurfaceControl getParentSurface(IWindow window,
                WindowManager.LayoutParams attrs) {
            SurfaceControl leash = new SurfaceControl.Builder(new SurfaceSession())
            SurfaceControl leash = new SurfaceControl.Builder()
                  .setContainerLayer()
                  .setName("SystemWindowLeash")
                  .setHidden(false)
+5 −9
Original line number Diff line number Diff line
@@ -43,7 +43,6 @@ import android.view.IWindow;
import android.view.LayoutInflater;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;
import android.view.SurfaceSession;
import android.view.View;
import android.view.WindowManager;
import android.view.WindowlessWindowManager;
@@ -74,7 +73,6 @@ public class SplitDecorManager extends WindowlessWindowManager {
    private static final String GAP_BACKGROUND_SURFACE_NAME = "GapBackground";

    private final IconProvider mIconProvider;
    private final SurfaceSession mSurfaceSession;

    private Drawable mIcon;
    private ImageView mVeilIconView;
@@ -103,17 +101,15 @@ public class SplitDecorManager extends WindowlessWindowManager {
    private int mOffsetY;
    private int mRunningAnimationCount = 0;

    public SplitDecorManager(Configuration configuration, IconProvider iconProvider,
            SurfaceSession surfaceSession) {
    public SplitDecorManager(Configuration configuration, IconProvider iconProvider) {
        super(configuration, null /* rootSurface */, null /* hostInputToken */);
        mIconProvider = iconProvider;
        mSurfaceSession = surfaceSession;
    }

    @Override
    protected SurfaceControl getParentSurface(IWindow window, WindowManager.LayoutParams attrs) {
        // Can't set position for the ViewRootImpl SC directly. Create a leash to manipulate later.
        final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession())
        final SurfaceControl.Builder builder = new SurfaceControl.Builder()
                .setContainerLayer()
                .setName(TAG)
                .setHidden(true)
@@ -238,7 +234,7 @@ public class SplitDecorManager extends WindowlessWindowManager {

        if (mBackgroundLeash == null) {
            mBackgroundLeash = SurfaceUtils.makeColorLayer(mHostLeash,
                    RESIZING_BACKGROUND_SURFACE_NAME, mSurfaceSession);
                    RESIZING_BACKGROUND_SURFACE_NAME);
            t.setColor(mBackgroundLeash, getResizingBackgroundColor(resizingTask))
                    .setLayer(mBackgroundLeash, Integer.MAX_VALUE - 1);
        }
@@ -248,7 +244,7 @@ public class SplitDecorManager extends WindowlessWindowManager {
            final int left = isLandscape ? mOldMainBounds.width() : 0;
            final int top = isLandscape ? 0 : mOldMainBounds.height();
            mGapBackgroundLeash = SurfaceUtils.makeColorLayer(mHostLeash,
                    GAP_BACKGROUND_SURFACE_NAME, mSurfaceSession);
                    GAP_BACKGROUND_SURFACE_NAME);
            // Fill up another side bounds area.
            t.setColor(mGapBackgroundLeash, getResizingBackgroundColor(resizingTask))
                    .setLayer(mGapBackgroundLeash, Integer.MAX_VALUE - 2)
@@ -405,7 +401,7 @@ public class SplitDecorManager extends WindowlessWindowManager {
        if (mBackgroundLeash == null) {
            // Initialize background
            mBackgroundLeash = SurfaceUtils.makeColorLayer(mHostLeash,
                    RESIZING_BACKGROUND_SURFACE_NAME, mSurfaceSession);
                    RESIZING_BACKGROUND_SURFACE_NAME);
            t.setColor(mBackgroundLeash, getResizingBackgroundColor(resizingTask))
                    .setLayer(mBackgroundLeash, Integer.MAX_VALUE - 1);
        }
+1 −2
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ import android.view.InsetsState;
import android.view.LayoutInflater;
import android.view.SurfaceControl;
import android.view.SurfaceControlViewHost;
import android.view.SurfaceSession;
import android.view.WindowManager;
import android.view.WindowlessWindowManager;

@@ -98,7 +97,7 @@ public final class SplitWindowManager extends WindowlessWindowManager {
    @Override
    protected SurfaceControl getParentSurface(IWindow window, WindowManager.LayoutParams attrs) {
        // Can't set position for the ViewRootImpl SC directly. Create a leash to manipulate later.
        final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession())
        final SurfaceControl.Builder builder = new SurfaceControl.Builder()
                .setContainerLayer()
                .setName(TAG)
                .setHidden(true)
Loading