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