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

Commit 54e883be authored by Derek Tan's avatar Derek Tan
Browse files

Update the preferred network type APIs.

Bug: 17255752
Change-Id: I8f74749752f8d8c6cd5b28dd5fe4ed89a33481ed
parent b5928445
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -29009,7 +29009,6 @@ package android.telephony {
    method public void enableSimplifiedNetworkSettings(boolean);
    method public void enableSimplifiedNetworkSettings(long, boolean);
    method public java.util.List<android.telephony.CellInfo> getAllCellInfo();
    method public int getCalculatedPreferredNetworkType();
    method public int getCallState();
    method public android.telephony.CellLocation getCellLocation();
    method public int getDataActivity();
@@ -29026,7 +29025,6 @@ package android.telephony {
    method public java.lang.String getNetworkOperatorName();
    method public int getNetworkType();
    method public int getPhoneType();
    method public int getPreferredNetworkType();
    method public java.lang.String getSimCountryIso();
    method public java.lang.String getSimOperator();
    method public java.lang.String getSimOperatorName();
@@ -29048,10 +29046,10 @@ package android.telephony {
    method public boolean isSmsCapable();
    method public void listen(android.telephony.PhoneStateListener, int);
    method public java.lang.String sendEnvelopeWithStatus(java.lang.String);
    method public boolean setGlobalPreferredNetworkType();
    method public void setLine1NumberForDisplay(java.lang.String, java.lang.String);
    method public void setLine1NumberForDisplay(long, java.lang.String, java.lang.String);
    method public boolean setOperatorBrandOverride(java.lang.String);
    method public boolean setPreferredNetworkType(int);
    field public static final java.lang.String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE";
    field public static final java.lang.String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE";
    field public static final int CALL_STATE_IDLE = 0; // 0x0
+16 −21
Original line number Diff line number Diff line
@@ -2902,27 +2902,6 @@ public class TelephonyManager {
        }
    }

    /**
     * Get the calculated preferred network type.
     * Used for debugging incorrect network type.
     * <p>
     * Requires Permission:
     *   {@link android.Manifest.permission#READ_PHONE_STATE READ_PHONE_STATE}
     *
     * @return the preferred network type, defined in RILConstants.java or -1 if
     *         none available.
     */
    public int getCalculatedPreferredNetworkType() {
        try {
            return getITelephony().getCalculatedPreferredNetworkType();
        } catch (RemoteException ex) {
            Rlog.e(TAG, "getCalculatedPreferredNetworkType RemoteException", ex);
        } catch (NullPointerException ex) {
            Rlog.e(TAG, "getCalculatedPreferredNetworkType NPE", ex);
        }
        return -1;
    }

    /**
     * Get the preferred network type.
     * Used for device configuration by some CDMA operators.
@@ -2932,6 +2911,7 @@ public class TelephonyManager {
     * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
     *
     * @return the preferred network type, defined in RILConstants.java.
     * @hide
     */
    public int getPreferredNetworkType() {
        try {
@@ -2954,6 +2934,7 @@ public class TelephonyManager {
     *
     * @param networkType the preferred network type, defined in RILConstants.java.
     * @return true on success; false on any failure.
     * @hide
     */
    public boolean setPreferredNetworkType(int networkType) {
        try {
@@ -2966,6 +2947,20 @@ public class TelephonyManager {
        return false;
    }

    /**
     * Set the preferred network type to global mode which includes LTE, CDMA, EvDo and GSM/WCDMA.
     *
     * <p>
     * Requires Permission:
     *   {@link android.Manifest.permission#MODIFY_PHONE_STATE MODIFY_PHONE_STATE}
     * Or the calling app has carrier privileges. @see #hasCarrierPrivileges
     *
     * @return true on success; false on any failure.
     */
    public boolean setGlobalPreferredNetworkType() {
        return setPreferredNetworkType(RILConstants.NETWORK_MODE_LTE_CDMA_EVDO_GSM_WCDMA);
    }

    /**
     * Values used to return status for hasCarrierPrivileges call.
     */