Allow multi users for building permission transfer intent

Auto uses user 10, so we need to support multi users by using
getActivityAsUser

Bug: 244429866
Test: atest CtsCompanionDeviceManagerUiAutomationTestCases

Change-Id: I5ca6db3f3427589dab34ccc34ac20379f2db48a7
This commit is contained in:
Evan Chen
2022-09-14 18:44:51 +00:00
parent a39cb4ae43
commit 8f4991fdf4

View File

@@ -150,8 +150,9 @@ public class SystemDataTransferProcessor {
// Create a PendingIntent
final long token = Binder.clearCallingIdentity();
try {
return PendingIntent.getActivity(mContext, /*requestCode */ associationId, intent,
FLAG_ONE_SHOT | FLAG_CANCEL_CURRENT | FLAG_IMMUTABLE);
return PendingIntent.getActivityAsUser(mContext, /*requestCode */ associationId, intent,
FLAG_ONE_SHOT | FLAG_CANCEL_CURRENT | FLAG_IMMUTABLE, /* options= */ null,
UserHandle.CURRENT);
} finally {
Binder.restoreCallingIdentity(token);
}