Merge "[DPP] Add DPP key management capability API"
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index ceb53be..d4c422d 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -202,7 +202,7 @@
     </hal>
     <hal format="hidl" optional="false">
         <name>android.hardware.graphics.composer</name>
-        <version>2.1</version>
+        <version>2.1-3</version>
         <interface>
             <name>IComposer</name>
             <instance>default</instance>
diff --git a/gnss/2.0/Android.bp b/gnss/2.0/Android.bp
index 6972e40..200671e 100644
--- a/gnss/2.0/Android.bp
+++ b/gnss/2.0/Android.bp
@@ -8,6 +8,8 @@
     },
     srcs: [
         "types.hal",
+        "IAGnss.hal",
+        "IAGnssCallback.hal",
         "IAGnssRil.hal",
         "IGnss.hal",
         "IGnssCallback.hal",
diff --git a/gnss/2.0/IAGnss.hal b/gnss/2.0/IAGnss.hal
new file mode 100644
index 0000000..d4e7d2f
--- /dev/null
+++ b/gnss/2.0/IAGnss.hal
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@2.0;
+
+import IAGnssCallback;
+
+/**
+ * Extended interface for Assisted GNSS support.
+ */
+interface IAGnss {
+    enum ApnIpType : uint8_t {
+        INVALID  = 0,
+        IPV4     = 1,
+        IPV6     = 2,
+        IPV4V6   = 3
+    };
+
+    /**
+     * Opens the AGNSS interface and provides the callback routines to the
+     * implementation of this interface.
+     *
+     * @param callback Handle to the AGNSS status callback interface.
+     */
+    setCallback(IAGnssCallback callback);
+
+    /**
+     * Notifies that the AGNSS data connection has been closed.
+     *
+     * @return success True if the operation is successful.
+     */
+    dataConnClosed() generates (bool success);
+
+    /**
+     * Notifies that a data connection is not available for AGNSS.
+     *
+     * @return success True if the operation is successful.
+     */
+    dataConnFailed() generates (bool success);
+
+    /**
+     * Sets the hostname and port for the AGNSS server.
+     *
+     * @param type Specifies if SUPL or C2K.
+     * @param hostname Hostname of the AGNSS server.
+     * @param port Port number associated with the server.
+     *
+     * @return success True if the operation is successful.
+     */
+    setServer(AGnssType type, string hostname, int32_t port)
+        generates (bool success);
+
+    /**
+     * Notifies GNSS that a data connection is available and sets the network handle,
+     * name of the APN, and its IP type to be used for SUPL connections.
+     *
+     * The HAL implementation must use the network handle to set the network for the
+     * SUPL connection sockets using the android_setsocknetwork function. This will ensure
+     * that there is a network path to the SUPL server. The network handle can also be used
+     * to get the IP address of SUPL FQDN using the android_getaddrinfofornetwork() function.
+     *
+     * @param networkHandle Handle representing the network for use with the NDK API.
+     * @param apn Access Point Name (follows regular APN naming convention).
+     * @param apnIpType Specifies IP type of APN.
+     *
+     * @return success True if the operation is successful.
+     */
+    dataConnOpen(net_handle_t networkHandle, string apn, ApnIpType apnIpType)
+        generates (bool success);
+};
\ No newline at end of file
diff --git a/gnss/2.0/IAGnssCallback.hal b/gnss/2.0/IAGnssCallback.hal
new file mode 100644
index 0000000..896be18
--- /dev/null
+++ b/gnss/2.0/IAGnssCallback.hal
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.gnss@2.0;
+
+/** Callback structure for the AGNSS interface. */
+interface IAGnssCallback {
+    /** AGNSS service type **/
+    enum AGnssType : uint8_t {
+        SUPL         = 1,
+        C2K          = 2,
+        SUPL_EIMS    = 3,
+        SUPL_IMS     = 4,
+    };
+
+    enum AGnssStatusValue : uint8_t {
+        /** GNSS requests data connection for AGNSS. */
+        REQUEST_AGNSS_DATA_CONN  = 1,
+        /** GNSS releases the AGNSS data connection. */
+        RELEASE_AGNSS_DATA_CONN  = 2,
+        /** AGNSS data connection initiated */
+        AGNSS_DATA_CONNECTED     = 3,
+        /** AGNSS data connection completed */
+        AGNSS_DATA_CONN_DONE     = 4,
+        /** AGNSS data connection failed */
+        AGNSS_DATA_CONN_FAILED   = 5
+    };
+
+    /**
+     * Callback with AGNSS status information.
+     *
+     * The GNSS HAL implementation must use this method to request the framework to setup
+     * network connection for the specified AGNSS service and to update the connection
+     * status so that the framework can release the resources.
+     *
+     * @param type Type of AGNSS service.
+     * @parama status Status of the data connection.
+     */
+    agnssStatusCb(AGnssType type, AGnssStatusValue status);
+};
\ No newline at end of file
diff --git a/gnss/2.0/IGnss.hal b/gnss/2.0/IGnss.hal
index 0799a60..fb8b040 100644
--- a/gnss/2.0/IGnss.hal
+++ b/gnss/2.0/IGnss.hal
@@ -21,6 +21,7 @@
 
 import IGnssCallback;
 import IGnssMeasurement;
+import IAGnss;
 import IAGnssRil;
 
 /** Represents the standard GNSS (Global Navigation Satellite System) interface. */
@@ -36,6 +37,16 @@
     setCallback_2_0(IGnssCallback callback) generates (bool success);
 
     /**
+     * This method returns the IAGnss Interface.
+     *
+     * The getExtensionAGnss() must return nullptr as the @1.0::IAGnss interface is
+     * deprecated.
+     *
+     * @return aGnssIface Handle to the IAGnss interface.
+     */
+    getExtensionAGnss_2_0() generates (IAGnss aGnssIface);
+
+    /**
      * This method returns the IAGnssRil Interface.
      *
      * @return aGnssRilIface Handle to the IAGnssRil interface.
@@ -59,4 +70,4 @@
      */
      getExtensionMeasurementCorrections()
             generates (IMeasurementCorrections measurementCorrectionsIface);
-};
\ No newline at end of file
+};
diff --git a/gnss/2.0/default/AGnss.cpp b/gnss/2.0/default/AGnss.cpp
new file mode 100644
index 0000000..c8e8bf1
--- /dev/null
+++ b/gnss/2.0/default/AGnss.cpp
@@ -0,0 +1,60 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "AGnss"
+
+#include "AGnss.h"
+#include <log/log.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+// Methods from ::android::hardware::gnss::V2_0::IAGnss follow.
+Return<void> AGnss::setCallback(const sp<V2_0::IAGnssCallback>&) {
+    // TODO implement
+    return Void();
+}
+
+Return<bool> AGnss::dataConnClosed() {
+    // TODO implement
+    return bool{};
+}
+
+Return<bool> AGnss::dataConnFailed() {
+    // TODO implement
+    return bool{};
+}
+
+Return<bool> AGnss::setServer(V2_0::IAGnssCallback::AGnssType type, const hidl_string& hostname,
+                              int32_t port) {
+    ALOGD("setServer: type: %s, hostname: %s, port: %d", toString(type).c_str(), hostname.c_str(),
+          port);
+    return true;
+}
+
+Return<bool> AGnss::dataConnOpen(uint64_t, const hidl_string&, V2_0::IAGnss::ApnIpType) {
+    // TODO implement
+    return bool{};
+}
+
+}  // namespace implementation
+}  // namespace V2_0
+}  // namespace gnss
+}  // namespace hardware
+}  // namespace android
diff --git a/gnss/2.0/default/AGnss.h b/gnss/2.0/default/AGnss.h
new file mode 100644
index 0000000..244a2c6
--- /dev/null
+++ b/gnss/2.0/default/AGnss.h
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H
+#define ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H
+
+#include <android/hardware/gnss/2.0/IAGnss.h>
+#include <hidl/MQDescriptor.h>
+#include <hidl/Status.h>
+
+namespace android {
+namespace hardware {
+namespace gnss {
+namespace V2_0 {
+namespace implementation {
+
+using ::android::sp;
+using ::android::hardware::hidl_array;
+using ::android::hardware::hidl_memory;
+using ::android::hardware::hidl_string;
+using ::android::hardware::hidl_vec;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+
+struct AGnss : public IAGnss {
+    // Methods from ::android::hardware::gnss::V2_0::IAGnss follow.
+    Return<void> setCallback(const sp<V2_0::IAGnssCallback>& callback) override;
+    Return<bool> dataConnClosed() override;
+    Return<bool> dataConnFailed() override;
+    Return<bool> setServer(V2_0::IAGnssCallback::AGnssType type, const hidl_string& hostname,
+                           int32_t port) override;
+    Return<bool> dataConnOpen(uint64_t networkHandle, const hidl_string& apn,
+                              V2_0::IAGnss::ApnIpType apnIpType) override;
+};
+
+}  // namespace implementation
+}  // namespace V2_0
+}  // namespace gnss
+}  // namespace hardware
+}  // namespace android
+
+#endif  // ANDROID_HARDWARE_GNSS_V2_0_AGNSS_H
\ No newline at end of file
diff --git a/gnss/2.0/default/Android.bp b/gnss/2.0/default/Android.bp
index dcdebe8..9119ee4 100644
--- a/gnss/2.0/default/Android.bp
+++ b/gnss/2.0/default/Android.bp
@@ -21,6 +21,7 @@
     vendor: true,
     vintf_fragments: ["android.hardware.gnss@2.0-service.xml"],
     srcs: [
+        "AGnss.cpp",
         "AGnssRil.cpp",
         "Gnss.cpp",
         "GnssMeasurement.cpp",
diff --git a/gnss/2.0/default/Gnss.cpp b/gnss/2.0/default/Gnss.cpp
index 886a3a8..bde904f 100644
--- a/gnss/2.0/default/Gnss.cpp
+++ b/gnss/2.0/default/Gnss.cpp
@@ -18,9 +18,12 @@
 
 #include "Gnss.h"
 #include <log/log.h>
+#include "AGnss.h"
 #include "AGnssRil.h"
 #include "GnssMeasurement.h"
 
+using ::android::hardware::Status;
+
 namespace android {
 namespace hardware {
 namespace gnss {
@@ -178,6 +181,10 @@
 }
 
 // Methods from V2_0::IGnss follow.
+Return<sp<V2_0::IAGnss>> Gnss::getExtensionAGnss_2_0() {
+    return new AGnss{};
+}
+
 Return<sp<V2_0::IAGnssRil>> Gnss::getExtensionAGnssRil_2_0() {
     return new AGnssRil{};
 }
diff --git a/gnss/2.0/default/Gnss.h b/gnss/2.0/default/Gnss.h
index cd69a93..47792cf 100644
--- a/gnss/2.0/default/Gnss.h
+++ b/gnss/2.0/default/Gnss.h
@@ -72,6 +72,7 @@
     Return<bool> injectBestLocation(const V1_0::GnssLocation& location) override;
 
     // Methods from V2_0::IGnss follow.
+    Return<sp<V2_0::IAGnss>> getExtensionAGnss_2_0() override;
     Return<sp<V2_0::IAGnssRil>> getExtensionAGnssRil_2_0() override;
     Return<sp<V2_0::IGnssMeasurement>> getExtensionGnssMeasurement_2_0() override;
     Return<bool> setCallback_2_0(const sp<V2_0::IGnssCallback>& callback) override;
@@ -89,4 +90,4 @@
 }  // namespace hardware
 }  // namespace android
 
-#endif  // ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
\ No newline at end of file
+#endif  // ANDROID_HARDWARE_GNSS_V2_0_GNSS_H
diff --git a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
index c1f1393..ef232c9 100644
--- a/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
+++ b/gnss/2.0/vts/functional/gnss_hal_test_cases.cpp
@@ -25,6 +25,10 @@
 using IGnssMeasurement_2_0 = android::hardware::gnss::V2_0::IGnssMeasurement;
 using IGnssMeasurement_1_1 = android::hardware::gnss::V1_1::IGnssMeasurement;
 using IGnssMeasurement_1_0 = android::hardware::gnss::V1_0::IGnssMeasurement;
+using IAGnssRil_2_0 = android::hardware::gnss::V2_0::IAGnssRil;
+using IAGnss_2_0 = android::hardware::gnss::V2_0::IAGnss;
+using IAGnss_1_0 = android::hardware::gnss::V1_0::IAGnss;
+using IAGnssCallback_2_0 = android::hardware::gnss::V2_0::IAGnssCallback;
 
 /*
  * SetupTeardownCreateCleanup:
@@ -60,7 +64,9 @@
  * Gets the AGnssRilExtension and verifies that it returns an actual extension.
  *
  * The GNSS HAL 2.0 implementation must support @2.0::IAGnssRil interface due to the deprecation
- * of framework network API methods needed to support the @1::IAGnssRil interface.
+ * of framework network API methods needed to support the @1.0::IAGnssRil interface.
+ *
+ * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launced with Q or later.
  */
 TEST_F(GnssHalTest, TestAGnssRilExtension) {
     auto agnssRil = gnss_hal_->getExtensionAGnssRil_2_0();
@@ -71,8 +77,8 @@
 
 /*
  * TestAGnssRilUpdateNetworkState_2_0:
- * 1. Update GNSS HAL that a network has connected.
- * 2. Update GNSS HAL that network has disconnected.
+ * 1. Updates GNSS HAL that a network has connected.
+ * 2. Updates GNSS HAL that network has disconnected.
  */
 TEST_F(GnssHalTest, TestAGnssRilUpdateNetworkState_2_0) {
     auto agnssRil = gnss_hal_->getExtensionAGnssRil_2_0();
@@ -80,7 +86,7 @@
     sp<IAGnssRil_2_0> iAGnssRil = agnssRil;
     ASSERT_NE(iAGnssRil, nullptr);
 
-    // Update GNSS HAL that a network is connected.
+    // Update GNSS HAL that a network has connected.
     IAGnssRil_2_0::NetworkAttributes networkAttributes = {
         .networkHandle = static_cast<uint64_t>(7700664333),
         .isConnected = true,
@@ -133,3 +139,38 @@
 
     iGnssMeasurement->close();
 }
+
+/*
+ * TestAGnssExtension:
+ * Gets the AGnssExtension and verifies that it supports @2.0::IAGnss interface by invoking
+ * a method.
+ *
+ * The GNSS HAL 2.0 implementation must support @2.0::IAGnss interface due to the deprecation
+ * of framework network API methods needed to support the @1.0::IAGnss interface.
+ *
+ * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launced with Q or later.
+ */
+TEST_F(GnssHalTest, TestAGnssExtension) {
+    // Verify IAGnss 2.0 is supported.
+    auto agnss = gnss_hal_->getExtensionAGnss_2_0();
+    ASSERT_TRUE(agnss.isOk());
+    sp<IAGnss_2_0> iAGnss = agnss;
+    ASSERT_NE(iAGnss, nullptr);
+
+    // Set SUPL server host/port
+    auto result = iAGnss->setServer(IAGnssCallback_2_0::AGnssType::SUPL, "supl.google.com", 7275);
+    ASSERT_TRUE(result.isOk());
+    EXPECT_TRUE(result);
+}
+
+/*
+ * TestAGnssExtension_1_0_Deprecation:
+ * Gets the @1.0::IAGnss extension and verifies that it is a nullptr.
+ *
+ * TODO (b/121287858): Enforce gnss@2.0 HAL package is supported on devices launced with Q or later.
+ */
+TEST_F(GnssHalTest, TestAGnssExtension_1_0_Deprecation) {
+    // Verify IAGnss 1.0 is not supported.
+    auto agnss_1_0 = gnss_hal_->getExtensionAGnss();
+    ASSERT_TRUE(!agnss_1_0.isOk() || ((sp<IAGnss_1_0>)agnss_1_0) == nullptr);
+}
diff --git a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
index 967a9f2..3b4eb21 100644
--- a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
@@ -89,11 +89,22 @@
                                                 sp<ExecutionCallback>& callback) {
     return preparedModel->execute_1_2(request, callback);
 }
+static Return<ErrorStatus> ExecutePreparedModel(sp<V1_0::IPreparedModel>&, const Request&) {
+    ADD_FAILURE() << "asking for synchronous execution at V1_0";
+    return ErrorStatus::GENERAL_FAILURE;
+}
+static Return<ErrorStatus> ExecutePreparedModel(sp<V1_2::IPreparedModel>& preparedModel,
+                                                const Request& request) {
+    return preparedModel->executeSynchronously(request);
+}
+enum class Synchronously { NO, YES };
+const float kDefaultAtol = 1e-5f;
+const float kDefaultRtol = 1e-5f;
 template <typename T_IPreparedModel>
 void EvaluatePreparedModel(sp<T_IPreparedModel>& preparedModel, std::function<bool(int)> is_ignored,
                            const std::vector<MixedTypedExample>& examples,
-                           bool hasRelaxedFloat32Model = false, float fpAtol = 1e-5f,
-                           float fpRtol = 1e-5f) {
+                           bool hasRelaxedFloat32Model = false, float fpAtol = kDefaultAtol,
+                           float fpRtol = kDefaultRtol, Synchronously sync = Synchronously::NO) {
     const uint32_t INPUT = 0;
     const uint32_t OUTPUT = 1;
 
@@ -186,19 +197,31 @@
         inputMemory->commit();
         outputMemory->commit();
 
-        // launch execution
-        sp<ExecutionCallback> executionCallback = new ExecutionCallback();
-        ASSERT_NE(nullptr, executionCallback.get());
-        Return<ErrorStatus> executionLaunchStatus = ExecutePreparedModel(
-            preparedModel, {.inputs = inputs_info, .outputs = outputs_info, .pools = pools},
-            executionCallback);
-        ASSERT_TRUE(executionLaunchStatus.isOk());
-        EXPECT_EQ(ErrorStatus::NONE, static_cast<ErrorStatus>(executionLaunchStatus));
+        if (sync == Synchronously::NO) {
+            SCOPED_TRACE("asynchronous");
 
-        // retrieve execution status
-        executionCallback->wait();
-        ErrorStatus executionReturnStatus = executionCallback->getStatus();
-        EXPECT_EQ(ErrorStatus::NONE, executionReturnStatus);
+            // launch execution
+            sp<ExecutionCallback> executionCallback = new ExecutionCallback();
+            ASSERT_NE(nullptr, executionCallback.get());
+            Return<ErrorStatus> executionLaunchStatus = ExecutePreparedModel(
+                preparedModel, {.inputs = inputs_info, .outputs = outputs_info, .pools = pools},
+                executionCallback);
+            ASSERT_TRUE(executionLaunchStatus.isOk());
+            EXPECT_EQ(ErrorStatus::NONE, static_cast<ErrorStatus>(executionLaunchStatus));
+
+            // retrieve execution status
+            executionCallback->wait();
+            ErrorStatus executionReturnStatus = executionCallback->getStatus();
+            EXPECT_EQ(ErrorStatus::NONE, executionReturnStatus);
+        } else {
+            SCOPED_TRACE("synchronous");
+
+            // execute
+            Return<ErrorStatus> executionStatus = ExecutePreparedModel(
+                preparedModel, {.inputs = inputs_info, .outputs = outputs_info, .pools = pools});
+            ASSERT_TRUE(executionStatus.isOk());
+            EXPECT_EQ(ErrorStatus::NONE, static_cast<ErrorStatus>(executionStatus));
+        }
 
         // validate results
         outputMemory->read();
@@ -216,6 +239,13 @@
         }
     }
 }
