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

Commit 697660ac authored by Tiger Huang's avatar Tiger Huang Committed by Android (Google) Code Review
Browse files

Merge "Let the client set transform hint on its own"

parents b4d3a16e 5242af60
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -278,6 +278,7 @@ public abstract class WallpaperService extends Service {
        private Display mDisplay;
        private Context mDisplayContext;
        private int mDisplayState;
        private @Surface.Rotation int mDisplayInstallOrientation;
        private float mWallpaperDimAmount = 0.05f;
        private float mPreviousWallpaperDimAmount = mWallpaperDimAmount;
        private float mDefaultDimAmount = mWallpaperDimAmount;
@@ -1122,6 +1123,11 @@ public abstract class WallpaperService extends Service {
                            mWindow, mLayout, mWidth, mHeight,
                            View.VISIBLE, 0, -1, mWinFrames, mMergedConfiguration, mSurfaceControl,
                            mInsetsState, mTempControls, mSurfaceSize);

                    final int transformHint = SurfaceControl.rotationToBufferTransform(
                            (mDisplayInstallOrientation + mDisplay.getRotation()) % 4);
                    mSurfaceControl.setTransformHint(transformHint);

                    if (mSurfaceControl.isValid()) {
                        if (mBbqSurfaceControl == null) {
                            mBbqSurfaceControl = new SurfaceControl.Builder()
@@ -1135,9 +1141,9 @@ public abstract class WallpaperService extends Service {
                                    .build();
                            updateSurfaceDimming();
                        }
                        // Propagate transform hint from WM so we can use the right hint for the
                        // Propagate transform hint from WM, so we can use the right hint for the
                        // first frame.
                        mBbqSurfaceControl.setTransformHint(mSurfaceControl.getTransformHint());
                        mBbqSurfaceControl.setTransformHint(transformHint);
                        Surface blastSurface = getOrCreateBLASTSurface(mSurfaceSize.x,
                                mSurfaceSize.y, mFormat);
                        // If blastSurface == null that means it hasn't changed since the last
@@ -1377,6 +1383,7 @@ public abstract class WallpaperService extends Service {
            mWallpaperDimAmount = mDefaultDimAmount;
            mPreviousWallpaperDimAmount = mWallpaperDimAmount;
            mDisplayState = mDisplay.getState();
            mDisplayInstallOrientation = mDisplay.getInstallOrientation();

            if (DEBUG) Log.v(TAG, "onCreate(): " + this);
            onCreate(mSurfaceHolder);
+12 −0
Original line number Diff line number Diff line
@@ -927,6 +927,18 @@ public final class Display {
        }
    }

    /**
     * Returns the install orientation of the display.
     * @hide
     */
    @Surface.Rotation
    public int getInstallOrientation() {
        synchronized (mLock) {
            updateDisplayInfoLocked();
            return mDisplayInfo.installOrientation;
        }
    }

    /**
     * @deprecated use {@link #getRotation}
     * @return orientation of this display.
+7 −1
Original line number Diff line number Diff line
@@ -398,6 +398,8 @@ public final class ViewRootImpl implements ViewParent,
    final DisplayManager mDisplayManager;
    final String mBasePackageName;

    private @Surface.Rotation int mDisplayInstallOrientation;

    final int[] mTmpLocation = new int[2];

    final TypedValue mTmpValue = new TypedValue();
@@ -1028,6 +1030,7 @@ public final class ViewRootImpl implements ViewParent,
                mView = view;

                mAttachInfo.mDisplayState = mDisplay.getState();
                mDisplayInstallOrientation = mDisplay.getInstallOrientation();
                mViewLayoutDirectionInitial = mView.getRawLayoutDirection();
                mFallbackEventHandler.setView(view);
                mWindowAttributes.copyFrom(attrs);
@@ -7937,6 +7940,10 @@ public final class ViewRootImpl implements ViewParent,
                mTmpFrames, mPendingMergedConfiguration, mSurfaceControl, mTempInsets,
                mTempControls, mSurfaceSize);

        final int transformHint = SurfaceControl.rotationToBufferTransform(
                (mDisplayInstallOrientation + mDisplay.getRotation()) % 4);
        mSurfaceControl.setTransformHint(transformHint);

        if (mAttachInfo.mContentCaptureManager != null) {
            MainContentCaptureSession mainSession = mAttachInfo.mContentCaptureManager
                    .getMainContentCaptureSession();
@@ -7955,7 +7962,6 @@ public final class ViewRootImpl implements ViewParent,
                mAttachInfo.mThreadedRenderer.setSurfaceControl(mSurfaceControl);
                mAttachInfo.mThreadedRenderer.setBlastBufferQueue(mBlastBufferQueue);
            }
            int transformHint = mSurfaceControl.getTransformHint();
            if (mPreviousTransformHint != transformHint) {
                mPreviousTransformHint = transformHint;
                dispatchTransformHintChanged(transformHint);
+0 −6
Original line number Diff line number Diff line
@@ -811,12 +811,6 @@
      "group": "WM_DEBUG_REMOTE_ANIMATIONS",
      "at": "com\/android\/server\/wm\/RemoteAnimationController.java"
    },
    "-1248290210": {
      "message": "Passing transform hint %d for window %s",
      "level": "VERBOSE",
      "group": "WM_DEBUG_ORIENTATION",
      "at": "com\/android\/server\/wm\/WindowManagerService.java"
    },
    "-1228653755": {
      "message": "Launch on display check: displayId=%d callingPid=%d callingUid=%d",
      "level": "DEBUG",
+0 −8
Original line number Diff line number Diff line
@@ -2445,14 +2445,6 @@ public class WindowManagerService extends IWindowManager.Stub
            configChanged = displayContent.updateOrientation();
            Trace.traceEnd(TRACE_TAG_WINDOW_MANAGER);

            final DisplayInfo displayInfo = win.getDisplayInfo();
            final int transformHint = (displayInfo.rotation + displayInfo.installOrientation) % 4;
            outSurfaceControl.setTransformHint(
                    SurfaceControl.rotationToBufferTransform(transformHint));
            ProtoLog.v(WM_DEBUG_ORIENTATION,
                    "Passing transform hint %d for window %s",
                    transformHint, win);

            if (toBeDisplayed && win.mIsWallpaper) {
                displayContent.mWallpaperController.updateWallpaperOffset(win, false /* sync */);
            }