Merge "Camera: Add support for testing partial results" into oc-dr1-dev
am: c60ec1c2ac

Change-Id: I6fac06fbe7f60712877933dc05fe10e256f705b1
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..9fbcb47
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,5 @@
+elsk@google.com
+maco@google.com
+malchev@google.com
+smoreland@google.com
+yim@google.com  # vts tests
diff --git a/automotive/vehicle/2.0/default/tests/VehicleHalTestUtils.h b/automotive/vehicle/2.0/default/tests/VehicleHalTestUtils.h
index 28e1a5a..2a06417 100644
--- a/automotive/vehicle/2.0/default/tests/VehicleHalTestUtils.h
+++ b/automotive/vehicle/2.0/default/tests/VehicleHalTestUtils.h
@@ -222,54 +222,6 @@
     return ss.str();
 }
 
-inline std::string toString(const VehiclePropValue &v) {
-    std::stringstream ss;
-    ss << "VehiclePropValue {n"
-       << "  prop: " << hexString(v.prop) << ",\n"
-       << "  areaId: " << hexString(v.areaId) << ",\n"
-       << "  timestamp: " << v.timestamp << ",\n"
-       << "  value {\n"
-       << "    int32Values: " << vecToString(v.value.int32Values) << ",\n"
-       << "    floatValues: " << vecToString(v.value.floatValues) << ",\n"
-       << "    int64Values: " << vecToString(v.value.int64Values) << ",\n"
-       << "    bytes: " << vecToString(v.value.bytes) << ",\n"
-       << "    string: " << v.value.stringValue.c_str() << ",\n"
-       << "  }\n"
-       << "}\n";
-
-    return ss.str();
-}
-
-inline std::string toString(const VehiclePropConfig &config) {
-    std::stringstream ss;
-    ss << "VehiclePropConfig {\n"
-       << "  prop: " << hexString(config.prop) << ",\n"
-       << "  supportedAreas: " << hexString(config.supportedAreas) << ",\n"
-       << "  access: " << enumToHexString(config.access) << ",\n"
-       << "  changeMode: " << enumToHexString(config.changeMode) << ",\n"
-       << "  configFlags: " << hexString(config.configFlags) << ",\n"
-       << "  minSampleRate: " << config.minSampleRate << ",\n"
-       << "  maxSampleRate: " << config.maxSampleRate << ",\n"
-       << "  configString: " << config.configString.c_str() << ",\n";
-
-    ss << "  areaConfigs {\n";
-    for (size_t i = 0; i < config.areaConfigs.size(); i++) {
-        const auto &area = config.areaConfigs[i];
-        ss << "    areaId: " << hexString(area.areaId) << ",\n"
-           << "    minFloatValue: " << area.minFloatValue << ",\n"
-           << "    minFloatValue: " << area.maxFloatValue << ",\n"
-           << "    minInt32Value: " << area.minInt32Value << ",\n"
-           << "    minInt32Value: " << area.maxInt32Value << ",\n"
-           << "    minInt64Value: " << area.minInt64Value << ",\n"
-           << "    minInt64Value: " << area.maxInt64Value << ",\n";
-    }
-    ss << "  }\n"
-       << "}\n";
-
-    return ss.str();
-}
-
-
 }  // namespace V2_0
 }  // namespace vehicle
 }  // namespace automotive
diff --git a/bluetooth/1.0/default/bluetooth_hci.h b/bluetooth/1.0/default/bluetooth_hci.h
index 6912405..e2797b1 100644
--- a/bluetooth/1.0/default/bluetooth_hci.h
+++ b/bluetooth/1.0/default/bluetooth_hci.h
@@ -21,6 +21,8 @@
 
 #include <hidl/MQDescriptor.h>
 
