diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2021-02-26 05:37:25 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-02-26 05:37:25 +0000 |
commit | 88a3bba7311180512978e20500c2e52b9619974b (patch) | |
tree | d572b026a0196cf27fc8407a4368e96ad008d9b0 | |
parent | cb764e382bf853dc23e585824f273b07b22d8a96 (diff) | |
parent | b9c7d5380c10fca7faec237509c2edc6d4849d50 (diff) | |
download | telephony-88a3bba7311180512978e20500c2e52b9619974b.tar.gz |
Merge "IMSI Encryption Support Over IRadio"
-rw-r--r-- | src/java/com/android/internal/telephony/GsmCdmaPhone.java | 7 | ||||
-rw-r--r-- | src/java/com/android/internal/telephony/Phone.java | 3 | ||||
-rw-r--r-- | src/java/com/android/internal/telephony/RIL.java | 31 |
3 files changed, 39 insertions, 2 deletions
diff --git a/src/java/com/android/internal/telephony/GsmCdmaPhone.java b/src/java/com/android/internal/telephony/GsmCdmaPhone.java index a3a25ee6a9..cb14687060 100644 --- a/src/java/com/android/internal/telephony/GsmCdmaPhone.java +++ b/src/java/com/android/internal/telephony/GsmCdmaPhone.java @@ -399,6 +399,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); @@ -1872,6 +1874,7 @@ public class GsmCdmaPhone extends Phone { @Override public void setCarrierInfoForImsiEncryption(ImsiEncryptionInfo imsiEncryptionInfo) { CarrierInfoManager.setCarrierInfoForImsiEncryption(imsiEncryptionInfo, mContext, mPhoneId); + mCi.setCarrierInfoForImsiEncryption(imsiEncryptionInfo, null); } @Override @@ -3233,6 +3236,10 @@ public class GsmCdmaPhone extends Phone { } break; } + case EVENT_RESET_CARRIER_KEY_IMSI_ENCRYPTION: { + resetCarrierKeysForImsiEncryption(); + break; + } default: super.handleMessage(msg); } diff --git a/src/java/com/android/internal/telephony/Phone.java b/src/java/com/android/internal/telephony/Phone.java index 5a604203cc..d07bf7cd56 100644 --- a/src/java/com/android/internal/telephony/Phone.java +++ b/src/java/com/android/internal/telephony/Phone.java @@ -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_"; diff --git a/src/java/com/android/internal/telephony/RIL.java b/src/java/com/android/internal/telephony/RIL.java index 2a24077088..de6c44f9f6 100644 --- a/src/java/com/android/internal/telephony/RIL.java +++ b/src/java/com/android/internal/telephony/RIL.java @@ -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; |