Pass callingPackage in UserLifecycleTest#startApp
Calling IActivityTaskManager#startActivity requires the callingPackage
to be set correctly as of ag/8668823, otherwise a SecurityException is
thrown.
Bug: 138095678
Test: Enable multi-user by declaring the
"android.software.managed_users" feature and setting
"config_multiuserMaximumUsers" to greather than 1. Then:
`atest android.multiuser.UserLifecycleTests#managedProfileUnlockAndLaunchApp`
Change-Id: Iab7cf0198a02a976ef5c54e4b87fb127aa7eac9a
This commit is contained in:
@@ -530,10 +530,10 @@ public class UserLifecycleTests {
|
||||
*/
|
||||
private void startApp(int userId, String packageName) throws RemoteException {
|
||||
final Context context = InstrumentationRegistry.getContext();
|
||||
final WaitResult result = ActivityTaskManager.getService().startActivityAndWait(null, null,
|
||||
context.getPackageManager().getLaunchIntentForPackage(packageName),
|
||||
null, null, null, 0, 0, null, null,
|
||||
userId);
|
||||
final WaitResult result = ActivityTaskManager.getService().startActivityAndWait(null,
|
||||
context.getPackageName(),
|
||||
context.getPackageManager().getLaunchIntentForPackage(packageName), null, null,
|
||||
null, 0, 0, null, null, userId);
|
||||
attestTrue("User " + userId + " failed to start " + packageName,
|
||||
result.result == ActivityManager.START_SUCCESS);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user