+#include <functional>
+
 namespace android {
 namespace hardware {
 namespace bluetooth {
diff --git a/bluetooth/1.0/default/hci_protocol.cc b/bluetooth/1.0/default/hci_protocol.cc
index a208da1..5d6f1d1 100644
--- a/bluetooth/1.0/default/hci_protocol.cc
+++ b/bluetooth/1.0/default/hci_protocol.cc
@@ -18,6 +18,7 @@
 
 #define LOG_TAG "android.hardware.bluetooth-hci-hci_protocol"
 #include <assert.h>
+#include <errno.h>
 #include <fcntl.h>
 #include <log/log.h>
 
diff --git a/radio/1.1/Android.mk b/radio/1.1/Android.mk
index 305b661..b83ac80 100644
--- a/radio/1.1/Android.mk
+++ b/radio/1.1/Android.mk
@@ -75,6 +75,101 @@
 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 (KeepaliveRequest)
+#
+GEN := $(intermediates)/android/hardware/radio/V1_1/KeepaliveRequest.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.KeepaliveRequest
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (KeepaliveStatus)
+#
+GEN := $(intermediates)/android/hardware/radio/V1_1/KeepaliveStatus.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.KeepaliveStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (KeepaliveStatusCode)
+#
+GEN := $(intermediates)/android/hardware/radio/V1_1/KeepaliveStatusCode.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.KeepaliveStatusCode
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (KeepaliveType)
+#
+GEN := $(intermediates)/android/hardware/radio/V1_1/KeepaliveType.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.KeepaliveType
+
+$(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
@@ -256,6 +351,8 @@
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IRadioResponse.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
 $(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
 $(GEN): PRIVATE_CUSTOM_TOOL = \
         $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
@@ -343,6 +440,101 @@
 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 (KeepaliveRequest)
+#
+GEN := $(intermediates)/android/hardware/radio/V1_1/KeepaliveRequest.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.KeepaliveRequest
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (KeepaliveStatus)
+#
+GEN := $(intermediates)/android/hardware/radio/V1_1/KeepaliveStatus.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.KeepaliveStatus
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (KeepaliveStatusCode)
+#
+GEN := $(intermediates)/android/hardware/radio/V1_1/KeepaliveStatusCode.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.KeepaliveStatusCode
+
+$(GEN): $(LOCAL_PATH)/types.hal
+	$(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
+#
+# Build types.hal (KeepaliveType)
+#
+GEN := $(intermediates)/android/hardware/radio/V1_1/KeepaliveType.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.KeepaliveType
+
+$(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
@@ -524,6 +716,8 @@
 $(GEN): $(HIDL)
 $(GEN): PRIVATE_HIDL := $(HIDL)
 $(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/IRadioResponse.hal
+$(GEN): PRIVATE_DEPS += $(LOCAL_PATH)/types.hal
+$(GEN): $(LOCAL_PATH)/types.hal
 $(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
 $(GEN): PRIVATE_CUSTOM_TOOL = \
         $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
diff --git a/radio/1.1/IRadio.hal b/radio/1.1/IRadio.hal
index b3e21e7..22d27d4 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.
@@ -99,4 +89,24 @@
      * Response function is IRadioResponse.stopNetworkScanResponse()
      */
     oneway stopNetworkScan(int32_t serial);
+
+    /**
+     * Start a Keepalive session (for IPsec)
+     *
+     * @param serial Serial number of request.
+     * @param keepalive A request structure containing all necessary info to describe a keepalive
+     *
+     * Response function is IRadioResponse.startKeepaliveResponse()
+     */
+    oneway startKeepalive(int32_t serial, KeepaliveRequest keepalive);
+
+    /**
+     * Stop an ongoing Keepalive session (for IPsec)
+     *
+     * @param serial Serial number of request.
+     * @param sessionHandle The handle that was provided by IRadioResponse.startKeepaliveResponse
+     *
+     * Response function is IRadioResponse.stopKeepaliveResponse()
+     */
+    oneway stopKeepalive(int32_t serial, int32_t sessionHandle);
 };
diff --git a/radio/1.1/IRadioIndication.hal b/radio/1.1/IRadioIndication.hal
index 27b6ec2..a0ad9b2 100644
--- a/radio/1.1/IRadioIndication.hal
+++ b/radio/1.1/IRadioIndication.hal
@@ -39,4 +39,15 @@
      * @param result Network scan result as NetworkScanResult defined in types.hal
      */
     oneway networkScanResult(RadioIndicationType type, NetworkScanResult result);
-};
\ No newline at end of file
+
+    /**
+     * Indicates a status update for a particular Keepalive session. This must include
+     * a handle for a previous session and should include a status update regarding the
+     * state of a keepalive. Unsolicited keepalive status reports should never be
+     * PENDING as unsolicited status should only be sent when known.
+     *
+     * @param type Type of radio indication
+     * @param status Status information for a Keepalive session
+     */
+    oneway keepaliveStatus(RadioIndicationType type, KeepaliveStatus status);
+};
diff --git a/radio/1.1/IRadioResponse.hal b/radio/1.1/IRadioResponse.hal
index 7415252..4e7bf43 100644
--- a/radio/1.1/IRadioResponse.hal
+++ b/radio/1.1/IRadioResponse.hal
@@ -71,4 +71,26 @@
      *   RadioError:MODEM_ERR
      */
     oneway stopNetworkScanResponse(RadioResponseInfo info);
+
+    /**
+     * @param info Response info struct containing response type, serial no. and error
+     * @param status Status object containing a new handle and a current status. The
+     * status returned here may be PENDING to indicate that the radio has not yet
+     * processed the keepalive request.
+     *
+     * Valid errors returned:
+     *   RadioError:NONE
+     *   RadioError:NO_RESOURCES
+     *   RadioError:INVALID_ARGUMENTS
+     */
+    oneway startKeepaliveResponse(RadioResponseInfo info, KeepaliveStatus status);
+
+    /**
+     * @param info Response info struct containing response type, serial no. and error
+     *
+     * Valid errors returned:
+     *   RadioError:NONE
+     *   RadioError:INVALID_ARGUMENTS
+     */
+    oneway stopKeepaliveResponse(RadioResponseInfo info);
 };
diff --git a/radio/1.1/types.hal b/radio/1.1/types.hal
index 245d96c..a8d836c 100644
--- a/radio/1.1/types.hal
+++ b/radio/1.1/types.hal
@@ -132,6 +132,19 @@
     COMPLETE = 2,                           // The result contains the last part of the scan results
 };
 
+enum KeepaliveType : int32_t {
+    NATT_IPV4 = 0,                          // Keepalive specified by RFC 3948 Sec. 2.3 using IPv4
+    NATT_IPV6 = 1,                          // Keepalive specified by RFC 3948 Sec. 2.3 using IPv6
+};
+
+enum KeepaliveStatusCode : int32_t {
+    ACTIVE,                                 // Keepalive is currently active
+    INACTIVE,                               // Keepalive is inactive, which indicates an error
+    PENDING,                                // Requested keepalive has not yet been processed by
+                                            // the modem. Only allowed in a RESPONSE message to
+                                            // a REQUEST
+};
+
 struct RadioAccessSpecifier {
     RadioAccessNetworks radioAccessNetwork; // The type of network to scan
     vec<GeranBands> geranBands;             // Valid only if radioAccessNetwork = GERAN
@@ -162,3 +175,44 @@
     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.
+};
+
+struct KeepaliveRequest {
+    KeepaliveType type;                     // The format of the keepalive packet
+    vec<uint8_t> sourceAddress;             // source address with type = family, in network
+                                            // byte order
+    int32_t sourcePort;                     // source port if relevant for the given type
+                                            // INT_MAX: 0x7FFFFFFF denotes that the field is unused
+    vec<uint8_t> destinationAddress;        // destination address with type = family, in network
+                                            // byte order
+    int32_t destinationPort;                // destination if relevant for the given type
+                                            // INT_MAX: 0x7FFFFFFF denotes that the field is unused
+    int32_t maxKeepaliveIntervalMillis;     // the max interval between packets, in milliseconds
+    int32_t cid;                            // Context ID, returned in setupDataCallResponse
+                                            // that uniquely identifies the data call to which
+                                            // this keepalive must applied
+};
+
+struct KeepaliveStatus {
+    int32_t sessionHandle;                  // the sessionHandle provided by the api
+    KeepaliveStatusCode code;               // status for the given keepalive
+};