Skip to content

Commit 8da429e

Browse files
author
Dianne Hackborn
committed
Fix issue #7209355, #7214271.
Issue #7209355: Intent on the secondary user results in an intent picker in the Primary user. Issue #7214271: Crash in system UI Also fix a bug where I recently broke the removeTask() operation in the activity manager where it would remove the wrong task. Change-Id: I448c73a0e83a78d9d8d96b4629658c169888d275
1 parent c9e94ea commit 8da429e

File tree

5 files changed

+32
-6
lines changed

5 files changed

+32
-6
lines changed

api/current.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6769,6 +6769,7 @@ package android.content.pm {
67696769

67706770
public class ResolveInfo implements android.os.Parcelable {
67716771
ctor public ResolveInfo();
6772+
ctor public ResolveInfo(android.content.pm.ResolveInfo);
67726773
method public int describeContents();
67736774
method public void dump(android.util.Printer, java.lang.String);
67746775
method public final int getIconResource();

core/java/android/content/pm/ResolveInfo.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,21 @@ public void dump(Printer pw, String prefix) {
230230
public ResolveInfo() {
231231
}
232232

233+
public ResolveInfo(ResolveInfo orig) {
234+
activityInfo = orig.activityInfo;
235+
serviceInfo = orig.serviceInfo;
236+
filter = orig.filter;
237+
priority = orig.priority;
238+
preferredOrder = orig.preferredOrder;
239+
match = orig.match;
240+
specificIndex = orig.specificIndex;
241+
labelRes = orig.labelRes;
242+
nonLocalizedLabel = orig.nonLocalizedLabel;
243+
icon = orig.icon;
244+
resolvePackageName = orig.resolvePackageName;
245+
system = orig.system;
246+
}
247+
233248
public String toString() {
234249
ComponentInfo ci = activityInfo != null ? activityInfo : serviceInfo;
235250
return "ResolveInfo{"

packages/SystemUI/src/com/android/systemui/recent/RecentsPanelView.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -538,12 +538,14 @@ public void onTasksLoaded(ArrayList<TaskDescription> tasks, boolean firstScreenf
538538
}
539539

540540
private void updateUiElements() {
541-
final int items = mRecentTaskDescriptions.size();
541+
final int items = mRecentTaskDescriptions != null
542+
? mRecentTaskDescriptions.size() : 0;
542543

543544
mRecentsContainer.setVisibility(items > 0 ? View.VISIBLE : View.GONE);
544545

545546
// Set description for accessibility
546-
int numRecentApps = mRecentTaskDescriptions.size();
547+
int numRecentApps = mRecentTaskDescriptions != null
548+
? mRecentTaskDescriptions.size() : 0;
547549
String recentAppsAccessibilityDescription;
548550
if (numRecentApps == 0) {
549551
recentAppsAccessibilityDescription =

services/java/com/android/server/am/ActivityStack.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4387,6 +4387,8 @@ public TaskAccessInfo getTaskAccessInfoLocked(int taskId, boolean inclThumbs) {
43874387
while (j < NA) {
43884388
ActivityRecord ar = mHistory.get(j);
43894389
if (!ar.finishing && ar.task.taskId == taskId) {
4390+
thumbs.root = ar;
4391+
thumbs.rootIndex = j;
43904392
holder = ar.thumbHolder;
43914393
if (holder != null) {
43924394
thumbs.mainThumbnail = holder.lastThumbnail;
@@ -4401,9 +4403,6 @@ public TaskAccessInfo getTaskAccessInfoLocked(int taskId, boolean inclThumbs) {
44014403
return thumbs;
44024404
}
44034405

4404-
thumbs.root = mHistory.get(j);
4405-
thumbs.rootIndex = j;
4406-
44074406
ArrayList<TaskAccessInfo.SubTask> subtasks = new ArrayList<TaskAccessInfo.SubTask>();
44084407
thumbs.subtasks = subtasks;
44094408
while (j < NA) {

services/java/com/android/server/pm/PackageManagerService.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2488,6 +2488,15 @@ private ResolveInfo chooseBestActivity(Intent intent, String resolvedType,
24882488
if (ri != null) {
24892489
return ri;
24902490
}
2491+
if (userId != 0) {
2492+
ri = new ResolveInfo(mResolveInfo);
2493+
ri.activityInfo = new ActivityInfo(ri.activityInfo);
2494+
ri.activityInfo.applicationInfo = new ApplicationInfo(
2495+
ri.activityInfo.applicationInfo);
2496+
ri.activityInfo.applicationInfo.uid = UserHandle.getUid(userId,
2497+
UserHandle.getAppId(ri.activityInfo.applicationInfo.uid));
2498+
return ri;
2499+
}
24912500
return mResolveInfo;
24922501
}
24932502
}
@@ -3668,7 +3677,7 @@ private PackageParser.Package scanPackageLI(PackageParser.Package pkg,
36683677
mResolveActivity.applicationInfo = mAndroidApplication;
36693678
mResolveActivity.name = ResolverActivity.class.getName();
36703679
mResolveActivity.packageName = mAndroidApplication.packageName;
3671-
mResolveActivity.processName = mAndroidApplication.processName;
3680+
mResolveActivity.processName = "system:ui";
36723681
mResolveActivity.launchMode = ActivityInfo.LAUNCH_MULTIPLE;
36733682
mResolveActivity.flags = ActivityInfo.FLAG_EXCLUDE_FROM_RECENTS;
36743683
mResolveActivity.theme = com.android.internal.R.style.Theme_Holo_Dialog_Alert;

0 commit comments

Comments
 (0)