fraction representing the proportion
+ * between the start and end values. The calculation is a simple parametric
+ * calculation on each of the separate components in the Rect objects
+ * (left, top, right, and bottom).
+ *
+ * The object returned will be the reuseRect passed into the constructor.
fraction parameter.
+ */
+ @Override
+ public RectF evaluate(float fraction, RectF startValue, RectF endValue) {
+ float left = startValue.left + ((endValue.left - startValue.left) * fraction);
+ float top = startValue.top + ((endValue.top - startValue.top) * fraction);
+ float right = startValue.right + ((endValue.right - startValue.right) * fraction);
+ float bottom = startValue.bottom + ((endValue.bottom - startValue.bottom) * fraction);
+ mRect.set(left, top, right, bottom);
+ return mRect;
+ }
+}
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 adc1e9200daa4..3f52ae8d7ed15 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
@@ -30,6 +30,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
+import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
@@ -554,39 +555,41 @@ public class SystemServicesProxy {
}
}
- /** Returns the activity label */
- public String getActivityLabel(ActivityInfo info) {
+ /**
+ * Returns the activity label, badging if necessary.
+ */
+ public String getBadgedActivityLabel(ActivityInfo info, int userId) {
if (mPm == null) return null;
// If we are mocking, then return a mock label
if (RecentsDebugFlags.Static.EnableSystemServicesProxy) {
- return "Recent Task";
+ return "Recent Task: " + userId;
}
- return info.loadLabel(mPm).toString();
+ return getBadgedLabel(info.loadLabel(mPm).toString(), userId);
}
- /** Returns the application label */
- public String getApplicationLabel(Intent baseIntent, int userId) {
+ /**
+ * Returns the application label, badging if necessary.
+ */
+ public String getBadgedApplicationLabel(ApplicationInfo appInfo, int userId) {
if (mPm == null) return null;
// If we are mocking, then return a mock label
if (RecentsDebugFlags.Static.EnableSystemServicesProxy) {
- return "Recent Task";
+ return "Recent Task App: " + userId;
}
- ResolveInfo ri = mPm.resolveActivityAsUser(baseIntent, 0, userId);
- CharSequence label = (ri != null) ? ri.loadLabel(mPm) : null;
- return (label != null) ? label.toString() : null;
+ return getBadgedLabel(appInfo.loadLabel(mPm).toString(), userId);
}
- /** Returns the content description for a given task */
- public String getContentDescription(Intent baseIntent, int userId, String activityLabel,
- Resources res) {
- String applicationLabel = getApplicationLabel(baseIntent, userId);
- if (applicationLabel == null) {
- return getBadgedLabel(activityLabel, userId);
- }
+ /**
+ * Returns the content description for a given task, badging it if necessary. The content
+ * description joins the app and activity labels.
+ */
+ public String getBadgedContentDescription(ActivityInfo info, int userId, Resources res) {
+ String activityLabel = info.loadLabel(mPm).toString();
+ String applicationLabel = info.applicationInfo.loadLabel(mPm).toString();
String badgedApplicationLabel = getBadgedLabel(applicationLabel, userId);
return applicationLabel.equals(activityLabel) ? badgedApplicationLabel
: res.getString(R.string.accessibility_recents_task_header,
@@ -609,6 +612,22 @@ public class SystemServicesProxy {
return getBadgedIcon(icon, userId);
}
+ /**
+ * Returns the application icon for the ApplicationInfo for a user, badging if
+ * necessary.
+ */
+ public Drawable getBadgedApplicationIcon(ApplicationInfo appInfo, int userId) {
+ if (mPm == null) return null;
+
+ // If we are mocking, then return a mock label
+ if (RecentsDebugFlags.Static.EnableSystemServicesProxy) {
+ return new ColorDrawable(0xFF666666);
+ }
+
+ Drawable icon = appInfo.loadIcon(mPm);
+ return getBadgedIcon(icon, userId);
+ }
+
/**
* Returns the task description icon, loading and badging it if it necessary.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
index 822ad77e71b81..9cdd703852fe3 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoadPlan.java
@@ -25,7 +25,8 @@ import android.graphics.drawable.Drawable;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.ArraySet;
-
+import android.util.SparseArray;
+import android.util.SparseIntArray;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.recents.Recents;
@@ -92,7 +93,7 @@ public class RecentsTaskLoadPlan {
}
/**
- * An optimization to preload the raw list of tasks. The raw tasks are saved in least-recent
+ * An optimization to preload the raw list of tasks. The raw tasks are saved in least-recent
* to most-recent order.
*/
public synchronized void preloadRawTasks(boolean isTopTaskHome) {
@@ -107,7 +108,7 @@ public class RecentsTaskLoadPlan {
}
/**
- * Preloads the list of recent tasks from the system. After this call, the TaskStack will
+ * Preloads the list of recent tasks from the system. After this call, the TaskStack will
* have a list of all the recent tasks with their metadata, not including icons or
* thumbnails which were not cached and have to be loaded.
*
@@ -115,13 +116,16 @@ public class RecentsTaskLoadPlan {
* - least-recent to most-recent stack tasks
* - least-recent to most-recent freeform tasks
*/
- public synchronized void preloadPlan(RecentsTaskLoader loader, boolean isTopTaskHome) {
+ public synchronized void preloadPlan(RecentsTaskLoader loader, int topTaskId,
+ boolean isTopTaskHome) {
Resources res = mContext.getResources();
ArrayList