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

Commit f7cab9f4 authored by Grace Chen's avatar Grace Chen Committed by android-build-merger
Browse files

Merge "Support different SIM power states" am: f7ea390c am: 69ee7f4e

am: bcc9dc40

Change-Id: I7c9ba95018674d97fd22c0998ea72298c219d993
parents fa3092fc bcc9dc40
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -2078,10 +2078,13 @@ public interface CommandsInterface {
    /**
     * 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
     */
    void setSimCardPower(boolean powerUp, Message result);
    void setSimCardPower(int state, Message result);

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

    /**
     * Set SIM card power state. Request is equivalent to inserting or removing the card.
     * @param powerUp True if powering up the SIM, otherwise powering down
     * Set SIM card power state.
     * @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) {
        mCi.setSimCardPower(powerUp, null);
    public void setSimPowerState(int state) {
        mCi.setSimCardPower(state, null);
    }

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

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

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

            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 {
                radioProxy.setSimCardPower(rr.mSerial, powerUp);
                    radioProxy11.setSimCardPower_1_1(rr.mSerial, state);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setSimCardPower", e);
                }
            }
        }
    }

    @Override
    public void setCarrierInfoForImsiEncryption(PublicKey publicKey, String keyIdentifier,
+7 −0
Original line number Diff line number Diff line
@@ -1193,6 +1193,13 @@ public class RadioResponse extends IRadioResponse.Stub {
        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) {
        RILRequest rr = mRil.processResponse(responseInfo);

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

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