Address comments at aosp/2361702
Test: 1. Patch local built module on T device
2. atest ConnectivityCoverageTests:android.net.connectivity.com.android.server.ConnectivityServiceTest
Fix: 267968887
Change-Id: I86e5be9a0cee0621ff9ef0996d56a51fc5f408c2
diff --git a/service/src/com/android/server/ConnectivityService.java b/service/src/com/android/server/ConnectivityService.java
index cd4421b..3250465 100755
--- a/service/src/com/android/server/ConnectivityService.java
+++ b/service/src/com/android/server/ConnectivityService.java
@@ -8802,6 +8802,9 @@
}
private void updateProfileAllowedNetworks() {
+ // Netd command is not implemented before U.
+ if (!SdkLevel.isAtLeastU()) return;
+
ensureRunningOnConnectivityServiceThread();
final ArrayList<NativeUidRangeConfig> configs = new ArrayList<>();
final List<UserHandle> users = mContext.getSystemService(UserManager.class)
@@ -8832,8 +8835,10 @@
mNetd.setNetworkAllowlist(configs.toArray(new NativeUidRangeConfig[0]));
} catch (ServiceSpecificException e) {
// Has the interface disappeared since the network was built?
+ Log.wtf(TAG, "Unexpected ServiceSpecificException", e);
} catch (RemoteException e) {
- // Netd died. This usually causes a runtime restart anyway.
+ // Netd died. This will cause a runtime restart anyway.
+ Log.wtf(TAG, "Unexpected RemoteException", e);
}
}