diff options
| author | 2019-06-17 15:24:02 -0700 | |
|---|---|---|
| committer | 2019-06-17 15:24:02 -0700 | |
| commit | 852dacf55efd15cd2b63b30d4a591114711b86fd (patch) | |
| tree | 6c338e686bb6e809dbc553683dea545b394b5359 | |
| parent | c5bdd4dbd425d89a4f4fbd58a864dea8031fed4e (diff) | |
| parent | 3aa7b56cb3320c4b9ba6d05f772f40b6a53135f5 (diff) | |
Merge "[AML] Check if launched activity has changed when handling visibility changes" into qt-dev am: cc0d8f3982
am: 3aa7b56cb3
Change-Id: I747002da6cdd0452564a2b8778bdcff92c7eadc1
| -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"); } } } |