+template <typename T_IPreparedModel>
+void EvaluatePreparedModel(sp<T_IPreparedModel>& preparedModel, std::function<bool(int)> is_ignored,
+                           const std::vector<MixedTypedExample>& examples,
+                           bool hasRelaxedFloat32Model, Synchronously sync) {
+    EvaluatePreparedModel(preparedModel, is_ignored, examples, hasRelaxedFloat32Model, kDefaultAtol,
+                          kDefaultRtol, sync);
+}
 
 static void getPreparedModel(sp<PreparedModelCallback> callback,
                              sp<V1_0::IPreparedModel>* preparedModel) {
@@ -363,7 +393,9 @@
     ASSERT_NE(nullptr, preparedModel.get());
 
     EvaluatePreparedModel(preparedModel, is_ignored, examples,
-                          model.relaxComputationFloat32toFloat16);
+                          model.relaxComputationFloat32toFloat16, Synchronously::NO);
+    EvaluatePreparedModel(preparedModel, is_ignored, examples,
+                          model.relaxComputationFloat32toFloat16, Synchronously::YES);
 }
 
 }  // namespace generated_tests
diff --git a/neuralnetworks/1.2/IPreparedModel.hal b/neuralnetworks/1.2/IPreparedModel.hal
index 5590487..4e91c67 100644
--- a/neuralnetworks/1.2/IPreparedModel.hal
+++ b/neuralnetworks/1.2/IPreparedModel.hal
@@ -51,8 +51,9 @@
      * and complete successfully (ErrorStatus::NONE). There must be
      * no failure unless the device itself is in a bad state.
      *
