From fe855d124b3fb3d59262b0fc6d528d91caf36951 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Wed, 17 Jun 2015 16:03:54 -0700 Subject: Fixing issue with recents not being hidden for translucent apps. - When tapping home, we can't depend on the stack state to determine whether or not hide recents since there can be translucent windows above it. In this case, we just dismiss recents directly since the receiver will only be registered while recents is visible. Bug: 20110140 Change-Id: I6b796cc4cbd790aac9a0857549e34117adb808d8 --- .../SystemUI/src/com/android/systemui/recents/Recents.java | 14 ++++++-------- .../src/com/android/systemui/recents/RecentsActivity.java | 4 ++-- .../com/android/systemui/recents/RecentsAppWidgetHost.java | 1 + 3 files changed, 9 insertions(+), 10 deletions(-) (limited to 'packages') diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java index 442af90..89c456c 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java @@ -316,14 +316,12 @@ public class Recents extends SystemUI void hideRecentsInternal(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { if (mBootCompleted) { - ActivityManager.RunningTaskInfo topTask = mSystemServicesProxy.getTopMostTask(); - if (topTask != null && mSystemServicesProxy.isRecentsTopMost(topTask, null)) { - // Notify recents to hide itself - Intent intent = createLocalBroadcastIntent(mContext, ACTION_HIDE_RECENTS_ACTIVITY); - intent.putExtra(EXTRA_TRIGGERED_FROM_ALT_TAB, triggeredFromAltTab); - intent.putExtra(EXTRA_TRIGGERED_FROM_HOME_KEY, triggeredFromHomeKey); - mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT); - } + // Defer to the activity to handle hiding recents, if it handles it, then it must still + // be visible + Intent intent = createLocalBroadcastIntent(mContext, ACTION_HIDE_RECENTS_ACTIVITY); + intent.putExtra(EXTRA_TRIGGERED_FROM_ALT_TAB, triggeredFromAltTab); + intent.putExtra(EXTRA_TRIGGERED_FROM_HOME_KEY, triggeredFromHomeKey); + mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT); } } diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index 3885799..3cd769e 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -134,9 +134,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView dismissRecentsToFocusedTaskOrHome(false); } else if (intent.getBooleanExtra(Recents.EXTRA_TRIGGERED_FROM_HOME_KEY, false)) { // Otherwise, dismiss Recents to Home - dismissRecentsToHome(true); + dismissRecentsToHomeRaw(true); } else { - // Do nothing, another activity is being launched on top of Recents + // Do nothing } } else if (action.equals(Recents.ACTION_TOGGLE_RECENTS_ACTIVITY)) { // If we are toggling Recents, then first unfilter any filtered stacks first diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsAppWidgetHost.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsAppWidgetHost.java index 02a7b94..d4e50f8 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsAppWidgetHost.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsAppWidgetHost.java @@ -70,6 +70,7 @@ public class RecentsAppWidgetHost extends AppWidgetHost { @Override protected void onProviderChanged(int appWidgetId, AppWidgetProviderInfo appWidgetInfo) { if (mCb == null) return; + if (mContext == null) return; SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy(); if (appWidgetId > -1 && appWidgetId == mConfig.searchBarAppWidgetId) { -- cgit v1.1