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

Commit 193707f0 authored by KalimochoAz's avatar KalimochoAz
Browse files

Crespo: Fix 2G/3G toggle widget

Since Crespo is not using the samsung RIL we need to add this
in order to solve the switch loop issue.

patch2: remove white space
patch3: add a gloval variable so this code can be reused on other devices
patch4: read the var only once, not every time

Change-Id: I42bd7105fb1b861a3f4e061e19192fd158b02b8d
parent d16dc993
Loading
Loading
Loading
Loading
+20 −1
Original line number Diff line number Diff line
@@ -218,6 +218,8 @@ public class RIL extends BaseCommands implements CommandsInterface {
     */
    private static final int DEFAULT_WAKE_LOCK_TIMEOUT = 30000;

    private boolean mNTmodeGlobal = SystemProperties.getBoolean("ro.ril.ntmodeglobal", false);

    //***** Instance Variables

    LocalSocket mSocket;
@@ -2260,7 +2262,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
            case RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM: ret =  responseInts(p); break;
            case RIL_REQUEST_EXPLICIT_CALL_TRANSFER: ret =  responseVoid(p); break;
            case RIL_REQUEST_SET_PREFERRED_NETWORK_TYPE: ret =  responseVoid(p); break;
            case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: ret =  responseInts(p); break;
            case RIL_REQUEST_GET_PREFERRED_NETWORK_TYPE: ret =  responseNetworkType(p); break;
            case RIL_REQUEST_GET_NEIGHBORING_CELL_IDS: ret = responseCellList(p); break;
            case RIL_REQUEST_SET_LOCATION_UPDATES: ret =  responseVoid(p); break;
            case RIL_REQUEST_CDMA_SET_SUBSCRIPTION: ret =  responseVoid(p); break;
@@ -3142,6 +3144,23 @@ public class RIL extends BaseCommands implements CommandsInterface {
        return response;
    }

    // When toggle from 3G to 2G in some devices you have enter infinite
    // loop here with try to change mode 7. In that case we force
    // the output to the loop and set 3G again. We cannot change
    // this in samsungRIL since crespo is not using it.
    protected Object
    responseNetworkType(Parcel p) {
        int response[] = (int[]) responseInts(p);

        // When the modem responds Phone.NT_MODE_GLOBAL, it means Phone.NT_MODE_WCDMA_PREF
        if (mNTmodeGlobal && response[0] == Phone.NT_MODE_GLOBAL) {
            Log.d(LOG_TAG, "Overriding network type response from global to WCDMA preferred");
            response[0] = Phone.NT_MODE_WCDMA_PREF;
        }

        return response;
    }

    protected ArrayList<CdmaInformationRecords>
    responseCdmaInformationRecord(Parcel p) {
        int numberOfInfoRecs;