From afaed1a5e08037b028b2a2038015a74d1d7143f8 Mon Sep 17 00:00:00 2001 From: Chalard Jean Date: Thu, 21 Nov 2019 14:48:00 +0900 Subject: [PATCH] Cut the dependency to APN constants With Telephony moving to Mainline these constants are not accessible any more, and should not be made public. As they are only used by a deprecated method that can only be called by apps with a target SDK < M and only for one of the features it used to handle, copying the constants until this method is completely removed is the simplest way to go. Test: FrameworksNetTests Bug: 144454341 Change-Id: Iea18c8d2f2c8a40f04db9383d3f74b917267ba25 --- core/java/android/net/ConnectivityManager.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/core/java/android/net/ConnectivityManager.java b/core/java/android/net/ConnectivityManager.java index 87e72f7b7a..56bacf29ac 100644 --- a/core/java/android/net/ConnectivityManager.java +++ b/core/java/android/net/ConnectivityManager.java @@ -58,7 +58,6 @@ import android.util.Log; import android.util.SparseIntArray; import com.android.internal.annotations.GuardedBy; -import com.android.internal.telephony.PhoneConstants; import com.android.internal.util.Preconditions; import com.android.internal.util.Protocol; @@ -711,6 +710,12 @@ public class ConnectivityManager { @Deprecated public static final int TYPE_TEST = 18; // TODO: Remove this once NetworkTypes are unused. + // Deprecated constants for return values of startUsingNetworkFeature. They used to live + // in com.android.internal.telephony.PhoneConstants until they were made inaccessible. + private static final int DEPRECATED_PHONE_CONSTANT_APN_ALREADY_ACTIVE = 0; + private static final int DEPRECATED_PHONE_CONSTANT_APN_REQUEST_STARTED = 1; + private static final int DEPRECATED_PHONE_CONSTANT_APN_REQUEST_FAILED = 3; + /** {@hide} */ public static final int MAX_RADIO_TYPE = TYPE_TEST; @@ -1407,7 +1412,7 @@ public class ConnectivityManager { if (netCap == null) { Log.d(TAG, "Can't satisfy startUsingNetworkFeature for " + networkType + ", " + feature); - return PhoneConstants.APN_REQUEST_FAILED; + return DEPRECATED_PHONE_CONSTANT_APN_REQUEST_FAILED; } NetworkRequest request = null; @@ -1417,9 +1422,9 @@ public class ConnectivityManager { Log.d(TAG, "renewing startUsingNetworkFeature request " + l.networkRequest); renewRequestLocked(l); if (l.currentNetwork != null) { - return PhoneConstants.APN_ALREADY_ACTIVE; + return DEPRECATED_PHONE_CONSTANT_APN_ALREADY_ACTIVE; } else { - return PhoneConstants.APN_REQUEST_STARTED; + return DEPRECATED_PHONE_CONSTANT_APN_REQUEST_STARTED; } } @@ -1427,10 +1432,10 @@ public class ConnectivityManager { } if (request != null) { Log.d(TAG, "starting startUsingNetworkFeature for request " + request); - return PhoneConstants.APN_REQUEST_STARTED; + return DEPRECATED_PHONE_CONSTANT_APN_REQUEST_STARTED; } else { Log.d(TAG, " request Failed"); - return PhoneConstants.APN_REQUEST_FAILED; + return DEPRECATED_PHONE_CONSTANT_APN_REQUEST_FAILED; } }