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. // Policy already enforced.
return; return;
} }
if (mPolicyManagerInternal.isUidRestrictedOnMeteredNetworks(uid)) { final long ident = Binder.clearCallingIdentity();
// If UID is restricted, don't allow them to bring up metered APNs. try {
networkCapabilities.addCapability(NET_CAPABILITY_NOT_METERED); 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);
} }
} }