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

Commit e4338f84 authored by Albert Chaulk's avatar Albert Chaulk Committed by Alex Sakhartchouk
Browse files

Propagate UIDs for all SurfaceControl instances

Previously, a default value was being propagated for surfaces constructed
though paths other than WindowManagerService.createSurfaceControl. This
allows us to handle all surfaces in VR in a better way

Bug: 36589137
Test: Launch chrome (uses SurfaceView)
Change-Id: I8434c356ebe51173cae161ec1405e3d5f9a17723
parent ef570066
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -16,10 +16,13 @@

package android.view;

import static android.view.WindowManager.LayoutParams.INVALID_WINDOW_TYPE;

import android.graphics.Bitmap;
import android.graphics.GraphicBuffer;
import android.graphics.Rect;
import android.graphics.Region;
import android.os.Binder;
import android.os.IBinder;
import android.util.Log;
import android.view.Surface.OutOfResourcesException;
@@ -302,7 +305,7 @@ public class SurfaceControl {
    public SurfaceControl(SurfaceSession session,
            String name, int w, int h, int format, int flags)
                    throws OutOfResourcesException {
        this(session, name, w, h, format, flags, null, -1, -1);
        this(session, name, w, h, format, flags, null, INVALID_WINDOW_TYPE, Binder.getCallingUid());
    }

    public SurfaceControl(SurfaceSession session, String name, int w, int h, int format, int flags,
+6 −0
Original line number Diff line number Diff line
@@ -742,6 +742,12 @@ public interface WindowManager extends ViewManager {
         */
        public static final int LAST_SYSTEM_WINDOW      = 2999;

        /**
         * @hide
         * Used internally when there is no suitable type available.
         */
        public static final int INVALID_WINDOW_TYPE = -1;

        /**
         * Return true if the window type is an alert window.
         *
+4 −1
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.os.Binder;
import android.os.Debug;
import android.os.Trace;
import android.util.ArraySet;
@@ -683,9 +684,11 @@ class WindowSurfacePlacer {
            final DisplayInfo displayInfo = displayContent.getDisplayInfo();

            // Create a new surface for the thumbnail
            WindowState window = appToken.findMainWindow();
            SurfaceControl surfaceControl = new SurfaceControl(mService.mFxSession,
                    "thumbnail anim", dirty.width(), dirty.height(),
                    PixelFormat.TRANSLUCENT, SurfaceControl.HIDDEN);
                    PixelFormat.TRANSLUCENT, SurfaceControl.HIDDEN,
                    appToken.windowType, window.mOwnerUid);
            surfaceControl.setLayerStack(display.getLayerStack());
            if (SHOW_TRANSACTIONS) {
                Slog.i(TAG, "  THUMBNAIL " + surfaceControl + ": CREATE");