summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorCraig Mautner <cmautner@google.com>2013-02-21 17:54:37 -0800
committerCraig Mautner <cmautner@google.com>2013-02-22 10:44:52 -0800
commit3c1743705c4df816089e07a17753c6043b4d8e66 (patch)
treedd68b3b869a0b24bac79d713af19eeba57f3e668 /services
parent7a7360ad528576d560aa13fbb4e81740b2c425b2 (diff)
downloadframeworks_base-3c1743705c4df816089e07a17753c6043b4d8e66.zip
frameworks_base-3c1743705c4df816089e07a17753c6043b4d8e66.tar.gz
frameworks_base-3c1743705c4df816089e07a17753c6043b4d8e66.tar.bz2
Create rotation animation modes.
Allow fullscreen windows to specify crossfade or jumpcut animations that override the default rotation animation. Only if the incoming and outgoing topmost windows are fullscreen and both specify the same animation to use. Fixes bug 8182773. Change-Id: I6b3c0020d7bd2cdfba5c66189e114ec62cd54fcf
Diffstat (limited to 'services')
-rw-r--r--services/java/com/android/server/wm/ScreenRotationAnimation.java21
-rw-r--r--services/java/com/android/server/wm/WindowManagerService.java34
2 files changed, 36 insertions, 19 deletions
diff --git a/services/java/com/android/server/wm/ScreenRotationAnimation.java b/services/java/com/android/server/wm/ScreenRotationAnimation.java
index 5d4ab56..ae110dd 100644
--- a/services/java/com/android/server/wm/ScreenRotationAnimation.java
+++ b/services/java/com/android/server/wm/ScreenRotationAnimation.java
@@ -49,7 +49,6 @@ class ScreenRotationAnimation {
BlackFrame mExitingBlackFrame;
BlackFrame mEnteringBlackFrame;
int mWidth, mHeight;
- int mExitAnimId, mEnterAnimId;
int mOriginalRotation;
int mOriginalWidth, mOriginalHeight;
@@ -190,12 +189,9 @@ class ScreenRotationAnimation {
}
public ScreenRotationAnimation(Context context, Display display, SurfaceSession session,
- boolean inTransaction, int originalWidth, int originalHeight, int originalRotation,
- int exitAnim, int enterAnim) {
+ boolean inTransaction, int originalWidth, int originalHeight, int originalRotation) {
mContext = context;
mDisplay = display;
- mExitAnimId = exitAnim;
- mEnterAnimId = enterAnim;
// Screenshot does NOT include rotation!
if (originalRotation == Surface.ROTATION_90
@@ -321,7 +317,7 @@ class ScreenRotationAnimation {
setRotationInTransaction(rotation);
if (TWO_PHASE_ANIMATION) {
return startAnimation(session, maxAnimationDuration, animationScale,
- finalWidth, finalHeight, false);
+ finalWidth, finalHeight, false, 0, 0);
}
// Don't start animation yet.
@@ -332,7 +328,8 @@ class ScreenRotationAnimation {
* Returns true if animating.
*/
private boolean startAnimation(SurfaceSession session, long maxAnimationDuration,
- float animationScale, int finalWidth, int finalHeight, boolean dismissing) {
+ float animationScale, int finalWidth, int finalHeight, boolean dismissing,
+ int exitAnim, int enterAnim) {
if (mSurfaceControl == null) {
// Can't do animation.
return false;
@@ -375,10 +372,10 @@ class ScreenRotationAnimation {
+ " origWidth=" + mOriginalWidth + " origHeight=" + mOriginalHeight);
final boolean customAnim;
- if (mExitAnimId != 0 && mEnterAnimId != 0) {
+ if (exitAnim != 0 && enterAnim != 0) {
customAnim = true;
- mRotateExitAnimation = AnimationUtils.loadAnimation(mContext, mExitAnimId);
- mRotateEnterAnimation = AnimationUtils.loadAnimation(mContext, mEnterAnimId);
+ mRotateExitAnimation = AnimationUtils.loadAnimation(mContext, exitAnim);
+ mRotateEnterAnimation = AnimationUtils.loadAnimation(mContext, enterAnim);
} else {
customAnim = false;
switch (delta) {
@@ -578,7 +575,7 @@ class ScreenRotationAnimation {
* Returns true if animating.
*/
public boolean dismiss(SurfaceSession session, long maxAnimationDuration,
- float animationScale, int finalWidth, int finalHeight) {
+ float animationScale, int finalWidth, int finalHeight, int exitAnim, int enterAnim) {
if (DEBUG_STATE) Slog.v(TAG, "Dismiss!");
if (mSurfaceControl == null) {
// Can't do animation.
@@ -586,7 +583,7 @@ class ScreenRotationAnimation {
}
if (!mStarted) {
startAnimation(session, maxAnimationDuration, animationScale, finalWidth, finalHeight,
- true);
+ true, exitAnim, enterAnim);
}
if (!mStarted) {
return false;
diff --git a/services/java/com/android/server/wm/WindowManagerService.java b/services/java/com/android/server/wm/WindowManagerService.java
index c2213b3..6690663 100644
--- a/services/java/com/android/server/wm/WindowManagerService.java
+++ b/services/java/com/android/server/wm/WindowManagerService.java
@@ -544,6 +544,9 @@ public class WindowManagerService extends IWindowManager.Stub
DragState mDragState = null;
+ // For frozen screen animations.
+ int mExitAnimId, mEnterAnimId;
+
/** Pulled out of performLayoutAndPlaceSurfacesLockedInner in order to refactor into multiple
* methods. */
class LayoutFields {
@@ -3505,7 +3508,13 @@ public class WindowManagerService extends IWindowManager.Stub
if (currentConfig.diff(mTempConfiguration) != 0) {
mWaitingForConfig = true;
getDefaultDisplayContentLocked().layoutNeeded = true;
- startFreezingDisplayLocked(false, 0, 0);
+ int anim[] = new int[2];
+ if (mAnimator.isDimmingLocked(Display.DEFAULT_DISPLAY)) {
+ anim[0] = anim[1] = 0;
+ } else {
+ mPolicy.selectRotationAnimationLw(anim);
+ }
+ startFreezingDisplayLocked(false, anim[0], anim[1]);
config = new Configuration(mTempConfiguration);
}
}
@@ -5485,7 +5494,13 @@ public class WindowManagerService extends IWindowManager.Stub
mH.sendEmptyMessageDelayed(H.WINDOW_FREEZE_TIMEOUT, WINDOW_FREEZE_TIMEOUT_DURATION);
mWaitingForConfig = true;
getDefaultDisplayContentLocked().layoutNeeded = true;
- startFreezingDisplayLocked(inTransaction, 0, 0);
+ final int[] anim = new int[2];
+ if (mAnimator.isDimmingLocked(Display.DEFAULT_DISPLAY)) {
+ anim[0] = anim[1] = 0;
+ } else {
+ mPolicy.selectRotationAnimationLw(anim);
+ }
+ startFreezingDisplayLocked(inTransaction, anim[0], anim[1]);
// startFreezingDisplayLocked can reset the ScreenRotationAnimation.
screenRotationAnimation =
mAnimator.getScreenRotationAnimationLocked(Display.DEFAULT_DISPLAY);
@@ -9246,8 +9261,7 @@ public class WindowManagerService extends IWindowManager.Stub
return null;
}
- private void startFreezingDisplayLocked(boolean inTransaction,
- int exitAnim, int enterAnim) {
+ private void startFreezingDisplayLocked(boolean inTransaction, int exitAnim, int enterAnim) {
if (mDisplayFrozen) {
return;
}
@@ -9279,6 +9293,8 @@ public class WindowManagerService extends IWindowManager.Stub
}
if (CUSTOM_SCREEN_ROTATION) {
+ mExitAnimId = exitAnim;
+ mEnterAnimId = enterAnim;
final DisplayContent displayContent = getDefaultDisplayContentLocked();
final int displayId = displayContent.getDisplayId();
ScreenRotationAnimation screenRotationAnimation =
@@ -9292,8 +9308,7 @@ public class WindowManagerService extends IWindowManager.Stub
final DisplayInfo displayInfo = displayContent.getDisplayInfo();
screenRotationAnimation = new ScreenRotationAnimation(mContext,
display, mFxSession, inTransaction, displayInfo.logicalWidth,
- displayInfo.logicalHeight, display.getRotation(),
- exitAnim, enterAnim);
+ displayInfo.logicalHeight, display.getRotation());
mAnimator.setScreenRotationAnimationLocked(displayId, screenRotationAnimation);
}
}
@@ -9331,9 +9346,14 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_ORIENTATION) Slog.i(TAG, "**** Dismissing screen rotation animation");
// TODO(multidisplay): rotation on main screen only.
DisplayInfo displayInfo = displayContent.getDisplayInfo();
+ // Get rotation animation again, with new top window
+ boolean isDimming = mAnimator.isDimmingLocked(Display.DEFAULT_DISPLAY);
+ if (!mPolicy.validateRotationAnimationLw(mExitAnimId, mEnterAnimId, isDimming)) {
+ mExitAnimId = mEnterAnimId = 0;
+ }
if (screenRotationAnimation.dismiss(mFxSession, MAX_ANIMATION_DURATION,
mTransitionAnimationScale, displayInfo.logicalWidth,
- displayInfo.logicalHeight)) {
+ displayInfo.logicalHeight, mExitAnimId, mEnterAnimId)) {
scheduleAnimationLocked();
} else {
screenRotationAnimation.kill();