-     * Multiple threads can call the execute_1_2 function on the same IPreparedModel
-     * object concurrently with different requests.
+     * Any number of calls to the execute, execute_1_2, and executeSynchronously
+     * functions, in any combination, may be made concurrently, even on the same
+     * IPreparedModel object.
      *
      * @param request The input and output information on which the prepared
      *                model is to be executed.
@@ -71,4 +72,39 @@
      */
     execute_1_2(Request request, IExecutionCallback callback)
         generates (ErrorStatus status);
+
+    /**
+     * Performs a synchronous execution on a prepared model.
+     *
+     * The execution is performed synchronously with respect to the caller.
+     * executeSynchronously must verify the inputs to the function are
+     * correct. If there is an error, executeSynchronously must immediately
+     * return with the appropriate ErrorStatus value. If the inputs to the
+     * function are valid and there is no error, executeSynchronously must
+     * perform the execution, and must not return until the execution is
+     * complete.
+     *
+     * If the prepared model was prepared from a model wherein all tensor
+     * operands have fully specified dimensions, and the inputs to the function
+     * are valid, then the execution should complete successfully
+     * (ErrorStatus::NONE). There must be no failure unless the device itself is
+     * in a bad state.
+     *
+     * Any number of calls to the execute, execute_1_2, and executeSynchronously
+     * functions, in any combination, may be made concurrently, even on the same
+     * IPreparedModel object.
+     *
+     * @param request The input and output information on which the prepared
+     *                model is to be executed.
+     * @return status Error status of the execution, must be:
+     *                - NONE if execution is performed successfully
+     *                - DEVICE_UNAVAILABLE if driver is offline or busy
+     *                - GENERAL_FAILURE if there is an unspecified error
+     *                - OUTPUT_INSUFFICIENT_SIZE if provided output buffer is
+     *                  not large enough to store the resultant values
+     *                - INVALID_ARGUMENT if one of the input arguments is
+     *                  invalid
+     */
+    executeSynchronously(Request request)
+        generates (ErrorStatus status);
 };
