Skip to content

Commit 8863cca

Browse files
author
Craig Mautner
committed
Fixes to Starting window and Wallpaper windows.
- Checking for found wallpaper to match either mWallpaperTarget or mLowerWallpaperTarget keeps from swapping the layers while transitioning between two wallpaper activities. - Fade out RecentsActivity while bringing up selected activity. This keeps the RecentsActivity from showing through a launching wallpaper activity. - When moving a starting window from one activity to another clear the startingDisplayed flag in the old activity. - When moving a starting window from one activity to another assign the new activity's mAppAnimator to the starting window's mWinAnimator. - Only treat a wallpaper transition as entering if the mWallpaperTarget is visible and not being hidden. Keeps from assigning the wrong animation when activities are launched back to back and the mWallpaperTarget is still animating away. Fixes bug 7148089. Change-Id: Idd405b1ba113f3345ca2116d141b474abe5bd4c0
1 parent 5d1a870 commit 8863cca

File tree

2 files changed

+23
-15
lines changed

2 files changed

+23
-15
lines changed

services/java/com/android/server/wm/WindowManagerService.java

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1648,7 +1648,8 @@ int adjustWallpaperWindowsLocked() {
16481648
}
16491649
}
16501650

1651-
if (mWallpaperTarget != foundW) {
1651+
if (mWallpaperTarget != foundW
1652+
&& (mLowerWallpaperTarget == null || mLowerWallpaperTarget != foundW)) {
16521653
if (DEBUG_WALLPAPER) {
16531654
Slog.v(TAG, "New wallpaper target: " + foundW
16541655
+ " oldTarget: " + mWallpaperTarget);
@@ -3391,7 +3392,7 @@ private Animation createThumbnailAnimationLocked(int transit,
33913392
// Exiting app
33923393
if (scaleUp) {
33933394
// noop animation
3394-
a = new AlphaAnimation(1, 1);
3395+
a = new AlphaAnimation(1, 0);
33953396
a.setDuration(duration);
33963397
} else {
33973398
float scaleW = thumbWidth / displayInfo.appWidth;
@@ -3440,15 +3441,15 @@ private boolean applyAnimationLocked(AppWindowToken atoken,
34403441
"applyAnimation: atoken=" + atoken
34413442
+ " anim=" + a + " nextAppTransition=ANIM_CUSTOM"
34423443
+ " transit=" + transit + " isEntrance=" + enter
3443-
+ " Callers " + Debug.getCallers(3));
3444+
+ " Callers=" + Debug.getCallers(3));
34443445
} else if (mNextAppTransitionType == ActivityOptions.ANIM_SCALE_UP) {
34453446
a = createScaleUpAnimationLocked(transit, enter);
34463447
initialized = true;
34473448
if (DEBUG_APP_TRANSITIONS || DEBUG_ANIM) Slog.v(TAG,
34483449
"applyAnimation: atoken=" + atoken
34493450
+ " anim=" + a + " nextAppTransition=ANIM_SCALE_UP"
34503451
+ " transit=" + transit + " isEntrance=" + enter
3451-
+ " Callers " + Debug.getCallers(3));
3452+
+ " Callers=" + Debug.getCallers(3));
34523453
} else if (mNextAppTransitionType == ActivityOptions.ANIM_THUMBNAIL_SCALE_UP ||
34533454
mNextAppTransitionType == ActivityOptions.ANIM_THUMBNAIL_SCALE_DOWN) {
34543455
boolean scaleUp = (mNextAppTransitionType == ActivityOptions.ANIM_THUMBNAIL_SCALE_UP);
@@ -3459,7 +3460,7 @@ private boolean applyAnimationLocked(AppWindowToken atoken,
34593460
Slog.v(TAG, "applyAnimation: atoken=" + atoken
34603461
+ " anim=" + a + " nextAppTransition=" + animName
34613462
+ " transit=" + transit + " isEntrance=" + enter
3462-
+ " Callers " + Debug.getCallers(3));
3463+
+ " Callers=" + Debug.getCallers(3));
34633464
}
34643465
} else {
34653466
int animAttr = 0;
@@ -3521,7 +3522,7 @@ private boolean applyAnimationLocked(AppWindowToken atoken,
35213522
+ " anim=" + a
35223523
+ " animAttr=0x" + Integer.toHexString(animAttr)
35233524
+ " transit=" + transit + " isEntrance=" + enter
3524-
+ " Callers " + Debug.getCallers(3));
3525+
+ " Callers=" + Debug.getCallers(3));
35253526
}
35263527
if (a != null) {
35273528
if (DEBUG_ANIM) {
@@ -4193,7 +4194,7 @@ public void setAppStartingWindow(IBinder token, String pkg,
41934194

41944195
synchronized(mWindowMap) {
41954196
if (DEBUG_STARTING_WINDOW) Slog.v(
4196-
TAG, "setAppStartingIcon: token=" + token + " pkg=" + pkg
4197+
TAG, "setAppStartingWindow: token=" + token + " pkg=" + pkg
41974198
+ " transferFrom=" + transferFrom);
41984199

41994200
AppWindowToken wtoken = findAppWindowToken(token);
@@ -4225,7 +4226,7 @@ public void setAppStartingWindow(IBinder token, String pkg,
42254226
mSkipAppTransitionAnimation = true;
42264227
}
42274228
if (DEBUG_STARTING_WINDOW) Slog.v(TAG,
4228-
"Moving existing starting from " + ttoken
4229+
"Moving existing starting " + startingWindow + " from " + ttoken
42294230
+ " to " + wtoken);
42304231
final long origId = Binder.clearCallingIdentity();
42314232

@@ -4234,6 +4235,7 @@ public void setAppStartingWindow(IBinder token, String pkg,
42344235
wtoken.startingData = ttoken.startingData;
42354236
wtoken.startingView = ttoken.startingView;
42364237
wtoken.startingDisplayed = ttoken.startingDisplayed;
4238+
ttoken.startingDisplayed = false;
42374239
wtoken.startingWindow = startingWindow;
42384240
wtoken.reportedVisible = ttoken.reportedVisible;
42394241
ttoken.startingData = null;
@@ -4243,6 +4245,8 @@ public void setAppStartingWindow(IBinder token, String pkg,
42434245
startingWindow.mToken = wtoken;
42444246
startingWindow.mRootToken = wtoken;
42454247
startingWindow.mAppToken = wtoken;
4248+
startingWindow.mWinAnimator.mAppAnimator = wtoken.mAppAnimator;
4249+
42464250
if (DEBUG_WINDOW_MOVEMENT || DEBUG_ADD_REMOVE || DEBUG_STARTING_WINDOW) {
42474251
Slog.v(TAG, "Removing starting window: " + startingWindow);
42484252
}
@@ -4550,9 +4554,9 @@ public void setAppVisibility(IBinder token, boolean visible) {
45504554
}
45514555
wtoken.hiddenRequested = !visible;
45524556

4553-
if (DEBUG_APP_TRANSITIONS) Slog.v(
4554-
TAG, "Setting dummy animation on: " + wtoken);
45554557
if (!wtoken.startingDisplayed) {
4558+
if (DEBUG_APP_TRANSITIONS) Slog.v(
4559+
TAG, "Setting dummy animation on: " + wtoken);
45564560
wtoken.mAppAnimator.setDummyAnimation();
45574561
}
45584562
mOpeningApps.remove(wtoken);
@@ -8147,7 +8151,11 @@ private final void assignLayersLocked(WindowList windows) {
81478151
updateLayoutToAnimationLocked();
81488152
}
81498153
if (DEBUG_LAYERS) Slog.v(TAG, "Assign layer " + w + ": "
8150-
+ winAnimator.mAnimLayer);
8154+
+ "mBase=" + w.mBaseLayer
8155+
+ " mLayer=" + w.mLayer
8156+
+ (w.mAppToken == null ?
8157+
"" : " mAppLayer=" + w.mAppToken.mAppAnimator.animLayerAdjustment)
8158+
+ " =mAnimLayer=" + winAnimator.mAnimLayer);
81518159
//System.out.println(
81528160
// "Assigned layer " + curLayer + " to " + w.mClient.asBinder());
81538161
}
@@ -8539,7 +8547,7 @@ public int handleAppTransitionReadyLocked(WindowList windows) {
85398547
transit = WindowManagerPolicy.TRANSIT_WALLPAPER_CLOSE;
85408548
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
85418549
"New transit away from wallpaper: " + transit);
8542-
} else if (mWallpaperTarget != null) {
8550+
} else if (mWallpaperTarget != null && mWallpaperTarget.isVisibleLw()) {
85438551
// We are transitioning from an activity without
85448552
// a wallpaper to now showing the wallpaper
85458553
transit = WindowManagerPolicy.TRANSIT_WALLPAPER_OPEN;
@@ -8596,7 +8604,7 @@ public int handleAppTransitionReadyLocked(WindowList windows) {
85968604
for (i=0; i<NN; i++) {
85978605
AppWindowToken wtoken = mClosingApps.get(i);
85988606
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
8599-
"Now closing app" + wtoken);
8607+
"Now closing app " + wtoken);
86008608
wtoken.mAppAnimator.clearThumbnail();
86018609
wtoken.inPendingTransaction = false;
86028610
wtoken.mAppAnimator.animation = null;

services/java/com/android/server/wm/WindowStateAnimator.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class WindowStateAnimator {
6262
final WindowState mWin;
6363
final WindowStateAnimator mAttachedWinAnimator;
6464
final WindowAnimator mAnimator;
65-
final AppWindowAnimator mAppAnimator;
65+
AppWindowAnimator mAppAnimator;
6666
final Session mSession;
6767
final WindowManagerPolicy mPolicy;
6868
final Context mContext;
@@ -1520,7 +1520,7 @@ boolean applyAnimationLocked(int transit, boolean isEntrance) {
15201520
"applyAnimation: win=" + this
15211521
+ " anim=" + anim + " attr=0x" + Integer.toHexString(attr)
15221522
+ " a=" + a
1523-
+ " mAnimation=" + mAnimation
1523+
+ " transit=" + transit
15241524
+ " isEntrance=" + isEntrance + " Callers " + Debug.getCallers(3));
15251525
if (a != null) {
15261526
if (WindowManagerService.DEBUG_ANIM) {

0 commit comments

Comments
 (0)