Merge "uwb(hal): Refactor HAL to support multiple UWB chips"
diff --git a/audio/core/all-versions/default/Android.bp b/audio/core/all-versions/default/Android.bp
index 392642d..6a0d0a0 100644
--- a/audio/core/all-versions/default/Android.bp
+++ b/audio/core/all-versions/default/Android.bp
@@ -57,7 +57,6 @@
     header_libs: [
         "android.hardware.audio-impl_headers",
         "android.hardware.audio.common.util@all-versions",
-        "libaudioclient_headers",
         "libaudioutils_headers",
         "libaudio_system_headers",
         "libhardware_headers",
@@ -140,8 +139,8 @@
     defaults: ["android.hardware.audio@6.0-impl_default"],
 }
 
-cc_library_shared {
-    name: "android.hardware.audio@7.0-impl",
+cc_defaults {
+    name: "android.hardware.audio@7.0-impl_default",
     defaults: ["android.hardware.audio-impl_default"],
     shared_libs: [
         "android.hardware.audio@7.0",
@@ -157,3 +156,8 @@
         "-include common/all-versions/VersionMacro.h",
     ],
 }
+
+cc_library_shared {
+    name: "android.hardware.audio@7.0-impl",
+    defaults: ["android.hardware.audio@7.0-impl_default"],
+}
diff --git a/audio/core/all-versions/vts/functional/Android.bp b/audio/core/all-versions/vts/functional/Android.bp
index 9f4a295..7c25c23 100644
--- a/audio/core/all-versions/vts/functional/Android.bp
+++ b/audio/core/all-versions/vts/functional/Android.bp
@@ -58,6 +58,7 @@
         "libmedia_helper",
         "android.hardware.audio@2.0",
         "android.hardware.audio.common@2.0",
+        "android.media.audio.common.types-V1-cpp",
     ],
     cflags: [
         "-DMAJOR_VERSION=2",
@@ -84,6 +85,7 @@
         "libmedia_helper",
         "android.hardware.audio@4.0",
         "android.hardware.audio.common@4.0",
+        "android.media.audio.common.types-V1-cpp",
     ],
     cflags: [
         "-DMAJOR_VERSION=4",
@@ -110,6 +112,7 @@
         "libmedia_helper",
         "android.hardware.audio@5.0",
         "android.hardware.audio.common@5.0",
+        "android.media.audio.common.types-V1-cpp",
     ],
     cflags: [
         "-DMAJOR_VERSION=5",
@@ -137,6 +140,7 @@
         "libmedia_helper",
         "android.hardware.audio@6.0",
         "android.hardware.audio.common@6.0",
+        "android.media.audio.common.types-V1-cpp",
     ],
     cflags: [
         "-DMAJOR_VERSION=6",
@@ -200,6 +204,7 @@
     static_libs: [
         "android.hardware.audio@6.0",
         "android.hardware.audio.common@6.0",
+        "android.media.audio.common.types-V1-cpp",
         "libaudiofoundation",
         "libaudiopolicycomponents",
         "libmedia_helper",
diff --git a/audio/effect/all-versions/default/Android.bp b/audio/effect/all-versions/default/Android.bp
index 6df9dbf..1e01ffb 100644
--- a/audio/effect/all-versions/default/Android.bp
+++ b/audio/effect/all-versions/default/Android.bp
@@ -45,7 +45,6 @@
     header_libs: [
         "android.hardware.audio.common.util@all-versions",
         "libaudio_system_headers",
-        "libaudioclient_headers",
         "libeffects_headers",
         "libhardware_headers",
         "libmedia_headers",
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index ad9642a..7fd4a79 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -989,7 +989,7 @@
                 .config =
                         {
                                 .prop = toInt(VehicleProperty::EPOCH_TIME),
-                                .access = VehiclePropertyAccess::READ_WRITE,
+                                .access = VehiclePropertyAccess::WRITE,
                                 .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
                         },
         },
diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal
index 6bfda32..b964991 100644
--- a/automotive/vehicle/2.0/types.hal
+++ b/automotive/vehicle/2.0/types.hal
@@ -1433,17 +1433,29 @@
      * This value denotes the number of milliseconds seconds that have
      * elapsed since 1/1/1970 UTC.
      *
-     * Reading this value will give you the system’s time. This can be
-     * useful to synchronize other vehicle systems (dash clock etc).
+     * AAOS will write to this value to give VHAL the Android system's time,
+     * if the VHAL supports this property. This can be useful to synchronize
+     * other vehicle systems (dash clock etc) with Android's time.
      *
-     * Writing this value will update the ‘ExternalTimeSuggestion’
-     * value (if enabled). This value may be consumed by the “Time
-     * Detector Service”, if other sources do not have a higher
-     * priority. For information on how to adjust time source
-     * priorities see Time Detector Service documentation.
+     * AAOS writes to this property once during boot, and
+     * will thereafter write only when some time-source changes are propagated.
+     * AAOS will fill in VehiclePropValue.timestamp correctly.
+     * Note that AAOS will not send updates for natural elapse of time.
+     *     int64Values[0] = provided Unix time (in milliseconds)
+     *
+     * Note that the property may take >0 ms to get propagated through the stack
+     * and, having a timestamped property helps reduce any time drift. So,
+     * for all writes to the property, the timestamp can be used to negate this
+     * drift:
+     *     drift = currentTimeMillis - PropValue.timestamp
+     *     effectiveTime = PropValue.value.int64Values[0] + diff
+     *
+     * Aside, this property could have been better named ANDROID_EPOCH_TIME, but it
+     * continues to be called EPOCH_TIME for legacy reasons. We will try to fix
+     * this naming discrepancy when we migrate to AIDL.
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
-     * @access VehiclePropertyAccess:READ_WRITE
+     * @access VehiclePropertyAccess:WRITE_ONLY
      * @unit VehicleUnit:MILLI_SECS
      */
     EPOCH_TIME = (
diff --git a/camera/device/3.4/default/ExternalCameraDevice.cpp b/camera/device/3.4/default/ExternalCameraDevice.cpp
index 677b496..311c688 100644
--- a/camera/device/3.4/default/ExternalCameraDevice.cpp
+++ b/camera/device/3.4/default/ExternalCameraDevice.cpp
@@ -413,8 +413,8 @@
     const uint8_t croppingType = ANDROID_SCALER_CROPPING_TYPE_CENTER_ONLY;
     UPDATE(ANDROID_SCALER_CROPPING_TYPE, &croppingType, 1);
 
-    const int32_t testPatternModes[] = {
-        ANDROID_SENSOR_TEST_PATTERN_MODE_OFF};
+    const int32_t testPatternModes[] = {ANDROID_SENSOR_TEST_PATTERN_MODE_OFF,
+                                        ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR};
     UPDATE(ANDROID_SENSOR_AVAILABLE_TEST_PATTERN_MODES, testPatternModes,
            ARRAY_SIZE(testPatternModes));
 
diff --git a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
index 5f86742..ca7186b 100644
--- a/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
+++ b/camera/device/3.4/default/ExternalCameraDeviceSession.cpp
@@ -1462,14 +1462,50 @@
         return onDeviceError("%s: V4L2 buffer map failed", __FUNCTION__);
     }
 
+    // Process camera mute state
+    auto testPatternMode = req->setting.find(ANDROID_SENSOR_TEST_PATTERN_MODE);
+    if (testPatternMode.count == 1) {
+        if (mCameraMuted != (testPatternMode.data.u8[0] != ANDROID_SENSOR_TEST_PATTERN_MODE_OFF)) {
+            mCameraMuted = !mCameraMuted;
+            // Get solid color for test pattern, if any was set
+            if (testPatternMode.data.u8[0] == ANDROID_SENSOR_TEST_PATTERN_MODE_SOLID_COLOR) {
+                auto entry = req->setting.find(ANDROID_SENSOR_TEST_PATTERN_DATA);
+                if (entry.count == 4) {
+                    // Update the mute frame if the pattern color has changed
+                    if (memcmp(entry.data.i32, mTestPatternData, sizeof(mTestPatternData)) != 0) {
+                        memcpy(mTestPatternData, entry.data.i32, sizeof(mTestPatternData));
+                        // Fill the mute frame with the solid color, use only 8 MSB of RGGB as RGB
+                        for (int i = 0; i < mMuteTestPatternFrame.size(); i += 3) {
+                            mMuteTestPatternFrame[i] = entry.data.i32[0] >> 24;
+                            mMuteTestPatternFrame[i + 1] = entry.data.i32[1] >> 24;
+                            mMuteTestPatternFrame[i + 2] = entry.data.i32[3] >> 24;
+                        }
+                    }
+                }
+            }
+        }
+    }
+
     // TODO: in some special case maybe we can decode jpg directly to gralloc output?
     if (req->frameIn->mFourcc == V4L2_PIX_FMT_MJPEG) {
         ATRACE_BEGIN("MJPGtoI420");
-        int res = libyuv::MJPGToI420(
-            inData, inDataSize, static_cast<uint8_t*>(mYu12FrameLayout.y), mYu12FrameLayout.yStride,
-            static_cast<uint8_t*>(mYu12FrameLayout.cb), mYu12FrameLayout.cStride,
-            static_cast<uint8_t*>(mYu12FrameLayout.cr), mYu12FrameLayout.cStride,
-            mYu12Frame->mWidth, mYu12Frame->mHeight, mYu12Frame->mWidth, mYu12Frame->mHeight);
+        int res = 0;
+        if (mCameraMuted) {
+            res = libyuv::ConvertToI420(
+                    mMuteTestPatternFrame.data(), mMuteTestPatternFrame.size(),
+                    static_cast<uint8_t*>(mYu12FrameLayout.y), mYu12FrameLayout.yStride,
+                    static_cast<uint8_t*>(mYu12FrameLayout.cb), mYu12FrameLayout.cStride,
+                    static_cast<uint8_t*>(mYu12FrameLayout.cr), mYu12FrameLayout.cStride, 0, 0,
+                    mYu12Frame->mWidth, mYu12Frame->mHeight, mYu12Frame->mWidth,
+                    mYu12Frame->mHeight, libyuv::kRotate0, libyuv::FOURCC_RAW);
+        } else {
+            res = libyuv::MJPGToI420(
+                    inData, inDataSize, static_cast<uint8_t*>(mYu12FrameLayout.y),
+                    mYu12FrameLayout.yStride, static_cast<uint8_t*>(mYu12FrameLayout.cb),
+                    mYu12FrameLayout.cStride, static_cast<uint8_t*>(mYu12FrameLayout.cr),
+                    mYu12FrameLayout.cStride, mYu12Frame->mWidth, mYu12Frame->mHeight,
+                    mYu12Frame->mWidth, mYu12Frame->mHeight);
+        }
         ATRACE_END();
 
         if (res != 0) {
@@ -1670,6 +1706,9 @@
         }
     }
 
+    // Allocate mute test pattern frame
+    mMuteTestPatternFrame.resize(mYu12Frame->mWidth * mYu12Frame->mHeight * 3);
+
     mBlobBufferSize = blobBufferSize;
     return Status::OK;
 }
@@ -1679,6 +1718,7 @@
     mYu12Frame.clear();
     mYu12ThumbFrame.clear();
     mIntermediateBuffers.clear();
+    mMuteTestPatternFrame.clear();
     mBlobBufferSize = 0;
 }
 
