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

Commit b47bbc3d authored by Craig Mautner's avatar Craig Mautner
Browse files

Clean up displayId and layerStack usage.

Make better use of Display object by saving it in DisplayContent.
Only use layerStack when referring to Surfaces. Get displayId from
default Display or default DisplayContent. Remove warnings.

Fixes bug 7038151.

Change-Id: Ie493f0f5e755dc9b91ee969ff561c2a098283ead
parent 2bd65b61
Loading
Loading
Loading
Loading
+0 −1
Original line number Original line Diff line number Diff line
@@ -24,7 +24,6 @@ import android.os.Message;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.ServiceManager;
import android.os.ServiceManager;
import android.util.Log;
import android.util.Log;
import android.util.SparseArray;
import android.view.CompatibilityInfoHolder;
import android.view.CompatibilityInfoHolder;
import android.view.Display;
import android.view.Display;
import android.view.DisplayInfo;
import android.view.DisplayInfo;
+4 −4
Original line number Original line Diff line number Diff line
@@ -389,7 +389,7 @@ public class Surface implements Parcelable {
     * release this object's reference. @hide */
     * release this object's reference. @hide */
    public native void destroy();
    public native void destroy();


    private native Canvas lockCanvasNative(Rect dirty);   
    private native Canvas lockCanvasNative(Rect dirty) throws OutOfResourcesException;


    /**
    /**
     * set the orientation of the given display.
     * set the orientation of the given display.
@@ -497,10 +497,10 @@ public class Surface implements Parcelable {
    }
    }
    
    
    private native void init(SurfaceSession s,
    private native void init(SurfaceSession s,
            int pid, String name, int displayId, int w, int h, int format, int flags)
            int pid, String name, int layerStack, int w, int h, int format, int flags)
            throws OutOfResourcesException;
            throws OutOfResourcesException;


    private native void init(Parcel source);
    private native void init(Parcel source) throws OutOfResourcesException;


    private native void initFromSurfaceTexture(SurfaceTexture surfaceTexture);
    private native void initFromSurfaceTexture(SurfaceTexture surfaceTexture);


+8 −9
Original line number Original line Diff line number Diff line
@@ -22,7 +22,6 @@ import android.graphics.Matrix;
import android.graphics.PixelFormat;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.Rect;
import android.util.Slog;
import android.util.Slog;
import android.view.Display;
import android.view.Surface;
import android.view.Surface;
import android.view.SurfaceSession;
import android.view.SurfaceSession;


@@ -36,7 +35,7 @@ public class BlackFrame {
        final int layer;
        final int layer;
        final Surface surface;
        final Surface surface;


        BlackSurface(SurfaceSession session, int layer, int l, int t, int r, int b)
        BlackSurface(SurfaceSession session, int layer, int l, int t, int r, int b, int layerStack)
                throws Surface.OutOfResourcesException {
                throws Surface.OutOfResourcesException {
            left = l;
            left = l;
            top = t;
            top = t;
@@ -45,10 +44,10 @@ public class BlackFrame {
            int h = b-t;
            int h = b-t;
            if (WindowManagerService.DEBUG_SURFACE_TRACE) {
            if (WindowManagerService.DEBUG_SURFACE_TRACE) {
                surface = new WindowStateAnimator.SurfaceTrace(session, 0, "BlackSurface("
                surface = new WindowStateAnimator.SurfaceTrace(session, 0, "BlackSurface("
                        + l + ", " + t + ")", Display.DEFAULT_DISPLAY,
                        + l + ", " + t + ")", layerStack,
                        w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
                        w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
            } else {
            } else {
                surface = new Surface(session, 0, "BlackSurface", Display.DEFAULT_DISPLAY,
                surface = new Surface(session, 0, "BlackSurface", layerStack,
                        w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
                        w, h, PixelFormat.OPAQUE, Surface.FX_SURFACE_DIM);
            }
            }
            surface.setAlpha(1);
            surface.setAlpha(1);
@@ -104,7 +103,7 @@ public class BlackFrame {
    }
    }


    public BlackFrame(SurfaceSession session, Rect outer, Rect inner,
    public BlackFrame(SurfaceSession session, Rect outer, Rect inner,
            int layer) throws Surface.OutOfResourcesException {
            int layer, final int layerStack) throws Surface.OutOfResourcesException {
        boolean success = false;
        boolean success = false;


        mOuterRect = new Rect(outer);
        mOuterRect = new Rect(outer);
@@ -112,19 +111,19 @@ public class BlackFrame {
        try {
        try {
            if (outer.top < inner.top) {
            if (outer.top < inner.top) {
                mBlackSurfaces[0] = new BlackSurface(session, layer,
                mBlackSurfaces[0] = new BlackSurface(session, layer,
                        outer.left, outer.top, inner.right, inner.top);
                        outer.left, outer.top, inner.right, inner.top, layerStack);
            }
            }
            if (outer.left < inner.left) {
            if (outer.left < inner.left) {
                mBlackSurfaces[1] = new BlackSurface(session, layer,
                mBlackSurfaces[1] = new BlackSurface(session, layer,
                        outer.left, inner.top, inner.left, outer.bottom);
                        outer.left, inner.top, inner.left, outer.bottom, layerStack);
            }
            }
            if (outer.bottom > inner.bottom) {
            if (outer.bottom > inner.bottom) {
                mBlackSurfaces[2] = new BlackSurface(session, layer,
                mBlackSurfaces[2] = new BlackSurface(session, layer,
                        inner.left, inner.bottom, outer.right, outer.bottom);
                        inner.left, inner.bottom, outer.right, outer.bottom, layerStack);
            }
            }
            if (outer.right > inner.right) {
            if (outer.right > inner.right) {
                mBlackSurfaces[3] = new BlackSurface(session, layer,
                mBlackSurfaces[3] = new BlackSurface(session, layer,
                        inner.right, outer.top, outer.right, inner.bottom);
                        inner.right, outer.top, outer.right, inner.bottom, layerStack);
            }
            }
            success = true;
            success = true;
        } finally {
        } finally {
+3 −3
Original line number Original line Diff line number Diff line
@@ -39,18 +39,18 @@ class DimAnimator {
    
    
    int mLastDimWidth, mLastDimHeight;
    int mLastDimWidth, mLastDimHeight;


    DimAnimator (SurfaceSession session, final int displayId) {
    DimAnimator (SurfaceSession session, final int layerStack) {
        if (mDimSurface == null) {
        if (mDimSurface == null) {
            try {
            try {
                if (WindowManagerService.DEBUG_SURFACE_TRACE) {
                if (WindowManagerService.DEBUG_SURFACE_TRACE) {
                    mDimSurface = new WindowStateAnimator.SurfaceTrace(session, 0,
                    mDimSurface = new WindowStateAnimator.SurfaceTrace(session, 0,
                        "DimAnimator",
                        "DimAnimator",
                        displayId, 16, 16, PixelFormat.OPAQUE,
                        layerStack, 16, 16, PixelFormat.OPAQUE,
                        Surface.FX_SURFACE_DIM);
                        Surface.FX_SURFACE_DIM);
                } else {
                } else {
                    mDimSurface = new Surface(session, 0,
                    mDimSurface = new Surface(session, 0,
                        "DimAnimator",
                        "DimAnimator",
                        displayId, 16, 16, PixelFormat.OPAQUE,
                        layerStack, 16, 16, PixelFormat.OPAQUE,
                        Surface.FX_SURFACE_DIM);
                        Surface.FX_SURFACE_DIM);
                }
                }
                if (WindowManagerService.SHOW_TRANSACTIONS ||
                if (WindowManagerService.SHOW_TRANSACTIONS ||
+3 −3
Original line number Original line Diff line number Diff line
@@ -30,18 +30,18 @@ class DimSurface {
    int mLayer = -1;
    int mLayer = -1;
    int mLastDimWidth, mLastDimHeight;
    int mLastDimWidth, mLastDimHeight;


    DimSurface(SurfaceSession session, final int displayId) {
    DimSurface(SurfaceSession session, final int layerStack) {
        if (mDimSurface == null) {
        if (mDimSurface == null) {
            try {
            try {
                if (WindowManagerService.DEBUG_SURFACE_TRACE) {
                if (WindowManagerService.DEBUG_SURFACE_TRACE) {
                    mDimSurface = new WindowStateAnimator.SurfaceTrace(session, 0,
                    mDimSurface = new WindowStateAnimator.SurfaceTrace(session, 0,
                        "DimSurface",
                        "DimSurface",
                        displayId, 16, 16, PixelFormat.OPAQUE,
                        layerStack, 16, 16, PixelFormat.OPAQUE,
                        Surface.FX_SURFACE_DIM);
                        Surface.FX_SURFACE_DIM);
                } else {
                } else {
                    mDimSurface = new Surface(session, 0,
                    mDimSurface = new Surface(session, 0,
                        "DimSurface",
                        "DimSurface",
                        displayId, 16, 16, PixelFormat.OPAQUE,
                        layerStack, 16, 16, PixelFormat.OPAQUE,
                        Surface.FX_SURFACE_DIM);
                        Surface.FX_SURFACE_DIM);
                }
                }
                if (WindowManagerService.SHOW_TRANSACTIONS ||
                if (WindowManagerService.SHOW_TRANSACTIONS ||
Loading