Skip to content

Commit de1ddd0

Browse files
Craig MautnerAndroid (Google) Code Review
authored andcommitted
Merge "Better handle changing app transitions." into jb-dev
2 parents a073e57 + 1d961d4 commit de1ddd0

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,9 @@ public void setAnimation(Animation anim, boolean initialized) {
7979
}
8080

8181
public void setDummyAnimation() {
82-
if (animation == null) {
83-
if (WindowManagerService.localLOGV) Slog.v(
84-
TAG, "Setting dummy animation in " + mAppToken);
85-
animation = sDummyAnimation;
86-
animInitialized = false;
87-
}
82+
if (WindowManagerService.localLOGV) Slog.v(TAG, "Setting dummy animation in " + mAppToken);
83+
animation = sDummyAnimation;
84+
animInitialized = false;
8885
hasTransformation = true;
8986
transformation.clear();
9087
transformation.setAlpha(mAppToken.reportedVisible ? 1 : 0);

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

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ int adjustWallpaperWindowsLocked() {
16381638
// it is of no interest to us.
16391639
if (w.mAppToken.hidden && w.mAppToken.mAppAnimator.animation == null) {
16401640
if (DEBUG_WALLPAPER) Slog.v(TAG,
1641-
"Skipping not hidden or animating token: " + w);
1641+
"Skipping hidden and not animating token: " + w);
16421642
continue;
16431643
}
16441644
}
@@ -3865,6 +3865,7 @@ public void prepareAppTransition(int transit, boolean alwaysKeepCurrent) {
38653865
if (DEBUG_APP_TRANSITIONS) Slog.v(
38663866
TAG, "Prepare app transition: transit=" + transit
38673867
+ " mNextAppTransition=" + mNextAppTransition
3868+
+ " alwaysKeepCurrent=" + alwaysKeepCurrent
38683869
+ " Callers=" + Debug.getCallers(3));
38693870
if (okToDisplay()) {
38703871
if (mNextAppTransition == WindowManagerPolicy.TRANSIT_UNSET
@@ -3934,6 +3935,15 @@ public void overridePendingAppTransitionThumb(Bitmap srcThumb, int startX,
39343935
}
39353936
}
39363937

3938+
private void cancelWindowAnimations(final AppWindowToken wtoken) {
3939+
for (int i = wtoken.windows.size() - 1; i >= 0; i--) {
3940+
final WindowStateAnimator winAnimator = wtoken.windows.get(i).mWinAnimator;
3941+
if (winAnimator.isAnimating()) {
3942+
winAnimator.clearAnimation();
3943+
}
3944+
}
3945+
}
3946+
39373947
public void executeAppTransition() {
39383948
if (!checkCallingPermission(android.Manifest.permission.MANAGE_APP_TOKENS,
39393949
"executeAppTransition()")) {
@@ -3949,6 +3959,12 @@ public void executeAppTransition() {
39493959
}
39503960
if (mNextAppTransition != WindowManagerPolicy.TRANSIT_UNSET) {
39513961
mAppTransitionReady = true;
3962+
for (int i = mOpeningApps.size() - 1; i >= 0; i--) {
3963+
cancelWindowAnimations(mOpeningApps.get(i));
3964+
}
3965+
for (int i = mClosingApps.size() - 1; i >= 0; i--) {
3966+
cancelWindowAnimations(mClosingApps.get(i));
3967+
}
39523968
final long origId = Binder.clearCallingIdentity();
39533969
performLayoutAndPlaceSurfacesLocked();
39543970
Binder.restoreCallingIdentity(origId);
@@ -4296,6 +4312,7 @@ public void setAppVisibility(IBinder token, boolean visible) {
42964312

42974313
if (DEBUG_APP_TRANSITIONS) Slog.v(
42984314
TAG, "Setting dummy animation on: " + wtoken);
4315+
cancelWindowAnimations(wtoken);
42994316
wtoken.mAppAnimator.setDummyAnimation();
43004317
mOpeningApps.remove(wtoken);
43014318
mClosingApps.remove(wtoken);
@@ -5319,7 +5336,8 @@ private void showStrictModeViolation(int arg) {
53195336
// the background..)
53205337
if (on) {
53215338
boolean isVisible = false;
5322-
for (WindowState ws : mWindows) {
5339+
for (int i = mWindows.size() - 1; i >= 0; i--) {
5340+
final WindowState ws = mWindows.get(i);
53235341
if (ws.mSession.mPid == pid && ws.isVisibleLw()) {
53245342
isVisible = true;
53255343
break;
@@ -6437,7 +6455,10 @@ boolean computeScreenConfigurationLocked(Configuration config) {
64376455

64386456
int keyboardPresence = 0;
64396457
int navigationPresence = 0;
6440-
for (InputDevice device : mInputManager.getInputDevices()) {
6458+
final InputDevice[] devices = mInputManager.getInputDevices();
6459+
final int len = devices.length;
6460+
for (int i = 0; i < len; i++) {
6461+
InputDevice device = devices[i];
64416462
if (!device.isVirtual()) {
64426463
final int sources = device.getSources();
64436464
final int presenceFlag = device.isExternal() ?
@@ -7946,7 +7967,7 @@ public int handleAppTransitionReadyLocked() {
79467967
for (i=0; i<NN && goodToGo; i++) {
79477968
AppWindowToken wtoken = mOpeningApps.get(i);
79487969
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
7949-
"Check opening app" + wtoken + ": allDrawn="
7970+
"Check opening app=" + wtoken + ": allDrawn="
79507971
+ wtoken.allDrawn + " startingDisplayed="
79517972
+ wtoken.startingDisplayed + " startingMoved="
79527973
+ wtoken.startingMoved);
@@ -8056,7 +8077,7 @@ public int handleAppTransitionReadyLocked() {
80568077
}
80578078
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
80588079
"New transit: " + transit);
8059-
} else if (oldWallpaper != null) {
8080+
} else if ((oldWallpaper != null) && (oldWallpaper != mWallpaperTarget)) {
80608081
// We are transitioning from an activity with
80618082
// a wallpaper to one without.
80628083
transit = WindowManagerPolicy.TRANSIT_WALLPAPER_CLOSE;

0 commit comments

Comments
 (0)