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

Commit 0a6e6e89 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge changes I68dab076,Ife50c3d3,I705518be,I949fbe81 into pi-dev

* changes:
  Disable move animations for ScreenDecor overlays.
  WindowManager: Use WindowSurfaceController for seamless rotation
  Prevent freezing the display while rotating seamlessly.
  Eliminate usage of global transaction for display configuration.
parents eca0aa82 772e8bc9
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.util.IntArray;
import android.util.SparseArray;
import android.view.Display;
import android.view.DisplayInfo;
import android.view.SurfaceControl;

/**
 * Display manager local system service interface.
@@ -115,7 +116,7 @@ public abstract class DisplayManagerInternal {
     * Called by the window manager to perform traversals while holding a
     * surface flinger transaction.
     */
    public abstract void performTraversalInTransactionFromWindowManager();
    public abstract void performTraversal(SurfaceControl.Transaction t);

    /**
     * Tells the display manager about properties of the display that depend on the windows on it.
+4 −1
Original line number Diff line number Diff line
@@ -239,10 +239,13 @@ public class ScreenDecorations extends SystemUI implements Tunable {
                        | WindowManager.LayoutParams.FLAG_SLIPPERY
                        | WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,
                PixelFormat.TRANSLUCENT);
        lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS;
        lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_SHOW_FOR_ALL_USERS
                | WindowManager.LayoutParams.PRIVATE_FLAG_NO_MOVE_ANIMATION;

        if (!DEBUG_SCREENSHOT_ROUNDED_CORNERS) {
            lp.privateFlags |= WindowManager.LayoutParams.PRIVATE_FLAG_IS_ROUNDED_CORNERS_OVERLAY;
        }

        lp.setTitle("ScreenDecorOverlay");
        lp.gravity = Gravity.TOP | Gravity.LEFT;
        lp.layoutInDisplayCutoutMode = LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
+9 −9
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ abstract class DisplayDevice {
    private Rect mCurrentDisplayRect;

    // The display device owns its surface, but it should only set it
    // within a transaction from performTraversalInTransactionLocked.
    // within a transaction from performTraversalLocked.
    private Surface mCurrentSurface;

    // DEBUG STATE: Last device info which was written to the log, or null if none.
@@ -122,7 +122,7 @@ abstract class DisplayDevice {
    /**
     * Gives the display device a chance to update its properties while in a transaction.
     */
    public void performTraversalInTransactionLocked() {
    public void performTraversalLocked(SurfaceControl.Transaction t) {
    }

    /**
@@ -140,7 +140,7 @@ abstract class DisplayDevice {
    /**
     * Sets the mode, if supported.
     */
    public void requestDisplayModesInTransactionLocked(int colorMode, int modeId) {
    public void requestDisplayModesLocked(int colorMode, int modeId) {
    }

    public void onOverlayChangedLocked() {
@@ -149,10 +149,10 @@ abstract class DisplayDevice {
    /**
     * Sets the display layer stack while in a transaction.
     */
    public final void setLayerStackInTransactionLocked(int layerStack) {
    public final void setLayerStackLocked(SurfaceControl.Transaction t, int layerStack) {
        if (mCurrentLayerStack != layerStack) {
            mCurrentLayerStack = layerStack;
            SurfaceControl.setDisplayLayerStack(mDisplayToken, layerStack);
            t.setDisplayLayerStack(mDisplayToken, layerStack);
        }
    }

@@ -166,7 +166,7 @@ abstract class DisplayDevice {
     *            mapped to. displayRect is specified post-orientation, that is
     *            it uses the orientation seen by the end-user
     */
    public final void setProjectionInTransactionLocked(int orientation,
    public final void setProjectionLocked(SurfaceControl.Transaction t, int orientation,
            Rect layerStackRect, Rect displayRect) {
        if (mCurrentOrientation != orientation
                || mCurrentLayerStackRect == null
@@ -185,7 +185,7 @@ abstract class DisplayDevice {
            }
            mCurrentDisplayRect.set(displayRect);

            SurfaceControl.setDisplayProjection(mDisplayToken,
            t.setDisplayProjection(mDisplayToken,
                    orientation, layerStackRect, displayRect);
        }
    }
@@ -193,10 +193,10 @@ abstract class DisplayDevice {
    /**
     * Sets the display surface while in a transaction.
     */
    public final void setSurfaceInTransactionLocked(Surface surface) {
    public final void setSurfaceLocked(SurfaceControl.Transaction t, Surface surface) {
        if (mCurrentSurface != surface) {
            mCurrentSurface = surface;
            SurfaceControl.setDisplaySurface(mDisplayToken, surface);
            t.setDisplaySurface(mDisplayToken, surface);
        }
    }

+11 −10
Original line number Diff line number Diff line
@@ -74,6 +74,7 @@ import android.util.SparseArray;
import android.view.Display;
import android.view.DisplayInfo;
import android.view.Surface;
import android.view.SurfaceControl;

import com.android.internal.util.Preconditions;
import com.android.server.AnimationThread;
@@ -457,14 +458,14 @@ public final class DisplayManagerService extends SystemService {
    }

    @VisibleForTesting
    void performTraversalInTransactionFromWindowManagerInternal() {
    void performTraversalInternal(SurfaceControl.Transaction t) {
        synchronized (mSyncRoot) {
            if (!mPendingTraversal) {
                return;
            }
            mPendingTraversal = false;

            performTraversalInTransactionLocked();
            performTraversalLocked(t);
        }

        // List is self-synchronized copy-on-write.
@@ -1056,7 +1057,7 @@ public final class DisplayManagerService extends SystemService {
        return changed;
    }

    private void performTraversalInTransactionLocked() {
    private void performTraversalLocked(SurfaceControl.Transaction t) {
        // Clear all viewports before configuring displays so that we can keep
        // track of which ones we have configured.
        clearViewportsLocked();
@@ -1065,8 +1066,8 @@ public final class DisplayManagerService extends SystemService {
        final int count = mDisplayDevices.size();
        for (int i = 0; i < count; i++) {
            DisplayDevice device = mDisplayDevices.get(i);
            configureDisplayInTransactionLocked(device);
            device.performTraversalInTransactionLocked();
            configureDisplayLocked(t, device);
            device.performTraversalLocked(t);
        }

        // Tell the input system about these new viewports.
@@ -1150,7 +1151,7 @@ public final class DisplayManagerService extends SystemService {
        mVirtualTouchViewports.clear();
    }

    private void configureDisplayInTransactionLocked(DisplayDevice device) {
    private void configureDisplayLocked(SurfaceControl.Transaction t, DisplayDevice device) {
        final DisplayDeviceInfo info = device.getDisplayDeviceInfoLocked();
        final boolean ownContent = (info.flags & DisplayDeviceInfo.FLAG_OWN_CONTENT_ONLY) != 0;

@@ -1175,7 +1176,7 @@ public final class DisplayManagerService extends SystemService {
                    + device.getDisplayDeviceInfoLocked());
            return;
        }
        display.configureDisplayInTransactionLocked(device, info.state == Display.STATE_OFF);
        display.configureDisplayLocked(t, device, info.state == Display.STATE_OFF);

        // Update the viewports if needed.
        if (!mDefaultViewport.valid
@@ -1233,7 +1234,7 @@ public final class DisplayManagerService extends SystemService {
        mHandler.sendMessage(msg);
    }

    // Requests that performTraversalsInTransactionFromWindowManager be called at a
    // Requests that performTraversals be called at a
    // later time to apply changes to surfaces and displays.
    private void scheduleTraversalLocked(boolean inTraversal) {
        if (!mPendingTraversal && mWindowManagerInternal != null) {
@@ -2031,8 +2032,8 @@ public final class DisplayManagerService extends SystemService {
        }

        @Override
        public void performTraversalInTransactionFromWindowManager() {
            performTraversalInTransactionFromWindowManagerInternal();
        public void performTraversal(SurfaceControl.Transaction t) {
            performTraversalInternal(t);
        }

        @Override
+5 −6
Original line number Diff line number Diff line
@@ -584,10 +584,9 @@ final class LocalDisplayAdapter extends DisplayAdapter {
        }

        @Override
        public void requestDisplayModesInTransactionLocked(
                int colorMode, int modeId) {
            if (requestModeInTransactionLocked(modeId) ||
                    requestColorModeInTransactionLocked(colorMode)) {
        public void requestDisplayModesLocked(int colorMode, int modeId) {
            if (requestModeLocked(modeId) ||
                    requestColorModeLocked(colorMode)) {
                updateDeviceInfoLocked();
            }
        }
@@ -597,7 +596,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
            updateDeviceInfoLocked();
        }

        public boolean requestModeInTransactionLocked(int modeId) {
        public boolean requestModeLocked(int modeId) {
            if (modeId == 0) {
                modeId = mDefaultModeId;
            } else if (mSupportedModes.indexOfKey(modeId) < 0) {
@@ -623,7 +622,7 @@ final class LocalDisplayAdapter extends DisplayAdapter {
            return true;
        }

        public boolean requestColorModeInTransactionLocked(int colorMode) {
        public boolean requestColorModeLocked(int colorMode) {
            if (mActiveColorMode == colorMode) {
                return false;
            }
Loading