diff --git a/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h b/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h
index 180f0c1..184c16e 100644
--- a/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h
+++ b/camera/device/3.4/default/include/ext_device_v3_4_impl/ExternalCameraDeviceSession.h
@@ -181,6 +181,9 @@
         std::unordered_map<Size, sp<AllocatedFrame>, SizeHasher> mScaledYu12Frames;
         YCbCrLayout mYu12FrameLayout;
         YCbCrLayout mYu12ThumbFrameLayout;
+        std::vector<uint8_t> mMuteTestPatternFrame;
+        uint32_t mTestPatternData[4] = {0, 0, 0, 0};
+        bool mCameraMuted = false;
         uint32_t mBlobBufferSize = 0; // 0 -> HAL derive buffer size, else: use given size
 
         std::string mExifMake;
diff --git a/camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.cpp b/camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.cpp
index 4cff1b7..7c3b982 100644
--- a/camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.cpp
+++ b/camera/provider/2.4/default/LegacyCameraProviderImpl_2_4.cpp
@@ -450,7 +450,9 @@
         const sp<ICameraProviderCallback>& callback) {
     Mutex::Autolock _l(mCbLock);
     mCallbacks = callback;
-
+    if (mCallbacks == nullptr) {
+        return Status::OK;
+    }
     // Add and report all presenting external cameras.
     for (auto const& statusPair : mCameraStatusMap) {
         int id = std::stoi(statusPair.first);
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 72cb2bc..f03008a 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -194,6 +194,13 @@
             <instance>default</instance>
         </interface>
     </hal>
+    <hal format="aidl" optional="true">
+        <name>android.hardware.contexthub</name>
+        <interface>
+            <name>IContextHub</name>
+            <instance>default</instance>
+        </interface>
+    </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.contexthub</name>
         <version>1.2</version>
@@ -529,7 +536,7 @@
     </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.soundtrigger</name>
-        <version>2.3-4</version>
+        <version>2.3</version>
         <interface>
             <name>ISoundTriggerHw</name>
             <instance>default</instance>
diff --git a/contexthub/aidl/Android.bp b/contexthub/aidl/Android.bp
new file mode 100644
index 0000000..2086508
--- /dev/null
+++ b/contexthub/aidl/Android.bp
@@ -0,0 +1,28 @@
+// Copyright 2021 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.
+
+aidl_interface {
+    name: "android.hardware.contexthub",
+    vendor_available: true,
+    srcs: ["android/hardware/contexthub/*.aidl"],
+    stability: "vintf",
+    backend: {
+        java: {
+            sdk_version: "module_current",
+        },
+        ndk: {
+            apps_enabled: false,
+        },
+    },
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/AsyncEventType.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/AsyncEventType.aidl
new file mode 100644
index 0000000..8e0ff89
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/AsyncEventType.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.contexthub;
+@Backing(type="int") @VintfStability
+enum AsyncEventType {
+  RESTARTED = 1,
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl
new file mode 100644
index 0000000..e573556
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubInfo.aidl
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.contexthub;
+@VintfStability
+parcelable ContextHubInfo {
+  String name;
+  String vendor;
+  String toolchain;
+  int id;
+  float peakMips;
+  int maxSupportedMessageLengthBytes;
+  long chrePlatformId;
+  byte chreApiMajorVersion;
+  byte chreApiMinorVersion;
+  char chrePatchVersion;
+  String[] supportedPermissions;
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl
new file mode 100644
index 0000000..e38c251
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/ContextHubMessage.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.contexthub;
+@VintfStability
+parcelable ContextHubMessage {
+  long nanoappId;
+  char hostEndPoint;
+  int messageType;
+  byte[] messageBody;
+  String[] permissions;
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl
new file mode 100644
index 0000000..cb31c84
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHub.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.contexthub;
+@VintfStability
+interface IContextHub {
+  List<android.hardware.contexthub.ContextHubInfo> getContextHubs();
+  boolean loadNanoapp(in int contextHubId, in android.hardware.contexthub.NanoappBinary appBinary, in int transactionId);
+  boolean unloadNanoapp(in int contextHubId, in long appId, in int transactionId);
+  boolean disableNanoapp(in int contextHubId, in long appId, in int transactionId);
+  boolean enableNanoapp(in int contextHubId, in long appId, in int transactionId);
+  void onSettingChanged(in android.hardware.contexthub.Setting setting, in boolean enabled);
+  boolean queryNanoapps(in int contextHubId);
+  boolean registerCallback(in int contextHubId, in android.hardware.contexthub.IContextHubCallback cb);
+  boolean sendMessageToHub(in int contextHubId, in android.hardware.contexthub.ContextHubMessage message);
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl
new file mode 100644
index 0000000..f81f7cf
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/IContextHubCallback.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.contexthub;
+@VintfStability
+interface IContextHubCallback {
+  void handleNanoappInfo(in android.hardware.contexthub.NanoappInfo[] appInfo);
+  void handleContextHubMessage(in android.hardware.contexthub.ContextHubMessage msg, in String[] msgContentPerms);
+  void handleContextHubAsyncEvent(in android.hardware.contexthub.AsyncEventType evt);
+  void handleTransactionResult(in int transactionId, in boolean success);
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl
new file mode 100644
index 0000000..d53b28f
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappBinary.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.contexthub;
+@VintfStability
+parcelable NanoappBinary {
+  long nanoappId;
+  int nanoappVersion;
+  int flags;
+  byte targetChreApiMajorVersion;
+  byte targetChreApiMinorVersion;
+  byte[] customBinary;
+  const int FLAG_SIGNED = 1;
+  const int FLAG_ENCRYPTED = 2;
+  const int FLAG_TCM_CAPABLE = 4;
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappInfo.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappInfo.aidl
new file mode 100644
index 0000000..ea7825a
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/NanoappInfo.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.contexthub;
+@VintfStability
+parcelable NanoappInfo {
+  long nanoappId;
+  int nanoappVersion;
+  boolean enabled;
+  String[] permissions;
+}
diff --git a/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl
new file mode 100644
index 0000000..41bc9ae
--- /dev/null
+++ b/contexthub/aidl/aidl_api/android.hardware.contexthub/current/android/hardware/contexthub/Setting.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.contexthub;
+@Backing(type="byte") @VintfStability
+enum Setting {
+  LOCATION = 1,
+  WIFI_MAIN = 2,
+  WIFI_SCANNING = 3,
+  AIRPLANE_MODE = 4,
+  MICROPHONE = 5,
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/AsyncEventType.aidl b/contexthub/aidl/android/hardware/contexthub/AsyncEventType.aidl
new file mode 100644
index 0000000..d884c9c
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/AsyncEventType.aidl
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2021 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.contexthub;
+
+@VintfStability
+@Backing(type="int")
+enum AsyncEventType {
+    /** An event where the Context Hub has restarted (e.g. due to a crash). */
+    RESTARTED = 1,
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl b/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl
new file mode 100644
index 0000000..c0fa702
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/ContextHubInfo.aidl
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2021 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.contexthub;
+
+@VintfStability
+parcelable ContextHubInfo {
+    /** Descriptive name of the Context Hub */
+    String name;
+
+    /** The vendor e.g. "Google" */
+    String vendor;
+
+    /** Toolchain that describes the binary architecture eg: "gcc ARM" */
+    String toolchain;
+
+    /** A unique ID for this Context Hub */
+    int id;
+
+    /** Peak MIPs this platform can deliver */
+    float peakMips;
+
+    /** The maximum length in bytes of the message that can be sent to the Context Hub. */
+    int maxSupportedMessageLengthBytes;
+
+    /**
+     * Machine-readable CHRE platform ID, returned to nanoapps in the CHRE API
+     * function call chreGetPlatformId(). This field pairs with
+     * chreApiMajorVersion, chreApiMinorVersion, and chrePatchVersion to fully
+     * specify the CHRE implementation version. See also the CHRE API header
+     * file chre/version.h.
+     */
+    long chrePlatformId;
+
+    /**
+     * The version of the CHRE implementation returned to nanoApps in the CHRE
+     *  API function call chreGetVersion(). The major and minor version specify
+     * the implemented version of the CHRE API, while the patch version
+     * describes the implementation version within the scope of the platform
+     * ID. See also the CHRE API header file chre/version.h.
+     */
+    byte chreApiMajorVersion;
+    byte chreApiMinorVersion;
+    char chrePatchVersion;
+
+    /**
+     * A list of Android permissions this Context Hub support for nanoapps to enforce host endpoints
+     * are granted in order to communicate with them.
+     */
+    String[] supportedPermissions;
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl b/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl
new file mode 100644
index 0000000..867da2f
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/ContextHubMessage.aidl
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2021 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.contexthub;
+
+@VintfStability
+parcelable ContextHubMessage {
+    /** The unique identifier of the nanoapp. */
+    long nanoappId;
+
+    /**
+     * The identifier of the host client that is sending/receiving this message.
+     *
+     * There are two reserved values of the host endpoint that has a specific meaning:
+     * 1) BROADCAST = 0xFFFF: see CHRE_HOST_ENDPOINT_BROADCAST in
+     *    system/chre/chre_api/include/chre_api/chre/event.h for details.
+     * 2) UNSPECIFIED = 0xFFFE: see CHRE_HOST_ENDPOINT_UNSPECIFIED in
+     *    system/chre/chre_api/include/chre_api/chre/event.h for details.
+     */
+    char hostEndPoint;
+
+    /** The type of this message */
+    int messageType;
+
+    /** The payload containing the message */
+    byte[] messageBody;
+
+    /**
+     * The list of Android permissions held by the sending nanoapp at the time
+     * the message was sent.
+     *
+     * The framework MUST drop messages to host apps that don't have a superset
+     * of the permissions that the sending nanoapp is using.
+     */
+    String[] permissions;
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
new file mode 100644
index 0000000..e820cbf
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/IContextHub.aidl
@@ -0,0 +1,154 @@
+/*
+ * Copyright (C) 2021 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.contexthub;
+
+import android.hardware.contexthub.ContextHubInfo;
+import android.hardware.contexthub.ContextHubMessage;
+import android.hardware.contexthub.IContextHubCallback;
+import android.hardware.contexthub.NanoappBinary;
+import android.hardware.contexthub.Setting;
+
+@VintfStability
+interface IContextHub {
+    /**
+     * Enumerates all available Context Hubs.
+     *
+     * @return A list of ContextHubInfo describing all Context Hubs.
+     */
+    List<ContextHubInfo> getContextHubs();
+
+    /**
+     * Loads a nanoapp, and invokes the nanoapp's initialization "start()" entrypoint.
+     *
+     * The return value of this method only indicates that the request has been accepted.
+     * If true is returned, the Context Hub must handle an asynchronous result using the
+     * the handleTransactionResult() callback.
+     *
+     * Depending on the implementation, nanoapp loaded via this API may or may
+     * not persist across reboots of the hub. If they do persist, the
+     * implementation must initially place nanoapp in the disabled state upon a
+     * reboot, and not start them until a call is made to enableNanoapp(). In
+     * this case, the app must also be unloaded upon a factory reset of the
+     * device.
+     *
+     * Loading a nanoapp must not take more than 30 seconds.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     * @param appBinary The nanoapp binary with header
+     * @param transactionId The transaction ID associated with this request
+     *
+     * @return The return code
+     */
+    boolean loadNanoapp(in int contextHubId, in NanoappBinary appBinary, in int transactionId);
+
+    /**
+     * Invokes the nanoapp's deinitialization "end()" entrypoint, and unloads the nanoapp.
+     *
+     * The return value of this method only indicates that the request has been accepted.
+     * If true is returned, the Context Hub must handle an asynchronous result using the
+     * the handleTransactionResult() callback.
+     *
+     * Unloading a nanoapp must not take more than 5 seconds.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     * @param appId The unique ID of the nanoapp
+     * @param transactionId The transaction ID associated with this request
+     *
+     * @return The return code
+     */
+    boolean unloadNanoapp(in int contextHubId, in long appId, in int transactionId);
+
+    /**
+     * Disables a nanoapp by invoking the nanoapp's "end()" entrypoint, but does not unload the
+     * nanoapp.
+     *
+     * The return value of this method only indicates that the request has been accepted.
+     * If true is returned, the Context Hub must handle an asynchronous result using the
+     * the handleTransactionResult() callback.
+     *
+     * Disabling a nanoapp must not take more than 5 seconds.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     * @param appId The unique ID of the nanoapp
+     * @param transactionId The transaction ID associated with this request
+     *
+     * @return The return code
+     */
+    boolean disableNanoapp(in int contextHubId, in long appId, in int transactionId);
+
+    /**
+     * Enables a nanoapp by invoking the nanoapp's initialization "start()" entrypoint.
+     *
+     * The return value of this method only indicates that the request has been accepted.
+     * If true is returned, the Context Hub must handle an asynchronous result using the
+     * the handleTransactionResult() callback.
+     *
+     * Enabling a nanoapp must not take more than 5 seconds.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     * @param appId appIdentifier returned by the HAL
+     * @param message   message to be sent
+     *
+     * @return true on success
+     */
+    boolean enableNanoapp(in int contextHubId, in long appId, in int transactionId);
+
+    /**
+     * Notification sent by the framework to indicate that the user has changed a setting.
+     *
+     * @param setting User setting that has been modified
+     * @param enabled true if the setting has been enabled, false otherwise
+     */
+    void onSettingChanged(in Setting setting, in boolean enabled);
+
+    /**
+     * Queries for a list of loaded nanoapps on a Context Hub.
+     *
+     * If this method succeeds, the result of the query must be delivered through the
+     * handleNanoappInfo() callback.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     *
+     * @return true on success
+     */
+    boolean queryNanoapps(in int contextHubId);
+
+    /**
+     * Register a callback for the HAL implementation to send asynchronous messages to the service
+     * from a Context hub. There can only be one callback registered for a single Context Hub ID.
+     *
+     * A call to this function when a callback has already been registered must override the
+     * previous registration.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     * @param callback an implementation of the IContextHubCallbacks
+     *
+     * @return true on success
+     *
+     */
+    boolean registerCallback(in int contextHubId, in IContextHubCallback cb);
+
+    /**
+     * Sends a message targeted to a nanoapp to the Context Hub.
+     *
+     * @param contextHubId The identifier of the Context Hub
+     * @param message The message to be sent
+     *
+     * @return true on success
+     */
+    boolean sendMessageToHub(in int contextHubId, in ContextHubMessage message);
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
new file mode 100644
index 0000000..e385d48
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/IContextHubCallback.aidl
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2021 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.contexthub;
+
+import android.hardware.contexthub.AsyncEventType;
+import android.hardware.contexthub.ContextHubMessage;
+import android.hardware.contexthub.NanoappInfo;
+
+@VintfStability
+interface IContextHubCallback {
+    /**
+     * This callback is passed by the Contexthub service to the HAL
+     * implementation to allow the HAL to send information about the
+     * currently loaded and active nanoapps on the hub.
+     *
+     * @param appInfo vector of HubAppinfo structure for each nanoApp
+     *                on the hub that can be enabled, disabled and
+     *                unloaded by the service. Any nanoApps that cannot
+     *                be controlled by the service must not be reported.
+     *                All nanoApps that can be controlled by the service
+     *                must be reported.
+     */
+    void handleNanoappInfo(in NanoappInfo[] appInfo);
+
+    /**
+     * This callback is passed by the Contexthub service to the HAL
+     * implementation to allow the HAL to send asynchronous messages back
+     * to the service and registered clients of the ContextHub service.
+     *
+     * @param msg             message that should be delivered to host app
+     *                        clients
+     * @param msgContentPerms list of Android permissions that cover the
+     *                        contents of the message being sent from the app.
+     *                        This is different from the permissions stored
+     *                        inside of ContextHubMsg in that these must be a
+     *                        subset of those permissions and are meant to
+     *                        assist in properly attributing the message
+     *                        contents when delivering to a ContextHub service
+     *                        client.
+     */
+    void handleContextHubMessage(in ContextHubMessage msg, in String[] msgContentPerms);
+
+    /**
+     * This callback is passed by the Contexthub service to the HAL
+     * implementation to allow the HAL to send an asynchronous event
+     * to the ContextHub service.
+     *
+     * @param evt event being sent from the contexthub
+     *
+     */
+    void handleContextHubAsyncEvent(in AsyncEventType evt);
+
+    /**
+     * This callback is passed by the Contexthub service to the HAL
+     * implementation to allow the HAL to send the response for a
+     * transaction.
+     *
+     * @param transactionId The ID of the transaction associated with this callback
+     * @param success true if the transaction succeeded, false otherwise
+     *
+     */
+    void handleTransactionResult(in int transactionId, in boolean success);
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/NanoappBinary.aidl b/contexthub/aidl/android/hardware/contexthub/NanoappBinary.aidl
new file mode 100644
index 0000000..c677ca6
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/NanoappBinary.aidl
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2021 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.contexthub;
+
+@VintfStability
+parcelable NanoappBinary {
+    /** Indicates that the nanoapp is securely signed (e.g. for production) */
+    const int FLAG_SIGNED = 1 << 0;
+    const int FLAG_ENCRYPTED = 1 << 1;
+    /** Indicates that the nanoapp can run on a Context Hub's TCM memory region */
+    const int FLAG_TCM_CAPABLE = 1 << 2;
+
+    /**
+     * The unique identifier of the nanoapp for the entire system. See chreNanoappInfo in
+     * system/chre/chre_api/include/chre_api/chre/event.h for the convention for choosing
+     * this ID.
+     */
+    long nanoappId;
+
+    /** The version of the nanoapp. */
+    int nanoappVersion;
+
+    /** The nanoapp flags, comprised of the bitmasks defined in FLAG_* constants above. */
+    int flags;
+
+    /**
+     * The version of the CHRE API that this nanoapp was compiled against. See
+     * the CHRE API header file chre/version.h for more information. The hub
+     * implementation must use this to confirm compatibility before loading
+     * this nanoapp.
+     */
+    byte targetChreApiMajorVersion;
+    byte targetChreApiMinorVersion;
+
+    /**
+     * Implementation-specific binary nanoapp data. This does not include the
+     * common nanoapp header that contains the app ID, etc., as this data is
+     * explicitly passed through the other fields in this struct.
+     */
+    byte[] customBinary;
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/NanoappInfo.aidl b/contexthub/aidl/android/hardware/contexthub/NanoappInfo.aidl
new file mode 100644
index 0000000..9991dc8
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/NanoappInfo.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 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.contexthub;
+
+@VintfStability
+parcelable NanoappInfo {
+    /** The unique identifier of the nanoapp. */
+    long nanoappId;
+
+    /** The version of the nanoapp */
+    int nanoappVersion;
+
+    /** True if this nanoapp is in a running state, false otherwise */
+    boolean enabled;
+
+    /**
+     * The list of Android permissions used by this nanoapp. This list MUST
+     * correspond to the permissions required for an equivalent Android app to
+     * sample similar signals through the Android framework.
+     *
+     * For example, if a nanoapp used location-based signals, the permissions
+     * list MUST contains android.permission.ACCESS_FINE_LOCATION and
+     * android.permission.ACCESS_BACKGROUND_LOCATION. If it were to also use
+     * audio data, it would require adding android.permission.RECORD_AUDIO to
+     * this list.
+     */
+    String[] permissions;
+}
diff --git a/contexthub/aidl/android/hardware/contexthub/Setting.aidl b/contexthub/aidl/android/hardware/contexthub/Setting.aidl
new file mode 100644
index 0000000..f2e55db
--- /dev/null
+++ b/contexthub/aidl/android/hardware/contexthub/Setting.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2021 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.contexthub;
+
+/**
+ * Used to indicate the type of user setting that has changed.
+ */
+@VintfStability
+@Backing(type="byte")
+enum Setting {
+    LOCATION = 1,
+    /**
+     * The main WiFi toggle in the Android settings for WiFi connectivity.
+     */
+    WIFI_MAIN,
+    /**
+     * The "Wi-Fi scanning" setting for location scans.
+     */
+    WIFI_SCANNING,
+    AIRPLANE_MODE,
+    /**
+     * Indicates if the microphone access is available for CHRE. Microphone
+     * access is disabled if the user has turned off the microphone as a
+     * privacy setting, in which case audio data cannot be used and propagated
+     * by CHRE.
+     */
+    MICROPHONE,
+}
diff --git a/contexthub/aidl/default/Android.bp b/contexthub/aidl/default/Android.bp
new file mode 100644
index 0000000..269057a
--- /dev/null
+++ b/contexthub/aidl/default/Android.bp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2021 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 {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_interfaces_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["hardware_interfaces_license"],
+}
+
+cc_library_static {
+    name: "libcontexthubexampleimpl",
+    vendor: true,
+    shared_libs: [
+        "libbase",
+        "libbinder_ndk",
+        "android.hardware.contexthub-V1-ndk",
+    ],
+    export_include_dirs: ["include"],
+    srcs: [
+        "ContextHub.cpp",
+    ],
+    visibility: [
+        ":__subpackages__",
+        "//hardware/interfaces/tests/extension/contexthub:__subpackages__",
+    ],
+}
+
+cc_binary {
+    name: "android.hardware.contexthub-service.example",
+    relative_install_path: "hw",
+    init_rc: ["contexthub-default.rc"],
+    vintf_fragments: ["contexthub-default.xml"],
+    vendor: true,
+    shared_libs: [
+        "libbase",
+        "libbinder_ndk",
+        "android.hardware.contexthub-V1-ndk",
+    ],
+    static_libs: [
+        "libcontexthubexampleimpl",
+    ],
+    srcs: ["main.cpp"],
+}
diff --git a/contexthub/aidl/default/ContextHub.cpp b/contexthub/aidl/default/ContextHub.cpp
new file mode 100644
index 0000000..1b56608
--- /dev/null
+++ b/contexthub/aidl/default/ContextHub.cpp
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#include "contexthub-impl/ContextHub.h"
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace contexthub {
+
+// TODO(b/194285834): Implement AIDL HAL
+
+::ndk::ScopedAStatus ContextHub::getContextHubs(
+        std::vector<ContextHubInfo>* /* out_contextHubInfos */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::loadNanoapp(int32_t /* in_contextHubId */,
+                                             const NanoappBinary& /* in_appBinary */,
+                                             int32_t /* in_transactionId */,
+                                             bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::unloadNanoapp(int32_t /* in_contextHubId */,
+                                               int64_t /* in_appId */,
+                                               int32_t /* in_transactionId */,
+                                               bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::disableNanoapp(int32_t /* in_contextHubId */,
+                                                int64_t /* in_appId */,
+                                                int32_t /* in_transactionId */,
+                                                bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::enableNanoapp(int32_t /* in_contextHubId */,
+                                               int64_t /* in_appId */,
+                                               int32_t /* in_transactionId */,
+                                               bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::onSettingChanged(Setting /* in_setting */, bool /*in_enabled */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::queryNanoapps(int32_t /* in_contextHubId */,
+                                               bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::registerCallback(
+        int32_t /* in_contextHubId */, const std::shared_ptr<IContextHubCallback>& /* in_cb */,
+        bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus ContextHub::sendMessageToHub(int32_t /* in_contextHubId */,
+                                                  const ContextHubMessage& /* in_message */,
+                                                  bool* /* _aidl_return */) {
+    return ndk::ScopedAStatus::ok();
+}
+
+}  // namespace contexthub
+}  // namespace hardware
+}  // namespace android
+}  // namespace aidl
diff --git a/contexthub/aidl/default/contexthub-default.rc b/contexthub/aidl/default/contexthub-default.rc
new file mode 100644
index 0000000..a6a6d2a
--- /dev/null
+++ b/contexthub/aidl/default/contexthub-default.rc
@@ -0,0 +1,4 @@
+service vendor.contexthub-default /vendor/bin/hw/android.hardware.contexthub-service.example
+    class hal
+    user context_hub
+    group context_hub
diff --git a/contexthub/aidl/default/contexthub-default.xml b/contexthub/aidl/default/contexthub-default.xml
new file mode 100644
index 0000000..e383c50
--- /dev/null
+++ b/contexthub/aidl/default/contexthub-default.xml
@@ -0,0 +1,7 @@
+<manifest version="1.0" type="device">
+    <hal format="aidl">
+        <name>android.hardware.contexthub</name>
+        <version>1</version>
+        <fqname>IContextHub/default</fqname>
+    </hal>
+</manifest>
diff --git a/contexthub/aidl/default/include/contexthub-impl/ContextHub.h b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
new file mode 100644
index 0000000..980cee5
--- /dev/null
+++ b/contexthub/aidl/default/include/contexthub-impl/ContextHub.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#pragma once
+
+#include <aidl/android/hardware/contexthub/BnContextHub.h>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace contexthub {
+
+class ContextHub : public BnContextHub {
+    ::ndk::ScopedAStatus getContextHubs(std::vector<ContextHubInfo>* out_contextHubInfos) override;
+    ::ndk::ScopedAStatus loadNanoapp(int32_t in_contextHubId, const NanoappBinary& in_appBinary,
+                                     int32_t in_transactionId, bool* _aidl_return) override;
+    ::ndk::ScopedAStatus unloadNanoapp(int32_t in_contextHubId, int64_t in_appId,
+                                       int32_t in_transactionId, bool* _aidl_return) override;
+    ::ndk::ScopedAStatus disableNanoapp(int32_t in_contextHubId, int64_t in_appId,
+                                        int32_t in_transactionId, bool* _aidl_return) override;
+    ::ndk::ScopedAStatus enableNanoapp(int32_t in_contextHubId, int64_t in_appId,
+                                       int32_t in_transactionId, bool* _aidl_return) override;
+    ::ndk::ScopedAStatus onSettingChanged(Setting in_setting, bool in_enabled) override;
+    ::ndk::ScopedAStatus queryNanoapps(int32_t in_contextHubId, bool* _aidl_return) override;
+    ::ndk::ScopedAStatus registerCallback(int32_t in_contextHubId,
+                                          const std::shared_ptr<IContextHubCallback>& in_cb,
+                                          bool* _aidl_return) override;
+    ::ndk::ScopedAStatus sendMessageToHub(int32_t in_contextHubId,
+                                          const ContextHubMessage& in_message,
+                                          bool* _aidl_return) override;
+};
+
+}  // namespace contexthub
+}  // namespace hardware
+}  // namespace android
+}  // namespace aidl
diff --git a/contexthub/aidl/default/main.cpp b/contexthub/aidl/default/main.cpp
new file mode 100644
index 0000000..dc9035f
--- /dev/null
+++ b/contexthub/aidl/default/main.cpp
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2021 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.
+ */
+
+#include "contexthub-impl/ContextHub.h"
+
+#include <android-base/logging.h>
+#include <android/binder_manager.h>
+#include <android/binder_process.h>
+
+using aidl::android::hardware::contexthub::ContextHub;
+
+int main() {
+    ABinderProcess_setThreadPoolMaxThreadCount(0);
+
+    // Make a default contexthub service
+    auto vib = ndk::SharedRefBase::make<ContextHub>();
+    const std::string vibName = std::string() + ContextHub::descriptor + "/default";
+    binder_status_t status = AServiceManager_addService(vib->asBinder().get(), vibName.c_str());
+    CHECK(status == STATUS_OK);
+
+    ABinderProcess_joinThreadPool();
+    return EXIT_FAILURE;  // should not reach
+}
diff --git a/current.txt b/current.txt
index 09df92d..e1c78f6 100644
--- a/current.txt
+++ b/current.txt
@@ -898,6 +898,7 @@
 c8a57364f6ad20842be14f4db284df5304f7521ca8eac6bcc1fa6c5b466fb8a6 android.hardware.wifi.supplicant@1.4::ISupplicantStaNetwork
 2123482b69f3b531c88023aa2a007110e130efbf4ed68ac9ce0bc55d5e82bc8b android.hardware.wifi.supplicant@1.4::ISupplicantStaNetworkCallback
 0821f516e4d428bc15251969f7e19411c94d8f2ccbd99e1fc8168d8e49e38b0f android.hardware.wifi.supplicant@1.4::types
+4a087a308608d146b022ebc15633de989f5f4dfe1491a83fa41763290a82e40d android.hardware.automotive.vehicle@2.0::types
 
 # ABI preserving changes to HALs during Android T
 62ace52d9c3ff1f60f94118557a2aaf0b953513e59dcd34d5f94ae28d4c7e780 android.hardware.fastboot@1.0::IFastboot
diff --git a/gnss/1.0/vts/functional/OWNERS b/gnss/1.0/vts/functional/OWNERS
new file mode 100644
index 0000000..b831eb4
--- /dev/null
+++ b/gnss/1.0/vts/functional/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 393449
+yuhany@google.com
diff --git a/gnss/1.1/vts/functional/OWNERS b/gnss/1.1/vts/functional/OWNERS
new file mode 100644
index 0000000..b831eb4
--- /dev/null
+++ b/gnss/1.1/vts/functional/OWNERS
@@ -0,0 +1,2 @@
+# Bug component: 393449
+yuhany@google.com
diff --git a/gnss/common/utils/default/include/v2_1/GnssTemplate.h b/gnss/common/utils/default/include/v2_1/GnssTemplate.h
index 4e07af9..b834a1f 100644
--- a/gnss/common/utils/default/include/v2_1/GnssTemplate.h
+++ b/gnss/common/utils/default/include/v2_1/GnssTemplate.h
@@ -191,14 +191,8 @@
             this->reportSvStatus(svStatus);
             auto currentLocation = getLocationFromHW();
             notePowerConsumption();
-            if (mGnssFd != -1) {
-                // Only report location if the return from hardware is valid
-                // note that we can not merge these two "if" together, if didn't
-                // get location from hardware, we shouldn't report location, not
-                // report the "default" one.
-                if (currentLocation != nullptr) {
-                    this->reportLocation(*currentLocation);
-                }
+            if (currentLocation != nullptr) {
+                this->reportLocation(*currentLocation);
             } else {
                 if (sGnssCallback_2_1 != nullptr || sGnssCallback_2_0 != nullptr) {
                     const auto location = Utils::getMockLocationV2_0();
diff --git a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp
index f78dda2..fe59a9d 100644
--- a/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp
+++ b/graphics/composer/2.2/utils/vts/RenderEngineVts.cpp
@@ -60,7 +60,6 @@
 
 void TestRenderEngine::drawLayers() {
     base::unique_fd bufferFence;
-    base::unique_fd readyFence;
 
     std::vector<const renderengine::LayerSettings*> compositionLayerPointers;
     compositionLayerPointers.reserve(mCompositionLayers.size());
@@ -71,8 +70,10 @@
                    });
     auto texture = std::make_shared<renderengine::ExternalTexture>(
             mGraphicBuffer, *mRenderEngine, renderengine::ExternalTexture::Usage::WRITEABLE);
-    mRenderEngine->drawLayers(mDisplaySettings, compositionLayerPointers, texture, true,
-                              std::move(bufferFence), &readyFence);
+    auto [status, readyFence] = mRenderEngine
+                                        ->drawLayers(mDisplaySettings, compositionLayerPointers,
+                                                     texture, true, std::move(bufferFence))
+                                        .get();
     int fd = readyFence.release();
     if (fd != -1) {
         ASSERT_EQ(0, sync_wait(fd, -1));
diff --git a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
index 476eed8..93fb19d 100644
--- a/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
+++ b/keymaster/4.0/vts/functional/keymaster_hidl_hal_test.cpp
@@ -940,7 +940,11 @@
  * UNSUPPORTED_KEY_SIZE.
  */
 TEST_P(NewKeyGenerationTest, AesInvalidKeySize) {
+    int32_t firstApiLevel = property_get_int32("ro.board.first_api_level", 0);
     for (auto key_size : InvalidKeySizes(Algorithm::AES)) {
+        if (key_size == 192 && SecLevel() == SecurityLevel::STRONGBOX && firstApiLevel < 31) {
+            continue;
+        }
         ASSERT_EQ(ErrorCode::UNSUPPORTED_KEY_SIZE,
                   GenerateKey(AuthorizationSetBuilder()
                                       .Authorization(TAG_NO_AUTH_REQUIRED)
diff --git a/neuralnetworks/1.0/vts/functional/AndroidTest.xml b/neuralnetworks/1.0/vts/functional/AndroidTest.xml
index 9dd85ae..8f56ff9 100644
--- a/neuralnetworks/1.0/vts/functional/AndroidTest.xml
+++ b/neuralnetworks/1.0/vts/functional/AndroidTest.xml
@@ -29,5 +29,6 @@
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="VtsHalNeuralnetworksV1_0TargetTest" />
         <option name="native-test-timeout" value="20m" />
+        <option name="native-test-flag" value="--gtest_break_on_failure" />
     </test>
 </configuration>
diff --git a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
index ae1e3a2..2ef66c2 100644
--- a/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/1.0/vts/functional/GeneratedTestHarness.cpp
@@ -154,6 +154,8 @@
 void GeneratedTestBase::SetUp() {
     testing::TestWithParam<GeneratedTestParam>::SetUp();
     ASSERT_NE(kDevice, nullptr);
+    const bool deviceIsResponsive = kDevice->ping().isOk();
+    ASSERT_TRUE(deviceIsResponsive);
 }
 
 std::vector<NamedModel> getNamedModels(const FilterFn& filter) {
diff --git a/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworks.cpp b/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworks.cpp
index 2c17796..e2c0511 100644
--- a/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworks.cpp
+++ b/neuralnetworks/1.0/vts/functional/VtsHalNeuralnetworks.cpp
@@ -81,6 +81,8 @@
 void NeuralnetworksHidlTest::SetUp() {
     testing::TestWithParam<NeuralnetworksHidlTestParam>::SetUp();
     ASSERT_NE(kDevice, nullptr);
+    const bool deviceIsResponsive = kDevice->ping().isOk();
+    ASSERT_TRUE(deviceIsResponsive);
 }
 
 static NamedDevice makeNamedDevice(const std::string& name) {
diff --git a/neuralnetworks/1.1/vts/functional/AndroidTest.xml b/neuralnetworks/1.1/vts/functional/AndroidTest.xml
index 74001f9..9569333 100644
--- a/neuralnetworks/1.1/vts/functional/AndroidTest.xml
+++ b/neuralnetworks/1.1/vts/functional/AndroidTest.xml
@@ -29,5 +29,6 @@
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="VtsHalNeuralnetworksV1_1TargetTest" />
         <option name="native-test-timeout" value="20m" />
+        <option name="native-test-flag" value="--gtest_break_on_failure" />
     </test>
 </configuration>
diff --git a/neuralnetworks/1.1/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.1/vts/functional/GeneratedTestHarness.cpp
index a233835..faf7bb4 100644
--- a/neuralnetworks/1.1/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/1.1/vts/functional/GeneratedTestHarness.cpp
@@ -162,6 +162,8 @@
 void GeneratedTestBase::SetUp() {
     testing::TestWithParam<GeneratedTestParam>::SetUp();
     ASSERT_NE(kDevice, nullptr);
+    const bool deviceIsResponsive = kDevice->ping().isOk();
+    ASSERT_TRUE(deviceIsResponsive);
 }
 
 std::vector<NamedModel> getNamedModels(const FilterFn& filter) {
diff --git a/neuralnetworks/1.1/vts/functional/VtsHalNeuralnetworks.cpp b/neuralnetworks/1.1/vts/functional/VtsHalNeuralnetworks.cpp
index 54e8802..613b828 100644
--- a/neuralnetworks/1.1/vts/functional/VtsHalNeuralnetworks.cpp
+++ b/neuralnetworks/1.1/vts/functional/VtsHalNeuralnetworks.cpp
@@ -84,6 +84,8 @@
 void NeuralnetworksHidlTest::SetUp() {
     testing::TestWithParam<NeuralnetworksHidlTestParam>::SetUp();
     ASSERT_NE(kDevice, nullptr);
+    const bool deviceIsResponsive = kDevice->ping().isOk();
+    ASSERT_TRUE(deviceIsResponsive);
 }
 
 static NamedDevice makeNamedDevice(const std::string& name) {
diff --git a/neuralnetworks/1.2/vts/functional/AndroidTest.xml b/neuralnetworks/1.2/vts/functional/AndroidTest.xml
index 5396d85..c28b2e2 100644
--- a/neuralnetworks/1.2/vts/functional/AndroidTest.xml
+++ b/neuralnetworks/1.2/vts/functional/AndroidTest.xml
@@ -29,5 +29,6 @@
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="VtsHalNeuralnetworksV1_2TargetTest" />
         <option name="native-test-timeout" value="20m" />
+        <option name="native-test-flag" value="--gtest_break_on_failure" />
     </test>
 </configuration>
diff --git a/neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp b/neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp
index ede1600..3d783d9 100644
--- a/neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp
+++ b/neuralnetworks/1.2/vts/functional/CompilationCachingTests.cpp
@@ -225,6 +225,8 @@
     void SetUp() override {
         testing::Test::SetUp();
         ASSERT_NE(kDevice.get(), nullptr);
+        const bool deviceIsResponsive = kDevice->ping().isOk();
+        ASSERT_TRUE(deviceIsResponsive);
 
         // Create cache directory. The cache directory and a temporary cache file is always created
         // to test the behavior of prepareModelFromCache, even when caching is not supported.
diff --git a/neuralnetworks/1.2/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.2/vts/functional/GeneratedTestHarness.cpp
index 56f3c0b..9fa139a 100644
--- a/neuralnetworks/1.2/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/1.2/vts/functional/GeneratedTestHarness.cpp
@@ -384,6 +384,8 @@
 void GeneratedTestBase::SetUp() {
     testing::TestWithParam<GeneratedTestParam>::SetUp();
     ASSERT_NE(kDevice, nullptr);
+    const bool deviceIsResponsive = kDevice->ping().isOk();
+    ASSERT_TRUE(deviceIsResponsive);
 }
 
 std::vector<NamedModel> getNamedModels(const FilterFn& filter) {
diff --git a/neuralnetworks/1.2/vts/functional/VtsHalNeuralnetworks.cpp b/neuralnetworks/1.2/vts/functional/VtsHalNeuralnetworks.cpp
index a60ec4d..729d584 100644
--- a/neuralnetworks/1.2/vts/functional/VtsHalNeuralnetworks.cpp
+++ b/neuralnetworks/1.2/vts/functional/VtsHalNeuralnetworks.cpp
@@ -87,6 +87,8 @@
 void NeuralnetworksHidlTest::SetUp() {
     testing::TestWithParam<NeuralnetworksHidlTestParam>::SetUp();
     ASSERT_NE(kDevice, nullptr);
+    const bool deviceIsResponsive = kDevice->ping().isOk();
+    ASSERT_TRUE(deviceIsResponsive);
 }
 
 static NamedDevice makeNamedDevice(const std::string& name) {
diff --git a/neuralnetworks/1.3/vts/functional/AndroidTest.xml b/neuralnetworks/1.3/vts/functional/AndroidTest.xml
index c418aaa..d1cba6a 100644
--- a/neuralnetworks/1.3/vts/functional/AndroidTest.xml
+++ b/neuralnetworks/1.3/vts/functional/AndroidTest.xml
@@ -29,5 +29,6 @@
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="VtsHalNeuralnetworksV1_3TargetTest" />
         <option name="native-test-timeout" value="20m" />
+        <option name="native-test-flag" value="--gtest_break_on_failure" />
     </test>
 </configuration>
diff --git a/neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp b/neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp
index edffa22..a2013ec 100644
--- a/neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp
+++ b/neuralnetworks/1.3/vts/functional/CompilationCachingTests.cpp
@@ -228,6 +228,8 @@
     void SetUp() override {
         testing::Test::SetUp();
         ASSERT_NE(kDevice.get(), nullptr);
+        const bool deviceIsResponsive = kDevice->ping().isOk();
+        ASSERT_TRUE(deviceIsResponsive);
 
         // Create cache directory. The cache directory and a temporary cache file is always created
         // to test the behavior of prepareModelFromCache_1_3, even when caching is not supported.
diff --git a/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp
index 0a95695..6d30d85 100644
--- a/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/1.3/vts/functional/GeneratedTestHarness.cpp
@@ -926,6 +926,8 @@
 void GeneratedTestBase::SetUp() {
     testing::TestWithParam<GeneratedTestParam>::SetUp();
     ASSERT_NE(kDevice, nullptr);
+    const bool deviceIsResponsive = kDevice->ping().isOk();
+    ASSERT_TRUE(deviceIsResponsive);
 }
 
 std::vector<NamedModel> getNamedModels(const FilterFn& filter) {
diff --git a/neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp b/neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp
index 5facc5e..e2fa6e4 100644
--- a/neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp
+++ b/neuralnetworks/1.3/vts/functional/MemoryDomainTests.cpp
@@ -243,6 +243,8 @@
     void SetUp() override {
         testing::Test::SetUp();
         ASSERT_NE(kDevice, nullptr);
+        const bool deviceIsResponsive = kDevice->ping().isOk();
+        ASSERT_TRUE(deviceIsResponsive);
     }
 
     sp<IPreparedModel> createConvPreparedModel(const TestOperand& testOperand,
diff --git a/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.cpp b/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.cpp
index df1e453..eb8cb4b 100644
--- a/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.cpp
+++ b/neuralnetworks/1.3/vts/functional/VtsHalNeuralnetworks.cpp
@@ -92,6 +92,8 @@
 void NeuralnetworksHidlTest::SetUp() {
     testing::TestWithParam<NeuralnetworksHidlTestParam>::SetUp();
     ASSERT_NE(kDevice, nullptr);
+    const bool deviceIsResponsive = kDevice->ping().isOk();
+    ASSERT_TRUE(deviceIsResponsive);
 }
 
 static NamedDevice makeNamedDevice(const std::string& name) {
diff --git a/neuralnetworks/aidl/vts/functional/AndroidTest.xml b/neuralnetworks/aidl/vts/functional/AndroidTest.xml
index 384d420..204d8f1 100644
--- a/neuralnetworks/aidl/vts/functional/AndroidTest.xml
+++ b/neuralnetworks/aidl/vts/functional/AndroidTest.xml
@@ -29,5 +29,6 @@
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="VtsHalNeuralnetworksTargetTest" />
         <option name="native-test-timeout" value="20m" />
+        <option name="native-test-flag" value="--gtest_break_on_failure" />
     </test>
 </configuration>
diff --git a/neuralnetworks/aidl/vts/functional/CompilationCachingTests.cpp b/neuralnetworks/aidl/vts/functional/CompilationCachingTests.cpp
index 94ce5c1..77208aa 100644
--- a/neuralnetworks/aidl/vts/functional/CompilationCachingTests.cpp
+++ b/neuralnetworks/aidl/vts/functional/CompilationCachingTests.cpp
@@ -223,6 +223,9 @@
     void SetUp() override {
         testing::Test::SetUp();
         ASSERT_NE(kDevice.get(), nullptr);
+        const bool deviceIsResponsive =
+                ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk();
+        ASSERT_TRUE(deviceIsResponsive);
 
         // Create cache directory. The cache directory and a temporary cache file is always created
         // to test the behavior of prepareModelFromCache, even when caching is not supported.
diff --git a/neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp b/neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp
index 2356ff0..ac5b96a 100644
--- a/neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp
+++ b/neuralnetworks/aidl/vts/functional/GeneratedTestHarness.cpp
@@ -904,6 +904,9 @@
 void GeneratedTestBase::SetUp() {
     testing::TestWithParam<GeneratedTestParam>::SetUp();
     ASSERT_NE(kDevice, nullptr);
+    const bool deviceIsResponsive =
+            ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk();
+    ASSERT_TRUE(deviceIsResponsive);
 }
 
 std::vector<NamedModel> getNamedModels(const FilterFn& filter) {
diff --git a/neuralnetworks/aidl/vts/functional/MemoryDomainTests.cpp b/neuralnetworks/aidl/vts/functional/MemoryDomainTests.cpp
index e8313f1..1819699 100644
--- a/neuralnetworks/aidl/vts/functional/MemoryDomainTests.cpp
+++ b/neuralnetworks/aidl/vts/functional/MemoryDomainTests.cpp
@@ -233,6 +233,9 @@
     void SetUp() override {
         testing::Test::SetUp();
         ASSERT_NE(kDevice, nullptr);
+        const bool deviceIsResponsive =
+                ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk();
+        ASSERT_TRUE(deviceIsResponsive);
     }
 
     std::shared_ptr<IPreparedModel> createConvPreparedModel(const TestOperand& testOperand,
diff --git a/neuralnetworks/aidl/vts/functional/VtsHalNeuralnetworks.cpp b/neuralnetworks/aidl/vts/functional/VtsHalNeuralnetworks.cpp
index ee7cf89..c417356 100644
--- a/neuralnetworks/aidl/vts/functional/VtsHalNeuralnetworks.cpp
+++ b/neuralnetworks/aidl/vts/functional/VtsHalNeuralnetworks.cpp
@@ -91,6 +91,9 @@
 void NeuralNetworksAidlTest::SetUp() {
     testing::TestWithParam<NeuralNetworksAidlTestParam>::SetUp();
     ASSERT_NE(kDevice, nullptr);
+    const bool deviceIsResponsive =
+            ndk::ScopedAStatus::fromStatus(AIBinder_ping(kDevice->asBinder().get())).isOk();
+    ASSERT_TRUE(deviceIsResponsive);
 }
 
 static NamedDevice makeNamedDevice(const std::string& name) {
diff --git a/nfc/1.2/vts/functional/OWNERS b/nfc/1.2/vts/functional/OWNERS
new file mode 100644
index 0000000..c506226
--- /dev/null
+++ b/nfc/1.2/vts/functional/OWNERS
@@ -0,0 +1,4 @@
+# Bug component: 48448
+georgekgchang@google.com
+jackcwyu@google.com
+alisher@google.com
diff --git a/radio/config/1.0/vts/functional/OWNERS b/radio/config/1.0/vts/functional/OWNERS
new file mode 100644
index 0000000..badd6d7
--- /dev/null
+++ b/radio/config/1.0/vts/functional/OWNERS
@@ -0,0 +1,6 @@
+# Bug component: 20868
+jminjie@google.com
+sarahchin@google.com
+amitmahajan@google.com
+shuoq@google.com
+jackyu@google.com
diff --git a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
index 1849723..cd8cfc5 100644
--- a/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
+++ b/security/keymint/aidl/android/hardware/security/keymint/IKeyMintDevice.aidl
@@ -96,7 +96,8 @@
  *
  * o   AES
  *
- *      - 128 and 256-bit keys
+ *      - TRUSTED_ENVIRONMENT IKeyMintDevices must support 128, 192 and 256-bit keys.
+ *        STRONGBOX IKeyMintDevices must only support 128 and 256-bit keys.
  *      - CBC, CTR, ECB and GCM modes.  The GCM mode must not allow the use of tags smaller than 96
  *        bits or nonce lengths other than 96 bits.
  *      - CBC and ECB modes must support unpadded and PKCS7 padding modes.  With no padding CBC and
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index 931317f..651b21f 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -1843,12 +1843,13 @@
     if (SecLevel() == SecurityLevel::STRONGBOX) return;
 
     auto result = GenerateKey(AuthorizationSetBuilder()
+                                      .Authorization(TAG_ALGORITHM, Algorithm::EC)
                                       .Authorization(TAG_KEY_SIZE, 224)
                                       .Authorization(TAG_EC_CURVE, EcCurve::P_256)
+                                      .SigningKey()
                                       .Digest(Digest::NONE)
                                       .SetDefaultValidity());
-    ASSERT_TRUE(result == ErrorCode::INVALID_ARGUMENT ||
-                result == ErrorCode::UNSUPPORTED_ALGORITHM);
+    ASSERT_TRUE(result == ErrorCode::INVALID_ARGUMENT);
 }
 
 /*
diff --git a/soundtrigger/2.2/vts/functional/OWNERS b/soundtrigger/2.2/vts/functional/OWNERS
new file mode 100644
index 0000000..43126f6
--- /dev/null
+++ b/soundtrigger/2.2/vts/functional/OWNERS
@@ -0,0 +1,3 @@
+# Bug component: 48436
+ytai@google.com
+mdooley@google.com
diff --git a/soundtrigger/2.4/cli/Android.bp b/soundtrigger/2.3/cli/Android.bp
similarity index 79%
rename from soundtrigger/2.4/cli/Android.bp
rename to soundtrigger/2.3/cli/Android.bp
index 8d0979b..27d7b30 100644
--- a/soundtrigger/2.4/cli/Android.bp
+++ b/soundtrigger/2.3/cli/Android.bp
@@ -8,10 +8,10 @@
 }
 
 java_binary {
-    name: "sthal_cli_2.4",
-    wrapper: "sthal_cli_2.4",
+    name: "sthal_cli_2.3",
+    wrapper: "sthal_cli_2.3",
     srcs: ["java/**/*.java"],
     static_libs: [
-        "android.hardware.soundtrigger-V2.4-java",
+        "android.hardware.soundtrigger-V2.3-java",
     ],
 }
diff --git a/soundtrigger/2.3/cli/OWNERS b/soundtrigger/2.3/cli/OWNERS
new file mode 100644
index 0000000..4fd27f3
--- /dev/null
+++ b/soundtrigger/2.3/cli/OWNERS
@@ -0,0 +1 @@
+include platform/frameworks/base:/services/core/java/com/android/server/soundtrigger_middleware/OWNERS
diff --git a/soundtrigger/2.4/cli/java/android/hardware/soundtrigger/V2_4/cli/SthalCli.java b/soundtrigger/2.3/cli/java/android/hardware/soundtrigger/V2_3/cli/SthalCli.java
similarity index 83%
rename from soundtrigger/2.4/cli/java/android/hardware/soundtrigger/V2_4/cli/SthalCli.java
rename to soundtrigger/2.3/cli/java/android/hardware/soundtrigger/V2_3/cli/SthalCli.java
index 4931105..68b04f4 100644
--- a/soundtrigger/2.4/cli/java/android/hardware/soundtrigger/V2_4/cli/SthalCli.java
+++ b/soundtrigger/2.3/cli/java/android/hardware/soundtrigger/V2_3/cli/SthalCli.java
@@ -13,15 +13,14 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package android.hardware.soundtrigger.V2_4.cli;
+package android.hardware.soundtrigger.V2_3.cli;
 
 import android.hardware.soundtrigger.V2_0.PhraseRecognitionExtra;
 import android.hardware.soundtrigger.V2_0.RecognitionMode;
 import android.hardware.soundtrigger.V2_0.SoundModelType;
 import android.hardware.soundtrigger.V2_3.OptionalModelParameterRange;
-import android.hardware.soundtrigger.V2_4.ISoundTriggerHw;
-import android.hardware.soundtrigger.V2_4.ISoundTriggerHwCallback;
-import android.hardware.soundtrigger.V2_4.ISoundTriggerHwGlobalCallback;
+import android.hardware.soundtrigger.V2_3.ISoundTriggerHw;
+import android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback;
 import android.os.HidlMemoryUtil;
 import android.os.HwBinder;
 import android.os.RemoteException;
@@ -51,7 +50,7 @@
  */
 public class SthalCli {
     private static SoundTriggerImpl mService;
-    private static final Scanner scanner = new Scanner(System.in);
+    private static final Scanner mScanner = new Scanner(System.in);
 
     public static void main(String[] args) {
         try {
@@ -79,7 +78,7 @@
     }
 
     private static boolean processCommand() {
-        String line = scanner.nextLine();
+        String line = mScanner.nextLine();
         String[] tokens = line.split("\\s+");
         if (tokens.length < 1) {
             return false;
@@ -88,14 +87,6 @@
             case "q":
                 return false;
 
-            case "a":
-                mService.sendOnResourcesAvailable();
-                return true;
-
-            case "u":
-                mService.sendModelUnloaded(Integer.parseInt(tokens[1]));
-                return true;
-
             case "r":
                 mService.sendRecognitionEvent(Integer.parseInt(tokens[1]),
                         Integer.parseInt(tokens[2]));
@@ -112,8 +103,6 @@
 
             case "h":
                 System.out.print("Available commands:\n" + "h - help\n" + "q - quit\n"
-                        + "a - send onResourcesAvailable event\n"
-                        + "u <model> - send modelUnloaded event\n"
                         + "r <model> <status> - send recognitionEvent\n"
                         + "p <model> <status> - send phraseRecognitionEvent\n"
                         + "d - dump models\n");
@@ -143,7 +132,6 @@
             }
         }
 
-        private ISoundTriggerHwGlobalCallback mGlobalCallback;
         private final ConcurrentMap<Integer, Model> mLoadedModels = new ConcurrentHashMap<>();
         private int mHandleCounter = 1;
 
@@ -161,16 +149,6 @@
             });
         }
 
-        public void sendOnResourcesAvailable() {
-            if (mGlobalCallback != null) {
-                try {
-                    mGlobalCallback.onResourcesAvailable();
-                } catch (RemoteException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-
         public void sendRecognitionEvent(int modelHandle, int status) {
             Model model = mLoadedModels.get(modelHandle);
             if (model != null && model.config != null) {
@@ -225,46 +203,31 @@
             }
         }
 
-        public void sendModelUnloaded(int modelHandle) {
-            Model model = mLoadedModels.remove(modelHandle);
-            if (model != null) {
-                try {
-                    model.callback.modelUnloaded(modelHandle);
-                } catch (RemoteException e) {
-                    e.printStackTrace();
-                }
-            }
-        }
-
         @Override
-        public void registerGlobalCallback(ISoundTriggerHwGlobalCallback callback) {
-            System.out.println("registerGlobalCallback()");
-            mGlobalCallback = callback;
-        }
-
-        @Override
-        public void loadSoundModel_2_4(SoundModel soundModel, ISoundTriggerHwCallback callback,
-                loadSoundModel_2_4Callback _hidl_cb) {
+        public void loadSoundModel_2_1(SoundModel soundModel,
+                android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie,
+                loadSoundModel_2_1Callback _hidl_cb) {
             int handle = mHandleCounter++;
-            System.out.printf("loadSoundModel_2_4(soundModel=%s) -> %d%n", soundModel, handle);
+            System.out.printf("loadSoundModel_2_1(soundModel=%s) -> %d%n", soundModel, handle);
             mLoadedModels.put(handle, new Model(callback, soundModel));
             _hidl_cb.onValues(0, handle);
         }
 
         @Override
-        public void loadPhraseSoundModel_2_4(PhraseSoundModel soundModel,
-                ISoundTriggerHwCallback callback, loadPhraseSoundModel_2_4Callback _hidl_cb) {
-            int handle = mHandleCounter++;
-            System.out.printf("loadPhraseSoundModel_2_4(soundModel=%s) -> %d%n", soundModel,
+        public void loadPhraseSoundModel_2_1(PhraseSoundModel soundModel,
+                android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie,
+                loadPhraseSoundModel_2_1Callback _hidl_cb) {
+             int handle = mHandleCounter++;
+            System.out.printf("loadPhraseSoundModel_2_1(soundModel=%s) -> %d%n", soundModel,
                     handle);
             mLoadedModels.put(handle, new Model(callback, soundModel));
             _hidl_cb.onValues(0, handle);
         }
 
         @Override
-        public int startRecognition_2_4(int modelHandle,
+        public int startRecognition_2_3(int modelHandle,
                 android.hardware.soundtrigger.V2_3.RecognitionConfig config) {
-            System.out.printf("startRecognition_2_4(modelHandle=%d)%n", modelHandle);
+            System.out.printf("startRecognition_2_3(modelHandle=%d)%n", modelHandle);
             Model model = mLoadedModels.get(modelHandle);
             if (model != null) {
                 model.config = config;
@@ -330,12 +293,6 @@
         // Everything below is not implemented and not expected to be called.
 
         @Override
-        public int startRecognition_2_3(int modelHandle,
-                android.hardware.soundtrigger.V2_3.RecognitionConfig config) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
         public int setParameter(int modelHandle, int modelParam, int value) {
             throw new UnsupportedOperationException();
         }
@@ -346,20 +303,6 @@
         }
 
         @Override
-        public void loadSoundModel_2_1(SoundModel soundModel,
-                android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie,
-                loadSoundModel_2_1Callback _hidl_cb) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
-        public void loadPhraseSoundModel_2_1(PhraseSoundModel soundModel,
-                android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie,
-                loadPhraseSoundModel_2_1Callback _hidl_cb) {
-            throw new UnsupportedOperationException();
-        }
-
-        @Override
         public int startRecognition_2_1(int modelHandle, RecognitionConfig config,
                 android.hardware.soundtrigger.V2_1.ISoundTriggerHwCallback callback, int cookie) {
             throw new UnsupportedOperationException();
diff --git a/soundtrigger/2.3/cli/sthal_cli_2.3 b/soundtrigger/2.3/cli/sthal_cli_2.3
new file mode 100644
index 0000000..78e9f9b
--- /dev/null
+++ b/soundtrigger/2.3/cli/sthal_cli_2.3
@@ -0,0 +1,7 @@
+#!/system/bin/sh
+# Script to start "sthal_cli_2.3" on the device
+#
+base=/system
+export CLASSPATH=$base/framework/sthal_cli_2.3.jar
+exec app_process $base/bin android.hardware.soundtrigger.V2_3.cli.SthalCli "$@"
+
diff --git a/soundtrigger/2.4/Android.bp b/soundtrigger/2.4/Android.bp
deleted file mode 100644
index 44befc3..0000000
--- a/soundtrigger/2.4/Android.bp
+++ /dev/null
@@ -1,30 +0,0 @@
-// This file is autogenerated by hidl-gen -Landroidbp.
-
-package {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "hardware_interfaces_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["hardware_interfaces_license"],
-}
-
-hidl_interface {
-    name: "android.hardware.soundtrigger@2.4",
-    root: "android.hardware",
-    srcs: [
-        "ISoundTriggerHw.hal",
-        "ISoundTriggerHwCallback.hal",
-        "ISoundTriggerHwGlobalCallback.hal",
-    ],
-    interfaces: [
-        "android.hardware.audio.common@2.0",
-        "android.hardware.soundtrigger@2.0",
-        "android.hardware.soundtrigger@2.1",
-        "android.hardware.soundtrigger@2.2",
-        "android.hardware.soundtrigger@2.3",
-        "android.hidl.base@1.0",
-        "android.hidl.safe_union@1.0",
-    ],
-    gen_java: true,
-}
diff --git a/soundtrigger/2.4/ISoundTriggerHw.hal b/soundtrigger/2.4/ISoundTriggerHw.hal
deleted file mode 100644
index fd39303..0000000
--- a/soundtrigger/2.4/ISoundTriggerHw.hal
+++ /dev/null
@@ -1,190 +0,0 @@
-/*
- * Copyright 2021 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.soundtrigger@2.4;
-
-import @2.0::SoundModelHandle;
-import @2.1::ISoundTriggerHw.SoundModel;
-import @2.1::ISoundTriggerHw.PhraseSoundModel;
-import @2.3::ISoundTriggerHw;
-import @2.3::RecognitionConfig;
-import ISoundTriggerHwCallback;
-import ISoundTriggerHwGlobalCallback;
-
-/**
- * SoundTrigger HAL interface. Used for hardware recognition of hotwords
- * and other sounds.
- *
- * Important notes about the threading model:
- * ==========================================
- * Both this interface and the corresponding callback interface use a synchronized calling
- * convention. This model comes with some advantages, but also with some risks of deadlocks if the
- * implementation does not handle this correctly. Please consider the following:
- * - After stopRecognition() returns no more recognition events for that model may be sent. This
- *   implies that any queues holding such events must be flushed before the call returns and that
- *   may imply that callback from the HAL to the client are done while stopRecognition() is blocked.
- *   This is OK, and supported by the framework.
- * - Similarly, the same relationship applies between unloadModel() and subsequent callbacks to
- *   modelUnloaded().
- * - Other than these two cases, calls into the HAL *MAY NOT* block on callbacks from the HAL, or
- *   else deadlock conditions may result, which may be handled by rebooting of the HAL process and
- *   cause service outages.
- *
- * Similarly, it is expected that a single call to startRecognition() generates at most one event
- * (the model automatically becomes stopped when the event occurs, until explicitly started again)
- * and that after a modelUnloaded() event no more events would be sent regarding the model.
- * Note that a getModelState() call may generate a recognition event, but this event DOES NOT modify
- * the model state - the model remains started.
- *
- * The HAL is expected to correctly handle a stopRecognition() call even after it sent an event
- * indicating that recognition is stopped and an unloadModel() call even after it sent an event
- * indicating that it has been unloaded. This is required in order to prevent race conditions
- * between these calls. This also implies that model handles should generally not be reused until
- * explicitly unloaded. To avoid the rare possibility of running out of handles, the framework will
- * call unloadModel() on models that have been preemptively unloaded by the HAL.
- *
- * Due to the asynchronous nature of recognition events and preemptive model unloading, the HAL must
- * correctly handle requests that would have been valid before an event has been delivered, but
- * became moot as result of the event. Namely:
- * - stopRecognition() may be called on a model that has already delivered an event and became
- *   inactive as a result. The HAL must return a successful return code in this case.
- * - Furthermore, if a model is preemptively unloaded after it triggers (typically, this would
- *   happen when it is first aborted and immediately preemptively unloaded), stopRecognition() may
- *   be called on it. The HAL must return a successful return code in this case.
- * - startRecognition() may be called on a model that has been preemptively unloaded. In this case,
- *   the HAL must return -EBUSY to indicate that the operation is temporarily unsuccessful.
- * - unloadSoundModel() may be called on a model that has been preemptively unloaded. The HAL must
- *   return a successful return code in this case.
- *
- * Important notes about resource constraints and concurrency
- * =========================================================
- * Up until this version, the framework would enforce concurrency constraints expressed by the
- * Properties presented by the soundtrigger instance. These include constraints on the maximum
- * amount of models that can be loaded at the same time and on running recognition while capturing
- * from the microphone.
- * This version changes the approach for how these constraints are modeled, both offering the HAL
- * implementation more flexibility and simplifying the framework's job in enforcing these
- * limitations. Note that there is no change for how the framework behaves with earlier versions,
- * everything described below only applies to this version and onward.
- * The way this is achieved is as following:
- * - The framework will no longer enforce constraints on concurrent loading of models, as expressed
- *   in the Properties.maxSoundModels field (this property is merely a hint at this point and may be
- *   deprecated in the future.
- * - The framework will no longer enforce constraints on concurrency of audio recording and
- *   soundtrigger operation, as expressed in the Properties.concurrentCapture field (this property
- *   is merely a hint at this point and may be deprecated in the future).
- * - The framework will no longer enforce constraints on concurrent loading of models, as expressed
- *   in the Properties (these properties are merely hints at this point and may be deprecated in the
- *   future.
- * - The HAL implementation is free to reject starting of any model at any time by having the
- *   respective start*() method return -EBUSY.
- * - The HAL implementation is free to reject loading of any model at any time by having the
- *   respective load*() method return -EBUSY.
- * - The HAL implementation is free to preemptively stop a previously started model at its own
- *   discretion (for example, if a higher priority use-case which cannot coexist with detection
- *   has been requested). The HAL must notify the framework of the preemption by sending a
- *   recognition event with an `ABORT` status. The implementation must NOT attempt to restart the
- *   recognition automatically when conditions change.
- * - The HAL implementation is free to preemptively unload a previously loaded model at its own
- *   discretion (for example, if a higher-priority model is being loaded and the two cannot
- *   coexist). When doing so, it must first abort the detection if active (as per above) and then
- *   notify the framework of the unload using the newly added modelUnloaded callback.
- * - When conditions change, such that a model that couldn't previously load or start or that had
- *   previously been preemptively stopped or unloaded, the HAL must notify the framework via the
- *   newly added tryAgain() callback. This callback is not a guarantee that any operation would now
- *   succeed, but merely a hint that retrying something that had previously failed, now MAY succeed.
- *   Until this callback arrives, the framework may assume that any operation that had previously
- *   failed or aborted would still fail if retried, so the implementation should not forget to
- *   deliver it. There are no guarantees regarding how the framework may respond to this event and
- *   the order in which it may choose to reload/restart its models. Typically, as result of this
- *   event the framework will make a single attempt per model to bring this model to its desired
- *   state (loaded, started).
- */
-interface ISoundTriggerHw extends @2.3::ISoundTriggerHw {
-    /**
-     * This will get called at most once per every attachment to the service.
-     *
-     * All events not tied to a specific model should go through this callback.
-     */
-    registerGlobalCallback(ISoundTriggerHwGlobalCallback callback);
-
-    /**
-     * Load a sound model. Once loaded, recognition of this model can be
-     * started and stopped.
-     * The implementation returns a unique handle used by other functions
-     * (unloadSoundModel(), startRecognition*(), etc...
-     *
-     * Must have the exact same semantics as loadSoundModel from ISoundTriggerHw@2.3 except that the
-     * return values have changed and that there is no cookie provided (the implementation may pass
-     * any value to the callback, as it is ignored).
-     *
-     * @param soundModel A SoundModel structure describing the sound model
-     *     to load.
-     * @param callback The callback interface on which the soundModelCallback*()
-     *     method must be called upon completion and modelUnloaded() upon preempted unload.
-     * @return retval Operation completion status: 0 in case of success,
-     *     -EBUSY in case the operation is temporarily unavailable (but possible in general).
-     * @return modelHandle A unique handle assigned by the HAL for use by the
-     *     framework when controlling activity for this sound model.
-     */
-    loadSoundModel_2_4(SoundModel soundModel, ISoundTriggerHwCallback callback)
-            generates (int32_t retval, SoundModelHandle modelHandle);
-
-    /**
-     * Load a key phrase sound model. Once loaded, recognition of this model can
-     * be started and stopped. Only one active recognition per model at a time.
-     * The SoundTrigger service must handle concurrent recognition requests by
-     * different users/applications on the same model.
-     * The implementation returns a unique handle used by other functions
-     * (unloadSoundModel(), startRecognition*(), etc...
-     *
-     * Must have the exact same semantics as loadPhraseSoundModel from ISoundTriggerHw@2.3 except
-     * that the return values have changed and that there is no cookie provided (the implementation
-     * may pass any value to the callback, as it is ignored).
-     *
-     * @param soundModel A PhraseSoundModel structure describing the sound model
-     *     to load.
-     * @param callback The callback interface on which the soundModelCallback*()
-     *     method must be called upon completion and modelUnloaded() upon preempted unload.
-     * @return retval Operation completion status: 0 in case of success,
-     *     -EBUSY in case the operation is temporarily unavailable (but possible in general).
-     * @return modelHandle A unique handle assigned by the HAL for use by the
-     *     framework when controlling activity for this sound model.
-     */
-    loadPhraseSoundModel_2_4(PhraseSoundModel soundModel, ISoundTriggerHwCallback callback)
-            generates (int32_t retval, SoundModelHandle modelHandle);
-
-    /**
-     * Start recognition on a given model. Only one recognition active
-     * at a time per model. Once recognition succeeds or fails, the callback
-     * associated with the model handle is called.
-     *
-     * Must have the exact same semantics as startRecognition from ISoundTriggerHw@2.3 except that
-     * there are different expectations of the return value and that there is no cookie provided
-     * (the implementation may pass any value to the callback, as it is ignored).
-     *
-     * @param modelHandle the handle of the sound model to use for recognition
-     * @param config A RecognitionConfig structure containing attributes of the
-     *     recognition to perform
-     * @param callback The callback interface on which the recognitionCallback()
-     *     method must be called upon recognition.
-     * @return retval Operation completion status: 0 in case of success,
-     *     -EBUSY in case the operation is temporarily unavailable (but possible in general), or in
-     *            case model has been preemtively unloaded.
-     */
-    startRecognition_2_4(SoundModelHandle modelHandle, RecognitionConfig config)
-            generates (int32_t retval);
-};
diff --git a/soundtrigger/2.4/ISoundTriggerHwCallback.hal b/soundtrigger/2.4/ISoundTriggerHwCallback.hal
deleted file mode 100644
index 594deb0..0000000
--- a/soundtrigger/2.4/ISoundTriggerHwCallback.hal
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright 2021 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.soundtrigger@2.4;
-
-import @2.0::SoundModelHandle;
-import @2.1::ISoundTriggerHwCallback;
-
-/**
- * SoundTrigger HAL per-model Callback interface.
- */
-interface ISoundTriggerHwCallback extends @2.1::ISoundTriggerHwCallback {
-    /**
-     * Callback method called by the HAL when a model has been unloaded at the HAL implementation's
-     * discretion. Only a stopped model may be unloaded.
-     * This event is NOT sent as part of an unload sequence initiated by the client.
-     *
-     * @param model The model handle.
-     */
-    modelUnloaded(SoundModelHandle model);
-};
diff --git a/soundtrigger/2.4/ISoundTriggerHwGlobalCallback.hal b/soundtrigger/2.4/ISoundTriggerHwGlobalCallback.hal
deleted file mode 100644
index 2f1a977..0000000
--- a/soundtrigger/2.4/ISoundTriggerHwGlobalCallback.hal
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2021 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.soundtrigger@2.4;
-
-/**
- * SoundTrigger HAL callback interface for events not associated with a particular model.
- */
-interface ISoundTriggerHwGlobalCallback {
-    /**
-     * Callback method called by the HAL whenever internal conditions have been made available, such
-     * that a call that would previously have failed with an -EBUSY status may now succeed.
-     * There is no guarantee that any call would succeed following this event. It is merely a hint
-     * to the client that it may retry.
-     * Conversely, any call that have failed previously with -EBUSY is guaranteed to fail again if
-     * retried, until this callback is delivered.
-     */
-    onResourcesAvailable();
-};
diff --git a/soundtrigger/2.4/cli/OWNERS b/soundtrigger/2.4/cli/OWNERS
deleted file mode 100644
index e21b66e..0000000
--- a/soundtrigger/2.4/cli/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include /media/java/android/media/soundtrigger_middleware/OWNERS
diff --git a/soundtrigger/2.4/cli/sthal_cli_2.4 b/soundtrigger/2.4/cli/sthal_cli_2.4
deleted file mode 100644
index 0801464..0000000
--- a/soundtrigger/2.4/cli/sthal_cli_2.4
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/system/bin/sh
-# Script to start "sthal_cli_2.4" on the device
-#
-base=/system
-export CLASSPATH=$base/framework/sthal_cli_2.4.jar
-exec app_process $base/bin android.hardware.soundtrigger.V2_4.cli.SthalCli "$@"
-
diff --git a/soundtrigger/2.4/vts/functional/Android.bp b/soundtrigger/2.4/vts/functional/Android.bp
deleted file mode 100644
index 4b7ae91..0000000
--- a/soundtrigger/2.4/vts/functional/Android.bp
+++ /dev/null
@@ -1,41 +0,0 @@
-//
-// Copyright (C) 2021 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 {
-    // See: http://go/android-license-faq
-    // A large-scale-change added 'default_applicable_licenses' to import
-    // all of the 'license_kinds' from "hardware_interfaces_license"
-    // to get the below license kinds:
-    //   SPDX-license-identifier-Apache-2.0
-    default_applicable_licenses: ["hardware_interfaces_license"],
-}
-
-cc_test {
-    name: "VtsHalSoundtriggerV2_4TargetTest",
-    defaults: ["VtsHalTargetTestDefaults"],
-    srcs: ["VtsHalSoundtriggerV2_4TargetTest.cpp"],
-    static_libs: [
-        "android.hardware.soundtrigger@2.0",
-        "android.hardware.soundtrigger@2.1",
-        "android.hardware.soundtrigger@2.2",
-        "android.hardware.soundtrigger@2.3",
-        "android.hardware.soundtrigger@2.4",
-    ],
-    test_suites: [
-        "general-tests",
-        "vts",
-    ],
-}
diff --git a/soundtrigger/2.4/vts/functional/VtsHalSoundtriggerV2_4TargetTest.cpp b/soundtrigger/2.4/vts/functional/VtsHalSoundtriggerV2_4TargetTest.cpp
deleted file mode 100644
index 13d7005..0000000
--- a/soundtrigger/2.4/vts/functional/VtsHalSoundtriggerV2_4TargetTest.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * Copyright (C) 2021 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 "SoundTriggerHidlHalTest"
-
-#include <android-base/logging.h>
-#include <android/hardware/audio/common/2.0/types.h>
-#include <android/hardware/soundtrigger/2.4/ISoundTriggerHwGlobalCallback.h>
-#include <android/hardware/soundtrigger/2.4/ISoundTriggerHw.h>
-#include <gtest/gtest.h>
-#include <hidl/GtestPrinter.h>
-#include <hidl/ServiceManagement.h>
-
-using ::android::sp;
-using ::android::hardware::Return;
-using ::android::hardware::Status;
-using ::android::hardware::soundtrigger::V2_4::ISoundTriggerHw;
-using ::android::hardware::soundtrigger::V2_4::ISoundTriggerHwGlobalCallback;
-
-/**
- * Test class holding the instance of the SoundTriggerHW service to test.
- * The passed parameter is the registered name of the implementing service
- * supplied by INSTANTIATE_TEST_SUITE_P() call.
- */
-class SoundTriggerHidlTest : public testing::TestWithParam<std::string> {
-public:
-    void SetUp() override {
-        mSoundtrigger = ISoundTriggerHw::getService(GetParam());
-
-        ASSERT_NE(mSoundtrigger, nullptr);
-        LOG(INFO) << "Test is remote " << mSoundtrigger->isRemote();
-    }
-
-protected:
-    sp<ISoundTriggerHw> mSoundtrigger;
-};
-
-/**
- * Empty test is in place to ensure service is initialized.
- * Due to the nature of SoundTrigger HAL providing an interface for
- * proprietary or vendor specific implementations, limited testing on
- * individual APIs is possible.
- */
-TEST_P(SoundTriggerHidlTest, ServiceIsInstantiated) {}
-
-class GlobalCallback : public ISoundTriggerHwGlobalCallback {
-    Return<void> onResourcesAvailable() override {
-        return Status::ok();
-    }
-};
-
-/**
- * Test ISoundTriggerHw::registerGlobalCallback method
- *
- * Verifies that:
- * - the implementation implements the method
- * - the method returns no error
- */
-TEST_P(SoundTriggerHidlTest, RegisterGlobalCallback) {
-    Return<void> hidlReturn;
-    sp<ISoundTriggerHwGlobalCallback> callback = new GlobalCallback();
-    hidlReturn = mSoundtrigger->registerGlobalCallback(callback);
-    EXPECT_TRUE(hidlReturn.isOk());
-}
-
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(SoundTriggerHidlTest);
-
-INSTANTIATE_TEST_SUITE_P(
-        PerInstance, SoundTriggerHidlTest,
-        testing::ValuesIn(android::hardware::getAllHalInstanceNames(ISoundTriggerHw::descriptor)),
-        android::hardware::PrintInstanceNameToString);
diff --git a/soundtrigger/aidl/cli/OWNERS b/soundtrigger/aidl/cli/OWNERS
index e21b66e..9f87c4c 100644
--- a/soundtrigger/aidl/cli/OWNERS
+++ b/soundtrigger/aidl/cli/OWNERS
@@ -1 +1 @@
-include /media/java/android/media/soundtrigger_middleware/OWNERS
+include platform/frameworks/base:/media/aidl/android/media/soundtrigger_middleware/OWNERS
diff --git a/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java b/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java
index d3e1aa7..2922e83 100644
--- a/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java
+++ b/soundtrigger/aidl/cli/java/android/hardware/soundtrigger3/cli/SthalCli.java
@@ -19,7 +19,11 @@
 import android.hardware.soundtrigger3.ISoundTriggerHw;
 import android.hardware.soundtrigger3.ISoundTriggerHwCallback;
 import android.hardware.soundtrigger3.ISoundTriggerHwGlobalCallback;
+import android.media.audio.common.AudioChannelLayout;
 import android.media.audio.common.AudioConfig;
+import android.media.audio.common.AudioFormatDescription;
+import android.media.audio.common.AudioFormatType;
+import android.media.audio.common.PcmType;
 import android.media.soundtrigger.ConfidenceLevel;
 import android.media.soundtrigger.ModelParameterRange;
 import android.media.soundtrigger.PhraseRecognitionEvent;
@@ -36,7 +40,6 @@
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.SystemProperties;
-
 import java.util.Scanner;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -196,9 +199,7 @@
                 event.type = SoundModelType.GENERIC;
                 event.status = status;
                 event.captureAvailable = true;
-                event.audioConfig.channelMask = 16;
-                event.audioConfig.format = 1;
-                event.audioConfig.sampleRateHz = 16000;
+                event.audioConfig = createConfig();
                 try {
                     model.callback.recognitionCallback(modelHandle, event);
                 } catch (RemoteException e) {
@@ -216,10 +217,7 @@
                 event.common.type = SoundModelType.KEYPHRASE;
                 event.common.status = status;
                 event.common.captureAvailable = true;
-                event.common.audioConfig = new AudioConfig();
-                event.common.audioConfig.channelMask = 16;
-                event.common.audioConfig.format = 1;
-                event.common.audioConfig.sampleRateHz = 16000;
+                event.common.audioConfig = createConfig();
                 if (model.phraseModel.phrases.length > 0) {
                     PhraseRecognitionExtra extra = new PhraseRecognitionExtra();
                     extra.id = model.phraseModel.phrases[0].id;
@@ -347,5 +345,15 @@
         public int getParameter(int modelHandle, int modelParam) {
             throw new IllegalArgumentException();
         }
+
+        private static AudioConfig createConfig() {
+            AudioConfig config = new AudioConfig();
+            config.channelMask = AudioChannelLayout.layoutMask(AudioChannelLayout.LAYOUT_MONO);
+            config.format = new AudioFormatDescription();
+            config.format.type = AudioFormatType.PCM;
+            config.format.pcm = PcmType.INT_16_BIT;
+            config.sampleRateHz = 16000;
+            return config;
+        }
     }
 }
diff --git a/uwb/aidl/Android.bp b/uwb/aidl/Android.bp
index 6cf5188..989815e 100755
--- a/uwb/aidl/Android.bp
+++ b/uwb/aidl/Android.bp
@@ -23,9 +23,16 @@
                 enabled: true,
             },
             apex_available: [
-               "com.android.uwb",
+                "com.android.uwb",
             ],
             min_sdk_version: "current",
         },
+        rust: {
+            enabled: true,
+            apex_available: [
+                "//apex_available:platform",
+                "com.android.uwb",
+            ],
+        },
     },
 }
diff --git a/wifi/1.5/default/wifi.h b/wifi/1.5/default/wifi.h
index 840bdfd..c94ef3f 100644
--- a/wifi/1.5/default/wifi.h
+++ b/wifi/1.5/default/wifi.h
@@ -17,11 +17,15 @@
 #ifndef WIFI_H_
 #define WIFI_H_
 
-#include <functional>
+// HACK: NAN is a macro defined in math.h, which can be included in various
+// headers. This wifi HAL uses an enum called NAN, which does not compile when
+// the macro is defined. Undefine NAN to work around it.
+#undef NAN
+#include <android/hardware/wifi/1.5/IWifi.h>
 
 #include <android-base/macros.h>
-#include <android/hardware/wifi/1.5/IWifi.h>
 #include <utils/Looper.h>
+#include <functional>
 
 #include "hidl_callback_util.h"
 #include "wifi_chip.h"