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