diff --git a/neuralnetworks/1.2/types.hal b/neuralnetworks/1.2/types.hal
index 7c55cab..40c07e7 100644
--- a/neuralnetworks/1.2/types.hal
+++ b/neuralnetworks/1.2/types.hal
@@ -160,6 +160,7 @@
     REDUCE_MIN = 94,
     REDUCE_ANY = 95,
     REDUCE_ALL = 96,
+    INSTANCE_NORMALIZATION = 97,
     /* ADDING A NEW FUNDAMENTAL OPERATION REQUIRES UPDATING THE VALUE OF
      * OperationTypeRange::OPERATION_FUNDAMENTAL_MAX.
      */
@@ -173,7 +174,7 @@
  */
 enum OperationTypeRange : uint32_t {
     OPERATION_FUNDAMENTAL_MIN = 0,
-    OPERATION_FUNDAMENTAL_MAX = 96,
+    OPERATION_FUNDAMENTAL_MAX = 97,
     OPERATION_OEM_MIN = 10000,
     OPERATION_OEM_MAX = 10000,
 };
diff --git a/neuralnetworks/1.2/vts/functional/ValidateRequest.cpp b/neuralnetworks/1.2/vts/functional/ValidateRequest.cpp
index e2722aa..d80fbcf 100644
--- a/neuralnetworks/1.2/vts/functional/ValidateRequest.cpp
+++ b/neuralnetworks/1.2/vts/functional/ValidateRequest.cpp
@@ -97,18 +97,29 @@
 static void validate(const sp<IPreparedModel>& preparedModel, const std::string& message,
                      Request request, const std::function<void(Request*)>& mutation) {
     mutation(&request);
-    SCOPED_TRACE(message + " [execute]");
 
-    sp<ExecutionCallback> executionCallback = new ExecutionCallback();
-    ASSERT_NE(nullptr, executionCallback.get());
-    Return<ErrorStatus> executeLaunchStatus =
-        preparedModel->execute_1_2(request, executionCallback);
-    ASSERT_TRUE(executeLaunchStatus.isOk());
-    ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, static_cast<ErrorStatus>(executeLaunchStatus));
+    {
+        SCOPED_TRACE(message + " [execute_1_2]");
 
-    executionCallback->wait();
-    ErrorStatus executionReturnStatus = executionCallback->getStatus();
-    ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, executionReturnStatus);
+        sp<ExecutionCallback> executionCallback = new ExecutionCallback();
+        ASSERT_NE(nullptr, executionCallback.get());
+        Return<ErrorStatus> executeLaunchStatus =
+            preparedModel->execute_1_2(request, executionCallback);
+        ASSERT_TRUE(executeLaunchStatus.isOk());
+        ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, static_cast<ErrorStatus>(executeLaunchStatus));
+
+        executionCallback->wait();
+        ErrorStatus executionReturnStatus = executionCallback->getStatus();
+        ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, executionReturnStatus);
+    }
+
+    {
+        SCOPED_TRACE(message + " [executeSynchronously]");
+
+        Return<ErrorStatus> executeStatus = preparedModel->executeSynchronously(request);
+        ASSERT_TRUE(executeStatus.isOk());
+        ASSERT_EQ(ErrorStatus::INVALID_ARGUMENT, static_cast<ErrorStatus>(executeStatus));
+    }
 }
 
 // Delete element from hidl_vec. hidl_vec doesn't support a "remove" operation,
