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

Commit acb14bcf authored by Chen Xu's avatar Chen Xu Committed by android-build-merger
Browse files

Merge "Address API feedbacks for networktypebitmask"

am: 307f4cfe

Change-Id: I5dddd1258d2f8ad0e34098db921d309a6b1c243b
parents f193d103 307f4cfe
Loading
Loading
Loading
Loading
+23 −22
Original line number Diff line number Diff line
@@ -6326,12 +6326,12 @@ package android.telephony {
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public boolean getEmergencyCallbackMode();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimDomain();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getIsimIst();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getPreferredNetworkTypeBitmap();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getPreferredNetworkTypeBitmap();
    method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public int getRadioPowerState();
    method public int getSimApplicationState();
    method public int getSimCardState();
    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public String getSimLocale();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public int getSupportedRadioAccessFamily();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getSupportedRadioAccessFamily();
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public java.util.List<android.telephony.TelephonyHistogram> getTelephonyHistograms();
    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public android.telephony.UiccSlotInfo[] getUiccSlotsInfo();
    method @Nullable public android.os.Bundle getVisualVoicemailSettings();
@@ -6360,7 +6360,7 @@ package android.telephony {
    method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(int, boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataRoamingEnabled(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setMultisimCarrierRestriction(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmap(int);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setPreferredNetworkTypeBitmap(long);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadio(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setRadioPower(boolean);
    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSimPowerState(int);
@@ -6388,25 +6388,26 @@ package android.telephony {
    field public static final String EXTRA_VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL = "android.telephony.extra.VISUAL_VOICEMAIL_ENABLED_BY_USER_BOOL";
    field public static final String EXTRA_VOICEMAIL_SCRAMBLED_PIN_STRING = "android.telephony.extra.VOICEMAIL_SCRAMBLED_PIN_STRING";
    field public static final long MAX_NUMBER_VERIFICATION_TIMEOUT_MILLIS = 60000L; // 0xea60L
    field public static final int NETWORK_TYPE_BITMASK_1xRTT = 128; // 0x80
    field public static final int NETWORK_TYPE_BITMASK_CDMA = 16; // 0x10
    field public static final int NETWORK_TYPE_BITMASK_EDGE = 4; // 0x4
    field public static final int NETWORK_TYPE_BITMASK_EHRPD = 16384; // 0x4000
    field public static final int NETWORK_TYPE_BITMASK_EVDO_0 = 32; // 0x20
    field public static final int NETWORK_TYPE_BITMASK_EVDO_A = 64; // 0x40
    field public static final int NETWORK_TYPE_BITMASK_EVDO_B = 4096; // 0x1000
    field public static final int NETWORK_TYPE_BITMASK_GPRS = 2; // 0x2
    field public static final int NETWORK_TYPE_BITMASK_GSM = 65536; // 0x10000
    field public static final int NETWORK_TYPE_BITMASK_HSDPA = 256; // 0x100
    field public static final int NETWORK_TYPE_BITMASK_HSPA = 1024; // 0x400
    field public static final int NETWORK_TYPE_BITMASK_HSPAP = 32768; // 0x8000
    field public static final int NETWORK_TYPE_BITMASK_HSUPA = 512; // 0x200
    field public static final int NETWORK_TYPE_BITMASK_LTE = 8192; // 0x2000
    field public static final int NETWORK_TYPE_BITMASK_LTE_CA = 524288; // 0x80000
    field public static final int NETWORK_TYPE_BITMASK_NR = 1048576; // 0x100000
    field public static final int NETWORK_TYPE_BITMASK_TD_SCDMA = 131072; // 0x20000
    field public static final int NETWORK_TYPE_BITMASK_UMTS = 8; // 0x8
    field public static final int NETWORK_TYPE_BITMASK_UNKNOWN = 1; // 0x1
    field public static final long NETWORK_TYPE_BITMASK_1xRTT = 64L; // 0x40L
    field public static final long NETWORK_TYPE_BITMASK_CDMA = 8L; // 0x8L
    field public static final long NETWORK_TYPE_BITMASK_EDGE = 2L; // 0x2L
    field public static final long NETWORK_TYPE_BITMASK_EHRPD = 8192L; // 0x2000L
    field public static final long NETWORK_TYPE_BITMASK_EVDO_0 = 16L; // 0x10L
    field public static final long NETWORK_TYPE_BITMASK_EVDO_A = 32L; // 0x20L
    field public static final long NETWORK_TYPE_BITMASK_EVDO_B = 2048L; // 0x800L
    field public static final long NETWORK_TYPE_BITMASK_GPRS = 1L; // 0x1L
    field public static final long NETWORK_TYPE_BITMASK_GSM = 32768L; // 0x8000L
    field public static final long NETWORK_TYPE_BITMASK_HSDPA = 128L; // 0x80L
    field public static final long NETWORK_TYPE_BITMASK_HSPA = 512L; // 0x200L
    field public static final long NETWORK_TYPE_BITMASK_HSPAP = 16384L; // 0x4000L
    field public static final long NETWORK_TYPE_BITMASK_HSUPA = 256L; // 0x100L
    field public static final long NETWORK_TYPE_BITMASK_IWLAN = 131072L; // 0x20000L
    field public static final long NETWORK_TYPE_BITMASK_LTE = 4096L; // 0x1000L
    field public static final long NETWORK_TYPE_BITMASK_LTE_CA = 262144L; // 0x40000L
    field public static final long NETWORK_TYPE_BITMASK_NR = 524288L; // 0x80000L
    field public static final long NETWORK_TYPE_BITMASK_TD_SCDMA = 65536L; // 0x10000L
    field public static final long NETWORK_TYPE_BITMASK_UMTS = 4L; // 0x4L
    field public static final long NETWORK_TYPE_BITMASK_UNKNOWN = 0L; // 0x0L
    field public static final int RADIO_POWER_OFF = 0; // 0x0
    field public static final int RADIO_POWER_ON = 1; // 0x1
    field public static final int RADIO_POWER_UNAVAILABLE = 2; // 0x2
+57 −50
Original line number Diff line number Diff line
@@ -17,12 +17,15 @@
package android.telephony;

import android.annotation.UnsupportedAppUsage;
import android.hardware.radio.V1_0.RadioTechnology;
import android.hardware.radio.V1_4.CellInfo.Info;
import android.os.Build;
import android.os.Parcel;
import android.os.Parcelable;

import com.android.internal.telephony.RILConstants;


/**
 * Object to indicate the phone radio type and access technology.
 *
@@ -33,32 +36,34 @@ public class RadioAccessFamily implements Parcelable {
    /**
     * TODO: get rid of RAF definition in RadioAccessFamily and
     * use {@link TelephonyManager.NetworkTypeBitMask}
     * TODO: public definition {@link TelephonyManager.NetworkTypeBitMask} is long.
     * TODO: Convert from int to long everywhere including HAL definitions.
     */
    // 2G
    public static final int RAF_UNKNOWN = TelephonyManager.NETWORK_TYPE_BITMASK_UNKNOWN;
    public static final int RAF_GSM = TelephonyManager.NETWORK_TYPE_BITMASK_GSM;
    public static final int RAF_GPRS = TelephonyManager.NETWORK_TYPE_BITMASK_GPRS;
    public static final int RAF_EDGE = TelephonyManager.NETWORK_TYPE_BITMASK_EDGE;
    public static final int RAF_IS95A = TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
    public static final int RAF_IS95B = TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
    public static final int RAF_1xRTT = TelephonyManager.NETWORK_TYPE_BITMASK_1xRTT;
    public static final int RAF_UNKNOWN = (int) TelephonyManager.NETWORK_TYPE_BITMASK_UNKNOWN;
    public static final int RAF_GSM = (int) TelephonyManager.NETWORK_TYPE_BITMASK_GSM;
    public static final int RAF_GPRS = (int) TelephonyManager.NETWORK_TYPE_BITMASK_GPRS;
    public static final int RAF_EDGE = (int) TelephonyManager.NETWORK_TYPE_BITMASK_EDGE;
    public static final int RAF_IS95A = (int) TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
    public static final int RAF_IS95B = (int) TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
    public static final int RAF_1xRTT = (int) TelephonyManager.NETWORK_TYPE_BITMASK_1xRTT;
    // 3G
    public static final int RAF_EVDO_0 = TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_0;
    public static final int RAF_EVDO_A = TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_A;
    public static final int RAF_EVDO_B = TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_B;
    public static final int RAF_EHRPD = TelephonyManager.NETWORK_TYPE_BITMASK_EHRPD;
    public static final int RAF_HSUPA = TelephonyManager.NETWORK_TYPE_BITMASK_HSUPA;
    public static final int RAF_HSDPA = TelephonyManager.NETWORK_TYPE_BITMASK_HSDPA;
    public static final int RAF_HSPA = TelephonyManager.NETWORK_TYPE_BITMASK_HSPA;
    public static final int RAF_HSPAP = TelephonyManager.NETWORK_TYPE_BITMASK_HSPAP;
    public static final int RAF_UMTS = TelephonyManager.NETWORK_TYPE_BITMASK_UMTS;
    public static final int RAF_TD_SCDMA = TelephonyManager.NETWORK_TYPE_BITMASK_TD_SCDMA;
    public static final int RAF_EVDO_0 = (int) TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_0;
    public static final int RAF_EVDO_A = (int) TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_A;
    public static final int RAF_EVDO_B = (int) TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_B;
    public static final int RAF_EHRPD = (int) TelephonyManager.NETWORK_TYPE_BITMASK_EHRPD;
    public static final int RAF_HSUPA = (int) TelephonyManager.NETWORK_TYPE_BITMASK_HSUPA;
    public static final int RAF_HSDPA = (int) TelephonyManager.NETWORK_TYPE_BITMASK_HSDPA;
    public static final int RAF_HSPA = (int) TelephonyManager.NETWORK_TYPE_BITMASK_HSPA;
    public static final int RAF_HSPAP = (int) TelephonyManager.NETWORK_TYPE_BITMASK_HSPAP;
    public static final int RAF_UMTS = (int) TelephonyManager.NETWORK_TYPE_BITMASK_UMTS;
    public static final int RAF_TD_SCDMA = (int) TelephonyManager.NETWORK_TYPE_BITMASK_TD_SCDMA;
    // 4G
    public static final int RAF_LTE = TelephonyManager.NETWORK_TYPE_BITMASK_LTE;
    public static final int RAF_LTE_CA = TelephonyManager.NETWORK_TYPE_BITMASK_LTE_CA;
    public static final int RAF_LTE = (int) TelephonyManager.NETWORK_TYPE_BITMASK_LTE;
    public static final int RAF_LTE_CA = (int) TelephonyManager.NETWORK_TYPE_BITMASK_LTE_CA;

    // 5G
    public static final int RAF_NR = TelephonyManager.NETWORK_TYPE_BITMASK_NR;
    public static final int RAF_NR = (int) TelephonyManager.NETWORK_TYPE_BITMASK_NR;

    // Grouping of RAFs
    // 2G
@@ -147,20 +152,20 @@ public class RadioAccessFamily implements Parcelable {
    /**
     * Implement the Parcelable interface.
     */
    public static final Creator<RadioAccessFamily> CREATOR =
            new Creator<RadioAccessFamily>() {
    public static final Creator<android.telephony.RadioAccessFamily> CREATOR =
            new Creator<android.telephony.RadioAccessFamily>() {

        @Override
        public RadioAccessFamily createFromParcel(Parcel in) {
        public android.telephony.RadioAccessFamily createFromParcel(Parcel in) {
            int phoneId = in.readInt();
            int radioAccessFamily = in.readInt();

            return new RadioAccessFamily(phoneId, radioAccessFamily);
            return new android.telephony.RadioAccessFamily(phoneId, radioAccessFamily);
        }

        @Override
        public RadioAccessFamily[] newArray(int size) {
            return new RadioAccessFamily[size];
        public android.telephony.RadioAccessFamily[] newArray(int size) {
            return new android.telephony.RadioAccessFamily[size];
        }
    };

@@ -391,76 +396,78 @@ public class RadioAccessFamily implements Parcelable {
    }

    /**
     * convert RAF from {@link ServiceState.RilRadioTechnology} bitmask to
     * convert RAF from {@link android.hardware.radio.V1_0.RadioAccessFamily} to
     * {@link TelephonyManager.NetworkTypeBitMask}, the bitmask represented by
     * {@link TelephonyManager.NetworkType}. Reasons are {@link TelephonyManager.NetworkType} are
     * public while {@link ServiceState.RilRadioTechnology} are hidden. We
     * don't want to expose two sets of definition to public.
     * {@link TelephonyManager.NetworkType}.
     *
     * @param raf bitmask represented by {@link ServiceState.RilRadioTechnology}
     * @param raf {@link android.hardware.radio.V1_0.RadioAccessFamily}
     * @return {@link TelephonyManager.NetworkTypeBitMask}
     */
    public static int convertToNetworkTypeBitMask(int raf) {
        int networkTypeRaf = 0;

        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GSM)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.GSM) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_GSM;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_GPRS)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.GPRS) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_GPRS;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EDGE)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.EDGE) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EDGE;
        }
        // convert both IS95A/IS95B to CDMA as network mode doesn't support CDMA
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95A)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.IS95A) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IS95B)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.IS95B) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_CDMA;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_1xRTT)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.ONE_X_RTT) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_1xRTT;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_0)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.EVDO_0) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_0;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_A)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.EVDO_A) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_A;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EVDO_B)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.EVDO_B) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EVDO_B;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_EHRPD)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.EHRPD) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_EHRPD;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSUPA)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.HSUPA) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_HSUPA;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSDPA)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.HSDPA) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_HSDPA;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPA)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.HSPA) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_HSPA;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_HSPAP)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.HSPAP) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_HSPAP;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_UMTS)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.UMTS) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_UMTS;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_TD_SCDMA)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.TD_SCDMA) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_TD_SCDMA;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.LTE) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_LTE;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_LTE_CA)) != 0) {
        if ((raf & android.hardware.radio.V1_0.RadioAccessFamily.LTE_CA) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_LTE_CA;
        }
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_NR)) != 0) {
        if ((raf & android.hardware.radio.V1_4.RadioAccessFamily.NR) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_NR;
        }
        // TODO: need hal definition
        if ((raf & (1 << ServiceState.RIL_RADIO_TECHNOLOGY_IWLAN)) != 0) {
            networkTypeRaf |= TelephonyManager.NETWORK_TYPE_BITMASK_IWLAN;
        }

        return (networkTypeRaf == 0) ? TelephonyManager.NETWORK_TYPE_UNKNOWN : networkTypeRaf;
    }
+37 −28

File changed.

Preview size limit exceeded, changes collapsed.