diff --git a/packages/SystemUI/res/anim/recents_from_launcher_enter.xml b/packages/SystemUI/res/anim/recents_from_launcher_enter.xml index 4e1d66dedda64..b191e625177b9 100644 --- a/packages/SystemUI/res/anim/recents_from_launcher_enter.xml +++ b/packages/SystemUI/res/anim/recents_from_launcher_enter.xml @@ -24,5 +24,5 @@ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" android:interpolator="@android:interpolator/linear" - android:duration="100"/> + android:duration="150"/> diff --git a/packages/SystemUI/res/anim/recents_from_launcher_exit.xml b/packages/SystemUI/res/anim/recents_from_launcher_exit.xml index afab78d0a1ecc..fa6caf295cce8 100644 --- a/packages/SystemUI/res/anim/recents_from_launcher_exit.xml +++ b/packages/SystemUI/res/anim/recents_from_launcher_exit.xml @@ -24,5 +24,5 @@ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" android:interpolator="@android:interpolator/linear_out_slow_in" - android:duration="100"/> + android:duration="150"/> diff --git a/packages/SystemUI/res/anim/recents_from_unknown_enter.xml b/packages/SystemUI/res/anim/recents_from_unknown_enter.xml index f68a143cbfeb9..da1dee0075469 100644 --- a/packages/SystemUI/res/anim/recents_from_unknown_enter.xml +++ b/packages/SystemUI/res/anim/recents_from_unknown_enter.xml @@ -23,6 +23,6 @@ diff --git a/packages/SystemUI/res/anim/recents_to_launcher_enter.xml b/packages/SystemUI/res/anim/recents_to_launcher_enter.xml index 4e1d66dedda64..b191e625177b9 100644 --- a/packages/SystemUI/res/anim/recents_to_launcher_enter.xml +++ b/packages/SystemUI/res/anim/recents_to_launcher_enter.xml @@ -24,5 +24,5 @@ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" android:interpolator="@android:interpolator/linear" - android:duration="100"/> + android:duration="150"/> diff --git a/packages/SystemUI/res/anim/recents_to_launcher_exit.xml b/packages/SystemUI/res/anim/recents_to_launcher_exit.xml index afab78d0a1ecc..fa6caf295cce8 100644 --- a/packages/SystemUI/res/anim/recents_to_launcher_exit.xml +++ b/packages/SystemUI/res/anim/recents_to_launcher_exit.xml @@ -24,5 +24,5 @@ android:fillEnabled="true" android:fillBefore="true" android:fillAfter="true" android:interpolator="@android:interpolator/linear_out_slow_in" - android:duration="100"/> + android:duration="150"/> diff --git a/packages/SystemUI/res/values-sw600dp/config.xml b/packages/SystemUI/res/values-sw600dp/config.xml index 4f6d209b3f7a0..5aafb66fa0acf 100644 --- a/packages/SystemUI/res/values-sw600dp/config.xml +++ b/packages/SystemUI/res/values-sw600dp/config.xml @@ -32,4 +32,7 @@ true + + + false diff --git a/packages/SystemUI/res/values-sw720dp/config.xml b/packages/SystemUI/res/values-sw720dp/config.xml index fbc0d1d8195cb..d8bb8d7d5806d 100644 --- a/packages/SystemUI/res/values-sw720dp/config.xml +++ b/packages/SystemUI/res/values-sw720dp/config.xml @@ -39,8 +39,5 @@ 5 - - - false diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java index ec39d77d1b033..2d114c0024e26 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java +++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java @@ -18,6 +18,7 @@ package com.android.systemui.recents; import android.app.ActivityManager; import android.app.ActivityOptions; +import android.appwidget.AppWidgetProviderInfo; import android.content.ActivityNotFoundException; import android.content.ComponentName; import android.content.Context; @@ -52,6 +53,7 @@ import java.util.concurrent.atomic.AtomicBoolean; public class AlternateRecentsComponent implements ActivityOptions.OnAnimationStartedListener { final public static String EXTRA_FROM_HOME = "recents.triggeredOverHome"; + final public static String EXTRA_FROM_SEARCH_HOME = "recents.triggeredOverSearchHome"; final public static String EXTRA_FROM_APP_THUMBNAIL = "recents.animatingWithThumbnail"; final public static String EXTRA_FROM_APP_FULL_SCREENSHOT = "recents.thumbnail"; final public static String EXTRA_FROM_TASK_ID = "recents.activeTaskId"; @@ -62,7 +64,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta final public static String ACTION_TOGGLE_RECENTS_ACTIVITY = "action_toggle_recents_activity"; final public static String ACTION_HIDE_RECENTS_ACTIVITY = "action_hide_recents_activity"; - final static int sMinToggleDelay = 425; + final static int sMinToggleDelay = 350; final static String sToggleRecentsAction = "com.android.systemui.recents.SHOW_RECENTS"; final static String sRecentsPackage = "com.android.systemui"; @@ -224,6 +226,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta } public void onConfigurationChanged(Configuration newConfig) { + // Reload the header bar layout reloadHeaderBarLayout(); sLastScreenshot = null; } @@ -344,8 +347,13 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta /** * Creates the activity options for a home->recents transition. */ - ActivityOptions getHomeTransitionActivityOptions() { + ActivityOptions getHomeTransitionActivityOptions(boolean fromSearchHome) { mStartAnimationTriggered = false; + if (fromSearchHome) { + return ActivityOptions.makeCustomAnimation(mContext, + R.anim.recents_from_search_launcher_enter, + R.anim.recents_from_search_launcher_exit, mHandler, this); + } return ActivityOptions.makeCustomAnimation(mContext, R.anim.recents_from_launcher_enter, R.anim.recents_from_launcher_exit, mHandler, this); @@ -470,8 +478,30 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta // 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 (hasRecentTasks) { - ActivityOptions opts = getHomeTransitionActivityOptions(); - startAlternateRecentsActivity(topTask, opts, EXTRA_FROM_HOME); + // Get the home activity info + String homeActivityPackage = mSystemServicesProxy.getHomeActivityPackageName(); + // Get the search widget info + AppWidgetProviderInfo searchWidget = null; + String searchWidgetPackage = null; + if (mConfig.hasSearchBarAppWidget()) { + searchWidget = mSystemServicesProxy.getAppWidgetInfo( + mConfig.searchBarAppWidgetId); + } else { + searchWidget = mSystemServicesProxy.resolveSearchAppWidget(); + } + if (searchWidget != null && searchWidget.provider != null) { + searchWidgetPackage = searchWidget.provider.getPackageName(); + } + // Determine whether we are coming from a search owned home activity + boolean fromSearchHome = false; + if (homeActivityPackage != null && searchWidgetPackage != null && + homeActivityPackage.equals(searchWidgetPackage)) { + fromSearchHome = true; + } + + ActivityOptions opts = getHomeTransitionActivityOptions(fromSearchHome); + startAlternateRecentsActivity(topTask, opts, + fromSearchHome ? EXTRA_FROM_SEARCH_HOME : EXTRA_FROM_HOME); } else { // Otherwise we do the normal fade from an unknown source ActivityOptions opts = getUnknownTransitionActivityOptions(); diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java index 2f9715ff4c59d..6cae7d434e153 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java @@ -107,9 +107,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView // Finish Recents if (mLaunchIntent != null) { if (mLaunchOpts != null) { - startActivityAsUser(mLaunchIntent, UserHandle.CURRENT); - } else { startActivityAsUser(mLaunchIntent, mLaunchOpts.toBundle(), UserHandle.CURRENT); + } else { + startActivityAsUser(mLaunchIntent, UserHandle.CURRENT); } } else { finish(); @@ -188,7 +188,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView } // Update the configuration based on the launch intent - mConfig.launchedFromHome = launchIntent.getBooleanExtra( + boolean fromSearchHome = launchIntent.getBooleanExtra( + AlternateRecentsComponent.EXTRA_FROM_SEARCH_HOME, false); + mConfig.launchedFromHome = fromSearchHome || launchIntent.getBooleanExtra( AlternateRecentsComponent.EXTRA_FROM_HOME, false); mConfig.launchedFromAppWithThumbnail = launchIntent.getBooleanExtra( AlternateRecentsComponent.EXTRA_FROM_APP_THUMBNAIL, false); @@ -200,6 +202,18 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView AlternateRecentsComponent.EXTRA_TRIGGERED_FROM_ALT_TAB, false); mConfig.launchedWithNoRecentTasks = !root.hasTasks(); + // Create the home intent runnable + Intent homeIntent = new Intent(Intent.ACTION_MAIN, null); + homeIntent.addCategory(Intent.CATEGORY_HOME); + homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | + Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); + mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent, + ActivityOptions.makeCustomAnimation(this, + fromSearchHome ? R.anim.recents_to_search_launcher_enter : + R.anim.recents_to_launcher_enter, + fromSearchHome ? R.anim.recents_to_search_launcher_exit : + R.anim.recents_to_launcher_exit)); + // Mark the task that is the launch target int taskStackCount = stacks.size(); if (mConfig.launchedToTaskId != -1) { @@ -346,15 +360,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView mConfig = RecentsConfiguration.reinitialize(this, RecentsTaskLoader.getInstance().getSystemServicesProxy()); - // Create the home intent runnable - Intent homeIntent = new Intent(Intent.ACTION_MAIN, null); - homeIntent.addCategory(Intent.CATEGORY_HOME); - homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | - Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); - mFinishLaunchHomeRunnable = new FinishRecentsRunnable(homeIntent, - ActivityOptions.makeCustomAnimation(this, R.anim.recents_to_launcher_enter, - R.anim.recents_to_launcher_exit)); - // Initialize the widget host (the host id is static and does not change) mAppWidgetHost = new RecentsAppWidgetHost(this, Constants.Values.App.AppWidgetHostId); 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 b29f3780eb4aa..e27c0ac788c4d 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java +++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java @@ -32,6 +32,7 @@ import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.IPackageManager; import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; @@ -363,6 +364,43 @@ public class SystemServicesProxy { return icon; } + /** Returns the package name of the home activity. */ + public String getHomeActivityPackageName() { + if (mPm == null) return null; + if (Constants.DebugFlags.App.EnableSystemServicesProxy) return null; + + ArrayList homeActivities = new ArrayList(); + ComponentName defaultHomeActivity = mPm.getHomeActivities(homeActivities); + if (defaultHomeActivity != null) { + return defaultHomeActivity.getPackageName(); + } else if (homeActivities.size() == 1) { + ResolveInfo info = homeActivities.get(0); + if (info.activityInfo != null) { + return info.activityInfo.packageName; + } + } + return null; + } + + /** + * Resolves and returns the first Recents widget from the same package as the global + * assist activity. + */ + public AppWidgetProviderInfo resolveSearchAppWidget() { + if (mAwm == null) return null; + if (mAssistComponent == null) return null; + + // Find the first Recents widget from the same package as the global assist activity + List widgets = mAwm.getInstalledProviders( + AppWidgetProviderInfo.WIDGET_CATEGORY_RECENTS); + for (AppWidgetProviderInfo info : widgets) { + if (info.provider.getPackageName().equals(mAssistComponent.getPackageName())) { + return info; + } + } + return null; + } + /** * Resolves and binds the search app widget that is to appear in the recents. */ @@ -371,15 +409,7 @@ public class SystemServicesProxy { if (mAssistComponent == null) return null; // Find the first Recents widget from the same package as the global assist activity - List widgets = mAwm.getInstalledProviders( - AppWidgetProviderInfo.WIDGET_CATEGORY_RECENTS); - AppWidgetProviderInfo searchWidgetInfo = null; - for (AppWidgetProviderInfo info : widgets) { - if (info.provider.getPackageName().equals(mAssistComponent.getPackageName())) { - searchWidgetInfo = info; - break; - } - } + AppWidgetProviderInfo searchWidgetInfo = resolveSearchAppWidget(); // Return early if there is no search widget if (searchWidgetInfo == null) return null; diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/SystemBarScrimViews.java b/packages/SystemUI/src/com/android/systemui/recents/views/SystemBarScrimViews.java index 5b17b418960a6..162897e3815ee 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/SystemBarScrimViews.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/SystemBarScrimViews.java @@ -97,6 +97,14 @@ public class SystemBarScrimViews { * going home). */ public void startExitRecentsAnimation() { + if (mHasStatusBarScrim && mShouldAnimateStatusBarScrim) { + mStatusBarScrimView.animate() + .translationY(-mStatusBarScrimView.getMeasuredHeight()) + .setStartDelay(0) + .setDuration(mConfig.taskBarExitAnimDuration) + .setInterpolator(mConfig.fastOutSlowInInterpolator) + .start(); + } if (mHasNavBarScrim && mShouldAnimateNavBarScrim) { mNavBarScrimView.animate() .translationY(mNavBarScrimView.getMeasuredHeight())