diff --git a/wifi/1.3/IWifiChip.hal b/wifi/1.3/IWifiChip.hal
index 74d527d..be00ee5 100644
--- a/wifi/1.3/IWifiChip.hal
+++ b/wifi/1.3/IWifiChip.hal
@@ -66,4 +66,17 @@
      * as gaming and virtual reality applications.
      */
     setLatencyMode(LatencyMode mode) generates (WifiStatus status);
+
+    /**
+     * API to flush debug ring buffer data to files.
+     *
+     * Force flush debug ring buffer using IBase::debug.
+     * This API help to collect firmware/driver/pkt logs.
+     *
+     * @return status WifiStatus of the operation.
+     *         Possible status codes:
+     *         |WifiStatusCode.SUCCESS|,
+     *         |WifiStatusCode.UNKNOWN|
+     */
+    flushRingBufferToFile() generates (WifiStatus status);
 };
diff --git a/wifi/1.3/default/wifi_chip.cpp b/wifi/1.3/default/wifi_chip.cpp
index dd6bd7c..1f1aa95 100644
--- a/wifi/1.3/default/wifi_chip.cpp
+++ b/wifi/1.3/default/wifi_chip.cpp
@@ -37,8 +37,8 @@
 using android::hardware::wifi::V1_0::IWifiChip;
 
 constexpr char kCpioMagic[] = "070701";
