diff options
| author | 2019-06-17 15:04:30 -0700 | |
|---|---|---|
| committer | 2019-06-17 15:04:30 -0700 | |
| commit | 4c1d56dd8abd3300e67ebde4ae9a27d1d36f6093 (patch) | |
| tree | 0c29e0e3ff18039a2ab8fee6be14b3b29af9a89b | |
| parent | 9d2da1ebf02473fb5224b391071fc71c789c2bd2 (diff) | |
| parent | cc0d8f3982677b4e0ce007eaacae3d636f74e499 (diff) | |
Merge "[AML] Check if launched activity has changed when handling visibility changes" into qt-dev
am: cc0d8f3982
Change-Id: I3973ca5fc03f0f16fe3d1e6a17f1440f3fbf5276
| -rw-r--r-- | services/core/java/com/android/server/wm/ActivityMetricsLogger.java | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java index feef5e27d26a..bc0f74715240 100644 --- a/services/core/java/com/android/server/wm/ActivityMetricsLogger.java +++ b/services/core/java/com/android/server/wm/ActivityMetricsLogger.java @@ -544,14 +544,30 @@ class ActivityMetricsLogger { // If we have an active transition that's waiting on a certain activity that will be // invisible now, we'll never get onWindowsDrawn, so abort the transition if necessary. - if (info != null && !hasVisibleNonFinishingActivity(t)) { - if (DEBUG_METRICS) Slog.i(TAG, "notifyVisibilityChanged to invisible" - + " activity=" + r); - logAppTransitionCancel(info); - mWindowingModeTransitionInfo.remove(r.getWindowingMode()); - if (mWindowingModeTransitionInfo.size() == 0) { - reset(true /* abort */, info, "notifyVisibilityChanged to invisible"); - } + + // We have no active transitions. + if (info == null) { + return; + } + + // The notified activity whose visibility changed is no longer the launched activity. + // We can still wait to get onWindowsDrawn. + if (info.launchedActivity != r) { + return; + } + + // Check if there is any activity in the task that is visible and not finishing. If the + // launched activity finished before it is drawn and if there is another activity in + // the task then that activity will be draw on screen. + if (hasVisibleNonFinishingActivity(t)) { + return; + } + + if (DEBUG_METRICS) Slog.i(TAG, "notifyVisibilityChanged to invisible activity=" + r); + logAppTransitionCancel(info); + mWindowingModeTransitionInfo.remove(r.getWindowingMode()); + if (mWindowingModeTransitionInfo.size() == 0) { + reset(true /* abort */, info, "notifyVisibilityChanged to invisible"); } } } |