Merge "Send app transition starting event at right time" into oc-dr1-dev am: 790e3ff6e3
am: 2eb38600c4
Change-Id: I5fae06627aefb39a6904a9ef1c3608f766b8e661
diff --git a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
index 82c862f..6909892 100644
--- a/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
+++ b/services/core/java/com/android/server/wm/WindowSurfacePlacer.java
@@ -233,7 +233,7 @@
*/
int handleAppTransitionReadyLocked() {
int appsCount = mService.mOpeningApps.size();
- if (!transitionGoodToGo(appsCount)) {
+ if (!transitionGoodToGo(appsCount, mTempTransitionReasons)) {
return 0;
}
Trace.traceBegin(Trace.TRACE_TAG_WINDOW_MANAGER, "AppTransitionReady");
@@ -375,6 +375,9 @@
true /*updateInputWindows*/);
mService.mFocusMayChange = false;
+ mService.mH.obtainMessage(NOTIFY_APP_TRANSITION_STARTING,
+ mTempTransitionReasons.clone()).sendToTarget();
+
Trace.traceEnd(Trace.TRACE_TAG_WINDOW_MANAGER);
return layoutRedo | FINISH_LAYOUT_REDO_LAYOUT | FINISH_LAYOUT_REDO_CONFIG;
@@ -499,7 +502,7 @@
}
}
- private boolean transitionGoodToGo(int appsCount) {
+ private boolean transitionGoodToGo(int appsCount, SparseIntArray outReasons) {
if (DEBUG_APP_TRANSITIONS) Slog.v(TAG,
"Checking " + appsCount + " opening apps (frozen="
+ mService.mDisplayFrozen + " timeout="
@@ -508,7 +511,7 @@
mService.mAnimator.getScreenRotationAnimationLocked(
Display.DEFAULT_DISPLAY);
- final SparseIntArray reasons = mTempTransitionReasons;
+ outReasons.clear();
if (!mService.mAppTransition.isTimeout()) {
// Imagine the case where we are changing orientation due to an app transition, but a previous
// orientation change is still in progress. We won't process the orientation change
@@ -542,10 +545,10 @@
final TaskStack stack = wtoken.getStack();
final int stackId = stack != null ? stack.mStackId : INVALID_STACK_ID;
if (allDrawn) {
- reasons.put(stackId, drawnBeforeRestoring ? APP_TRANSITION_WINDOWS_DRAWN
+ outReasons.put(stackId, drawnBeforeRestoring ? APP_TRANSITION_WINDOWS_DRAWN
: APP_TRANSITION_SAVED_SURFACE);
} else {
- reasons.put(stackId, wtoken.startingData instanceof SplashScreenStartingData
+ outReasons.put(stackId, wtoken.startingData instanceof SplashScreenStartingData
? APP_TRANSITION_SPLASH_SCREEN
: APP_TRANSITION_SNAPSHOT);
}
@@ -569,13 +572,10 @@
boolean wallpaperReady = !mWallpaperControllerLocked.isWallpaperVisible() ||
mWallpaperControllerLocked.wallpaperTransitionReady();
if (wallpaperReady) {
- mService.mH.obtainMessage(NOTIFY_APP_TRANSITION_STARTING, reasons.clone())
- .sendToTarget();
return true;
}
return false;
}
- mService.mH.obtainMessage(NOTIFY_APP_TRANSITION_STARTING, reasons.clone()).sendToTarget();
return true;
}