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

Commit 9e9af0e7 authored by Pawit Pornkitprasan's avatar Pawit Pornkitprasan
Browse files

SamsungRIL: Fix 2G/3G toggle widget

Samsung's RIL returns Phone.NT_MODE_GLOBAL when it means
Phone.NT_MODE_WCDMA_PREF and that confuses the userspace.

Change-Id: Iac482ba3ed8d96bd98362fb16151f546041f6f96
parent fa47382b
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ public SamsungRIL(Context context, int networkMode, int cdmaSubscription) {
            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;
@@ -792,6 +792,19 @@ public SamsungRIL(Context context, int networkMode, int cdmaSubscription) {
	        return response;
	    }

    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 (!mIsSamsungCdma && 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 class SamsungDriverCall extends DriverCall {
        @Override
        public String