-constexpr size_t kMaxBufferSizeBytes = 1024 * 1024;
-constexpr uint32_t kMaxRingBufferFileAgeSeconds = 60 * 60;
+constexpr size_t kMaxBufferSizeBytes = 1024 * 1024 * 3;
+constexpr uint32_t kMaxRingBufferFileAgeSeconds = 60 * 60 * 10;
 constexpr uint32_t kMaxRingBufferFileNum = 20;
 constexpr char kTombstoneFolderPath[] = "/data/vendor/tombstones/wifi/";
 
@@ -515,6 +515,13 @@
                            hidl_status_cb, ring_name);
 }
 
+Return<void> WifiChip::flushRingBufferToFile(
+    flushRingBufferToFile_cb hidl_status_cb) {
+    return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
+                           &WifiChip::flushRingBufferToFileInternal,
+                           hidl_status_cb);
+}
+
 Return<void> WifiChip::stopLoggingToDebugRingBuffer(
     stopLoggingToDebugRingBuffer_cb hidl_status_cb) {
     return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
@@ -1000,6 +1007,14 @@
     return createWifiStatusFromLegacyError(legacy_status);
 }
 
+WifiStatus WifiChip::flushRingBufferToFileInternal() {
+    if (!writeRingbufferFilesInternal()) {
+        LOG(ERROR) << "Error writing files to flash";
+        return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN);
+    }
+    return createWifiStatus(WifiStatusCode::SUCCESS);
+}
+
 WifiStatus WifiChip::stopLoggingToDebugRingBufferInternal() {
     legacy_hal::wifi_error legacy_status =
         legacy_hal_.lock()->deregisterRingBufferCallbackHandler(
diff --git a/wifi/1.3/default/wifi_chip.h b/wifi/1.3/default/wifi_chip.h
index 6695240..d14ced6 100644
--- a/wifi/1.3/default/wifi_chip.h
+++ b/wifi/1.3/default/wifi_chip.h
@@ -126,6 +126,8 @@
     Return<void> forceDumpToDebugRingBuffer(
         const hidl_string& ring_name,
         forceDumpToDebugRingBuffer_cb hidl_status_cb) override;
+    Return<void> flushRingBufferToFile(
+        flushRingBufferToFile_cb hidl_status_cb) override;
     Return<void> stopLoggingToDebugRingBuffer(
         stopLoggingToDebugRingBuffer_cb hidl_status_cb) override;
     Return<void> getDebugHostWakeReasonStats(
@@ -198,6 +200,7 @@
         WifiDebugRingBufferVerboseLevel verbose_level,
         uint32_t max_interval_in_sec, uint32_t min_data_size_in_bytes);
     WifiStatus forceDumpToDebugRingBufferInternal(const hidl_string& ring_name);
+    WifiStatus flushRingBufferToFileInternal();
     WifiStatus stopLoggingToDebugRingBufferInternal();
     std::pair<WifiStatus, WifiDebugHostWakeReasonStats>
     getDebugHostWakeReasonStatsInternal();