am 648c87e6: Providing a more seamless transition to Home (Bug. 17012456)
* commit '648c87e6a9d0c7955eee4b4ff60776a84d6d3efb': Providing a more seamless transition to Home (Bug. 17012456)
This commit is contained in:
@@ -24,5 +24,5 @@
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true" android:fillAfter="true"
|
||||
android:interpolator="@android:interpolator/linear"
|
||||
android:duration="100"/>
|
||||
android:duration="150"/>
|
||||
</set>
|
||||
|
||||
@@ -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"/>
|
||||
</set>
|
||||
|
||||
@@ -23,6 +23,6 @@
|
||||
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true" android:fillAfter="true"
|
||||
android:interpolator="@android:interpolator/fast_out_slow_in"
|
||||
android:interpolator="@android:interpolator/linear"
|
||||
android:duration="200"/>
|
||||
</set>
|
||||
|
||||
@@ -24,5 +24,5 @@
|
||||
android:fillEnabled="true"
|
||||
android:fillBefore="true" android:fillAfter="true"
|
||||
android:interpolator="@android:interpolator/linear"
|
||||
android:duration="100"/>
|
||||
android:duration="150"/>
|
||||
</set>
|
||||
|
||||
@@ -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"/>
|
||||
</set>
|
||||
|
||||
@@ -32,4 +32,7 @@
|
||||
|
||||
<!-- Set to true to enable the user switcher on the keyguard. -->
|
||||
<bool name="config_keyguardUserSwitcher">true</bool>
|
||||
|
||||
<!-- Transposes the recents layout in landscape. -->
|
||||
<bool name="recents_transpose_layout_with_orientation">false</bool>
|
||||
</resources>
|
||||
|
||||
@@ -39,8 +39,5 @@
|
||||
<!-- The maximum count of notifications on Keyguard. The rest will be collapsed in an overflow
|
||||
card. -->
|
||||
<integer name="keyguard_max_notification_count">5</integer>
|
||||
|
||||
<!-- Transposes the recents layout in landscape. -->
|
||||
<bool name="recents_transpose_layout_with_orientation">false</bool>
|
||||
</resources>
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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<ResolveInfo> homeActivities = new ArrayList<ResolveInfo>();
|
||||
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<AppWidgetProviderInfo> 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<AppWidgetProviderInfo> 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;
|
||||
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user