Merge "Merge "Fix vts tests:" into oc-dev am: 14b34e19d6 am: 01cb1ff6d7  -s ours" into oc-dr1-dev-plus-aosp
am: 824fe31298  -s ours

Change-Id: If2a9f01485c53552008a8e6934433d6ec6f91d93
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
index fe34a3f..4800cd8 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
@@ -61,10 +61,11 @@
 
 StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) {
     if (propValue.prop == kGenerateFakeDataControllingProperty) {
-        return handleGenerateFakeDataRequest(propValue);
-    };
-
-    if (mHvacPowerProps.count(propValue.prop)) {
+        StatusCode status = handleGenerateFakeDataRequest(propValue);
+        if (status != StatusCode::OK) {
+            return status;
+        }
+    } else if (mHvacPowerProps.count(propValue.prop)) {
         auto hvacPowerOn = mPropStore->readValueOrNull(toInt(VehicleProperty::HVAC_POWER_ON),
                                                       toInt(VehicleAreaZone::ROW_1));
 
@@ -176,6 +177,13 @@
 }
 
 bool EmulatedVehicleHal::setPropertyFromVehicle(const VehiclePropValue& propValue) {
+    if (propValue.prop == kGenerateFakeDataControllingProperty) {
+        StatusCode status = handleGenerateFakeDataRequest(propValue);
+        if (status != StatusCode::OK) {
+            return false;
+        }
+    }
+
     if (mPropStore->writeValue(propValue)) {
         doHalEvent(getValuePool()->obtain(propValue));
         return true;
diff --git a/automotive/vehicle/2.1/types.hal b/automotive/vehicle/2.1/types.hal
index 7be611c..d22f77f 100644
--- a/automotive/vehicle/2.1/types.hal
+++ b/automotive/vehicle/2.1/types.hal
@@ -620,6 +620,9 @@
 
   /* The version of the VMS layer. */
   VMS_LAYER_VERSION = 2,
+
+  /* The layer type as defined in the vms protocol */
+  VMS_LAYER_SUB_TYPE = 3,
 };
 
 /*
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
index 69da6b2..f965296 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_misc.cpp
@@ -184,7 +184,7 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        EXPECT_EQ(radioRsp->rspInfo.error, RadioError::NONE);
     }
 }
 
@@ -216,7 +216,7 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        EXPECT_EQ(radioRsp->rspInfo.error, RadioError::NONE);
     }
 }
 
@@ -651,6 +651,7 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
+        std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
         ASSERT_TRUE(CheckGeneralError() ||
                     radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
                     radioRsp->rspInfo.error == RadioError::INVALID_STATE);
@@ -669,6 +670,7 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
+        std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
         ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::RADIO_NOT_AVAILABLE ||
                     radioRsp->rspInfo.error == RadioError::LCE_NOT_SUPPORTED ||
                     radioRsp->rspInfo.error == RadioError::INTERNAL_ERR);
@@ -745,7 +747,7 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        EXPECT_EQ(radioRsp->rspInfo.error, RadioError::NONE);
   }
 
   /* Reset back to no carrier restriction */
@@ -759,7 +761,7 @@
   EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
   if (cardStatus.cardState == CardState::ABSENT) {
-      ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+      EXPECT_EQ(radioRsp->rspInfo.error, RadioError::NONE);
   }
 }
 
@@ -775,7 +777,7 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
-        ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE);
+        EXPECT_EQ(radioRsp->rspInfo.error, RadioError::NONE);
     }
 }
 
@@ -825,6 +827,7 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
+        std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
         ASSERT_TRUE(radioRsp->rspInfo.error == RadioError::NONE ||
                     radioRsp->rspInfo.error == RadioError::REQUEST_NOT_SUPPORTED);
     }
