From c422f80cc9bc0ca3c1e8fa4fa81d64570e559a2d Mon Sep 17 00:00:00 2001 From: Matthew Ng Date: Wed, 2 Aug 2017 14:00:59 -0700 Subject: [PATCH] Reset wait for transition state to false when recents goes invisible From ag/2572257, this change will ensure the transition wait flag to be false when recents runs "onStop" or when it becomes invisible. This should fix edge cases when a user goes from Recents to somewhere that is not a fullscreen app (like home). Resetting the state should allow users to use the recents button without getting blocked. There is only two locations where the flag is set to true, when user starts recents and when an app is started from recents. When a user goes from recents to home with the recents button (when the phone gets into a wierd state), then the flag is true but home does not reset the flag because the old change expects a non-home app to start. Now whenever recents is dismissed, the flag will be reset. Fixes: 37277853 Bug: 64098508 Test: start recents with apps in it, go to guest account, start apps in recents, go back to main account, unlock keyguard, press recents button to dismiss recents (do not press home or back), it will go to home, press recents again Change-Id: I07c292d701a621685c836a4f6040864377f0a3dd --- .../src/com/android/systemui/recents/Recents.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java index de2ace4c30d1a..9d2574428f271 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java @@ -54,6 +54,7 @@ import com.android.systemui.plugins.PluginActivityManager; import com.android.systemui.recents.events.EventBus; import com.android.systemui.recents.events.activity.ConfigurationChangedEvent; import com.android.systemui.recents.events.activity.DockedTopTaskEvent; +import com.android.systemui.recents.events.activity.LaunchTaskFailedEvent; import com.android.systemui.recents.events.activity.RecentsActivityStartingEvent; import com.android.systemui.recents.events.component.RecentsVisibilityChangedEvent; import com.android.systemui.recents.events.component.ScreenPinningRequestEvent; @@ -612,6 +613,14 @@ public class Recents extends SystemUI } }); } + + // This will catch the cases when a user launches from recents to another app + // (and vice versa) that is not in the recents stack (such as home or bugreport) and it + // would not reset the wait for transition flag. This will catch it and make sure that the + // flag is reset. + if (!event.visible) { + mImpl.setWaitingForTransitionStart(false); + } } /** @@ -684,6 +693,11 @@ public class Recents extends SystemUI } } + public final void onBusEvent(LaunchTaskFailedEvent event) { + // Reset the transition when tasks fail to launch + mImpl.setWaitingForTransitionStart(false); + } + public final void onBusEvent(ConfigurationChangedEvent event) { // Update the configuration for the Recents component when the activity configuration // changes as well