Merge "Fixing misc issues that leads to black screen when pressing Home" into nyc-dev

This commit is contained in:
Chong Zhang
2016-03-14 22:44:59 +00:00
committed by Android (Google) Code Review
5 changed files with 22 additions and 30 deletions

View File

@@ -171,17 +171,21 @@ public class AppWindowAnimator {
transformation.setAlpha(mAppToken.isVisible() ? 1 : 0);
}
void setNullAnimation() {
animation = null;
usingTransferredAnimation = false;
}
public void clearAnimation() {
if (animation != null) {
animation = null;
animating = true;
}
clearThumbnail();
setNullAnimation();
if (mAppToken.deferClearAllDrawn) {
mAppToken.allDrawn = false;
mAppToken.deferClearAllDrawn = false;
}
usingTransferredAnimation = false;
}
public boolean isAnimating() {
@@ -202,9 +206,9 @@ public class AppWindowAnimator {
if (animation != null) {
toAppAnimator.animation = animation;
animation = null;
toAppAnimator.animating = animating;
toAppAnimator.animLayerAdjustment = animLayerAdjustment;
setNullAnimation();
animLayerAdjustment = 0;
toAppAnimator.updateLayers();
updateLayers();
@@ -311,7 +315,7 @@ public class AppWindowAnimator {
if (mProlongAnimation == PROLONG_ANIMATION_AT_END) {
hasMoreFrames = true;
} else {
animation = null;
setNullAnimation();
clearThumbnail();
if (DEBUG_ANIM) Slog.v(TAG, "Finished animation in " + mAppToken + " @ "
+ currentTime);

View File

@@ -322,23 +322,6 @@ class AppWindowToken extends WindowToken {
}
}
void setWindowsExiting(boolean exiting) {
for (int i = allAppWindows.size() - 1; i >= 0; i--) {
WindowState win = allAppWindows.get(i);
// If the app already requested to remove its window, we don't modify
// its exiting state. Otherwise the stale window won't get removed on
// exit and could cause focus to be given to the wrong window.
if (!(win.mRemoveOnExit && win.mAnimatingExit)) {
win.mAnimatingExit = exiting;
}
// If we're no longer exiting, remove the window from destroying list
if (!win.mAnimatingExit && win.mDestroying) {
win.mDestroying = false;
service.mDestroySurface.remove(win);
}
}
}
// Here we destroy surfaces which have been marked as eligible by the animator, taking care
// to ensure the client has finished with them. If the client could still be using them
// we will skip destruction and try again when the client has stopped.

View File

@@ -2826,10 +2826,12 @@ public class WindowManagerService extends IWindowManager.Stub
if (win.isWinVisibleLw() && winAnimator.applyAnimationLocked(transit, false)) {
focusMayChange = isDefaultDisplay;
win.mAnimatingExit = true;
win.mWinAnimator.mAnimating = true;
} else if (win.mWinAnimator.isAnimating()) {
// Currently in a hide animation... turn this into
// an exit.
win.mAnimatingExit = true;
win.mWinAnimator.mAnimating = true;
} else if (mWallpaperControllerLocked.isWallpaperTarget(win)) {
// If the wallpaper is currently behind this
// window, we need to change both of them inside
@@ -4086,7 +4088,7 @@ public class WindowManagerService extends IWindowManager.Stub
if (transit != AppTransition.TRANSIT_UNSET) {
if (wtoken.mAppAnimator.animation == AppWindowAnimator.sDummyAnimation) {
wtoken.mAppAnimator.animation = null;
wtoken.mAppAnimator.setNullAnimation();
}
if (applyAnimationLocked(wtoken, lp, transit, visible, isVoiceInteraction)) {
delayed = runningAppAnimation = true;
@@ -4196,7 +4198,7 @@ public class WindowManagerService extends IWindowManager.Stub
void updateTokenInPlaceLocked(AppWindowToken wtoken, int transit) {
if (transit != AppTransition.TRANSIT_UNSET) {
if (wtoken.mAppAnimator.animation == AppWindowAnimator.sDummyAnimation) {
wtoken.mAppAnimator.animation = null;
wtoken.mAppAnimator.setNullAnimation();
}
applyAnimationLocked(wtoken, null, transit, false, false);
}
@@ -4256,7 +4258,6 @@ public class WindowManagerService extends IWindowManager.Stub
if (DEBUG_ADD_REMOVE) Slog.v(
TAG_WM, "No longer Stopped: " + wtoken);
wtoken.mAppStopped = false;
wtoken.setWindowsExiting(false);
mOpeningApps.add(wtoken);
wtoken.startingMoved = false;
@@ -4288,6 +4289,11 @@ public class WindowManagerService extends IWindowManager.Stub
// animation is going on (in this case an application transition). If the animation
// was transferred from another application/animator, no dummy animator should be
// created since an animation is already in progress.
if (wtoken.mAppAnimator.usingTransferredAnimation
&& wtoken.mAppAnimator.animation == null) {
Slog.wtf(TAG_WM, "Will NOT set dummy animation on: " + wtoken
+ ", using null transfered animation!");
}
if (!wtoken.mAppAnimator.usingTransferredAnimation &&
(!wtoken.startingDisplayed || mSkipAppTransitionAnimation)) {
if (DEBUG_APP_TRANSITIONS) Slog.v(
@@ -4298,7 +4304,6 @@ public class WindowManagerService extends IWindowManager.Stub
if (visible) {
wtoken.mEnteringAnimation = true;
} else {
wtoken.setWindowsExiting(true);
mClosingApps.add(wtoken);
wtoken.mEnteringAnimation = false;
}

View File

@@ -670,8 +670,8 @@ final class WindowState implements WindowManagerPolicy.WindowState {
}
if (windowsAreFloating) {
// In floating modes (e.g. freeform, pinned) we have only to set the rectangle
// if it wasn't set already. No need to intersect it with the (visible)
// In floating modes (e.g. freeform, pinned) we have only to set the rectangle
// if it wasn't set already. No need to intersect it with the (visible)
// "content frame" since it is allowed to be outside the visible desktop.
if (mContainingFrame.isEmpty()) {
mContainingFrame.set(cf);

View File

@@ -1158,7 +1158,7 @@ class WindowSurfacePlacer {
if (!appAnimator.usingTransferredAnimation) {
appAnimator.clearThumbnail();
appAnimator.animation = null;
appAnimator.setNullAnimation();
}
wtoken.inPendingTransaction = false;
@@ -1231,7 +1231,7 @@ class WindowSurfacePlacer {
final AppWindowAnimator appAnimator = wtoken.mAppAnimator;
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG, "Now closing app " + wtoken);
appAnimator.clearThumbnail();
appAnimator.animation = null;
appAnimator.setNullAnimation();
wtoken.inPendingTransaction = false;
mService.setTokenVisibilityLocked(wtoken, animLp, false, transit, false,
voiceInteraction);
@@ -1494,7 +1494,7 @@ class WindowSurfacePlacer {
if (DEBUG_APP_TRANSITIONS)
Slog.v(TAG, "Now animating app in place " + wtoken);
appAnimator.clearThumbnail();
appAnimator.animation = null;
appAnimator.setNullAnimation();
mService.updateTokenInPlaceLocked(wtoken, transit);
wtoken.updateReportedVisibilityLocked();