diff options
6 files changed, 18 insertions, 10 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java index ab2ad966e97f..eb09335c9565 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentTasksLoader.java @@ -156,7 +156,7 @@ public class RecentTasksLoader implements View.OnTouchListener { // Create an TaskDescription, returning null if the title or icon is null TaskDescription createTaskDescription(int taskId, int persistentTaskId, Intent baseIntent, - ComponentName origActivity, CharSequence description) { + ComponentName origActivity, CharSequence description, int userId) { Intent intent = new Intent(baseIntent); if (origActivity != null) { intent.setComponent(origActivity); @@ -175,7 +175,7 @@ public class RecentTasksLoader implements View.OnTouchListener { TaskDescription item = new TaskDescription(taskId, persistentTaskId, resolveInfo, baseIntent, info.packageName, - description); + description, userId); item.setLabel(title); return item; @@ -391,7 +391,8 @@ public class RecentTasksLoader implements View.OnTouchListener { item = createTaskDescription(recentInfo.id, recentInfo.persistentId, recentInfo.baseIntent, - recentInfo.origActivity, recentInfo.description); + recentInfo.origActivity, recentInfo.description, + recentInfo.userId); if (item != null) { loadThumbnailAndIcon(item); } @@ -474,7 +475,8 @@ public class RecentTasksLoader implements View.OnTouchListener { TaskDescription item = createTaskDescription(recentInfo.id, recentInfo.persistentId, recentInfo.baseIntent, - recentInfo.origActivity, recentInfo.description); + recentInfo.origActivity, recentInfo.description, + recentInfo.userId); if (item != null) { while (true) { diff --git a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java index ef5604474baf..98bdee0c16ea 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java +++ b/packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java @@ -689,7 +689,7 @@ public class RecentsPanelView extends FrameLayout implements OnItemClickListener if (DEBUG) Log.v(TAG, "Starting activity " + intent); try { context.startActivityAsUser(intent, opts, - new UserHandle(UserHandle.USER_CURRENT)); + new UserHandle(ad.userId)); } catch (SecurityException e) { Log.e(TAG, "Recents does not have the permission to launch " + intent, e); } catch (ActivityNotFoundException e) { diff --git a/packages/SystemUI/src/com/android/systemui/recent/TaskDescription.java b/packages/SystemUI/src/com/android/systemui/recent/TaskDescription.java index 2e0ee3606956..5ad965f427a0 100644 --- a/packages/SystemUI/src/com/android/systemui/recent/TaskDescription.java +++ b/packages/SystemUI/src/com/android/systemui/recent/TaskDescription.java @@ -16,6 +16,7 @@ package com.android.systemui.recent; +import android.os.UserHandle; import android.content.Intent; import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; @@ -27,6 +28,7 @@ public final class TaskDescription { final Intent intent; // launch intent for application final String packageName; // used to override animations (see onClick()) final CharSequence description; + final int userId; private Drawable mThumbnail; // generated by Activity.onCreateThumbnail() private Drawable mIcon; // application package icon @@ -35,7 +37,7 @@ public final class TaskDescription { public TaskDescription(int _taskId, int _persistentTaskId, ResolveInfo _resolveInfo, Intent _intent, - String _packageName, CharSequence _description) { + String _packageName, CharSequence _description, int _userId) { resolveInfo = _resolveInfo; intent = _intent; taskId = _taskId; @@ -43,6 +45,7 @@ public final class TaskDescription { description = _description; packageName = _packageName; + userId = _userId; } public TaskDescription() { @@ -53,6 +56,7 @@ public final class TaskDescription { description = null; packageName = null; + userId = UserHandle.USER_NULL; } public void setLoaded(boolean loaded) { diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java index e193a95420f8..d661f287c13c 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java +++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsTaskLoader.java @@ -414,7 +414,7 @@ public class RecentsTaskLoader { // Create a new task Task task = new Task(t.persistentId, (t.id > -1), t.baseIntent, activityLabel, - activityIcon); + activityIcon, t.userId); // Preload the specified number of apps if (i >= (taskCount - preloadCount)) { 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 ed2ab2a5b91f..a0ff3b7dda8c 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java +++ b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java @@ -65,15 +65,17 @@ public class Task { public Bitmap activityIcon; public Bitmap thumbnail; public boolean isActive; + public int userId; TaskCallbacks mCb; public Task(int id, boolean isActive, Intent intent, String activityTitle, - Bitmap activityIcon) { + Bitmap activityIcon, int userId) { this.key = new TaskKey(id, intent); this.activityLabel = activityTitle; this.activityIcon = activityIcon; this.isActive = isActive; + this.userId = userId; } /** Set the callbacks */ 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 cb5279490ff0..1ebe2317883e 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java +++ b/packages/SystemUI/src/com/android/systemui/recents/views/RecentsView.java @@ -257,9 +257,9 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV try { if (opts != null) { getContext().startActivityAsUser(i, opts.toBundle(), - UserHandle.CURRENT); + new UserHandle(task.userId)); } else { - getContext().startActivityAsUser(i, UserHandle.CURRENT); + getContext().startActivityAsUser(i, new UserHandle(task.userId)); } } catch (ActivityNotFoundException anfe) { Console.logError(getContext(), "Could not start Activity"); |