Wallpaper target selection during animation
am: b0d267043a
Change-Id: Ib649f9399d6c9f7f84f05ddef8dd8e3d87bb7923
This commit is contained in:
@@ -340,6 +340,7 @@ class AppWindowToken extends WindowToken {
|
||||
}
|
||||
|
||||
void clearAnimatingFlags() {
|
||||
boolean wallpaperMightChange = false;
|
||||
for (int i = allAppWindows.size() - 1; i >= 0; i--) {
|
||||
final WindowState win = allAppWindows.get(i);
|
||||
// We don't want to clear it out for windows that get replaced, because the
|
||||
@@ -350,7 +351,6 @@ class AppWindowToken extends WindowToken {
|
||||
// by the client. We should let animation proceed and not clear this flag or
|
||||
// they won't eventually be removed by WindowStateAnimator#finishExit.
|
||||
if (!win.mWillReplaceWindow && !win.mRemoveOnExit) {
|
||||
win.mAnimatingExit = false;
|
||||
// Clear mAnimating flag together with mAnimatingExit. When animation
|
||||
// changes from exiting to entering, we need to clear this flag until the
|
||||
// new animation gets applied, so that isAnimationStarting() becomes true
|
||||
@@ -358,15 +358,24 @@ class AppWindowToken extends WindowToken {
|
||||
// Otherwise applySurfaceChangesTransaction will faill to skip surface
|
||||
// placement for this window during this period, one or more frame will
|
||||
// show up with wrong position or scale.
|
||||
win.mWinAnimator.mAnimating = false;
|
||||
|
||||
if (win.mAnimatingExit) {
|
||||
win.mAnimatingExit = false;
|
||||
wallpaperMightChange = true;
|
||||
}
|
||||
if (win.mWinAnimator.mAnimating) {
|
||||
win.mWinAnimator.mAnimating = false;
|
||||
wallpaperMightChange = true;
|
||||
}
|
||||
if (win.mDestroying) {
|
||||
win.mDestroying = false;
|
||||
service.mDestroySurface.remove(win);
|
||||
wallpaperMightChange = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
requestUpdateWallpaperIfNeeded();
|
||||
if (wallpaperMightChange) {
|
||||
requestUpdateWallpaperIfNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
void destroySurfaces() {
|
||||
|
||||
@@ -586,9 +586,14 @@ class WallpaperController {
|
||||
if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG,
|
||||
"New i: " + wallpaperTargetIndex + " old i: " + oldI);
|
||||
if (oldI >= 0) {
|
||||
if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG,
|
||||
"Animating wallpapers: old#" + oldI + "=" + oldW + "; new#"
|
||||
+ wallpaperTargetIndex + "=" + wallpaperTarget);
|
||||
final boolean newTargetHidden =
|
||||
wallpaperTarget.mAppToken != null && wallpaperTarget.mAppToken.hiddenRequested;
|
||||
final boolean oldTargetHidden =
|
||||
oldW.mAppToken != null && oldW.mAppToken.hiddenRequested;
|
||||
if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG, "Animating wallpapers:"
|
||||
+ " old#" + oldI + "=" + oldW + " hidden=" + oldTargetHidden
|
||||
+ " new#" + wallpaperTargetIndex + "=" + wallpaperTarget
|
||||
+ " hidden=" + newTargetHidden);
|
||||
|
||||
// Set the upper and lower wallpaper targets correctly,
|
||||
// and make sure that we are positioning the wallpaper below the lower.
|
||||
@@ -598,6 +603,7 @@ class WallpaperController {
|
||||
"Found target above old target.");
|
||||
mUpperWallpaperTarget = wallpaperTarget;
|
||||
mLowerWallpaperTarget = oldW;
|
||||
|
||||
wallpaperTarget = oldW;
|
||||
wallpaperTargetIndex = oldI;
|
||||
} else {
|
||||
@@ -607,15 +613,21 @@ class WallpaperController {
|
||||
mUpperWallpaperTarget = oldW;
|
||||
mLowerWallpaperTarget = wallpaperTarget;
|
||||
}
|
||||
|
||||
// If the new target is going hidden, set it back to the old target.
|
||||
if (wallpaperTarget.mAppToken != null
|
||||
&& wallpaperTarget.mAppToken.hiddenRequested) {
|
||||
if (newTargetHidden && !oldTargetHidden) {
|
||||
if (DEBUG_WALLPAPER_LIGHT) Slog.v(TAG,
|
||||
"Old wallpaper still the target.");
|
||||
// Use the old target if new target is hidden but old target
|
||||
// is not. If they're both hidden, still use the new target.
|
||||
mWallpaperTarget = oldW;
|
||||
} else if (newTargetHidden == oldTargetHidden
|
||||
&& !mService.mOpeningApps.contains(wallpaperTarget.mAppToken)
|
||||
&& (mService.mOpeningApps.contains(oldW.mAppToken)
|
||||
|| mService.mClosingApps.contains(oldW.mAppToken))) {
|
||||
// If they're both hidden (or both not hidden), prefer the one that's
|
||||
// currently in opening or closing app list, this allows transition
|
||||
// selection logic to better determine the wallpaper status of
|
||||
// opening/closing apps.
|
||||
mWallpaperTarget = oldW;
|
||||
wallpaperTarget = oldW;
|
||||
wallpaperTargetIndex = oldI;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user