Temporarily change uid to appId
Due to b/192431153, PermissionMonitor only apply permission to
app id which is listed in settings. Thus, temporarily change uid
to appId.
Bug: 192116643
Test: atest ConnectivityManagerTest#testUidsAllowedOnRestricted\
Networks with system & secondary user.
Original-Change: https://android-review.googlesource.com/1770606
Merged-In: Iadec66344d88bd80170cd5441270b768cdbe0917
Change-Id: Iadec66344d88bd80170cd5441270b768cdbe0917
This commit is contained in:
committed by
Paul Hu
parent
8920d32880
commit
bf92c036e2
@@ -281,7 +281,14 @@ public class PermissionMonitor {
|
||||
@VisibleForTesting
|
||||
synchronized void updateUidsAllowedOnRestrictedNetworks(final Set<Integer> uids) {
|
||||
mUidsAllowedOnRestrictedNetworks.clear();
|
||||
mUidsAllowedOnRestrictedNetworks.addAll(uids);
|
||||
// This is necessary for the app id to match in isUidAllowedOnRestrictedNetworks, and will
|
||||
// grant the permission to all uids associated with the app ID. This is safe even if the app
|
||||
// is only installed on some users because the uid cannot match some other app – this uid is
|
||||
// in effect not installed and can't be run.
|
||||
// TODO (b/192431153): Change appIds back to uids.
|
||||
for (int uid : uids) {
|
||||
mUidsAllowedOnRestrictedNetworks.add(UserHandle.getAppId(uid));
|
||||
}
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
|
||||
Reference in New Issue
Block a user