Replace NetworkPolicyManagerInternal#isUidRestrictedOnMeteredNetworks()
Connectivity service is going to become a mainline module which will not able to access hidden APIs. NetworkPolicyManagerInternal is a internal serivce that CS can't be access after be a mainline module. Thus, create NPMS#isUidRestrictedOnMeteredNetworks() and NPM#isUidRestrictedOnMeteredNetworks() to replace NPMI#isUidRestrictedOnMeteredNetworks(). Also correct the permission check in isUidNetworkingBlocked() that needs to check OBSERVE_NETWORK_POLICY only. Bug: 170598012 Test: atest FrameworksNetTests Test: atest FrameworksCoreTests:NetworkPolicyManagerTest Test: atest FrameworksServicesTests:NetworkPolicyManagerServiceTest Test: atest CtsNetTestCases Test: atest CtsHostsideNetworkTests Change-Id: I5801a3a2076f3eb199a0226c38c85014b26c64e7
This commit is contained in:
parent
bf49c1948a
commit
af50d7d24e
1 changed files with 8 additions and 3 deletions
|
|
@ -5777,9 +5777,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue