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

Commit f24f9a73 authored by Jack Yu's avatar Jack Yu Committed by Gerrit Code Review
Browse files

Merge changes from topics "getApnTypeString", "qns_switched_pref"

* changes:
  [Telephony] Clean up: use getApnTypeString instead of getApnTypeStringInternal
  Disallow data when QNS switched the preference
parents 83e8ee8d e607c72f
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -375,7 +375,7 @@ public class RetryManager {
                        if (splitStr.length == 2) {
                            String apnTypeStr = splitStr[0].trim();
                            // Check if this retry pattern is for the APN we want.
                            if (apnTypeStr.equals(ApnSetting.getApnTypeStringInternal(apnType))) {
                            if (apnTypeStr.equals(ApnSetting.getApnTypeString(apnType))) {
                                // Extract the config string. Note that an empty string is valid
                                // here, meaning no retry for the specified APN.
                                configString = splitStr[1];
@@ -697,7 +697,7 @@ public class RetryManager {

    public String toString() {
        if (mConfig == null) return "";
        return "RetryManager: apnType=" + ApnSetting.getApnTypeStringInternal(apnType)
        return "RetryManager: apnType=" + ApnSetting.getApnTypeString(apnType)
                + " mRetryCount="
                + mRetryCount + " mMaxRetryCount=" + mMaxRetryCount + " mCurrentApnIndex="
                + mCurrentApnIndex + " mSameApnRtryCount=" + mSameApnRetryCount
@@ -709,6 +709,6 @@ public class RetryManager {

    @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
    private void log(String s) {
        Rlog.d(LOG_TAG, "[" + ApnSetting.getApnTypeStringInternal(apnType) + "] " + s);
        Rlog.d(LOG_TAG, "[" + ApnSetting.getApnTypeString(apnType) + "] " + s);
    }
}
+3 −3
Original line number Diff line number Diff line
@@ -147,7 +147,7 @@ public class AccessNetworksManager extends Handler {
                accessNetworkStrings.add(AccessNetworkType.toString(network));
            }
            return "[QualifiedNetworks: apnType="
                    + ApnSetting.getApnTypeStringInternal(apnType)
                    + ApnSetting.getApnTypeString(apnType)
                    + ", networks="
                    + Arrays.stream(qualifiedNetworks)
                    .mapToObj(type -> AccessNetworkType.toString(type))
@@ -475,9 +475,9 @@ public class AccessNetworksManager extends Handler {

        for (int i = 0; i < mAvailableNetworks.size(); i++) {
            pw.println("APN type "
                    + ApnSetting.getApnTypeStringInternal(mAvailableNetworks.keyAt(i))
                    + ApnSetting.getApnTypeString(mAvailableNetworks.keyAt(i))
                    + ": [" + Arrays.stream(mAvailableNetworks.valueAt(i))
                    .mapToObj(type -> AccessNetworkType.toString(type))
                    .mapToObj(AccessNetworkType::toString)
                    .collect(Collectors.joining(",")) + "]");
        }
        pw.decreaseIndent();
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ public class ApnContext {
     * @param priority Priority of APN type
     */
    public ApnContext(Phone phone, int typeId, String logTag, DcTracker tracker, int priority) {
        this(phone, ApnSetting.getApnTypeStringInternal(typeId), logTag, tracker, priority);
        this(phone, ApnSetting.getApnTypeString(typeId), logTag, tracker, priority);
    }

    /**
+3 −3
Original line number Diff line number Diff line
@@ -162,8 +162,8 @@ public class ApnSettingUtils {
                    + Arrays.toString(meteredApnSet.toArray()));
        }

        if (meteredApnSet.contains(ApnSetting.getApnTypeStringInternal(apnType))) {
            if (DBG) Rlog.d(LOG_TAG, ApnSetting.getApnTypeStringInternal(apnType) + " is metered.");
        if (meteredApnSet.contains(ApnSetting.getApnTypeString(apnType))) {
            if (DBG) Rlog.d(LOG_TAG, ApnSetting.getApnTypeString(apnType) + " is metered.");
            return true;
        } else if (apnType == ApnSetting.TYPE_ALL) {
            // Assuming no configuration error, if at least one APN type is
@@ -174,7 +174,7 @@ public class ApnSettingUtils {
            }
        }

        if (DBG) Rlog.d(LOG_TAG, ApnSetting.getApnTypeStringInternal(apnType) + " is not metered.");
        if (DBG) Rlog.d(LOG_TAG, ApnSetting.getApnTypeString(apnType) + " is not metered.");
        return false;
    }

+27 −15
Original line number Diff line number Diff line
@@ -50,12 +50,12 @@ public class DataConnectionReasons {
    public String toString() {
        StringBuilder reasonStr = new StringBuilder();
        if (mDataDisallowedReasonSet.size() > 0) {
            reasonStr.append("Data disallowed, reasons:");
            reasonStr.append("Data disallowed reasons:");
            for (DataDisallowedReasonType reason : mDataDisallowedReasonSet) {
                reasonStr.append(" ").append(reason);
            }
        } else {
            reasonStr.append("Data allowed, reason:");
            reasonStr.append("Data allowed reason:");
            reasonStr.append(" ").append(mDataAllowedReason);
        }
        return reasonStr.toString();
@@ -100,9 +100,13 @@ public class DataConnectionReasons {
    // Disallowed reasons. There could be multiple reasons if data connection is not allowed.
    public enum DataDisallowedReasonType {
        // Soft failure reasons. Normally the reasons from users or policy settings.
        DATA_DISABLED(false),               // Data is disabled by the user or policy.
        ROAMING_DISABLED(false),            // Data roaming is disabled by the user.
        DEFAULT_DATA_UNSELECTED(false),     // Default data not selected.

        // Data is disabled by the user or policy.
        DATA_DISABLED(false),
        // Data roaming is disabled by the user.
        ROAMING_DISABLED(false),
        // Default data not selected.
        DEFAULT_DATA_UNSELECTED(false),

        // Belows are all hard failure reasons.
        NOT_ATTACHED(true),
@@ -113,19 +117,27 @@ public class DataConnectionReasons {
        UNDESIRED_POWER_STATE(true),
        INTERNAL_DATA_DISABLED(true),
        RADIO_DISABLED_BY_CARRIER(true),
        APN_NOT_CONNECTABLE(true),  // Not in the right state for data call setup.
        DATA_IS_CONNECTING(true),   // Data is in connecting state. No need to send another setup
                                    // request.
        DATA_IS_DISCONNECTING(true),    // Data is being disconnected. Telephony will retry after
                                        // disconnected.
        DATA_ALREADY_CONNECTED(true),   // Data is already connected. No need to setup data again.
        // Not in the right state for data call setup.
        APN_NOT_CONNECTABLE(true),
        // Data is in connecting state. No need to send another setup request.
        DATA_IS_CONNECTING(true),
        // Data is being disconnected. Telephony will retry after disconnected.
        DATA_IS_DISCONNECTING(true),
        // Data is already connected. No need to setup data again.
        DATA_ALREADY_CONNECTED(true),
        // certain APNs are not allowed on IWLAN in legacy mode.
        ON_IWLAN(true),
        // certain APNs are only allowed when the device is camped on NR.
        NOT_ON_NR(true),
        // Data is not allowed while device is in emergency callback mode.
        IN_ECBM(true),
        ON_OTHER_TRANSPORT(true),   // When data retry occurs, the given APN type's preferred
                                    // transport might be already changed. In this case we
                                    // should disallow data retry.
        DATA_SERVICE_NOT_READY(true);   // Underlying data service is not bound.
        // The given APN type's preferred transport has switched.
        ON_OTHER_TRANSPORT(true),
        // Underlying data service is not bound.
        DATA_SERVICE_NOT_READY(true),
        // Qualified networks service does not allow certain types of APN brought up on either
        // cellular or IWLAN.
        DISABLED_BY_QNS(true);

        private boolean mIsHardReason;

Loading