Merge "Replace NetworkPolicyManagerInternal#isUidRestrictedOnMeteredNetworks()"

This commit is contained in:
Paul Hu
2021-01-22 14:18:47 +00:00
committed by Gerrit Code Review

View File

@@ -5714,9 +5714,14 @@ public class ConnectivityService extends IConnectivityManager.Stub
// Policy already enforced.
return;
}
if (mPolicyManagerInternal.isUidRestrictedOnMeteredNetworks(uid)) {
// If UID is restricted, don't allow them to bring up metered APNs.
networkCapabilities.addCapability(NET_CAPABILITY_NOT_METERED);
final long ident = Binder.clearCallingIdentity();
try {
if (mPolicyManager.isUidRestrictedOnMeteredNetworks(uid)) {
// If UID is restricted, don't allow them to bring up metered APNs.
networkCapabilities.addCapability(NET_CAPABILITY_NOT_METERED);
}
} finally {
Binder.restoreCallingIdentity(ident);
}
}