Loading services/core/java/com/android/server/wm/DisplayContent.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -340,6 +340,12 @@ class DisplayContent { } } } } static int deltaRotation(int oldRotation, int newRotation) { int delta = newRotation - oldRotation; if (delta < 0) delta += 4; return delta; } public void dump(String prefix, PrintWriter pw) { public void dump(String prefix, PrintWriter pw) { pw.print(prefix); pw.print("Display: mDisplayId="); pw.println(mDisplayId); pw.print(prefix); pw.print("Display: mDisplayId="); pw.println(mDisplayId); final String subPrefix = " " + prefix; final String subPrefix = " " + prefix; Loading services/core/java/com/android/server/wm/ScreenRotationAnimation.java +2 −8 Original line number Original line Diff line number Diff line Loading @@ -291,12 +291,6 @@ class ScreenRotationAnimation { return mSurfaceControl != null; return mSurfaceControl != null; } } static int deltaRotation(int oldRotation, int newRotation) { int delta = newRotation - oldRotation; if (delta < 0) delta += 4; return delta; } private void setSnapshotTransformInTransaction(Matrix matrix, float alpha) { private void setSnapshotTransformInTransaction(Matrix matrix, float alpha) { if (mSurfaceControl != null) { if (mSurfaceControl != null) { matrix.getValues(mTmpFloats); matrix.getValues(mTmpFloats); Loading Loading @@ -352,7 +346,7 @@ class ScreenRotationAnimation { // Compute the transformation matrix that must be applied // Compute the transformation matrix that must be applied // to the snapshot to make it stay in the same original position // to the snapshot to make it stay in the same original position // with the current screen rotation. // with the current screen rotation. int delta = deltaRotation(rotation, Surface.ROTATION_0); int delta = DisplayContent.deltaRotation(rotation, Surface.ROTATION_0); createRotationMatrix(delta, mWidth, mHeight, mSnapshotInitialMatrix); createRotationMatrix(delta, mWidth, mHeight, mSnapshotInitialMatrix); if (DEBUG_STATE) Slog.v(TAG, "**** ROTATION: " + delta); if (DEBUG_STATE) Slog.v(TAG, "**** ROTATION: " + delta); Loading Loading @@ -391,7 +385,7 @@ class ScreenRotationAnimation { boolean firstStart = false; boolean firstStart = false; // Figure out how the screen has moved from the original rotation. // Figure out how the screen has moved from the original rotation. int delta = deltaRotation(mCurRotation, mOriginalRotation); int delta = DisplayContent.deltaRotation(mCurRotation, mOriginalRotation); if (TWO_PHASE_ANIMATION && mFinishExitAnimation == null if (TWO_PHASE_ANIMATION && mFinishExitAnimation == null && (!dismissing || delta != Surface.ROTATION_0)) { && (!dismissing || delta != Surface.ROTATION_0)) { Loading services/core/java/com/android/server/wm/TaskStack.java +47 −4 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.util.DisplayMetrics; import android.util.EventLog; import android.util.EventLog; import android.util.Slog; import android.util.Slog; import android.util.TypedValue; import android.util.TypedValue; import android.view.Display; import android.view.Surface; import com.android.server.EventLogTags; import com.android.server.EventLogTags; Loading @@ -52,6 +54,8 @@ public class TaskStack { /** For comparison with DisplayContent bounds. */ /** For comparison with DisplayContent bounds. */ private Rect mTmpRect = new Rect(); private Rect mTmpRect = new Rect(); /** For handling display rotations. */ private Rect mTmpRect2 = new Rect(); /** Content limits relative to the DisplayContent this sits in. */ /** Content limits relative to the DisplayContent this sits in. */ private Rect mBounds = new Rect(); private Rect mBounds = new Rect(); Loading Loading @@ -94,6 +98,9 @@ public class TaskStack { // the status bar. // the status bar. boolean mUnderStatusBar; boolean mUnderStatusBar; // Device rotation as of the last time {@link #mBounds} was set. int mRotation; TaskStack(WindowManagerService service, int stackId) { TaskStack(WindowManagerService service, int stackId) { mService = service; mService = service; mStackId = stackId; mStackId = stackId; Loading Loading @@ -135,8 +142,10 @@ public class TaskStack { /** Set the stack bounds. Passing in null sets the bounds to fullscreen. */ /** Set the stack bounds. Passing in null sets the bounds to fullscreen. */ boolean setBounds(Rect bounds) { boolean setBounds(Rect bounds) { boolean oldFullscreen = mFullscreen; boolean oldFullscreen = mFullscreen; int rotation = Surface.ROTATION_0; if (mDisplayContent != null) { if (mDisplayContent != null) { mDisplayContent.getLogicalDisplayRect(mTmpRect); mDisplayContent.getLogicalDisplayRect(mTmpRect); rotation = mDisplayContent.getDisplayInfo().rotation; if (bounds == null) { if (bounds == null) { bounds = mTmpRect; bounds = mTmpRect; mFullscreen = true; mFullscreen = true; Loading @@ -147,10 +156,10 @@ public class TaskStack { } } if (bounds == null) { if (bounds == null) { // Can set to fullscreen if we don't have a display to get bounds from... // Can't set to fullscreen if we don't have a display to get bounds from... return false; return false; } } if (mBounds.equals(bounds) && oldFullscreen == mFullscreen) { if (mBounds.equals(bounds) && oldFullscreen == mFullscreen && mRotation == rotation) { return false; return false; } } Loading @@ -158,6 +167,7 @@ public class TaskStack { mAnimationBackgroundSurface.setBounds(bounds); mAnimationBackgroundSurface.setBounds(bounds); mBounds.set(bounds); mBounds.set(bounds); mUnderStatusBar = (mBounds.top == 0); mUnderStatusBar = (mBounds.top == 0); mRotation = rotation; updateOverrideConfiguration(); updateOverrideConfiguration(); return true; return true; } } Loading Loading @@ -191,9 +201,42 @@ public class TaskStack { } } void updateDisplayInfo() { void updateDisplayInfo() { if (mFullscreen && mDisplayContent != null) { if (mFullscreen) { setBounds(null); } else if (mDisplayContent != null) { final int newRotation = mDisplayContent.getDisplayInfo().rotation; if (mRotation == newRotation) { return; } // Device rotation changed. We don't want the stack to move around on the screen when // this happens, so update the stack bounds so it stays in the same place. final int rotationDelta = DisplayContent.deltaRotation(mRotation, newRotation); mDisplayContent.getLogicalDisplayRect(mTmpRect); mDisplayContent.getLogicalDisplayRect(mTmpRect); setBounds(mTmpRect); switch (rotationDelta) { case Surface.ROTATION_0: mTmpRect2.set(mBounds); break; case Surface.ROTATION_90: mTmpRect2.top = mTmpRect.bottom - mBounds.right; mTmpRect2.left = mBounds.top; mTmpRect2.right = mTmpRect2.left + mBounds.height(); mTmpRect2.bottom = mTmpRect2.top + mBounds.width(); break; case Surface.ROTATION_180: mTmpRect2.top = mTmpRect.bottom - mBounds.bottom; mTmpRect2.left = mTmpRect.right - mBounds.right; mTmpRect2.right = mTmpRect2.left + mBounds.width(); mTmpRect2.bottom = mTmpRect2.top + mBounds.height(); break; case Surface.ROTATION_270: mTmpRect2.top = mBounds.left; mTmpRect2.left = mTmpRect.right - mBounds.bottom; mTmpRect2.right = mTmpRect2.left + mBounds.height(); mTmpRect2.bottom = mTmpRect2.top + mBounds.width(); break; } setBounds(mTmpRect2); } } } } Loading Loading
services/core/java/com/android/server/wm/DisplayContent.java +6 −0 Original line number Original line Diff line number Diff line Loading @@ -340,6 +340,12 @@ class DisplayContent { } } } } static int deltaRotation(int oldRotation, int newRotation) { int delta = newRotation - oldRotation; if (delta < 0) delta += 4; return delta; } public void dump(String prefix, PrintWriter pw) { public void dump(String prefix, PrintWriter pw) { pw.print(prefix); pw.print("Display: mDisplayId="); pw.println(mDisplayId); pw.print(prefix); pw.print("Display: mDisplayId="); pw.println(mDisplayId); final String subPrefix = " " + prefix; final String subPrefix = " " + prefix; Loading
services/core/java/com/android/server/wm/ScreenRotationAnimation.java +2 −8 Original line number Original line Diff line number Diff line Loading @@ -291,12 +291,6 @@ class ScreenRotationAnimation { return mSurfaceControl != null; return mSurfaceControl != null; } } static int deltaRotation(int oldRotation, int newRotation) { int delta = newRotation - oldRotation; if (delta < 0) delta += 4; return delta; } private void setSnapshotTransformInTransaction(Matrix matrix, float alpha) { private void setSnapshotTransformInTransaction(Matrix matrix, float alpha) { if (mSurfaceControl != null) { if (mSurfaceControl != null) { matrix.getValues(mTmpFloats); matrix.getValues(mTmpFloats); Loading Loading @@ -352,7 +346,7 @@ class ScreenRotationAnimation { // Compute the transformation matrix that must be applied // Compute the transformation matrix that must be applied // to the snapshot to make it stay in the same original position // to the snapshot to make it stay in the same original position // with the current screen rotation. // with the current screen rotation. int delta = deltaRotation(rotation, Surface.ROTATION_0); int delta = DisplayContent.deltaRotation(rotation, Surface.ROTATION_0); createRotationMatrix(delta, mWidth, mHeight, mSnapshotInitialMatrix); createRotationMatrix(delta, mWidth, mHeight, mSnapshotInitialMatrix); if (DEBUG_STATE) Slog.v(TAG, "**** ROTATION: " + delta); if (DEBUG_STATE) Slog.v(TAG, "**** ROTATION: " + delta); Loading Loading @@ -391,7 +385,7 @@ class ScreenRotationAnimation { boolean firstStart = false; boolean firstStart = false; // Figure out how the screen has moved from the original rotation. // Figure out how the screen has moved from the original rotation. int delta = deltaRotation(mCurRotation, mOriginalRotation); int delta = DisplayContent.deltaRotation(mCurRotation, mOriginalRotation); if (TWO_PHASE_ANIMATION && mFinishExitAnimation == null if (TWO_PHASE_ANIMATION && mFinishExitAnimation == null && (!dismissing || delta != Surface.ROTATION_0)) { && (!dismissing || delta != Surface.ROTATION_0)) { Loading
services/core/java/com/android/server/wm/TaskStack.java +47 −4 Original line number Original line Diff line number Diff line Loading @@ -26,6 +26,8 @@ import android.util.DisplayMetrics; import android.util.EventLog; import android.util.EventLog; import android.util.Slog; import android.util.Slog; import android.util.TypedValue; import android.util.TypedValue; import android.view.Display; import android.view.Surface; import com.android.server.EventLogTags; import com.android.server.EventLogTags; Loading @@ -52,6 +54,8 @@ public class TaskStack { /** For comparison with DisplayContent bounds. */ /** For comparison with DisplayContent bounds. */ private Rect mTmpRect = new Rect(); private Rect mTmpRect = new Rect(); /** For handling display rotations. */ private Rect mTmpRect2 = new Rect(); /** Content limits relative to the DisplayContent this sits in. */ /** Content limits relative to the DisplayContent this sits in. */ private Rect mBounds = new Rect(); private Rect mBounds = new Rect(); Loading Loading @@ -94,6 +98,9 @@ public class TaskStack { // the status bar. // the status bar. boolean mUnderStatusBar; boolean mUnderStatusBar; // Device rotation as of the last time {@link #mBounds} was set. int mRotation; TaskStack(WindowManagerService service, int stackId) { TaskStack(WindowManagerService service, int stackId) { mService = service; mService = service; mStackId = stackId; mStackId = stackId; Loading Loading @@ -135,8 +142,10 @@ public class TaskStack { /** Set the stack bounds. Passing in null sets the bounds to fullscreen. */ /** Set the stack bounds. Passing in null sets the bounds to fullscreen. */ boolean setBounds(Rect bounds) { boolean setBounds(Rect bounds) { boolean oldFullscreen = mFullscreen; boolean oldFullscreen = mFullscreen; int rotation = Surface.ROTATION_0; if (mDisplayContent != null) { if (mDisplayContent != null) { mDisplayContent.getLogicalDisplayRect(mTmpRect); mDisplayContent.getLogicalDisplayRect(mTmpRect); rotation = mDisplayContent.getDisplayInfo().rotation; if (bounds == null) { if (bounds == null) { bounds = mTmpRect; bounds = mTmpRect; mFullscreen = true; mFullscreen = true; Loading @@ -147,10 +156,10 @@ public class TaskStack { } } if (bounds == null) { if (bounds == null) { // Can set to fullscreen if we don't have a display to get bounds from... // Can't set to fullscreen if we don't have a display to get bounds from... return false; return false; } } if (mBounds.equals(bounds) && oldFullscreen == mFullscreen) { if (mBounds.equals(bounds) && oldFullscreen == mFullscreen && mRotation == rotation) { return false; return false; } } Loading @@ -158,6 +167,7 @@ public class TaskStack { mAnimationBackgroundSurface.setBounds(bounds); mAnimationBackgroundSurface.setBounds(bounds); mBounds.set(bounds); mBounds.set(bounds); mUnderStatusBar = (mBounds.top == 0); mUnderStatusBar = (mBounds.top == 0); mRotation = rotation; updateOverrideConfiguration(); updateOverrideConfiguration(); return true; return true; } } Loading Loading @@ -191,9 +201,42 @@ public class TaskStack { } } void updateDisplayInfo() { void updateDisplayInfo() { if (mFullscreen && mDisplayContent != null) { if (mFullscreen) { setBounds(null); } else if (mDisplayContent != null) { final int newRotation = mDisplayContent.getDisplayInfo().rotation; if (mRotation == newRotation) { return; } // Device rotation changed. We don't want the stack to move around on the screen when // this happens, so update the stack bounds so it stays in the same place. final int rotationDelta = DisplayContent.deltaRotation(mRotation, newRotation); mDisplayContent.getLogicalDisplayRect(mTmpRect); mDisplayContent.getLogicalDisplayRect(mTmpRect); setBounds(mTmpRect); switch (rotationDelta) { case Surface.ROTATION_0: mTmpRect2.set(mBounds); break; case Surface.ROTATION_90: mTmpRect2.top = mTmpRect.bottom - mBounds.right; mTmpRect2.left = mBounds.top; mTmpRect2.right = mTmpRect2.left + mBounds.height(); mTmpRect2.bottom = mTmpRect2.top + mBounds.width(); break; case Surface.ROTATION_180: mTmpRect2.top = mTmpRect.bottom - mBounds.bottom; mTmpRect2.left = mTmpRect.right - mBounds.right; mTmpRect2.right = mTmpRect2.left + mBounds.width(); mTmpRect2.bottom = mTmpRect2.top + mBounds.height(); break; case Surface.ROTATION_270: mTmpRect2.top = mBounds.left; mTmpRect2.left = mTmpRect.right - mBounds.bottom; mTmpRect2.right = mTmpRect2.left + mBounds.height(); mTmpRect2.bottom = mTmpRect2.top + mBounds.width(); break; } setBounds(mTmpRect2); } } } } Loading