Add a null check in canForwardTo for getProfileParent.
PackageManagerService#canForwardTo assumes the method is called from a work profile. However, with the new changes in the intent resolver and share sheet, we use this method from the personal profile as well, in order to determine if an intent is cross-profile or not. Without this null check, we get a NPE when we call canForwardTo from the personal profile. Test: CTS tests are not relevant in this case, as PackageManagerService#canForwardTo is not a public API and the only place it's called from is IntentForwarderActivity, which does not have CTS coverage. Fixes: 149311698 Change-Id: I172f572920c258723b6a51ac35f2abc0c3aabbf8
This commit is contained in:
committed by
Antoan Angelov
parent
06092ad9d6
commit
c77699997d
@@ -6698,6 +6698,9 @@ public class PackageManagerService extends IPackageManager.Stub
|
||||
// cross-profile app linking works only towards the parent.
|
||||
final int callingUid = Binder.getCallingUid();
|
||||
final UserInfo parent = getProfileParent(sourceUserId);
|
||||
if (parent == null) {
|
||||
return false;
|
||||
}
|
||||
synchronized (mLock) {
|
||||
int flags = updateFlagsForResolve(0, parent.id, callingUid,
|
||||
false /*includeInstantApps*/);
|
||||
|
||||
Reference in New Issue
Block a user