summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/recents
diff options
context:
space:
mode:
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/recents')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java39
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/Task.java18
3 files changed, 48 insertions, 18 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java
index 3c34e90..fd0f6d1 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java
@@ -192,8 +192,9 @@ class TaskResourceLoader implements Runnable {
" forceLoad: " + forceLoadTask);
// Load the application icon
if (loadIcon == null || forceLoadTask) {
- ActivityInfo info = ssp.getActivityInfo(t.key.baseIntent.getComponent());
- Drawable icon = ssp.getActivityIcon(info);
+ ActivityInfo info = ssp.getActivityInfo(t.key.baseIntent.getComponent(),
+ t.userId);
+ Drawable icon = ssp.getActivityIcon(info, t.userId);
if (!mCancelled) {
if (icon != null) {
Console.log(Constants.DebugFlags.App.TaskDataLoader,
@@ -411,7 +412,7 @@ public class RecentsTaskLoader {
int taskCount = tasks.size();
for (int i = 0; i < taskCount; i++) {
ActivityManager.RecentTaskInfo t = tasks.get(i);
- ActivityInfo info = ssp.getActivityInfo(t.baseIntent.getComponent());
+ ActivityInfo info = ssp.getActivityInfo(t.baseIntent.getComponent(), t.userId);
String activityLabel = (t.activityLabel == null ? ssp.getActivityLabel(info) :
t.activityLabel.toString());
Bitmap activityIcon = t.activityIcon;
@@ -437,7 +438,7 @@ public class RecentsTaskLoader {
}
}
if (task.applicationIcon == null) {
- task.applicationIcon = ssp.getActivityIcon(info);
+ task.applicationIcon = ssp.getActivityIcon(info, task.userId);
if (task.applicationIcon != null) {
mApplicationIconCache.put(task.key, task.applicationIcon);
} else {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java
index 505238d..7f0d9ee 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/SystemServicesProxy.java
@@ -18,14 +18,19 @@ package com.android.systemui.recents;
import android.app.ActivityManager;
import android.app.ActivityOptions;
+import android.app.AppGlobals;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
+import android.content.pm.IPackageManager;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
+import android.os.RemoteException;
+import android.os.UserHandle;
+import android.os.UserManager;
import java.util.ArrayList;
import java.util.List;
@@ -38,6 +43,8 @@ import java.util.Random;
public class SystemServicesProxy {
ActivityManager mAm;
PackageManager mPm;
+ IPackageManager mIpm;
+ UserManager mUm;
String mPackage;
Bitmap mDummyIcon;
@@ -46,6 +53,8 @@ public class SystemServicesProxy {
public SystemServicesProxy(Context context) {
mAm = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
mPm = context.getPackageManager();
+ mUm = (UserManager) context.getSystemService(Context.USER_SERVICE);
+ mIpm = AppGlobals.getPackageManager();
mPackage = context.getPackageName();
if (Constants.DebugFlags.App.EnableSystemServicesProxy) {
@@ -142,14 +151,19 @@ public class SystemServicesProxy {
mAm.removeTask(taskId, ActivityManager.REMOVE_TASK_KILL_PROCESS);
}
- /** Returns the activity info for a given component name */
- public ActivityInfo getActivityInfo(ComponentName cn) {
- if (mPm == null) return null;
+ /**
+ * Returns the activity info for a given component name.
+ *
+ * @param ComponentName The component name of the activity.
+ * @param userId The userId of the user that this is for.
+ */
+ public ActivityInfo getActivityInfo(ComponentName cn, int userId) {
+ if (mIpm == null) return null;
if (Constants.DebugFlags.App.EnableSystemServicesProxy) return null;
try {
- return mPm.getActivityInfo(cn, PackageManager.GET_META_DATA);
- } catch (PackageManager.NameNotFoundException e) {
+ return mIpm.getActivityInfo(cn, PackageManager.GET_META_DATA, userId);
+ } catch (RemoteException e) {
e.printStackTrace();
return null;
}
@@ -167,15 +181,22 @@ public class SystemServicesProxy {
return info.loadLabel(mPm).toString();
}
- /** Returns the activity icon */
- public Drawable getActivityIcon(ActivityInfo info) {
- if (mPm == null) return null;
+ /**
+ * Returns the activity icon for the ActivityInfo for a user, badging if
+ * necessary.
+ */
+ public Drawable getActivityIcon(ActivityInfo info, int userId) {
+ if (mPm == null || mUm == null) return null;
// If we are mocking, then return a mock label
if (Constants.DebugFlags.App.EnableSystemServicesProxy) {
return new ColorDrawable(0xFF666666);
}
- return info.loadIcon(mPm);
+ Drawable icon = info.loadIcon(mPm);
+ if (userId != UserHandle.myUserId()) {
+ icon = mUm.getBadgedDrawableForUser(icon, new UserHandle(userId));
+ }
+ return icon;
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
index 189f358..ff062f6 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
@@ -37,25 +37,33 @@ public class Task {
public static class TaskKey {
public final int id;
public final Intent baseIntent;
+ public final int userId;
- public TaskKey(int id, Intent intent) {
+ public TaskKey(int id, Intent intent, int userId) {
this.id = id;
this.baseIntent = intent;
+ this.userId = userId;
}
@Override
public boolean equals(Object o) {
- return hashCode() == o.hashCode();
+ if (!(o instanceof TaskKey)) {
+ return false;
+ }
+ return id == ((TaskKey) o).id
+ && userId == ((TaskKey) o).userId;
}
@Override
public int hashCode() {
- return id;
+ return (id << 5) + userId;
}
@Override
public String toString() {
- return "Task.Key: " + id + ", " + baseIntent.getComponent().getPackageName();
+ return "Task.Key: " + id + ", "
+ + "u" + userId + ", "
+ + baseIntent.getComponent().getPackageName();
}
}
@@ -75,7 +83,7 @@ public class Task {
public Task(int id, boolean isActive, Intent intent, String activityTitle,
Bitmap activityIcon, int userId) {
- this.key = new TaskKey(id, intent);
+ this.key = new TaskKey(id, intent, userId);
this.activityLabel = activityTitle;
this.activityIcon = activityIcon;
this.isActive = isActive;