Merge "Get application info in the correct user id" into pi-dev

am: 28a696afb4

Change-Id: I763a8fae339cb9ca56b713c695d3e97e3c46c3d5
This commit is contained in:
Tony Mak
2018-03-26 17:15:29 +00:00
committed by android-build-merger

View File

@@ -202,7 +202,9 @@ public class PermissionMonitor {
// Only using the first package name. There may be multiple names if multiple
// apps share the same UID, but in that case they also share permissions so
// querying with any of the names will return the same results.
final PackageInfo app = mPackageManager.getPackageInfo(names[0], GET_PERMISSIONS);
int userId = UserHandle.getUserId(uid);
final PackageInfo app = mPackageManager.getPackageInfoAsUser(
names[0], GET_PERMISSIONS, userId);
return hasUseBackgroundNetworksPermission(app);
} catch (NameNotFoundException e) {
// App not found.