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

Commit e1676912 authored by Jayachandran C's avatar Jayachandran C Committed by Jayachandran Chinnakkannu
Browse files

Convert NV reset type into ResetNvType defined in types.hal

Test: 1. Sprint OMADM execution and verified device camps on service
      2. FDR on Marlin and verified vendor code receives resetType 3

Bug: 37849113
Bug: 38169447
Change-Id: Iaf66c6f29a09d83f3f8bef73b65a589ea4c5df03
parent d19f1391
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;
@@ -1287,6 +1288,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
@@ -3220,7 +3241,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);
            }