Merge "Add in sandbox UIDs when configuring VPN." am: 1cdbdd902d

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2073688

Change-Id: Ideac20a8ec70ab7c9f97df9e8c74938bb89ca05d
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Martijn Coenen
2022-05-12 12:20:34 +00:00
committed by Automerger Merge Worker

View File

@@ -1621,11 +1621,17 @@ public class Vpn {
}
// 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) {
SortedSet<Integer> uids = new TreeSet<>();
for (String app : packageNames) {
int uid = getAppUid(app, userId);
if (uid != -1) uids.add(uid);
if (Process.isApplicationUid(uid)) {
uids.add(Process.toSdkSandboxUid(uid));
}
}
return uids;
}