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

Commit 284131dd authored by Jayachandran Chinnakkannu's avatar Jayachandran Chinnakkannu Committed by android-build-merger
Browse files

Merge "Convert NV reset type into ResetNvType defined in types.hal" into oc-dev

am: 9c0e1cfd

Change-Id: Id3c4d62e6a7e175eeac927a1032c13a1b5c82791
parents 21728cfb 9c0e1cfd
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import android.hardware.radio.V1_0.RadioError;
import android.hardware.radio.V1_0.RadioIndicationType;
import android.hardware.radio.V1_0.RadioResponseInfo;
import android.hardware.radio.V1_0.RadioResponseType;
import android.hardware.radio.V1_0.ResetNvType;
import android.hardware.radio.V1_0.SelectUiccSub;
import android.hardware.radio.V1_0.SetupDataCallResult;
import android.hardware.radio.V1_0.SimApdu;
@@ -1288,6 +1289,26 @@ public final class RIL extends BaseCommands implements CommandsInterface {
        return dpi;
    }

    /**
     * Convert NV reset type into ResetNvType defined in types.hal.
     * @param resetType NV reset type.
     * @return Converted reset type in integer or -1 if param is invalid.
     */
    private static int convertToHalResetNvType(int resetType) {
        /**
         * resetType values
         * 1 - reload all NV items
         * 2 - erase NV reset (SCRTN)
         * 3 - factory reset (RTN)
         */
        switch (resetType) {
            case 1: return ResetNvType.RELOAD;
            case 2: return ResetNvType.ERASE;
            case 3: return ResetNvType.FACTORY_RESET;
        }
        return -1;
    }

    /**
     * Convert SetupDataCallResult defined in types.hal into DataCallResponse
     * @param dcResult setup data call result
@@ -3221,7 +3242,7 @@ public final class RIL extends BaseCommands implements CommandsInterface {
            }

            try {
                radioProxy.nvResetConfig(rr.mSerial, resetType);
                radioProxy.nvResetConfig(rr.mSerial, convertToHalResetNvType(resetType));
            } catch (RemoteException | RuntimeException e) {
                handleRadioProxyExceptionForRR(rr, "nvResetConfig", e);
            }