Merge "Launch recents with the correct user."
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -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 */
|
||||
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user