diff --git a/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp b/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
index 8fe04fd..d57360f 100644
--- a/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
+++ b/radio/1.0/vts/functional/radio_hidl_hal_voice.cpp
@@ -365,6 +365,7 @@
     EXPECT_EQ(serial, radioRsp->rspInfo.serial);
 
     if (cardStatus.cardState == CardState::ABSENT) {
+        std::cout << static_cast<int>(radioRsp->rspInfo.error) << std::endl;
         ASSERT_TRUE(CheckGeneralError() ||
                     radioRsp->rspInfo.error == RadioError::INVALID_ARGUMENTS ||
                     radioRsp->rspInfo.error == RadioError::NONE ||
diff --git a/radio/1.1/Android.mk b/radio/1.1/Android.mk
index 305b661..21c4a6a 100644
--- a/radio/1.1/Android.mk
+++ b/radio/1.1/Android.mk
@@ -75,6 +75,25 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build types.hal (ImsiEncryptionInfo)
+#
+GEN := $(intermediates)/android/hardware/radio/V1_1/ImsiEncryptionInfo.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio@1.1::types.ImsiEncryptionInfo
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build types.hal (NetworkScanRequest)
 #
 GEN := $(intermediates)/android/hardware/radio/V1_1/NetworkScanRequest.java
@@ -343,6 +362,25 @@
 LOCAL_GENERATED_SOURCES += $(GEN)
 
 #
+# Build types.hal (ImsiEncryptionInfo)
+#
+GEN := $(intermediates)/android/hardware/radio/V1_1/ImsiEncryptionInfo.java
+$(GEN): $(HIDL)
+$(GEN): PRIVATE_HIDL := $(HIDL)
+$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
+$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
+$(GEN): PRIVATE_CUSTOM_TOOL = \
+        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
+        -Ljava \
+        -randroid.hardware:hardware/interfaces \
+        -randroid.hidl:system/libhidl/transport \
+        android.hardware.radio@1.1::types.ImsiEncryptionInfo
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
 # Build types.hal (NetworkScanRequest)
 #
 GEN := $(intermediates)/android/hardware/radio/V1_1/NetworkScanRequest.java
diff --git a/radio/1.1/IRadio.hal b/radio/1.1/IRadio.hal
index b3e21e7..ea9b96f 100644
--- a/radio/1.1/IRadio.hal
+++ b/radio/1.1/IRadio.hal
@@ -34,23 +34,13 @@
      * switch and everytime the framework receives a new certificate.
      *
      * @param serial Serial number of request.
-     * @param carrierKey Carrier specific key to be used for encryption. It must
-     *        be opaque to the framework. This is the byte-stream representation
-     *        of the key. This is an external encoded form for the key used when
-     *        a standard representation of the key is needed outside the Java
-     *        Virtual Machine, as when transmitting the key to some other party.
-     *        The key is encoded according to a standard format
-     *        (such as X.509 SubjectPublicKeyInfo or PKCS#8), and is returned using
-     *        the getEncoded method.
-     * @param keyIdentifier This is an opaque value we're given by the carrier
-     *        and is returned to the carrier. This is used by the server to
-     *        help it locate the private key to decrypt the permanent identity.
+     * @param message ImsiEncryptionInfo as defined in types.hal.
+     *
      *
      * Response callback is
      * IRadioResponse.setCarrierInfoForImsiEncryptionResponse()
      */
-     oneway setCarrierInfoForImsiEncryption(int32_t serial, vec<uint8_t> carrierKey,
-             string keyIdentifier);
+     oneway setCarrierInfoForImsiEncryption(int32_t serial, ImsiEncryptionInfo imsiEncryptionInfo);
 
     /**
      * Set SIM card power state.
diff --git a/radio/1.1/types.hal b/radio/1.1/types.hal
index 245d96c..bdd0338 100644
--- a/radio/1.1/types.hal
+++ b/radio/1.1/types.hal
@@ -162,3 +162,23 @@
     RadioError error;                       // The error code of the incremental result
     vec<CellInfo> networkInfos;             // List of network information as CellInfo
 };
+
+struct ImsiEncryptionInfo {
+    string mcc;                   // MCC of the Carrier.
+    string mnc;                   // MNC of the Carrier.
+    vec<uint8_t> carrierKey;      // Carrier specific key to be used for encryption. It must
+                                  // be opaque to the framework. This is the byte-stream
+                                  // representation of the key. This is an external encoded
+                                  // form for the key used when a standard representation of
+                                  // the key is needed outside the Java Virtual Machine, as
+                                  // when transmitting the key to some other party.
+                                  // The key is encoded according to a standard format
+                                  // (such as X.509 SubjectPublicKeyInfo or PKCS#8), and is
+                                  // returned using the getEncoded method as defined on the
+                                  // java.security.Key interface.
+    string keyIdentifier;         // This is an opaque value we're given by the carrier
+                                  // and is returned to the carrier. This is used by the server to
+                                  // help it locate the private key to decrypt the permanent
+                                  // identity.
+    int64_t expirationTime;       // date-time in UTC when the key will expire.
+};