Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c06d788e authored by Chalard Jean's avatar Chalard Jean
Browse files

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
parent 54543bb4
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -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;
        }
    }