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

Commit 29983476 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira
Browse files

Telephony: Add getLteOnGsmMode() method

Same functionality as the existing getLteOnCdmaMode, but for GSM
LTE devices.
Enable with the telephony.lteOnGsmDevice system property

Additionally, support GSM LTE in the SystemUI LTE power widget

Change-Id: Ibfb47ca608e51393b99d3308e0a6c66050b3f32e
parent cebc0ce5
Loading
Loading
Loading
Loading
+8 −4
Original line number Original line Diff line number Diff line
@@ -29,11 +29,13 @@ public class LTEButton extends PowerButton{
        int network = getCurrentPreferredNetworkMode(mView.getContext());
        int network = getCurrentPreferredNetworkMode(mView.getContext());
        switch(network) {
        switch(network) {
            case Phone.NT_MODE_GLOBAL:
            case Phone.NT_MODE_GLOBAL:
            case Phone.NT_MODE_LTE_GSM_WCDMA:
            case Phone.NT_MODE_LTE_ONLY:
                mIcon = R.drawable.stat_lte_on;
                mIcon = R.drawable.stat_lte_on;
                mState = STATE_ENABLED;
                mState = STATE_ENABLED;
                Settings.System.putInt(resolver, Settings.System.LTE_MODE, 1);
                Settings.System.putInt(resolver, Settings.System.LTE_MODE, 1);
                break;
                break;
            case Phone.NT_MODE_CDMA:
            default:
                mIcon = R.drawable.stat_lte_off;
                mIcon = R.drawable.stat_lte_off;
                mState = STATE_DISABLED;
                mState = STATE_DISABLED;
                Settings.System.putInt(resolver, Settings.System.LTE_MODE, 0);
                Settings.System.putInt(resolver, Settings.System.LTE_MODE, 0);
@@ -47,11 +49,13 @@ public class LTEButton extends PowerButton{
            .getSystemService(Context.TELEPHONY_SERVICE);
            .getSystemService(Context.TELEPHONY_SERVICE);
        int network = getCurrentPreferredNetworkMode(mView.getContext());
        int network = getCurrentPreferredNetworkMode(mView.getContext());
        ContentResolver resolver = mView.getContext().getContentResolver();
        ContentResolver resolver = mView.getContext().getContentResolver();
        if (Phone.NT_MODE_GLOBAL == network) {
        if (Phone.NT_MODE_GLOBAL == network ||
              Phone.NT_MODE_LTE_GSM_WCDMA == network) {
            tm.toggleLTE(false);
            tm.toggleLTE(false);
            mState = STATE_DISABLED;
            mState = STATE_DISABLED;
            Settings.System.putInt(resolver, Settings.System.LTE_MODE, 0);
            Settings.System.putInt(resolver, Settings.System.LTE_MODE, 0);
        } else if (Phone.NT_MODE_CDMA == network) {
        } else if (Phone.NT_MODE_CDMA == network ||
                     tm.getLteOnGsmMode() != 0) {
            tm.toggleLTE(true);
            tm.toggleLTE(true);
            mState = STATE_ENABLED;
            mState = STATE_ENABLED;
            Settings.System.putInt(resolver, Settings.System.LTE_MODE, 1);
            Settings.System.putInt(resolver, Settings.System.LTE_MODE, 1);
+15 −0
Original line number Original line Diff line number Diff line
@@ -710,6 +710,21 @@ public class TelephonyManager {
        }
        }
    }
    }


    /**
     * Return if the current radio is LTE on GSM
     * @hide
     */
    public int getLteOnGsmMode() {
        try {
            return getITelephony().getLteOnGsmMode();
        } catch (RemoteException ex) {
            return 0;
        } catch (NullPointerException ex) {
            // This could happen before phone restarts due to crashing
            return 0;
        }
    }

    //
    //
    //
    //
    // Subscriber Info
    // Subscriber Info
+17 −0
Original line number Original line Diff line number Diff line
@@ -898,4 +898,21 @@ public abstract class BaseCommands implements CommandsInterface {
                "' lteOnCdmaProductType='" + sLteOnCdmaProductType + "'");
                "' lteOnCdmaProductType='" + sLteOnCdmaProductType + "'");
        return retVal;
        return retVal;
    }
    }

    /**
     * @hide
     */
    @Override
    public int getLteOnGsmMode() {
        return getLteOnGsmModeStatic();
    }

    /**
     * Return if the current radio is LTE on GSM
     * @hide
     */
    public static int getLteOnGsmModeStatic() {
        return SystemProperties.getInt(TelephonyProperties.PROPERTY_LTE_ON_GSM_DEVICE,
                    0);
    }
}
}
+6 −0
Original line number Original line Diff line number Diff line
@@ -1632,6 +1632,12 @@ public interface CommandsInterface {
     */
     */
    public int getLteOnCdmaMode();
    public int getLteOnCdmaMode();


    /**
     * Return if the current radio is LTE on GSM
     * @hide
     */
    public int getLteOnGsmMode();

    /**
    /**
     * Request the ISIM application on the UICC to perform the AKA
     * Request the ISIM application on the UICC to perform the AKA
     * challenge/response algorithm for IMS authentication. The nonce string
     * challenge/response algorithm for IMS authentication. The nonce string
+2 −0
Original line number Original line Diff line number Diff line
@@ -284,5 +284,7 @@ interface ITelephony {
     * or {@link PHone#LTE_ON_CDMA_TRUE}
     * or {@link PHone#LTE_ON_CDMA_TRUE}
     */
     */
    int getLteOnCdmaMode();
    int getLteOnCdmaMode();

    int getLteOnGsmMode();
}
}
Loading