Merge "Add in sandbox UIDs when configuring VPN." into tm-dev am: a8455d088b
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17884328 Change-Id: I40769c3fa54ffd3d2d37574c116ae674ca73c98c Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -1533,11 +1533,17 @@ public class Vpn {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Note: Return type guarantees results are deduped and sorted, which callers require.
|
// Note: Return type guarantees results are deduped and sorted, which callers require.
|
||||||
|
// This method also adds the SDK sandbox UIDs corresponding to the applications by default,
|
||||||
|
// since apps are generally not aware of them, yet they should follow the VPN configuration
|
||||||
|
// of the app they belong to.
|
||||||
private SortedSet<Integer> getAppsUids(List<String> packageNames, int userId) {
|
private SortedSet<Integer> getAppsUids(List<String> packageNames, int userId) {
|
||||||
SortedSet<Integer> uids = new TreeSet<>();
|
SortedSet<Integer> uids = new TreeSet<>();
|
||||||
for (String app : packageNames) {
|
for (String app : packageNames) {
|
||||||
int uid = getAppUid(app, userId);
|
int uid = getAppUid(app, userId);
|
||||||
if (uid != -1) uids.add(uid);
|
if (uid != -1) uids.add(uid);
|
||||||
|
if (Process.isApplicationUid(uid)) {
|
||||||
|
uids.add(Process.toSdkSandboxUid(uid));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return uids;
|
return uids;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user