OSDN Git Service

Radio Interface changes to allow the modem to query the framework
authorpkanwar <pkanwar@google.com>
Sun, 21 May 2017 17:24:30 +0000 (10:24 -0700)
committerSteven Moreland <smoreland@google.com>
Wed, 28 Jun 2017 00:31:44 +0000 (00:31 +0000)
for the key.

We will now pass the ImsiEncryptionInfo object which includes mnc/mcc.
BUG: 35606429
Test: manual

(cherry picked from commit d99e9284e93d2c687b17d733e3e0570bca9a23c8)
Merged-In: I670465878e01e382b074a6434fbaf1bcb0fecc65
Change-Id: I670465878e01e382b074a6434fbaf1bcb0fecc65

include/telephony/ril.h
libril/ril_service.cpp

index dfca7cb..a97bad6 100644 (file)
@@ -752,13 +752,17 @@ typedef struct {
 } RIL_CarrierRestrictions;
 
 typedef struct {
-  const uint8_t * carrierKey;            /* Public Key from the Carrier used to encrypt the
-                                          * IMSI/IMPI.
-                                          */
-  const char * KeyIdentifier;            /* The keyIdentifier Attribute value pair that helps
-                                          * a server locate the private key to decrypt the
-                                          * permanent identity.
-                                          */
+  char * mcc;                         /* MCC of the Carrier. */
+  char * mnc ;                        /* MNC of the Carrier. */
+  uint8_t * carrierKey;               /* Public Key from the Carrier used to encrypt the
+                                       * IMSI/IMPI.
+                                       */
+  char * keyIdentifier;               /* The keyIdentifier Attribute value pair that helps
+                                       * a server locate the private key to decrypt the
+                                       * permanent identity.
+                                       */
+  int64_t expirationTime;             /* Date-Time (in UTC) when the key will expire. */
+
 } RIL_CarrierInfoForImsiEncryption;
 
 /* See RIL_REQUEST_LAST_CALL_FAIL_CAUSE */
index e8d67cd..1a78195 100644 (file)
@@ -451,8 +451,7 @@ struct RadioImpl : public V1_1::IRadio {
     Return<void> responseAcknowledgement();
 
     Return<void> setCarrierInfoForImsiEncryption(int32_t serial,
-            const ::android::hardware::hidl_vec<uint8_t>& carrierKey,
-            const hidl_string& keyIdentifier);
+            const ::android::hardware::radio::V1_1::ImsiEncryptionInfo& message);
 
     void checkReturnStatus(Return<void>& ret);
 };
@@ -2553,7 +2552,6 @@ Return<void> RadioImpl::setDataProfile(int32_t serial, const hidl_vec<DataProfil
                     pRI)) {
                 success = false;
             }
-
             if (success && !copyHidlStringToRil(&dataProfiles[i].mvnoMatchData,
                     profiles[i].mvnoMatchData, pRI)) {
                 success = false;
@@ -2837,10 +2835,28 @@ Return<void> OemHookImpl::sendRequestStrings(int32_t serial,
 }
 
 Return<void> RadioImpl::setCarrierInfoForImsiEncryption(int32_t serial,
-        const ::android::hardware::hidl_vec<uint8_t>& carrierKey,
-        const hidl_string& keyIdentifier) {
+        const ::android::hardware::radio::V1_1::ImsiEncryptionInfo& data) {
     RLOGD("setCarrierInfoForImsiEncryption: serial %d", serial);
-    dispatchRaw(serial, mSlotId, RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION, carrierKey);
+    RequestInfo *pRI = android::addRequestToList(serial, mSlotId, RIL_REQUEST_SET_CARRIER_INFO_IMSI_ENCRYPTION);
+    RIL_CarrierInfoForImsiEncryption imsiEncryption = {};
+
+    if (!copyHidlStringToRil(&imsiEncryption.mnc, data.mnc, pRI)) {
+        return Void();
+    }
+    if (!copyHidlStringToRil(&imsiEncryption.mcc, data.mcc, pRI)) {
+        memsetAndFreeStrings(1, imsiEncryption.mnc);
+        return Void();
+    }
+    if (!copyHidlStringToRil(&imsiEncryption.keyIdentifier, data.keyIdentifier, pRI)) {
+        memsetAndFreeStrings(2, imsiEncryption.mnc, imsiEncryption.mcc);
+        return Void();
+    }
+    int32_t lSize = data.carrierKey.size();
+    imsiEncryption.carrierKey = new uint8_t[lSize];
+    memcpy(imsiEncryption.carrierKey, data.carrierKey.data(), lSize);
+    imsiEncryption.expirationTime = data.expirationTime;
+    s_vendorFunctions->onRequest(pRI->pCI->requestNumber, &imsiEncryption, sizeof(RIL_CarrierInfoForImsiEncryption), pRI);
+    delete(imsiEncryption.carrierKey);
     return Void();
 }