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

Commit 5caa18cb authored by chen xu's avatar chen xu
Browse files

address API council feedbacks for Telephony.Carriers

Bug: 118296421
Test: telephony unit test
Change-Id: Ib26db49e5fa6891c2176124681172c271e6cc423
parent 11c16864
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -4615,18 +4615,18 @@ package android.provider {
  public static final class Telephony.Carriers implements android.provider.BaseColumns {
    field public static final java.lang.String APN_SET_ID = "apn_set_id";
    field public static final int CARRIER_EDITED = 4; // 0x4
    field public static final java.lang.String EDITED = "edited";
    field public static final java.lang.String MAX_CONNS = "max_conns";
    field public static final java.lang.String MAX_CONNS_TIME = "max_conns_time";
    field public static final java.lang.String MODEM_COGNITIVE = "modem_cognitive";
    field public static final java.lang.String EDITED_STATUS = "edited";
    field public static final java.lang.String MAX_CONNECTIONS = "max_conns";
    field public static final java.lang.String MODEM_PERSIST = "modem_cognitive";
    field public static final java.lang.String MTU = "mtu";
    field public static final int NO_SET_SET = 0; // 0x0
    field public static final int NO_APN_SET_ID = 0; // 0x0
    field public static final java.lang.String TIME_LIMIT_FOR_MAX_CONNECTIONS = "max_conns_time";
    field public static final int UNEDITED = 0; // 0x0
    field public static final int USER_DELETED = 2; // 0x2
    field public static final java.lang.String USER_EDITABLE = "user_editable";
    field public static final int USER_EDITED = 1; // 0x1
    field public static final java.lang.String USER_VISIBLE = "user_visible";
    field public static final java.lang.String WAIT_TIME = "wait_time";
    field public static final java.lang.String WAIT_TIME_RETRY = "wait_time";
  }

  public final class TimeZoneRulesDataContract {
+58 −32
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.provider;

import android.annotation.IntDef;
import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
@@ -44,6 +45,8 @@ import android.util.Patterns;
import com.android.internal.telephony.PhoneConstants;
import com.android.internal.telephony.SmsApplication;

import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.util.HashSet;
import java.util.Set;
import java.util.regex.Matcher;
@@ -2962,34 +2965,36 @@ public final class Telephony {
         *@hide
         */
        @SystemApi
        public static final String MODEM_COGNITIVE = "modem_cognitive";
        public static final String MODEM_PERSIST = "modem_cognitive";

        /**
         * The max connections of this APN.
         * The max number of connections of this APN.
         * <p>Type: INTEGER</p>
         *@hide
         */
        @SystemApi
        public static final String MAX_CONNS = "max_conns";
        public static final String MAX_CONNECTIONS = "max_conns";

        /**
         * The wait time for retry of the APN.
         * The wait time for retrying the APN, in milliseconds.
         * <p>Type: INTEGER</p>
         *@hide
         */
        @SystemApi
        public static final String WAIT_TIME = "wait_time";
        public static final String WAIT_TIME_RETRY = "wait_time";

        /**
         * The time to limit max connection for the APN.
         * The max number of seconds this APN will support its maximum number of connections
         * as defined in {@link #MAX_CONNECTIONS}.
         * <p>Type: INTEGER</p>
         *@hide
         */
        @SystemApi
        public static final String MAX_CONNS_TIME = "max_conns_time";
        public static final String TIME_LIMIT_FOR_MAX_CONNECTIONS = "max_conns_time";

        /**
         * The MTU(Maxinum transmit unit) size of the mobile interface to which the APN connected.
         * The MTU (maximum transmit unit) size of the mobile interface to which the APN is
         * connected, in bytes.
         * <p>Type: INTEGER </p>
         * @hide
         */
@@ -2998,11 +3003,19 @@ public final class Telephony {

        /**
         * APN edit status. APN could be added/edited/deleted by a user or carrier.
         * see all possible returned APN edit status.
         * <ul>
         *     <li>{@link #UNEDITED}</li>
         *     <li>{@link #USER_EDITED}</li>
         *     <li>{@link #USER_DELETED}</li>
         *     <li>{@link #CARRIER_EDITED}</li>
         *     <li>{@link #CARRIER_DELETED}</li>
         * </ul>
         * <p>Type: INTEGER </p>
         * @hide
         */
        @SystemApi
        public static final String EDITED = "edited";
        public static final String EDITED_STATUS = "edited";

        /**
         * {@code true} if this APN visible to the user, {@code false} otherwise.
@@ -3021,59 +3034,61 @@ public final class Telephony {
        public static final String USER_EDITABLE = "user_editable";

        /**
         * {@link #EDITED APN edit status} indicates that this APN has not been edited or fails to
         * edit.
         * {@link #EDITED_STATUS APN edit status} indicates that this APN has not been edited or
         * fails to edit.
         * <p>Type: INTEGER </p>
         * @hide
         */
        @SystemApi
        public static final int UNEDITED = 0;
        public static final @EditStatus int UNEDITED = 0;

        /**
         * {@link #EDITED APN edit status} indicates that this APN has been edited by users.
         * {@link #EDITED_STATUS APN edit status} indicates that this APN has been edited by users.
         * <p>Type: INTEGER </p>
         * @hide
         */
        @SystemApi
        public static final int USER_EDITED = 1;
        public static final @EditStatus int USER_EDITED = 1;

        /**
         * {@link #EDITED APN edit status} indicates that this APN has been deleted by users.
         * {@link #EDITED_STATUS APN edit status} indicates that this APN has been deleted by users.
         * <p>Type: INTEGER </p>
         * @hide
         */
        @SystemApi
        public static final int USER_DELETED = 2;
        public static final @EditStatus int USER_DELETED = 2;

        /**
         * {@link #EDITED APN edit status} is an intermediate value used to indicate that an entry
         * deleted by the user is still present in the new APN database and therefore must remain
         * tagged as user deleted rather than completely removed from the database.
         * {@link #EDITED_STATUS APN edit status} is an intermediate value used to indicate that an
         * entry deleted by the user is still present in the new APN database and therefore must
         * remain tagged as user deleted rather than completely removed from the database.
         * @hide
         */
        public static final int USER_DELETED_BUT_PRESENT_IN_XML = 3;

        /**
         * {@link #EDITED APN edit status} indicates that this APN has been edited by carriers.
         * {@link #EDITED_STATUS APN edit status} indicates that this APN has been edited by
         * carriers.
         * <p>Type: INTEGER </p>
         * @hide
         */
        @SystemApi
        public static final int CARRIER_EDITED = 4;
        public static final @EditStatus int CARRIER_EDITED = 4;

        /**
         * {@link #EDITED APN edit status} indicates that this APN has been deleted by carriers.
         * CARRIER_DELETED values are currently not used as there is no use case. If they are used,
         * delete() will have to change accordingly. Currently it is hardcoded to USER_DELETED.
         * {@link #EDITED_STATUS APN edit status} indicates that this APN has been deleted by
         * carriers. CARRIER_DELETED values are currently not used as there is no use case.
         * If they are used, delete() will have to change accordingly. Currently it is hardcoded to
         * USER_DELETED.
         * <p>Type: INTEGER </p>
         * @hide
         */
        public static final int CARRIER_DELETED = 5;
        public static final @EditStatus int CARRIER_DELETED = 5;

        /**
         * {@link #EDITED APN edit status} is an intermediate value used to indicate that an entry
         * deleted by the carrier is still present in the new APN database and therefore must remain
         * tagged as user deleted rather than completely removed from the database.
         * {@link #EDITED_STATUS APN edit status} is an intermediate value used to indicate that an
         * entry deleted by the carrier is still present in the new APN database and therefore must
         * remain tagged as user deleted rather than completely removed from the database.
         * @hide
         */
        public static final int CARRIER_DELETED_BUT_PRESENT_IN_XML = 6;
@@ -3111,13 +3126,13 @@ public final class Telephony {

        /**
         * Possible value for the {@link #APN_SET_ID} field. By default APNs will not belong to a
         * set. If the user manually selects an APN with no set set, there is no need to prioritize
         * any specific APN set ids.
         * set. If the user manually selects an APN without apn set id, there is no need to
         * prioritize any specific APN set ids.
         * <p>Type: INTEGER</p>
         * @hide
         */
        @SystemApi
        public static final int NO_SET_SET = 0;
        public static final int NO_APN_SET_ID = 0;

        /**
         * A unique carrier id associated with this APN
@@ -3126,6 +3141,17 @@ public final class Telephony {
         */
        public static final String CARRIER_ID = "carrier_id";

        /** @hide */
        @IntDef({
                UNEDITED,
                USER_EDITED,
                USER_DELETED,
                CARRIER_DELETED,
                CARRIER_EDITED,
        })
        @Retention(RetentionPolicy.SOURCE)
        public @interface EditStatus {}

    }

    /**
+6 −6
Original line number Diff line number Diff line
@@ -693,7 +693,7 @@ public class ApnSetting implements Parcelable {
            mmsc, mmsProxyAddress, mmsProxyPort, user, password, authType, mApnTypeBitmask,
            protocol, roamingProtocol, carrierEnabled, networkTypeBitmask, profileId,
            modemCognitive, maxConns, waitTime, maxConnsTime, mtu, mvnoType, mvnoMatchData,
            Carriers.NO_SET_SET, TelephonyManager.UNKNOWN_CARRIER_ID);
            Carriers.NO_APN_SET_ID, TelephonyManager.UNKNOWN_CARRIER_ID);
    }

    /**
@@ -740,11 +740,11 @@ public class ApnSetting implements Parcelable {
            networkTypeBitmask,
            cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.PROFILE_ID)),
            cursor.getInt(cursor.getColumnIndexOrThrow(
                Telephony.Carriers.MODEM_COGNITIVE)) == 1,
            cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.MAX_CONNS)),
            cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.WAIT_TIME)),
                Telephony.Carriers.MODEM_PERSIST)) == 1,
            cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.MAX_CONNECTIONS)),
            cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.WAIT_TIME_RETRY)),
            cursor.getInt(cursor.getColumnIndexOrThrow(
                Telephony.Carriers.MAX_CONNS_TIME)),
                Telephony.Carriers.TIME_LIMIT_FOR_MAX_CONNECTIONS)),
            cursor.getInt(cursor.getColumnIndexOrThrow(Telephony.Carriers.MTU)),
            getMvnoTypeIntFromString(
                cursor.getString(cursor.getColumnIndexOrThrow(
@@ -870,7 +870,7 @@ public class ApnSetting implements Parcelable {
        int mtu = UNSET_MTU;
        String mvnoType = "";
        String mvnoMatchData = "";
        int apnSetId = Carriers.NO_SET_SET;
        int apnSetId = Carriers.NO_APN_SET_ID;
        int carrierId = TelephonyManager.UNKNOWN_CARRIER_ID;
        if (version == 1) {
            typeArray = new String[a.length - 13];