Skip to content

Commit 203a2f4

Browse files
author
Amith Yamasani
committed
Fix launching home when there are multiple launchers installed
Bug: 7283782 Since ResolverActivity now runs in the correct user, it doesn't need to explicitly pass in the calling userId. In fact, for the Home case, since ActivityManager is the one requesting resolution of Home activity, Resolver is running as user 0 instead of the current user. Removing explicit calls based on the launchingUid fixes the problem. Change-Id: I4676c155aafaa0dd5cefb1acefa0e7e9c1e20f25
1 parent 33c3689 commit 203a2f4

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

core/java/com/android/internal/app/ResolverActivity.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ protected void onCreate(Bundle savedInstanceState, Intent intent,
150150

151151
resizeGrid();
152152
} else if (count == 1) {
153-
startActivityAsUser(mAdapter.intentForPosition(0),
154-
new UserHandle(UserHandle.getUserId(mLaunchedFromUid)));
153+
startActivity(mAdapter.intentForPosition(0));
155154
mPackageMonitor.unregister();
156155
mRegistered = false;
157156
finish();
@@ -364,20 +363,20 @@ protected void onIntentSelected(ResolveInfo ri, Intent intent, boolean alwaysChe
364363
if (r.match > bestMatch) bestMatch = r.match;
365364
}
366365
getPackageManager().addPreferredActivity(filter, bestMatch, set,
367-
intent.getComponent(), UserHandle.getUserId(mLaunchedFromUid));
366+
intent.getComponent());
368367
}
369368
}
370369

371370
if (intent != null) {
372-
startActivityAsUser(intent, new UserHandle(UserHandle.getUserId(mLaunchedFromUid)));
371+
startActivity(intent);
373372
}
374373
}
375374

376375
void showAppDetails(ResolveInfo ri) {
377376
Intent in = new Intent().setAction("android.settings.APPLICATION_DETAILS_SETTINGS")
378377
.setData(Uri.fromParts("package", ri.activityInfo.packageName, null))
379378
.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
380-
startActivityAsUser(in, new UserHandle(UserHandle.getUserId(mLaunchedFromUid)));
379+
startActivity(in);
381380
}
382381

383382
private final class DisplayResolveInfo {
@@ -436,10 +435,9 @@ private void rebuildList() {
436435
if (mBaseResolveList != null) {
437436
mCurrentResolveList = mBaseResolveList;
438437
} else {
439-
mCurrentResolveList = mPm.queryIntentActivitiesAsUser(
438+
mCurrentResolveList = mPm.queryIntentActivities(
440439
mIntent, PackageManager.MATCH_DEFAULT_ONLY
441-
| (mAlwaysUseOption ? PackageManager.GET_RESOLVED_FILTER : 0),
442-
UserHandle.getUserId(mLaunchedFromUid));
440+
| (mAlwaysUseOption ? PackageManager.GET_RESOLVED_FILTER : 0));
443441
// Filter out any activities that the launched uid does not
444442
// have permission for. We don't do this when we have an explicit
445443
// list of resolved activities, because that only happens when

0 commit comments

Comments
 (0)