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

Commit 2b52223e authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "IMSI Encryption Support Over IRadio" am: 88a3bba7 am: 90afd7bc

Original change: https://android-review.googlesource.com/c/platform/frameworks/opt/telephony/+/1489384

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Iddb359fbd18bbd4dfea0009585e69c44043423de
parents 88a96b69 90afd7bc
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -401,6 +401,8 @@ public class GsmCdmaPhone extends Phone {
        mCi.registerForRilConnected(this, EVENT_RIL_CONNECTED, null);
        mCi.registerForVoiceRadioTechChanged(this, EVENT_VOICE_RADIO_TECH_CHANGED, null);
        mCi.registerForLceInfo(this, EVENT_LINK_CAPACITY_CHANGED, null);
        mCi.registerForCarrierInfoForImsiEncryption(this,
                EVENT_RESET_CARRIER_KEY_IMSI_ENCRYPTION, null);
        IntentFilter filter = new IntentFilter(
                CarrierConfigManager.ACTION_CARRIER_CONFIG_CHANGED);
        filter.addAction(TelecomManager.ACTION_CURRENT_TTY_MODE_CHANGED);
@@ -1874,6 +1876,7 @@ public class GsmCdmaPhone extends Phone {
    @Override
    public void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo) {
        CarrierInfoManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo, mContext, mPhoneId);
        mCi.setCarrierInfoForImsiEncryption(imsiEncryptionInfo, null);
    }

    @Override
@@ -3235,6 +3238,10 @@ public class GsmCdmaPhone extends Phone {
                }
                break;
            }
            case EVENT_RESET_CARRIER_KEY_IMSI_ENCRYPTION: {
                resetCarrierKeysForImsiEncryption();
                break;
            }
            default:
                super.handleMessage(msg);
        }
+2 −1
Original line number Diff line number Diff line
@@ -227,8 +227,9 @@ public abstract class Phone extends Handler implements PhoneInternalInterface {
    protected static final int EVENT_REGISTRATION_FAILED = 57;
    protected static final int EVENT_BARRING_INFO_CHANGED = 58;
    protected static final int EVENT_LINK_CAPACITY_CHANGED = 59;
    protected static final int EVENT_RESET_CARRIER_KEY_IMSI_ENCRYPTION = 60;

    protected static final int EVENT_LAST = EVENT_LINK_CAPACITY_CHANGED;
    protected static final int EVENT_LAST = EVENT_RESET_CARRIER_KEY_IMSI_ENCRYPTION;

    // For shared prefs.
    private static final String GSM_ROAMING_LIST_OVERRIDE_PREFIX = "gsm_roaming_list_";
+30 −1
Original line number Diff line number Diff line
@@ -5501,7 +5501,36 @@ public class RIL extends BaseCommands implements CommandsInterface {
        checkNotNull(imsiEncryptionInfo, "ImsiEncryptionInfo cannot be null.");
        IRadio radioProxy = getRadioProxy(result);
        if (radioProxy != null) {
            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
            if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_6)) {
                android.hardware.radio.V1_6.IRadio radioProxy16 =
                        (android.hardware.radio.V1_6.IRadio ) radioProxy;

                RILRequest rr = obtainRequest(RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, result,
                        mRILDefaultWorkSource);
                if (RILJ_LOGD) riljLog(rr.serialString() + "> " + requestToString(rr.mRequest));

                try {
                    android.hardware.radio.V1_6.ImsiEncryptionInfo halImsiInfo =
                            new android.hardware.radio.V1_6.ImsiEncryptionInfo();
                    halImsiInfo.base.mnc = imsiEncryptionInfo.getMnc();
                    halImsiInfo.base.mcc = imsiEncryptionInfo.getMcc();
                    halImsiInfo.base.keyIdentifier = imsiEncryptionInfo.getKeyIdentifier();
                    if (imsiEncryptionInfo.getExpirationTime() != null) {
                        halImsiInfo.base.expirationTime =
                                imsiEncryptionInfo.getExpirationTime().getTime();
                    }
                    for (byte b : imsiEncryptionInfo.getPublicKey().getEncoded()) {
                        halImsiInfo.base.carrierKey.add(new Byte(b));
                    }
                    halImsiInfo.keyType = imsiEncryptionInfo.getKeyType();

                    radioProxy16.setCarrierInfoForImsiEncryption_1_6(
                            rr.mSerial, halImsiInfo);
                } catch (RemoteException | RuntimeException e) {
                    handleRadioProxyExceptionForRR(rr, "setCarrierInfoForImsiEncryption", e);
                }
            }
            else if (mRadioVersion.greaterOrEqual(RADIO_HAL_VERSION_1_1)) {
                android.hardware.radio.V1_1.IRadio radioProxy11 =
                        (android.hardware.radio.V1_1.IRadio ) radioProxy;