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

Commit a429a86a authored by Jordan Liu's avatar Jordan Liu
Browse files

Implement setSimPowerState

Bug: 171433370
Test: manual
Change-Id: I39c29117c1c2afb80e37d531aeb83c3fdbd6e8b9
parent 022ea955
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -4379,8 +4379,8 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
     * - {@link android.telephony.TelephonyManager#CARD_POWER_UP}
     * - {@link android.telephony.TelephonyManager#CARD_POWER_UP_PASS_THROUGH}
     **/
    public void setSimPowerState(int state, WorkSource workSource) {
        mCi.setSimCardPower(state, null, workSource);
    public void setSimPowerState(int state, Message result, WorkSource workSource) {
        mCi.setSimCardPower(state, result, workSource);
    }

    public void setCarrierTestOverride(String mccmnc, String imsi, String iccid, String gid1,
+18 −10
Original line number Diff line number Diff line
@@ -4208,7 +4208,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

    @Override
    public void getCellInfoList(Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);
        workSource = getDefaultWorkSourceIfInvalid(workSource);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_GET_CELL_INFO_LIST, result,
@@ -4235,7 +4235,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

    @Override
    public void setCellInfoListRate(int rateInMillis, Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);
        workSource = getDefaultWorkSourceIfInvalid(workSource);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_UNSOL_CELL_INFO_LIST_RATE, result,
@@ -4490,7 +4490,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

    @Override
    public void nvReadItem(int itemID, Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);
        workSource = getDefaultWorkSourceIfInvalid(workSource);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_NV_READ_ITEM, result,
@@ -4511,7 +4511,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

    @Override
    public void nvWriteItem(int itemId, String itemValue, Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);
        workSource = getDefaultWorkSourceIfInvalid(workSource);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_NV_WRITE_ITEM, result,
@@ -4947,7 +4947,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

    @Override
    public void getModemActivityInfo(Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);
        workSource = getDefaultWorkSourceIfInvalid(workSource);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_GET_ACTIVITY_INFO, result,
@@ -5013,7 +5013,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        riljLog("RIL.java - setAllowedCarriers");

        checkNotNull(carrierRestrictionRules, "Carrier restriction cannot be null.");
        workSource = getDeafultWorkSourceIfInvalid(workSource);
        workSource = getDefaultWorkSourceIfInvalid(workSource);

        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy == null) return;
@@ -5093,7 +5093,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

    @Override
    public void getAllowedCarriers(Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);
        workSource = getDefaultWorkSourceIfInvalid(workSource);

        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy == null) return;
@@ -5333,7 +5333,7 @@ public class RIL extends BaseCommands implements CommandsInterface {

    @Override
    public void setSimCardPower(int state, Message result, WorkSource workSource) {
        workSource = getDeafultWorkSourceIfInvalid(workSource);
        workSource = getDefaultWorkSourceIfInvalid(workSource);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_SIM_CARD_POWER, result,
@@ -5343,7 +5343,15 @@ public class RIL extends BaseCommands implements CommandsInterface {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + state);
            }

            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
                try {
                    android.hardware.radio.V1_6.IRadio radioProxy16 =
                            (android.hardware.radio.V1_6.IRadio) radioProxy;
                    radioProxy16.setSimCardPower_1_6(rr.mSerial, state);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setSimCardPower", e);
                }
            } else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
                try {
                    android.hardware.radio.V1_1.IRadio radioProxy11 =
                            (android.hardware.radio.V1_1.IRadio) radioProxy;
@@ -6045,7 +6053,7 @@ public class RIL extends BaseCommands implements CommandsInterface {
        rr.release();
    }

    private WorkSource getDeafultWorkSourceIfInvalid(WorkSource workSource) {
    private WorkSource getDefaultWorkSourceIfInvalid(WorkSource workSource) {
        if (workSource == null) {
            workSource = mRILDefaultWorkSource;
        }