Use bpf map based isUidNetworkingBlocked on V+

NetworkPolicyManager#isUidNetworkingBlocked does not know about some
firewall chains status(e.g. FIREWALL_CHAIN_OEM_DENY_1)
So BpfNetMaps#isUidNetworkingBlocked is more correct but there could be
some behavior difference.
To avoid breaking devices and have longer verification time, this CL
updates to use BpfNetMaps#isUidNetworkingBlocked only on V+ devices.

Bug: 328732146
Test: TH
Change-Id: I60f84a5fff90386103692841dead465652249446
This commit is contained in:
Motomu Utsumi 2024-03-15 19:08:01 +09:00
commit 9b272fa53a

View file

@ -2235,7 +2235,11 @@ public class ConnectivityService extends IConnectivityManager.Stub
final long ident = Binder.clearCallingIdentity();
try {
final boolean metered = nc == null ? true : nc.isMetered();
return mPolicyManager.isUidNetworkingBlocked(uid, metered);
if (mDeps.isAtLeastV()) {
return mBpfNetMaps.isUidNetworkingBlocked(uid, metered);
} else {
return mPolicyManager.isUidNetworkingBlocked(uid, metered);
}
} finally {
Binder.restoreCallingIdentity(ident);
}