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

Commit f7ea390c authored by Grace Chen's avatar Grace Chen Committed by Gerrit Code Review
Browse files

Merge "Support different SIM power states"

parents 7fd619a6 2d4f7c72
Loading
Loading
Loading
Loading
+5 −2
Original line number Original line Diff line number Diff line
@@ -2078,10 +2078,13 @@ public interface CommandsInterface {
    /**
    /**
     * Set SIM card power up or down
     * Set SIM card power up or down
     *
     *
     * @param powerUp True if powering up the sim card
     * @param state  State of SIM (power down, power up, pass through)
     * - {@link android.telephony.TelephonyManager#CARD_POWER_DOWN}
     * - {@link android.telephony.TelephonyManager#CARD_POWER_UP}
     * - {@link android.telephony.TelephonyManager#CARD_POWER_UP_PASS_THROUGH}
     * @param result callback message contains the information of SUCCESS/FAILURE
     * @param result callback message contains the information of SUCCESS/FAILURE
     */
     */
    void setSimCardPower(boolean powerUp, Message result);
    void setSimCardPower(int state, Message result);


    /**
    /**
     * Register for unsolicited Carrier Public Key.
     * Register for unsolicited Carrier Public Key.
+7 −4
Original line number Original line Diff line number Diff line
@@ -3444,11 +3444,14 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    }
    }


    /**
    /**
     * Set SIM card power state. Request is equivalent to inserting or removing the card.
     * Set SIM card power state.
     * @param powerUp True if powering up the SIM, otherwise powering down
     * @param state State of SIM (power down, power up, pass through)
     * - {@link android.telephony.TelephonyManager#CARD_POWER_DOWN}
     * - {@link android.telephony.TelephonyManager#CARD_POWER_UP}
     * - {@link android.telephony.TelephonyManager#CARD_POWER_UP_PASS_THROUGH}
     **/
     **/
    public void setSimPowerState(boolean powerUp) {
    public void setSimPowerState(int state) {
        mCi.setSimCardPower(powerUp, null);
        mCi.setSimCardPower(state, null);
    }
    }


    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
    public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
+33 −7
Original line number Original line Diff line number Diff line
@@ -75,6 +75,7 @@ import android.telephony.Rlog;
import android.telephony.SignalStrength;
import android.telephony.SignalStrength;
import android.telephony.SmsManager;
import android.telephony.SmsManager;
import android.telephony.TelephonyHistogram;
import android.telephony.TelephonyHistogram;
import android.telephony.TelephonyManager;
import android.text.TextUtils;
import android.text.TextUtils;
import android.util.SparseArray;
import android.util.SparseArray;


@@ -3605,23 +3606,48 @@ public final class RIL extends BaseCommands implements CommandsInterface {
    }
    }


    @Override
    @Override
    public void setSimCardPower(boolean powerUp, Message result) {
    public void setSimCardPower(int state, Message result) {
        IRadio radioProxy = getRadioProxy(result);
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
        if (radioProxy != null) {
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_SIM_CARD_POWER, result,
            RILRequest rr = obtainRequest(RIL_REQUEST_SET_SIM_CARD_POWER, result,
                    mRILDefaultWorkSource);
                    mRILDefaultWorkSource);


            if (RILJ_LOGD) {
            if (RILJ_LOGD) {
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + powerUp);
                riljLog(rr.serialString() + "> " + requestToString(rr.mRequest) + " " + state);
            }
            }

            android.hardware.radio.V1_1.IRadio radioProxy11 =
                    android.hardware.radio.V1_1.IRadio.castFrom(radioProxy);
            if (radioProxy11 == null) {
                try {
                    switch (state) {
                        case TelephonyManager.CARD_POWER_DOWN: {
                            radioProxy.setSimCardPower(rr.mSerial, false);
                            break;
                        }
                        case TelephonyManager.CARD_POWER_UP: {
                            radioProxy.setSimCardPower(rr.mSerial, true);
                            break;
                        }
                        default: {
                            if (result != null) {
                                AsyncResult.forMessage(result, null,
                                        CommandException.fromRilErrno(REQUEST_NOT_SUPPORTED));
                                result.sendToTarget();
                            }
                        }
                    }
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setSimCardPower", e);
                }
            } else {
                try {
                try {
                radioProxy.setSimCardPower(rr.mSerial, powerUp);
                    radioProxy11.setSimCardPower_1_1(rr.mSerial, state);
                } catch (RemoteException | RuntimeException e) {
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setSimCardPower", e);
                    handleRadioProxyExceptionForRR(rr, "setSimCardPower", e);
                }
                }
            }
            }
        }
        }
    }


    @Override
    @Override
    public void setCarrierInfoForImsiEncryption(PublicKey publicKey, String keyIdentifier,
    public void setCarrierInfoForImsiEncryption(PublicKey publicKey, String keyIdentifier,
+7 −0
Original line number Original line Diff line number Diff line
@@ -1195,6 +1195,13 @@ public class RadioResponse extends IRadioResponse.Stub {
        responseVoid(responseInfo);
        responseVoid(responseInfo);
    }
    }


    /**
     * @param responseInfo Response info struct containing response type, serial no. and error
     */
    public void setSimCardPowerResponse_1_1(RadioResponseInfo responseInfo) {
        responseVoid(responseInfo);
    }

    private void responseIccCardStatus(RadioResponseInfo responseInfo, CardStatus cardStatus) {
    private void responseIccCardStatus(RadioResponseInfo responseInfo, CardStatus cardStatus) {
        RILRequest rr = mRil.processResponse(responseInfo);
        RILRequest rr = mRil.processResponse(responseInfo);


+1 −1
Original line number Original line Diff line number Diff line
@@ -637,6 +637,6 @@ class ImsPhoneCommandInterface extends BaseCommands implements CommandsInterface
    }
    }


    @Override
    @Override
    public void setSimCardPower(boolean powerUp, Message result) {
    public void setSimCardPower(int state, Message result) {
    }
    }
}
}
Loading