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

Commit e42cfa68 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

am: 284131dd

Change-Id: I9674f70bf6c76b00ef45c53341f5185d5b550ef6
parents c0db1e72 284131dd
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;
@@ -1289,6 +1290,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
@@ -3222,7 +3243,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);
            }