Fix am start -S <package>
Previously, am start <package> and am start -S <package> had different behaviors because the -S code path did not convert the default user id (by calling handleIncomingUser) into a proper userId that is uses for querying intent activities. The default user id is converted in other code paths, so we do not convert it inside of makeIntent, but only in the mStopOption path, right before queryIntentActivities. Test: adb shell am start -S com.android.chrome Test: adb shell run-as com.example.zhin am start (same as P) IllegalArgumentException: No intent supplied Test: adb shell run-as com.example.zhin am start com.example.zhin (same as P) Security exception: Permission Denial: startActivityAsUser asks to run as user -2 but is calling from uid u0a193; this requires android.permission.INTERACT_ACROSS_USERS_FULL Test: adb shell run-as com.example.zhin am start --user 0 com.example.zhin (same as P) Starting: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] pkg=com.example.zhin } Error: Activity not started, unable to resolve Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 pkg=com.example.zhin } Bug: 129712542 Change-Id: I3ce6ffd40fd834bffd28b4440c1fb0024c799d95
Loading
Please register or sign in to comment