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

Commit 544b8efa authored by Hall Liu's avatar Hall Liu Committed by Gerrit Code Review
Browse files

Merge "Add intdef for Telephony network type constants"

parents 51ec0ebb cb46f9ee
Loading
Loading
Loading
Loading
+48 −21
Original line number Diff line number Diff line
@@ -2089,10 +2089,37 @@ public class TelephonyManager {

    /** Max network type number. Update as new types are added. Don't add negative types. {@hide} */
    public static final int MAX_NETWORK_TYPE = NETWORK_TYPE_LTE_CA;

    /** @hide */
    @IntDef({
            NETWORK_TYPE_UNKNOWN,
            NETWORK_TYPE_GPRS,
            NETWORK_TYPE_EDGE,
            NETWORK_TYPE_UMTS,
            NETWORK_TYPE_CDMA,
            NETWORK_TYPE_EVDO_0,
            NETWORK_TYPE_EVDO_A,
            NETWORK_TYPE_1xRTT,
            NETWORK_TYPE_HSDPA,
            NETWORK_TYPE_HSUPA,
            NETWORK_TYPE_HSPA,
            NETWORK_TYPE_IDEN,
            NETWORK_TYPE_EVDO_B,
            NETWORK_TYPE_LTE,
            NETWORK_TYPE_EHRPD,
            NETWORK_TYPE_HSPAP,
            NETWORK_TYPE_GSM,
            NETWORK_TYPE_TD_SCDMA,
            NETWORK_TYPE_IWLAN,
            NETWORK_TYPE_LTE_CA,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface NetworkType{}

    /**
     * @return the NETWORK_TYPE_xxxx for current data connection.
     */
    public int getNetworkType() {
    public @NetworkType int getNetworkType() {
       try {
           ITelephony telephony = getITelephony();
           if (telephony != null) {
@@ -2187,7 +2214,7 @@ public class TelephonyManager {
     */
    @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
    @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
    public int getDataNetworkType() {
    public @NetworkType int getDataNetworkType() {
        return getDataNetworkType(getSubId(SubscriptionManager.getDefaultDataSubscriptionId()));
    }

@@ -2227,7 +2254,7 @@ public class TelephonyManager {
     */
    @SuppressAutoDoc // Blocked by b/72967236 - no support for carrier privileges
    @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE)
    public int getVoiceNetworkType() {
    public @NetworkType int getVoiceNetworkType() {
        return getVoiceNetworkType(getSubId());
    }