diff options
| author | 2016-01-05 19:41:23 +0000 | |
|---|---|---|
| committer | 2016-01-05 19:41:23 +0000 | |
| commit | 61dead71a45acd9ad8ef67bd1f11c529d7fe6136 (patch) | |
| tree | a17cb73d3522648e03af574215e436b47f1fdd62 | |
| parent | eceac1b1e3eae4edd18e9b37cd8aecde72ce25a5 (diff) | |
| parent | d8b1d63f96580fe961e1751e7b4f56c90c1e0a76 (diff) | |
Merge "Fixing issue with exit animation due to incorrect visibility state."
9 files changed, 58 insertions, 48 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index ffcc805c4e74..57074df392db 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -77,6 +77,7 @@ import com.android.systemui.recents.model.TaskStack; import com.android.systemui.recents.views.RecentsView; import com.android.systemui.recents.views.SystemBarScrimViews; import com.android.systemui.recents.views.ViewAnimation; +import com.android.systemui.statusbar.BaseStatusBar; import java.util.ArrayList; @@ -298,12 +299,23 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD */ void dismissRecentsToHome(boolean animated) { if (animated) { - ReferenceCountedTrigger exitTrigger = new ReferenceCountedTrigger(null, - mFinishLaunchHomeRunnable, null); + ReferenceCountedTrigger exitTrigger = new ReferenceCountedTrigger(); + exitTrigger.increment(); + exitTrigger.addLastDecrementRunnable(mFinishLaunchHomeRunnable); + exitTrigger.addLastDecrementRunnable(new Runnable() { + @Override + public void run() { + Recents.getSystemServices().sendCloseSystemWindows( + BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY); + } + }); mRecentsView.startExitToHomeAnimation( new ViewAnimation.TaskViewExitContext(exitTrigger)); + exitTrigger.decrement(); } else { mFinishLaunchHomeRunnable.run(); + Recents.getSystemServices().sendCloseSystemWindows( + BaseStatusBar.SYSTEM_DIALOG_REASON_HOME_KEY); } } @@ -343,7 +355,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD EventBus.getDefault().register(this, EVENT_BUS_PRIORITY); // Initialize the widget host (the host id is static and does not change) - if (!RecentsDebugFlags.Static.DisableSearchBar) { + if (RecentsDebugFlags.Static.EnableSearchBar) { mAppWidgetHost = new RecentsAppWidgetHost(this, RecentsAppWidgetHost.HOST_ID); } mPackageMonitor = new RecentsPackageMonitor(); @@ -368,14 +380,14 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent); // Bind the search app widget when we first start up - if (!RecentsDebugFlags.Static.DisableSearchBar) { + if (RecentsDebugFlags.Static.EnableSearchBar) { mSearchWidgetInfo = ssp.getOrBindSearchAppWidget(this, mAppWidgetHost); } // Register the broadcast receiver to handle messages when the screen is turned off IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_SCREEN_OFF); - if (!RecentsDebugFlags.Static.DisableSearchBar) { + if (RecentsDebugFlags.Static.EnableSearchBar) { filter.addAction(SearchManager.INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED); } registerReceiver(mSystemBroadcastReceiver, filter); @@ -475,7 +487,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD mPackageMonitor.unregister(); // Stop listening for widget package changes if there was one bound - if (!RecentsDebugFlags.Static.DisableSearchBar) { + if (RecentsDebugFlags.Static.EnableSearchBar) { mAppWidgetHost.stopListening(); } @@ -656,8 +668,8 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD ReferenceCountedTrigger t = new ReferenceCountedTrigger(); ViewAnimation.TaskViewEnterContext ctx = new ViewAnimation.TaskViewEnterContext(t); ctx.postAnimationTrigger.increment(); - if (mSearchWidgetInfo != null) { - if (!RecentsDebugFlags.Static.DisableSearchBar) { + if (RecentsDebugFlags.Static.EnableSearchBar) { + if (mSearchWidgetInfo != null) { ctx.postAnimationTrigger.addLastDecrementRunnable(new Runnable() { @Override public void run() { diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java index 40c84baf7fd6..c323522013d4 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsDebugFlags.java @@ -32,8 +32,8 @@ public class RecentsDebugFlags implements TunerService.Tunable { public static class Static { // Enables debug drawing for the transition thumbnail public static final boolean EnableTransitionThumbnailDebugMode = false; - // This disables the search bar integration - public static final boolean DisableSearchBar = true; + // This enables the search bar integration + public static final boolean EnableSearchBar = false; // This disables the bitmap and icon caches public static final boolean DisableBackgroundCache = false; // Enables the simulated task affiliations diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java index a974c23f8bd8..fd00289b0248 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsImpl.java @@ -19,6 +19,7 @@ package com.android.systemui.recents; import android.app.ActivityManager; import android.app.ActivityOptions; import android.app.ITaskStackListener; +import android.appwidget.AppWidgetProviderInfo; import android.content.ActivityNotFoundException; import android.content.Context; import android.content.Intent; @@ -60,6 +61,7 @@ import com.android.systemui.recents.views.TaskStackLayoutAlgorithm; import com.android.systemui.recents.views.TaskStackView; import com.android.systemui.recents.views.TaskViewHeader; import com.android.systemui.recents.views.TaskViewTransform; +import com.android.systemui.statusbar.BaseStatusBar; import com.android.systemui.statusbar.phone.PhoneStatusBar; import java.util.ArrayList; @@ -364,6 +366,9 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements // Otherwise, start the recents activity startRecentsActivity(topTask, isTopTaskHome.value, true /* animate */); + + // Only close the other system windows if we are actually showing recents + ssp.sendCloseSystemWindows(BaseStatusBar.SYSTEM_DIALOG_REASON_RECENT_APPS); mLastToggleTime = SystemClock.elapsedRealtime(); } } catch (ActivityNotFoundException e) { @@ -578,7 +583,7 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements // Update the configuration for the current state config.update(windowRect); - if (!RecentsDebugFlags.Static.DisableSearchBar && tryAndBindSearchWidget) { + if (RecentsDebugFlags.Static.EnableSearchBar && tryAndBindSearchWidget) { // Try and pre-emptively bind the search widget on startup to ensure that we // have the right thumbnail bounds to animate to. // Note: We have to reload the widget id before we get the task stack bounds below @@ -854,11 +859,19 @@ public class RecentsImpl extends IRecentsNonSystemUserCallbacks.Stub implements if (!useThumbnailTransition) { // If there is no thumbnail transition, but is launching from home into recents, then // use a quick home transition and do the animation from home - if (!RecentsDebugFlags.Static.DisableSearchBar && hasRecentTasks) { + if (hasRecentTasks) { SystemServicesProxy ssp = Recents.getSystemServices(); String homeActivityPackage = ssp.getHomeActivityPackageName(); - String searchWidgetPackage = Prefs.getString(mContext, - Prefs.Key.OVERVIEW_SEARCH_APP_WIDGET_PACKAGE, null); + String searchWidgetPackage = null; + if (RecentsDebugFlags.Static.EnableSearchBar) { + searchWidgetPackage = Prefs.getString(mContext, + Prefs.Key.OVERVIEW_SEARCH_APP_WIDGET_PACKAGE, null); + } else { + AppWidgetProviderInfo searchWidgetInfo = ssp.resolveSearchAppWidget(); + if (searchWidgetInfo != null) { + searchWidgetPackage = searchWidgetInfo.provider.getPackageName(); + } + } // Determine whether we are coming from a search owned home activity boolean fromSearchHome = (homeActivityPackage != null) && diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java index ce75e8add781..108029d68805 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java @@ -68,6 +68,7 @@ import com.android.systemui.Prefs; import com.android.systemui.R; import com.android.systemui.recents.RecentsDebugFlags; import com.android.systemui.recents.RecentsImpl; +import com.android.systemui.statusbar.BaseStatusBar; import java.io.IOException; import java.util.ArrayList; @@ -502,6 +503,18 @@ public class SystemServicesProxy { } /** + * Sends a message to close other system windows. + */ + public void sendCloseSystemWindows(String reason) { + if (ActivityManagerNative.isSystemReady()) { + try { + ActivityManagerNative.getDefault().closeSystemDialogs(reason); + } catch (RemoteException e) { + } + } + } + + /** * Returns the activity info for a given component name. * * @param cn The component name of the activity. @@ -638,7 +651,7 @@ public class SystemServicesProxy { if (mPm == null) return null; if (RecentsDebugFlags.Static.EnableSystemServicesProxy) return null; - ArrayList<ResolveInfo> homeActivities = new ArrayList<ResolveInfo>(); + ArrayList<ResolveInfo> homeActivities = new ArrayList<>(); ComponentName defaultHomeActivity = mPm.getHomeActivities(homeActivities); if (defaultHomeActivity != null) { return defaultHomeActivity.getPackageName(); @@ -726,7 +739,7 @@ public class SystemServicesProxy { /** * Returns the first Recents widget from the same package as the global assist activity. */ - private AppWidgetProviderInfo resolveSearchAppWidget() { + public AppWidgetProviderInfo resolveSearchAppWidget() { if (mAssistComponent == null) return null; List<AppWidgetProviderInfo> widgets = mAwm.getInstalledProviders( AppWidgetProviderInfo.WIDGET_CATEGORY_SEARCHBOX); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java index 9b1315a2220f..c95c73bc4f89 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java @@ -317,7 +317,7 @@ public class RecentsView extends FrameLayout { * Hides the task stack and shows the empty view. */ public void showEmptyView() { - if (!RecentsDebugFlags.Static.DisableSearchBar && (mSearchBar != null)) { + if (RecentsDebugFlags.Static.EnableSearchBar && (mSearchBar != null)) { mSearchBar.setVisibility(View.INVISIBLE); } mTaskStackView.setVisibility(View.INVISIBLE); @@ -332,7 +332,7 @@ public class RecentsView extends FrameLayout { public void hideEmptyView() { mEmptyView.setVisibility(View.INVISIBLE); mTaskStackView.setVisibility(View.VISIBLE); - if (!RecentsDebugFlags.Static.DisableSearchBar && (mSearchBar != null)) { + if (RecentsDebugFlags.Static.EnableSearchBar && (mSearchBar != null)) { mSearchBar.setVisibility(View.VISIBLE); } mTaskStackView.bringToFront(); diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java index 10df15609e0f..9d391b0c8c86 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackLayoutAlgorithm.java @@ -333,7 +333,6 @@ public class TaskStackLayoutAlgorithm { * including the search bar. */ public void initialize(Rect taskStackBounds, StackState state) { - RecentsDebugFlags debugFlags = Recents.getDebugFlags(); RecentsConfiguration config = Recents.getConfiguration(); int widthPadding = (int) (config.taskStackWidthPaddingPct * taskStackBounds.width()); int heightPadding = mContext.getResources().getDimensionPixelSize( diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 11d7b9ba0894..5906bdac4523 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -148,8 +148,9 @@ public abstract class BaseStatusBar extends SystemUI implements protected static final int INTERRUPTION_THRESHOLD = 10; protected static final String SETTING_HEADS_UP_TICKER = "ticker_gets_heads_up"; - // Should match the value in PhoneWindowManager + // Should match the values in PhoneWindowManager public static final String SYSTEM_DIALOG_REASON_RECENT_APPS = "recentapps"; + public static final String SYSTEM_DIALOG_REASON_HOME_KEY = "homekey"; private static final String BANNER_ACTION_CANCEL = "com.android.systemui.statusbar.banner_action_cancel"; @@ -1189,7 +1190,6 @@ public abstract class BaseStatusBar extends SystemUI implements protected void toggleRecents() { if (mRecents != null) { - sendCloseSystemWindows(mContext, SYSTEM_DIALOG_REASON_RECENT_APPS); mRecents.toggleRecents(mDisplay, mLayoutDirection, getStatusBarView()); } } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 80fcba60e895..2ed40c19274a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -4120,32 +4120,6 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, return false; } - // Recents - - @Override - protected void showRecents(boolean triggeredFromAltTab) { - // Set the recents visibility flag - mSystemUiVisibility |= View.RECENT_APPS_VISIBLE; - notifyUiVisibilityChanged(mSystemUiVisibility); - super.showRecents(triggeredFromAltTab); - } - - @Override - protected void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { - // Unset the recents visibility flag - mSystemUiVisibility &= ~View.RECENT_APPS_VISIBLE; - notifyUiVisibilityChanged(mSystemUiVisibility); - super.hideRecents(triggeredFromAltTab, triggeredFromHomeKey); - } - - @Override - protected void toggleRecents() { - // Toggle the recents visibility flag - mSystemUiVisibility ^= View.RECENT_APPS_VISIBLE; - notifyUiVisibilityChanged(mSystemUiVisibility); - super.toggleRecents(); - } - public void updateRecentsVisibility(boolean visible) { // Update the recents visibility flag if (visible) { diff --git a/services/core/java/com/android/server/policy/PhoneWindowManager.java b/services/core/java/com/android/server/policy/PhoneWindowManager.java index c0134126bbe0..72611b7703e9 100644 --- a/services/core/java/com/android/server/policy/PhoneWindowManager.java +++ b/services/core/java/com/android/server/policy/PhoneWindowManager.java @@ -3381,7 +3381,6 @@ public class PhoneWindowManager implements WindowManagerPolicy { if (awakenFromDreams) { awakenDreams(); } - sendCloseSystemWindows(SYSTEM_DIALOG_REASON_HOME_KEY); hideRecentApps(false, true); } else { // Otherwise, just launch Home |