[am] resolve service again when resetting userId in retrieveServiceLocked()

Test: manual and no incorrect
isLoadedApkResourceDirsUpToDate() results during work profile setup

BUG: 149410951
Change-Id: If40f37612a794b8850b71ab9edbe13682c8fa05f
This commit is contained in:
Songchun Fan
2020-05-29 09:14:45 -07:00
parent dcd5bcaf10
commit 89f29261cd

View File

@@ -2460,6 +2460,16 @@ public final class ActiveServices {
&& mAm.isValidSingletonCall(callingUid, sInfo.applicationInfo.uid)) {
userId = 0;
smap = getServiceMapLocked(0);
ResolveInfo rInfoForUserId0 =
mAm.getPackageManagerInternalLocked().resolveService(service,
resolvedType, flags, userId, callingUid);
if (rInfoForUserId0 == null) {
Slog.w(TAG_SERVICE,
"Unable to resolve service " + service + " U=" + userId
+ ": not found");
return null;
}
sInfo = rInfoForUserId0.serviceInfo;
}
sInfo = new ServiceInfo(sInfo);
sInfo.applicationInfo = mAm.getAppInfoForUser(sInfo.applicationInfo, userId);