summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlucaslin <lucaslin@google.com>2020-11-13 10:23:35 +0800
committerLucas Lin <lucaslin@google.com>2020-11-17 07:07:29 +0000
commitff493c4f0a75d1a218a206332b36ebcf5c13dfd7 (patch)
treef6488bd58334fe1b48bd0d9ebddf30c2a7cb9eea
parent464bc344a5892167915837c444e0dccf76032528 (diff)
Don't use @hide API - ConnectivityManager#getNetworkTypeName()
To prevent calling @hide API, print definition of network type directly instead of calling @hide API. Bug: 172183305 Test: atest FrameworksNetTests Test: atest CtsNetTestCasesLatestSdk Test: Setup a platform VPN and enable VPN always-on, then check the log. Change-Id: I807e90537f706face51c5cc221490ea742d22a0e
-rw-r--r--services/core/java/com/android/server/net/LockdownVpnTracker.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/services/core/java/com/android/server/net/LockdownVpnTracker.java b/services/core/java/com/android/server/net/LockdownVpnTracker.java
index 0b774df3fe2f..64c3c289163e 100644
--- a/services/core/java/com/android/server/net/LockdownVpnTracker.java
+++ b/services/core/java/com/android/server/net/LockdownVpnTracker.java
@@ -16,6 +16,7 @@
package com.android.server.net;
+import static android.net.ConnectivityManager.TYPE_NONE;
import static android.provider.Settings.ACTION_VPN_SETTINGS;
import static com.android.server.connectivity.NetworkNotificationManager.NOTIFICATION_CHANNEL_VPN;
@@ -27,7 +28,6 @@ import android.app.NotificationManager;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
-import android.net.ConnectivityManager;
import android.net.LinkAddress;
import android.net.LinkProperties;
import android.net.NetworkInfo;
@@ -125,12 +125,11 @@ public class LockdownVpnTracker {
final boolean egressChanged = egressProp == null
|| !TextUtils.equals(mAcceptedEgressIface, egressProp.getInterfaceName());
- final String egressTypeName = (egressInfo == null) ?
- null : ConnectivityManager.getNetworkTypeName(egressInfo.getType());
+ final int egressType = (egressInfo == null) ? TYPE_NONE : egressInfo.getType();
final String egressIface = (egressProp == null) ?
null : egressProp.getInterfaceName();
- Slog.d(TAG, "handleStateChanged: egress=" + egressTypeName +
- " " + mAcceptedEgressIface + "->" + egressIface);
+ Slog.d(TAG, "handleStateChanged: egress=" + egressType
+ + " " + mAcceptedEgressIface + "->" + egressIface);
if (egressDisconnected || egressChanged) {
mAcceptedEgressIface = null;
@@ -141,7 +140,6 @@ public class LockdownVpnTracker {
return;
}
- final int egressType = egressInfo.getType();
if (vpnInfo.getDetailedState() == DetailedState.FAILED) {
EventLogTags.writeLockdownVpnError(egressType);
}