Merge "Cleanup NN callback error handling"
diff --git a/OWNERS b/OWNERS
index 433bbb7..3a1a038 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,9 +1,14 @@
 per-file *.hal,*.aidl,OWNERS = set noparent
-per-file *.hal,*.aidl,OWNERS = elsk@google.com,malchev@google.com,smoreland@google.com
+per-file *.hal,*.aidl,OWNERS = devinmoore@google.com,elsk@google.com,malchev@google.com,smoreland@google.com
 
+# Android Native API Council
+devinmoore@google.com
 elsk@google.com
-maco@google.com
 malchev@google.com
 smoreland@google.com
-yim@google.com  # vts tests
-guangzhu@google.com # vts tests
+
+# historical/backup
+maco@google.com
+
+# vts tests
+guangzhu@google.com
diff --git a/audio/common/all-versions/default/HidlUtils.h b/audio/common/all-versions/default/HidlUtils.h
index c420a2f..a0bd1bc 100644
--- a/audio/common/all-versions/default/HidlUtils.h
+++ b/audio/common/all-versions/default/HidlUtils.h
@@ -76,19 +76,7 @@
                                          const char* halDeviceAddress, DeviceAddress* device);
 #endif
 
-#if MAJOR_VERSION <= 6
-    // Temporary versions for compatibility with forks of the default implementation.
-    // Will be removed, do not use!
-    static status_t audioConfigFromHal(const audio_config_t& halConfig, AudioConfig* config) {
-        return audioConfigFromHal(halConfig, false /*isInput--ignored*/, config);
-    }
-    static std::unique_ptr<audio_port_config[]> audioPortConfigsToHal(
-            const hidl_vec<AudioPortConfig>& configs) {
-        std::unique_ptr<audio_port_config[]> halConfigs;
-        (void)audioPortConfigsToHal(configs, &halConfigs);
-        return halConfigs;
-    }
-#else  // V7 and above
+#if MAJOR_VERSION >= 7
     static status_t audioChannelMaskFromHal(audio_channel_mask_t halChannelMask, bool isInput,
                                             AudioChannelMask* channelMask);
     static status_t audioChannelMasksFromHal(const std::vector<std::string>& halChannelMasks,
@@ -138,7 +126,7 @@
                                                struct audio_port_config_device_ext* device,
                                                struct audio_port_config_mix_ext* mix,
                                                struct audio_port_config_session_ext* session);
-#endif
+#endif  // MAJOR_VERSION >= 7
 
     // V4 and below have DeviceAddress defined in the 'core' interface.
     // To avoid duplicating code, the implementations of deviceAddressTo/FromHal
diff --git a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp
index 1612d3c..9a4a8b2 100644
--- a/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/all-versions/vts/functional/4.0/AudioPrimaryHidlHalTest.cpp
@@ -140,20 +140,23 @@
 #if MAJOR_VERSION <= 6
     using AD = AudioDevice;
     for (auto deviceType : {AD::OUT_HDMI, AD::OUT_WIRED_HEADPHONE, AD::IN_USB_HEADSET}) {
+        SCOPED_TRACE("device=" + ::testing::PrintToString(deviceType));
 #elif MAJOR_VERSION >= 7
     using AD = xsd::AudioDevice;
-    for (auto deviceType :
-         {toString(AD::AUDIO_DEVICE_OUT_HDMI), toString(AD::AUDIO_DEVICE_OUT_WIRED_HEADPHONE),
-          toString(AD::AUDIO_DEVICE_IN_USB_HEADSET)}) {
+    for (auto deviceType : {AD::AUDIO_DEVICE_OUT_HDMI, AD::AUDIO_DEVICE_OUT_WIRED_HEADPHONE,
+                            AD::AUDIO_DEVICE_IN_USB_HEADSET}) {
+        SCOPED_TRACE("device=" + toString(deviceType));
 #endif
-        SCOPED_TRACE("device=" + ::testing::PrintToString(deviceType));
         for (bool state : {true, false}) {
             SCOPED_TRACE("state=" + ::testing::PrintToString(state));
             DeviceAddress address = {};
 #if MAJOR_VERSION <= 6
             address.device = deviceType;
 #elif MAJOR_VERSION >= 7
-            address.deviceType = deviceType;
+            address.deviceType = toString(deviceType);
+            if (deviceType == AD::AUDIO_DEVICE_IN_USB_HEADSET) {
+                address.address.alsa({0, 0});
+            }
 #endif
             auto ret = getDevice()->setConnectedState(address, state);
             ASSERT_TRUE(ret.isOk());
diff --git a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp
index 941c4bd..6bb7995 100644
--- a/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp
+++ b/audio/core/all-versions/vts/functional/7.0/AudioPrimaryHidlHalTest.cpp
@@ -44,22 +44,26 @@
         for (const auto& device : getDeviceParameters()) {
             auto module =
                     getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device));
+            if (!module || !module->getFirstMixPorts()) break;
             for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) {
                 if (mixPort.getRole() != xsd::Role::source) continue;  // not an output profile
-                auto xsdFlags = mixPort.getFlags();
-                const bool isOffload =
-                        std::find(xsdFlags.begin(), xsdFlags.end(),
-                                  xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) !=
-                        xsdFlags.end();
                 std::vector<AudioInOutFlag> flags;
-                if (!isOffload) {
-                    for (auto flag : xsdFlags) {
-                        if (flag != xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_PRIMARY) {
-                            flags.push_back(toString(flag));
+                bool isOffload = false;
+                if (mixPort.hasFlags()) {
+                    auto xsdFlags = mixPort.getFlags();
+                    isOffload =
+                            std::find(xsdFlags.begin(), xsdFlags.end(),
+                                      xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) !=
+                            xsdFlags.end();
+                    if (!isOffload) {
+                        for (auto flag : xsdFlags) {
+                            if (flag != xsd::AudioInOutFlag::AUDIO_OUTPUT_FLAG_PRIMARY) {
+                                flags.push_back(toString(flag));
+                            }
                         }
+                    } else {
+                        flags = offloadFlags;
                     }
-                } else {
-                    flags = offloadFlags;
                 }
                 for (const auto& profile : mixPort.getProfile()) {
                     auto configs =
@@ -94,11 +98,15 @@
         for (const auto& device : getDeviceParameters()) {
             auto module =
                     getCachedPolicyConfig().getModuleFromName(std::get<PARAM_DEVICE_NAME>(device));
+            if (!module || !module->getFirstMixPorts()) break;
             for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) {
                 if (mixPort.getRole() != xsd::Role::sink) continue;  // not an input profile
                 std::vector<AudioInOutFlag> flags;
-                std::transform(mixPort.getFlags().begin(), mixPort.getFlags().end(), flags.begin(),
-                               [](auto flag) { return toString(flag); });
+                if (mixPort.hasFlags()) {
+                    std::transform(mixPort.getFlags().begin(), mixPort.getFlags().end(),
+                                   std::back_inserter(flags),
+                                   [](auto flag) { return toString(flag); });
+                }
                 for (const auto& profile : mixPort.getProfile()) {
                     auto configs =
                             combineAudioConfig(profile.getChannelMasks(),
diff --git a/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h b/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h
index d790b34..7d88642 100644
--- a/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h
+++ b/audio/core/all-versions/vts/functional/7.0/PolicyConfig.h
@@ -33,10 +33,14 @@
         if (mConfig) {
             mStatus = OK;
             mPrimaryModule = getModuleFromName(DeviceManager::kPrimaryDevice);
-            for (const auto& module : mConfig->getFirstModules()->get_module()) {
-                auto attachedDevices = module.getFirstAttachedDevices()->getItem();
-                if (!attachedDevices.empty()) {
-                    mModulesWithDevicesNames.insert(module.getName());
+            if (mConfig->getFirstModules()) {
+                for (const auto& module : mConfig->getFirstModules()->get_module()) {
+                    if (module.getFirstAttachedDevices()) {
+                        auto attachedDevices = module.getFirstAttachedDevices()->getItem();
+                        if (!attachedDevices.empty()) {
+                            mModulesWithDevicesNames.insert(module.getName());
+                        }
+                    }
                 }
             }
         }
@@ -52,7 +56,7 @@
     }
     const std::string& getFilePath() const { return mFilePath; }
     const xsd::Module* getModuleFromName(const std::string& name) const {
-        if (mConfig) {
+        if (mConfig && mConfig->getFirstModules()) {
             for (const auto& module : mConfig->getFirstModules()->get_module()) {
                 if (module.getName() == name) return &module;
             }
@@ -65,8 +69,10 @@
     }
     bool haveInputProfilesInModule(const std::string& name) const {
         auto module = getModuleFromName(name);
-        for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) {
-            if (mixPort.getRole() == xsd::Role::sink) return true;
+        if (module && module->getFirstMixPorts()) {
+            for (const auto& mixPort : module->getFirstMixPorts()->getMixPort()) {
+                if (mixPort.getRole() == xsd::Role::sink) return true;
+            }
         }
         return false;
     }
diff --git a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
index 05c9bf7..43c44cb 100644
--- a/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
+++ b/audio/core/all-versions/vts/functional/AudioPrimaryHidlHalTest.h
@@ -156,6 +156,21 @@
     return *policyConfig;
 }
 
+TEST(CheckConfig, audioPolicyConfigurationValidation) {
+    const auto factories = ::android::hardware::getAllHalInstanceNames(IDevicesFactory::descriptor);
+    if (factories.size() == 0) {
+        GTEST_SKIP() << "Skipping audioPolicyConfigurationValidation because no factory instances "
+                        "are found.";
+    }
+    RecordProperty("description",
+                   "Verify that the audio policy configuration file "
+                   "is valid according to the schema");
+
+    const char* xsd = "/data/local/tmp/audio_policy_configuration_" STRINGIFY(CPP_VERSION) ".xsd";
+    EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(kConfigFileName,
+                                            android::audio_get_configuration_paths(), xsd);
+}
+
 //////////////////////////////////////////////////////////////////////////////
 //////////////////// Test parameter types and definitions ////////////////////
 //////////////////////////////////////////////////////////////////////////////
@@ -231,21 +246,6 @@
     }
 };
 
-TEST(CheckConfig, audioPolicyConfigurationValidation) {
-    auto deviceParameters = getDeviceParametersForFactoryTests();
-    if (deviceParameters.size() == 0) {
-        GTEST_SKIP() << "Skipping audioPolicyConfigurationValidation because no device parameter "
-                        "is found.";
-    }
-    RecordProperty("description",
-                   "Verify that the audio policy configuration file "
-                   "is valid according to the schema");
-
-    const char* xsd = "/data/local/tmp/audio_policy_configuration_" STRINGIFY(CPP_VERSION) ".xsd";
-    EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS(kConfigFileName,
-                                            android::audio_get_configuration_paths(), xsd);
-}
-
 class AudioPolicyConfigTest : public AudioHidlTestWithDeviceParameter {
   public:
     void SetUp() override {
diff --git a/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/DeviceInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
similarity index 84%
copy from memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/DeviceInfo.aidl
copy to automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
index 00abff9..6d729e2 100644
--- a/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/DeviceInfo.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
@@ -15,9 +15,11 @@
 // 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.memtrack;
+package android.hardware.automotive.audiocontrol;
 @VintfStability
-parcelable DeviceInfo {
-  int id;
-  @utf8InCpp String name;
+parcelable DuckingInfo {
+  int zoneId;
+  String[] deviceAddressesToDuck;
+  String[] deviceAddressesToUnduck;
+  String[] usagesHoldingFocus;
 }
diff --git a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl
index 6916846..bc4162b 100644
--- a/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/IAudioControl.aidl
@@ -19,6 +19,8 @@
 @VintfStability
 interface IAudioControl {
   oneway void onAudioFocusChange(in String usage, in int zoneId, in android.hardware.automotive.audiocontrol.AudioFocusChange focusChange);
+  oneway void onDevicesToDuckChange(in android.hardware.automotive.audiocontrol.DuckingInfo[] duckingInfos);
+  oneway void onDevicesToMuteChange(in android.hardware.automotive.audiocontrol.MutingInfo[] mutingInfos);
   oneway void registerFocusListener(in android.hardware.automotive.audiocontrol.IFocusListener listener);
   oneway void setBalanceTowardRight(in float value);
   oneway void setFadeTowardFront(in float value);
diff --git a/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/DeviceInfo.aidl b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/MutingInfo.aidl
similarity index 86%
rename from memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/DeviceInfo.aidl
rename to automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/MutingInfo.aidl
index 00abff9..ab902ec 100644
--- a/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/DeviceInfo.aidl
+++ b/automotive/audiocontrol/aidl/aidl_api/android.hardware.automotive.audiocontrol/current/android/hardware/automotive/audiocontrol/MutingInfo.aidl
@@ -15,9 +15,10 @@
 // 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.memtrack;
+package android.hardware.automotive.audiocontrol;
 @VintfStability
-parcelable DeviceInfo {
-  int id;
-  @utf8InCpp String name;
+parcelable MutingInfo {
+  int zoneId;
+  String[] deviceAddressesToMute;
+  String[] deviceAddressesToUnmute;
 }
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
new file mode 100644
index 0000000..e95fe9b
--- /dev/null
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/DuckingInfo.aidl
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2020 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.automotive.audiocontrol;
+
+ /**
+  * The current ducking information for a single audio zone.
+  *
+  * <p>This includes devices to duck, as well as unduck based on the contents of a previous
+  * {@link DuckingInfo}. Additionally, the current usages holding focus in the specified zone are
+  * included, which were used to determine which addresses to duck.
+  */
+ @VintfStability
+ parcelable DuckingInfo {
+     /**
+      * ID of the associated audio zone
+      */
+     int zoneId;
+
+     /**
+      * List of addresses for audio output devices that should be ducked.
+      *
+      * <p>The provided address strings are defined in audio_policy_configuration.xml.
+      */
+     String[] deviceAddressesToDuck;
+
+     /**
+      * List of addresses for audio output devices that were previously be ducked and should now be
+      * unducked.
+      *
+      * <p>The provided address strings are defined in audio_policy_configuration.xml.
+      */
+     String[] deviceAddressesToUnduck;
+
+     /**
+      * List of usages currently holding focus for this audio zone.
+      *
+      * <p> See {@code audioUsage} in audio_policy_configuration.xsd for the list of allowed values.
+      */
+     String[] usagesHoldingFocus;
+ }
\ No newline at end of file
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
index 0641691..3a02245 100644
--- a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/IAudioControl.aidl
@@ -17,6 +17,8 @@
 package android.hardware.automotive.audiocontrol;
 
 import android.hardware.automotive.audiocontrol.AudioFocusChange;
+import android.hardware.automotive.audiocontrol.DuckingInfo;
+import android.hardware.automotive.audiocontrol.MutingInfo;
 import android.hardware.automotive.audiocontrol.IFocusListener;
 
 /**
@@ -42,6 +44,29 @@
     oneway void onAudioFocusChange(in String usage, in int zoneId, in AudioFocusChange focusChange);
 
     /**
+     * Notifies HAL of changes in output devices that the HAL should apply ducking to.
+     *
+     * This will be called in response to changes in audio focus, and will include a
+     * {@link DuckingInfo} object per audio zone that experienced a change in audo focus.
+     *
+     * @param duckingInfos an array of {@link DuckingInfo} objects for the audio zones where audio
+     * focus has changed.
+     */
+     oneway void onDevicesToDuckChange(in DuckingInfo[] duckingInfos);
+
+     /**
+      * Notifies HAL of changes in output devices that the HAL should apply muting to.
+      *
+      * This will be called in response to changes in audio mute state for each volume group
+      * and will include a {@link MutingInfo} object per audio zone that experienced a mute state
+      * event.
+      *
+      * @param mutingInfos an array of {@link MutingInfo} objects for the audio zones where audio
+      * mute state has changed.
+      */
+     oneway void onDevicesToMuteChange(in MutingInfo[] mutingInfos);
+
+    /**
      * Registers focus listener to be used by HAL for requesting and abandoning audio focus.
      *
      * It is expected that there will only ever be a single focus listener registered. If the
diff --git a/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/MutingInfo.aidl b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/MutingInfo.aidl
new file mode 100644
index 0000000..783640f
--- /dev/null
+++ b/automotive/audiocontrol/aidl/android/hardware/automotive/audiocontrol/MutingInfo.aidl
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2020 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.automotive.audiocontrol;
+
+ /**
+  * The current muting information for a single audio zone.
+  *
+  * <p>This includes devices to mute, as well as mute based on the contents of a previous
+  * {@link MutingInfo}.
+  */
+ @VintfStability
+ parcelable MutingInfo {
+     /**
+      * ID of the associated audio zone
+      */
+     int zoneId;
+
+     /**
+      * List of addresses for audio output devices that should be muted.
+      *
+      * <p>The provided address strings are defined in audio_policy_configuration.xml.
+      */
+     String[] deviceAddressesToMute;
+
+     /**
+      * List of addresses for audio output devices that were previously be muted and should now be
+      * unmuted.
+      *
+      * <p>The provided address strings are defined in audio_policy_configuration.xml.
+      */
+     String[] deviceAddressesToUnmute;
+ }
\ No newline at end of file
diff --git a/automotive/audiocontrol/aidl/default/AudioControl.cpp b/automotive/audiocontrol/aidl/default/AudioControl.cpp
index 5e09b4f..b076d01 100644
--- a/automotive/audiocontrol/aidl/default/AudioControl.cpp
+++ b/automotive/audiocontrol/aidl/default/AudioControl.cpp
@@ -17,6 +17,7 @@
 #include "AudioControl.h"
 
 #include <aidl/android/hardware/automotive/audiocontrol/AudioFocusChange.h>
+#include <aidl/android/hardware/automotive/audiocontrol/DuckingInfo.h>
 #include <aidl/android/hardware/automotive/audiocontrol/IFocusListener.h>
 
 #include <android-base/logging.h>
@@ -102,6 +103,44 @@
     return ndk::ScopedAStatus::ok();
 }
 
+ndk::ScopedAStatus AudioControl::onDevicesToDuckChange(
+        const std::vector<DuckingInfo>& in_duckingInfos) {
+    LOG(INFO) << "AudioControl::onDevicesToDuckChange";
+    for (const DuckingInfo& duckingInfo : in_duckingInfos) {
+        LOG(INFO) << "zone: " << duckingInfo.zoneId;
+        LOG(INFO) << "Devices to duck:";
+        for (const auto& addressToDuck : duckingInfo.deviceAddressesToDuck) {
+            LOG(INFO) << addressToDuck;
+        }
+        LOG(INFO) << "Devices to unduck:";
+        for (const auto& addressToUnduck : duckingInfo.deviceAddressesToUnduck) {
+            LOG(INFO) << addressToUnduck;
+        }
+        LOG(INFO) << "Usages holding focus:";
+        for (const auto& usage : duckingInfo.usagesHoldingFocus) {
+            LOG(INFO) << usage;
+        }
+    }
+    return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus AudioControl::onDevicesToMuteChange(
+        const std::vector<MutingInfo>& in_mutingInfos) {
+    LOG(INFO) << "AudioControl::onDevicesToMuteChange";
+    for (const MutingInfo& mutingInfo : in_mutingInfos) {
+        LOG(INFO) << "zone: " << mutingInfo.zoneId;
+        LOG(INFO) << "Devices to mute:";
+        for (const auto& addressToMute : mutingInfo.deviceAddressesToMute) {
+            LOG(INFO) << addressToMute;
+        }
+        LOG(INFO) << "Devices to unmute:";
+        for (const auto& addressToUnmute : mutingInfo.deviceAddressesToUnmute) {
+            LOG(INFO) << addressToUnmute;
+        }
+    }
+    return ndk::ScopedAStatus::ok();
+}
+
 binder_status_t AudioControl::dump(int fd, const char** args, uint32_t numArgs) {
     if (numArgs == 0) {
         return dumpsys(fd);
diff --git a/automotive/audiocontrol/aidl/default/AudioControl.h b/automotive/audiocontrol/aidl/default/AudioControl.h
index a77da3e..ab0b1b3 100644
--- a/automotive/audiocontrol/aidl/default/AudioControl.h
+++ b/automotive/audiocontrol/aidl/default/AudioControl.h
@@ -18,6 +18,8 @@
 
 #include <aidl/android/hardware/automotive/audiocontrol/AudioFocusChange.h>
 #include <aidl/android/hardware/automotive/audiocontrol/BnAudioControl.h>
+#include <aidl/android/hardware/automotive/audiocontrol/DuckingInfo.h>
+#include <aidl/android/hardware/automotive/audiocontrol/MutingInfo.h>
 
 namespace aidl::android::hardware::automotive::audiocontrol {
 
@@ -27,6 +29,10 @@
   public:
     ndk::ScopedAStatus onAudioFocusChange(const std::string& in_usage, int32_t in_zoneId,
                                           AudioFocusChange in_focusChange) override;
+    ndk::ScopedAStatus onDevicesToDuckChange(
+            const std::vector<DuckingInfo>& in_duckingInfos) override;
+    ndk::ScopedAStatus onDevicesToMuteChange(
+            const std::vector<MutingInfo>& in_mutingInfos) override;
     ndk::ScopedAStatus registerFocusListener(
             const shared_ptr<IFocusListener>& in_listener) override;
     ndk::ScopedAStatus setBalanceTowardRight(float in_value) override;
diff --git a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
index f33b8a5..ae53c68 100644
--- a/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
+++ b/automotive/audiocontrol/aidl/vts/VtsHalAudioControlTargetTest.cpp
@@ -31,7 +31,9 @@
 using android::binder::Status;
 using android::hardware::automotive::audiocontrol::AudioFocusChange;
 using android::hardware::automotive::audiocontrol::BnFocusListener;
+using android::hardware::automotive::audiocontrol::DuckingInfo;
 using android::hardware::automotive::audiocontrol::IAudioControl;
+using android::hardware::automotive::audiocontrol::MutingInfo;
 
 #include "android_audio_policy_configuration_V7_0.h"
 
@@ -129,6 +131,34 @@
             audioControl->onAudioFocusChange(usage, 0, AudioFocusChange::GAIN_TRANSIENT).isOk());
 };
 
+TEST_P(AudioControlAidl, MuteChangeExercise) {
+    ALOGI("Mute change test");
+
+    MutingInfo mutingInfo;
+    mutingInfo.zoneId = 0;
+    mutingInfo.deviceAddressesToMute = {String16("address 1"), String16("address 2")};
+    mutingInfo.deviceAddressesToUnmute = {String16("address 3"), String16("address 4")};
+    std::vector<MutingInfo> mutingInfos = {mutingInfo};
+    ALOGI("Mute change test start");
+    ASSERT_TRUE(audioControl->onDevicesToMuteChange(mutingInfos).isOk());
+}
+
+TEST_P(AudioControlAidl, DuckChangeExercise) {
+    ALOGI("Duck change test");
+
+    DuckingInfo duckingInfo;
+    duckingInfo.zoneId = 0;
+    duckingInfo.deviceAddressesToDuck = {String16("address 1"), String16("address 2")};
+    duckingInfo.deviceAddressesToUnduck = {String16("address 3"), String16("address 4")};
+    duckingInfo.usagesHoldingFocus = {
+            String16(xsd::toString(xsd::AudioUsage::AUDIO_USAGE_MEDIA).c_str()),
+            String16(xsd::toString(xsd::AudioUsage::AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE)
+                             .c_str())};
+    std::vector<DuckingInfo> duckingInfos = {duckingInfo};
+    ALOGI("Duck change test start");
+    ASSERT_TRUE(audioControl->onDevicesToDuckChange(duckingInfos).isOk());
+}
+
 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(AudioControlAidl);
 INSTANTIATE_TEST_SUITE_P(
         Audiocontrol, AudioControlAidl,
diff --git a/biometrics/face/aidl/default/Face.cpp b/biometrics/face/aidl/default/Face.cpp
index d3883d6..773359e 100644
--- a/biometrics/face/aidl/default/Face.cpp
+++ b/biometrics/face/aidl/default/Face.cpp
@@ -19,7 +19,7 @@
 
 namespace aidl::android::hardware::biometrics::face {
 
-const int kSensorId = 0;
+const int kSensorId = 4;
 const common::SensorStrength kSensorStrength = common::SensorStrength::STRONG;
 const int kMaxEnrollmentsPerUser = 5;
 const FaceSensorType kSensorType = FaceSensorType::RGB;
diff --git a/bluetooth/audio/2.1/default/BluetoothAudioProvider.cpp b/bluetooth/audio/2.1/default/BluetoothAudioProvider.cpp
index 092038b..73fe06c 100644
--- a/bluetooth/audio/2.1/default/BluetoothAudioProvider.cpp
+++ b/bluetooth/audio/2.1/default/BluetoothAudioProvider.cpp
@@ -57,14 +57,14 @@
 
   if (audioConfig.getDiscriminator() ==
       V2_0::AudioConfiguration::hidl_discriminator::pcmConfig) {
-    audioConfig_2_1.pcmConfig() = {
+    audioConfig_2_1.pcmConfig({
         .sampleRate =
             static_cast<SampleRate>(audioConfig.pcmConfig().sampleRate),
         .channelMode = audioConfig.pcmConfig().channelMode,
         .bitsPerSample = audioConfig.pcmConfig().bitsPerSample,
-        .dataIntervalUs = 0};
+        .dataIntervalUs = 0});
   } else {
-    audioConfig_2_1.codecConfig() = audioConfig.codecConfig();
+    audioConfig_2_1.codecConfig(audioConfig.codecConfig());
   }
 
   return startSession_2_1(hostIf, audioConfig_2_1, _hidl_cb);
diff --git a/common/TEST_MAPPING b/common/TEST_MAPPING
new file mode 100644
index 0000000..7dd29e5
--- /dev/null
+++ b/common/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+  "presubmit": [
+    {
+      "name": "libaidlcommonsupport_test"
+    }
+  ]
+}
diff --git a/common/support/Android.bp b/common/support/Android.bp
new file mode 100644
index 0000000..3bb4804
--- /dev/null
+++ b/common/support/Android.bp
@@ -0,0 +1,27 @@
+cc_library_static {
+    name: "libaidlcommonsupport",
+    vendor_available: true,
+    host_supported: true,
+    defaults: ["libbinder_ndk_host_user"],
+    srcs: ["NativeHandle.cpp"],
+    export_include_dirs: ["include"],
+    shared_libs: [
+        "android.hardware.common-unstable-ndk_platform",
+        "libcutils",
+    ],
+}
+
+cc_test {
+    name: "libaidlcommonsupport_test",
+    host_supported: true,
+    defaults: ["libbinder_ndk_host_user"],
+    srcs: ["test.cpp"],
+    static_libs: [
+        "libaidlcommonsupport",
+    ],
+    shared_libs: [
+        "android.hardware.common-unstable-ndk_platform",
+        "libcutils",
+    ],
+    test_suites: ["general-tests"],
+}
diff --git a/common/support/NativeHandle.cpp b/common/support/NativeHandle.cpp
new file mode 100644
index 0000000..321d7a8
--- /dev/null
+++ b/common/support/NativeHandle.cpp
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2020 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 <aidlcommonsupport/NativeHandle.h>
+
+#include <fcntl.h>
+
+namespace android {
+
+using aidl::android::hardware::common::NativeHandle;
+
+static native_handle_t* fromAidl(const NativeHandle& handle, bool doDup) {
+    native_handle_t* to = native_handle_create(handle.fds.size(), handle.ints.size());
+    if (!to) return nullptr;
+
+    for (size_t i = 0; i < handle.fds.size(); i++) {
+        int fd = handle.fds[i].get();
+        to->data[i] = doDup ? fcntl(fd, F_DUPFD_CLOEXEC, 0) : fd;
+    }
+    memcpy(to->data + handle.fds.size(), handle.ints.data(), handle.ints.size() * sizeof(int));
+    return to;
+}
+
+native_handle_t* makeFromAidl(const NativeHandle& handle) {
+    return fromAidl(handle, false /* doDup */);
+}
+native_handle_t* dupFromAidl(const NativeHandle& handle) {
+    return fromAidl(handle, true /* doDup */);
+}
+
+static NativeHandle toAidl(const native_handle_t* handle, bool doDup) {
+    NativeHandle to;
+
+    to.fds = std::vector<ndk::ScopedFileDescriptor>(handle->numFds);
+    for (size_t i = 0; i < handle->numFds; i++) {
+        int fd = handle->data[i];
+        to.fds.at(i).set(doDup ? fcntl(fd, F_DUPFD_CLOEXEC, 0) : fd);
+    }
+
+    to.ints = std::vector<int32_t>(handle->data + handle->numFds,
+                                   handle->data + handle->numFds + handle->numInts);
+    return to;
+}
+
+NativeHandle makeToAidl(const native_handle_t* handle) {
+    return toAidl(handle, false /* doDup */);
+}
+
+NativeHandle dupToAidl(const native_handle_t* handle) {
+    return toAidl(handle, true /* doDup */);
+}
+
+}  // namespace android
diff --git a/common/support/include/aidlcommonsupport/NativeHandle.h b/common/support/include/aidlcommonsupport/NativeHandle.h
new file mode 100644
index 0000000..10eecba
--- /dev/null
+++ b/common/support/include/aidlcommonsupport/NativeHandle.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (C) 2020 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/common/NativeHandle.h>
+#include <cutils/native_handle.h>
+
+namespace android {
+
+/**
+ * Creates a libcutils native handle from an AIDL native handle, but it does not
+ * dup internally, so it will contain the same FDs as the handle itself. The
+ * result should be deleted with native_handle_delete.
+ */
+native_handle_t* makeFromAidl(const aidl::android::hardware::common::NativeHandle& handle);
+
+/**
+ * Creates a libcutils native handle from an AIDL native handle with a dup
+ * internally. It's expected the handle is cleaned up with native_handle_close
+ * and native_handle_delete.
+ */
+native_handle_t* dupFromAidl(const aidl::android::hardware::common::NativeHandle& handle);
+
+/**
+ * Creates an AIDL native handle from a libcutils native handle, but does not
+ * dup internally, so the result will contain the same FDs as the handle itself.
+ *
+ * Warning: this passes ownership of the FDs to the ScopedFileDescriptor
+ * objects.
+ */
+aidl::android::hardware::common::NativeHandle makeToAidl(const native_handle_t* handle);
+
+/**
+ * Creates an AIDL native handle from a libcutils native handle with a dup
+ * internally.
+ */
+aidl::android::hardware::common::NativeHandle dupToAidl(const native_handle_t* handle);
+
+}  // namespace android
diff --git a/common/support/test.cpp b/common/support/test.cpp
new file mode 100644
index 0000000..2359277
--- /dev/null
+++ b/common/support/test.cpp
@@ -0,0 +1,138 @@
+/*
+ * Copyright (C) 2020 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 <aidlcommonsupport/NativeHandle.h>
+#include <gtest/gtest.h>
+
+namespace android {
+
+using aidl::android::hardware::common::NativeHandle;
+using ndk::ScopedFileDescriptor;
+
+static void checkEq(const NativeHandle& aidl, native_handle_t* libcutils, bool exceptFds) {
+    ASSERT_NE(libcutils, nullptr);
+    ASSERT_EQ(libcutils->numFds, aidl.fds.size());
+
+    for (size_t i = 0; i < libcutils->numFds; i++) {
+        int afd = aidl.fds.at(i).get();
+        int lfd = libcutils->data[i];
+
+        EXPECT_GE(afd, 0) << "Invalid fd at index " << i;
+        EXPECT_GE(lfd, 0) << "Invalid fd at index " << i;
+
+        if (exceptFds) {
+            EXPECT_NE(afd, lfd) << "Index matched at " << i << " but should be dup'd fd";
+        } else {
+            EXPECT_EQ(afd, lfd) << "Index mismatched at " << i << " but should be same fd";
+        }
+    }
+
+    ASSERT_EQ(libcutils->numInts, aidl.ints.size());
+
+    for (size_t i = 0; i < libcutils->numInts; i++) {
+        int afd = aidl.ints.at(i);
+        int lfd = libcutils->data[libcutils->numFds + i];
+
+        EXPECT_EQ(afd, lfd) << "Index mismatch at " << i;
+    }
+}
+
+static NativeHandle makeTestAidlHandle() {
+    NativeHandle handle = {
+            .fds = std::vector<ScopedFileDescriptor>(2),
+            .ints = {1, 2, 3, 4},
+    };
+    handle.fds[0].set(dup(0));
+    handle.fds[1].set(dup(0));
+    return handle;
+}
+
+TEST(ConvertNativeHandle, MakeFromAidlEmpty) {
+    NativeHandle handle;
+    native_handle_t* to = makeFromAidl(handle);
+    checkEq(handle, to, false /*exceptFds*/);
+    // no native_handle_close b/c fds are owned by NativeHandle
+    EXPECT_EQ(0, native_handle_delete(to));
+}
+
+TEST(ConvertNativeHandle, MakeFromAidl) {
+    NativeHandle handle = makeTestAidlHandle();
+    native_handle_t* to = makeFromAidl(handle);
+    checkEq(handle, to, false /*exceptFds*/);
+    // no native_handle_close b/c fds are owned by NativeHandle
+    EXPECT_EQ(0, native_handle_delete(to));
+}
+
+TEST(ConvertNativeHandle, DupFromAidlEmpty) {
+    NativeHandle handle;
+    native_handle_t* to = dupFromAidl(handle);
+    checkEq(handle, to, true /*exceptFds*/);
+    EXPECT_EQ(0, native_handle_close(to));
+    EXPECT_EQ(0, native_handle_delete(to));
+}
+
+TEST(ConvertNativeHandle, DupFromAidl) {
+    NativeHandle handle = makeTestAidlHandle();
+    native_handle_t* to = dupFromAidl(handle);
+    checkEq(handle, to, true /*exceptFds*/);
+    EXPECT_EQ(0, native_handle_close(to));
+    EXPECT_EQ(0, native_handle_delete(to));
+}
+
+static native_handle_t* makeTestLibcutilsHandle() {
+    native_handle_t* handle = native_handle_create(2, 4);
+    handle->data[0] = dup(0);
+    handle->data[1] = dup(0);
+    handle->data[2] = 1;
+    handle->data[3] = 2;
+    handle->data[4] = 3;
+    handle->data[5] = 4;
+    return handle;
+}
+
+TEST(ConvertNativeHandle, MakeToAidlEmpty) {
+    native_handle_t* handle = native_handle_create(0, 0);
+    NativeHandle to = makeToAidl(handle);
+    checkEq(to, handle, false /*exceptFds*/);
+    // no native_handle_close b/c fds are owned by NativeHandle now
+    EXPECT_EQ(0, native_handle_delete(handle));
+}
+
+TEST(ConvertNativeHandle, MakeToAidl) {
+    native_handle_t* handle = makeTestLibcutilsHandle();
+    NativeHandle to = makeToAidl(handle);
+    checkEq(to, handle, false /*exceptFds*/);
+    // no native_handle_close b/c fds are owned by NativeHandle now
+    EXPECT_EQ(0, native_handle_delete(handle));
+}
+
+TEST(ConvertNativeHandle, DupToAidlEmpty) {
+    native_handle_t* handle = native_handle_create(0, 0);
+    NativeHandle to = dupToAidl(handle);
+    checkEq(to, handle, true /*exceptFds*/);
+    EXPECT_EQ(0, native_handle_close(handle));
+    EXPECT_EQ(0, native_handle_delete(handle));
+}
+
+TEST(ConvertNativeHandle, DupToAidl) {
+    native_handle_t* handle = makeTestLibcutilsHandle();
+    NativeHandle to = dupToAidl(handle);
+    checkEq(to, handle, true /*exceptFds*/);
+    EXPECT_EQ(0, native_handle_close(handle));
+    EXPECT_EQ(0, native_handle_delete(handle));
+}
+
+}  // namespace android
diff --git a/compatibility_matrices/Android.bp b/compatibility_matrices/Android.bp
index b2a815f..de73201 100644
--- a/compatibility_matrices/Android.bp
+++ b/compatibility_matrices/Android.bp
@@ -60,5 +60,6 @@
     kernel_configs: [
         "kernel_config_current_4.19",
         "kernel_config_current_5.4",
+        "kernel_config_current_5.10",
     ],
 }
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index e12d920..b16ae40 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -354,13 +354,6 @@
             <instance>default</instance>
         </interface>
     </hal>
-    <hal format="aidl" optional="true">
-        <name>android.hardware.memtrack</name>
-        <interface>
-            <name>IMemtrack</name>
-            <instance>default</instance>
-        </interface>
-    </hal>
     <hal format="hidl" optional="true">
         <name>android.hardware.memtrack</name>
         <version>1.0</version>
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl
index 7d15855..73d8a86 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssMeasurement.aidl
@@ -32,7 +32,6 @@
   int accumulatedDeltaRangeState;
   double accumulatedDeltaRangeM;
   double accumulatedDeltaRangeUncertaintyM;
-  float carrierFrequencyHz;
   long carrierCycles;
   double carrierPhase;
   double carrierPhaseUncertainty;
diff --git a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl
index 3e66c4a..f10b943 100644
--- a/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl
+++ b/gnss/aidl/aidl_api/android.hardware.gnss/current/android/hardware/gnss/GnssSignalType.aidl
@@ -20,21 +20,21 @@
 parcelable GnssSignalType {
   android.hardware.gnss.GnssConstellationType constellation;
   double carrierFrequencyHz;
-  String codeType;
-  const String CODE_TYPE_A = "A";
-  const String CODE_TYPE_B = "B";
-  const String CODE_TYPE_C = "C";
-  const String CODE_TYPE_D = "D";
-  const String CODE_TYPE_I = "I";
-  const String CODE_TYPE_L = "L";
-  const String CODE_TYPE_M = "M";
-  const String CODE_TYPE_N = "N";
-  const String CODE_TYPE_P = "P";
-  const String CODE_TYPE_Q = "Q";
-  const String CODE_TYPE_S = "S";
-  const String CODE_TYPE_W = "W";
-  const String CODE_TYPE_X = "X";
-  const String CODE_TYPE_Y = "Y";
-  const String CODE_TYPE_Z = "Z";
-  const String CODE_TYPE_UNKNOWN = "UNKNOWN";
+  @utf8InCpp String codeType;
+  const @utf8InCpp String CODE_TYPE_A = "A";
+  const @utf8InCpp String CODE_TYPE_B = "B";
+  const @utf8InCpp String CODE_TYPE_C = "C";
+  const @utf8InCpp String CODE_TYPE_D = "D";
+  const @utf8InCpp String CODE_TYPE_I = "I";
+  const @utf8InCpp String CODE_TYPE_L = "L";
+  const @utf8InCpp String CODE_TYPE_M = "M";
+  const @utf8InCpp String CODE_TYPE_N = "N";
+  const @utf8InCpp String CODE_TYPE_P = "P";
+  const @utf8InCpp String CODE_TYPE_Q = "Q";
+  const @utf8InCpp String CODE_TYPE_S = "S";
+  const @utf8InCpp String CODE_TYPE_W = "W";
+  const @utf8InCpp String CODE_TYPE_X = "X";
+  const @utf8InCpp String CODE_TYPE_Y = "Y";
+  const @utf8InCpp String CODE_TYPE_Z = "Z";
+  const @utf8InCpp String CODE_TYPE_UNKNOWN = "UNKNOWN";
 }
diff --git a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
index fae862b..ce88647 100644
--- a/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
+++ b/gnss/aidl/android/hardware/gnss/GnssMeasurement.aidl
@@ -16,7 +16,6 @@
 
 package android.hardware.gnss;
 
-import android.hardware.gnss.GnssConstellationType;
 import android.hardware.gnss.GnssSignalType;
 import android.hardware.gnss.GnssMultipathIndicator;
 
@@ -477,24 +476,6 @@
     double accumulatedDeltaRangeUncertaintyM;
 
     /**
-     * Carrier frequency of the signal tracked, for example it can be the
-     * GPS central frequency for L1 = 1575.45 MHz, or L2 = 1227.60 MHz, L5 =
-     * 1176.45 MHz, varying GLO channels, etc. If the field is not set, it
-     * is the primary common use central frequency, e.g. L1 = 1575.45 MHz
-     * for GPS.
-     *
-     * For an L1, L5 receiver tracking a satellite on L1 and L5 at the same
-     * time, two raw measurement structs must be reported for this same
-     * satellite, in one of the measurement structs, all the values related
-     * to L1 must be filled, and in the other all of the values related to
-     * L5 must be filled.
-     *
-     * If the data is available, gnssMeasurementFlags must contain
-     * HAS_CARRIER_FREQUENCY.
-     */
-    float carrierFrequencyHz;
-
-    /**
      * The number of full carrier cycles between the satellite and the
      * receiver. The reference frequency is given by the field
      * 'carrierFrequencyHz'. Indications of possible cycle slips and
diff --git a/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl
index a284fed..9c68db1 100644
--- a/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl
+++ b/gnss/aidl/android/hardware/gnss/GnssSignalType.aidl
@@ -46,67 +46,67 @@
     /**
      * GNSS signal code type "A" representing GALILEO E1A, GALILEO E6A, IRNSS L5A, IRNSS SA.
      */
-    const String CODE_TYPE_A = "A";
+    const @utf8InCpp String CODE_TYPE_A = "A";
 
     /**
      * GNSS signal code type "B" representing GALILEO E1B, GALILEO E6B, IRNSS L5B, IRNSS SB.
      */
-    const String CODE_TYPE_B = "B";
+    const @utf8InCpp String CODE_TYPE_B = "B";
 
     /**
      * GNSS signal code type "C" representing GPS L1 C/A,  GPS L2 C/A, GLONASS G1 C/A,
      * GLONASS G2 C/A, GALILEO E1C, GALILEO E6C, SBAS L1 C/A, QZSS L1 C/A, IRNSS L5C.
      */
-    const String CODE_TYPE_C = "C";
+    const @utf8InCpp String CODE_TYPE_C = "C";
 
     /**
      * GNSS signal code type "D" representing BDS B1C D.
      */
-    const String CODE_TYPE_D = "D";
+    const @utf8InCpp String CODE_TYPE_D = "D";
 
     /**
      * GNSS signal code type "I" representing GPS L5 I, GLONASS G3 I, GALILEO E5a I, GALILEO E5b I,
      * GALILEO E5a+b I, SBAS L5 I, QZSS L5 I, BDS B1 I, BDS B2 I, BDS B3 I.
      */
-    const String CODE_TYPE_I = "I";
+    const @utf8InCpp String CODE_TYPE_I = "I";
 
     /**
      * GNSS signal code type "L" representing GPS L1C (P), GPS L2C (L), QZSS L1C (P), QZSS L2C (L),
      * LEX(6) L.
      */
-    const String CODE_TYPE_L = "L";
+    const @utf8InCpp String CODE_TYPE_L = "L";
 
     /**
      * GNSS signal code type "M" representing GPS L1M, GPS L2M.
      */
-    const String CODE_TYPE_M = "M";
+    const @utf8InCpp String CODE_TYPE_M = "M";
 
     /**
      * GNSS signal code type "N" representing GPS L1 codeless, GPS L2 codeless.
      */
-    const String CODE_TYPE_N = "N";
+    const @utf8InCpp String CODE_TYPE_N = "N";
 
     /**
      * GNSS signal code type "P" representing GPS L1P, GPS L2P, GLONASS G1P, GLONASS G2P, BDS B1C P.
      */
-    const String CODE_TYPE_P = "P";
+    const @utf8InCpp String CODE_TYPE_P = "P";
 
     /**
      * GNSS signal code type "Q" representing GPS L5 Q, GLONASS G3 Q, GALILEO E5a Q, GALILEO E5b Q,
      * GALILEO E5a+b Q, SBAS L5 Q, QZSS L5 Q, BDS B1 Q, BDS B2 Q, BDS B3 Q.
      */
-    const String CODE_TYPE_Q = "Q";
+    const @utf8InCpp String CODE_TYPE_Q = "Q";
 
     /**
      * GNSS signal code type "S" represents GPS L1C (D), GPS L2C (M), QZSS L1C (D), QZSS L2C (M),
      * LEX(6) S.
      */
-    const String CODE_TYPE_S = "S";
+    const @utf8InCpp String CODE_TYPE_S = "S";
 
     /**
      * GNSS signal code type "W" representing GPS L1 Z-tracking, GPS L2 Z-tracking.
      */
-    const String CODE_TYPE_W = "W";
+    const @utf8InCpp String CODE_TYPE_W = "W";
 
     /**
      * GNSS signal code type "X" representing GPS L1C (D+P), GPS L2C (M+L), GPS L5 (I+Q),
@@ -114,22 +114,22 @@
      * GALILEO E6 (B+C), SBAS L5 (I+Q), QZSS L1C (D+P), QZSS L2C (M+L), QZSS L5 (I+Q),
      * LEX(6) (S+L), BDS B1 (I+Q), BDS B1C (D+P), BDS B2 (I+Q), BDS B3 (I+Q), IRNSS L5 (B+C).
      */
-    const String CODE_TYPE_X = "X";
+    const @utf8InCpp String CODE_TYPE_X = "X";
 
     /**
      * GNSS signal code type "Y" representing GPS L1Y, GPS L2Y.
      */
-    const String CODE_TYPE_Y = "Y";
+    const @utf8InCpp String CODE_TYPE_Y = "Y";
 
     /**
      * GNSS signal code type "Z" representing GALILEO E1 (A+B+C), GALILEO E6 (A+B+C), QZSS L1-SAIF.
      */
-    const String CODE_TYPE_Z = "Z";
+    const @utf8InCpp String CODE_TYPE_Z = "Z";
 
     /**
      * GNSS signal code type "UNKNOWN" representing the GNSS Measurement's code type is unknown.
      */
-    const String CODE_TYPE_UNKNOWN = "UNKNOWN";
+    const @utf8InCpp String CODE_TYPE_UNKNOWN = "UNKNOWN";
 
     /**
      * The type of code that is currently being tracked in the GNSS signal.
@@ -145,5 +145,5 @@
      * "A channel"). In the future, if for instance a code "G" was added in the official RINEX
      * standard, "G" could be specified here.
      */
-    String codeType;
+    @utf8InCpp String codeType;
 }
diff --git a/gnss/common/utils/default/Utils.cpp b/gnss/common/utils/default/Utils.cpp
index dd932d4..e383d51 100644
--- a/gnss/common/utils/default/Utils.cpp
+++ b/gnss/common/utils/default/Utils.cpp
@@ -25,14 +25,17 @@
 namespace gnss {
 namespace common {
 
-using IGnss = aidl::android::hardware::gnss::IGnss;
-using IGnssMeasurementCallback = aidl::android::hardware::gnss::IGnssMeasurementCallback;
-using GnssMeasurement = aidl::android::hardware::gnss::GnssMeasurement;
+using aidl::android::hardware::gnss::ElapsedRealtime;
+using aidl::android::hardware::gnss::GnssClock;
+using aidl::android::hardware::gnss::GnssData;
+using aidl::android::hardware::gnss::GnssMeasurement;
+using aidl::android::hardware::gnss::IGnss;
+using aidl::android::hardware::gnss::IGnssMeasurementCallback;
+
 using GnssSvFlags = V1_0::IGnssCallback::GnssSvFlags;
 using GnssMeasurementFlagsV1_0 = V1_0::IGnssMeasurementCallback::GnssMeasurementFlags;
 using GnssMeasurementFlagsV2_1 = V2_1::IGnssMeasurementCallback::GnssMeasurementFlags;
 using GnssMeasurementStateV2_0 = V2_0::IGnssMeasurementCallback::GnssMeasurementState;
-using ElapsedRealtime = aidl::android::hardware::gnss::ElapsedRealtime;
 using ElapsedRealtimeFlags = V2_0::ElapsedRealtimeFlags;
 using GnssConstellationTypeV2_0 = V2_0::GnssConstellationType;
 using IGnssMeasurementCallbackV2_0 = V2_0::IGnssMeasurementCallback;
@@ -137,38 +140,53 @@
     return gnssData;
 }
 
-aidl::android::hardware::gnss::GnssData Utils::getMockMeasurement() {
+GnssData Utils::getMockMeasurement() {
     aidl::android::hardware::gnss::GnssSignalType signalType = {
             .constellation = aidl::android::hardware::gnss::GnssConstellationType::GLONASS,
             .carrierFrequencyHz = 1.59975e+09,
             .codeType = aidl::android::hardware::gnss::GnssSignalType::CODE_TYPE_C,
     };
-    aidl::android::hardware::gnss::GnssMeasurement measurement = {
-            .flags = GnssMeasurement::HAS_CARRIER_FREQUENCY,
-            .svid = 6,
+    GnssMeasurement measurement = {
+            .flags = GnssMeasurement::HAS_AUTOMATIC_GAIN_CONTROL |
+                     GnssMeasurement::HAS_CARRIER_FREQUENCY | GnssMeasurement::HAS_CARRIER_PHASE |
+                     GnssMeasurement::HAS_CARRIER_PHASE_UNCERTAINTY |
+                     GnssMeasurement::HAS_FULL_ISB | GnssMeasurement::HAS_FULL_ISB_UNCERTAINTY |
+                     GnssMeasurement::HAS_SATELLITE_ISB |
+                     GnssMeasurement::HAS_SATELLITE_ISB_UNCERTAINTY,
+            .svid = 13,
             .signalType = signalType,
             .timeOffsetNs = 0.0,
             .receivedSvTimeInNs = 8195997131077,
             .receivedSvTimeUncertaintyInNs = 15,
             .antennaCN0DbHz = 30.0,
+            .basebandCN0DbHz = 26.5,
+            .agcLevelDb = 2.3,
             .pseudorangeRateMps = -484.13739013671875,
             .pseudorangeRateUncertaintyMps = 1.0379999876022339,
             .accumulatedDeltaRangeState = GnssMeasurement::ADR_STATE_UNKNOWN,
-            .accumulatedDeltaRangeM = 0.0,
-            .accumulatedDeltaRangeUncertaintyM = 0.0,
+            .accumulatedDeltaRangeM = 1.52,
+            .accumulatedDeltaRangeUncertaintyM = 2.43,
             .multipathIndicator = aidl::android::hardware::gnss::GnssMultipathIndicator::UNKNOWN,
             .state = GnssMeasurement::STATE_CODE_LOCK | GnssMeasurement::STATE_BIT_SYNC |
                      GnssMeasurement::STATE_SUBFRAME_SYNC | GnssMeasurement::STATE_TOW_DECODED |
                      GnssMeasurement::STATE_GLO_STRING_SYNC |
-                     GnssMeasurement::STATE_GLO_TOD_DECODED};
+                     GnssMeasurement::STATE_GLO_TOD_DECODED,
+            .fullInterSignalBiasNs = 21.5,
+            .fullInterSignalBiasUncertaintyNs = 792.0,
+            .satelliteInterSignalBiasNs = 233.9,
+            .satelliteInterSignalBiasUncertaintyNs = 921.2,
+    };
 
-    aidl::android::hardware::gnss::GnssClock clock = {.timeNs = 2713545000000,
-                                                      .fullBiasNs = -1226701900521857520,
-                                                      .biasNs = 0.59689998626708984,
-                                                      .biasUncertaintyNs = 47514.989972114563,
-                                                      .driftNsps = -51.757811607455452,
-                                                      .driftUncertaintyNsps = 310.64968328491528,
-                                                      .hwClockDiscontinuityCount = 1};
+    GnssClock clock = {.gnssClockFlags = GnssClock::HAS_FULL_BIAS | GnssClock::HAS_FULL_BIAS |
+                                         GnssClock::HAS_BIAS_UNCERTAINTY | GnssClock::HAS_DRIFT |
+                                         GnssClock::HAS_DRIFT_UNCERTAINTY,
+                       .timeNs = 35854545000000,
+                       .fullBiasNs = -234621900521857520,
+                       .biasNs = 0.2352389998626708984,
+                       .biasUncertaintyNs = 274.989972114563,
+                       .driftNsps = -124.3742360,
+                       .driftUncertaintyNsps = 239.6234285828,
+                       .hwClockDiscontinuityCount = 999};
 
     ElapsedRealtime timestamp = {
             .flags = ElapsedRealtime::HAS_TIMESTAMP_NS | ElapsedRealtime::HAS_TIME_UNCERTAINTY_NS,
@@ -176,9 +194,9 @@
             // This is an hardcoded value indicating a 1ms of uncertainty between the two clocks.
             // In an actual implementation provide an estimate of the synchronization uncertainty
             // or don't set the field.
-            .timeUncertaintyNs = 1000000};
+            .timeUncertaintyNs = 1020400};
 
-    aidl::android::hardware::gnss::GnssData gnssData = {
+    GnssData gnssData = {
             .measurements = {measurement}, .clock = clock, .elapsedRealtime = timestamp};
     return gnssData;
 }
diff --git a/memtrack/aidl/Android.bp b/memtrack/aidl/Android.bp
deleted file mode 100644
index fe4d01b..0000000
--- a/memtrack/aidl/Android.bp
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2020 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.memtrack",
-    vendor_available: true,
-    srcs: ["android/hardware/memtrack/*.aidl"],
-    stability: "vintf",
-    backend: {
-        cpp: {
-            enabled: false,
-        },
-        java: {
-            enabled: false,
-        },
-        ndk: {
-            vndk: {
-                enabled: true,
-            },
-        },
-    },
-}
diff --git a/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/IMemtrack.aidl b/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/IMemtrack.aidl
deleted file mode 100644
index 844a1bb..0000000
--- a/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/IMemtrack.aidl
+++ /dev/null
@@ -1,23 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files 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.memtrack;
-@VintfStability
-interface IMemtrack {
-  android.hardware.memtrack.MemtrackRecord[] getMemory(in int pid, in android.hardware.memtrack.MemtrackType type);
-  android.hardware.memtrack.DeviceInfo[] getGpuDeviceInfo();
-}
diff --git a/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/MemtrackRecord.aidl b/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/MemtrackRecord.aidl
deleted file mode 100644
index 09ecefc..0000000
--- a/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/MemtrackRecord.aidl
+++ /dev/null
@@ -1,32 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files 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.memtrack;
-@VintfStability
-parcelable MemtrackRecord {
-  int flags;
-  long sizeInBytes;
-  const int FLAG_SMAPS_ACCOUNTED = 2;
-  const int FLAG_SMAPS_UNACCOUNTED = 4;
-  const int FLAG_SHARED = 8;
-  const int FLAG_SHARED_PSS = 16;
-  const int FLAG_PRIVATE = 32;
-  const int FLAG_SYSTEM = 64;
-  const int FLAG_DEDICATED = 128;
-  const int FLAG_NONSECURE = 256;
-  const int FLAG_SECURE = 512;
-}
diff --git a/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/MemtrackType.aidl b/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/MemtrackType.aidl
deleted file mode 100644
index 7f3f939..0000000
--- a/memtrack/aidl/aidl_api/android.hardware.memtrack/current/android/hardware/memtrack/MemtrackType.aidl
+++ /dev/null
@@ -1,27 +0,0 @@
-///////////////////////////////////////////////////////////////////////////////
-// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
-///////////////////////////////////////////////////////////////////////////////
-
-// This file is a snapshot of an AIDL interface (or parcelable). Do not try to
-// edit this file. It looks like you are doing that because you have modified
-// an AIDL interface in a backward-incompatible way, e.g., deleting a function
-// from an interface or a field from a parcelable and it broke the build. That
-// breakage is intended.
-//
-// You must not make a backward incompatible changes to the AIDL files 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.memtrack;
-@Backing(type="int") @VintfStability
-enum MemtrackType {
-  OTHER = 0,
-  GL = 1,
-  GRAPHICS = 2,
-  MULTIMEDIA = 3,
-  CAMERA = 4,
-  NUM_TYPES = 5,
-}
diff --git a/memtrack/aidl/android/hardware/memtrack/DeviceInfo.aidl b/memtrack/aidl/android/hardware/memtrack/DeviceInfo.aidl
deleted file mode 100644
index aec11e9..0000000
--- a/memtrack/aidl/android/hardware/memtrack/DeviceInfo.aidl
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2020 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.memtrack;
-
-/*
- * A vector of DeviceInfo is returned by the function getGpuDeviceInfo().
- * Each entry consists of the device name and the device id.
- * See getGpuDeviceInfo() for further details.
- */
-@VintfStability
-parcelable DeviceInfo {
-    int id;
-    @utf8InCpp String name;
-}
-
diff --git a/memtrack/aidl/android/hardware/memtrack/IMemtrack.aidl b/memtrack/aidl/android/hardware/memtrack/IMemtrack.aidl
deleted file mode 100644
index 33c6956..0000000
--- a/memtrack/aidl/android/hardware/memtrack/IMemtrack.aidl
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (C) 2020 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.memtrack;
-
-import android.hardware.memtrack.DeviceInfo;
-import android.hardware.memtrack.MemtrackRecord;
-import android.hardware.memtrack.MemtrackType;
-
-/**
- * The Memory Tracker HAL is designed to return information about
- * device-specific memory usage.
- * The primary goal is to be able to track memory that is not
- * trackable in any other way, for example texture memory that is allocated by
- * a process, but not mapped in to that process's address space.
- * A secondary goal is to be able to categorize memory used by a process into
- * GL, graphics, etc. All memory sizes must be in real memory usage,
- * accounting for stride, bit depth, rounding up to page size, etc.
- *
- * Constructor for the interface should be used to perform memtrack management
- * setup actions and is called once before any calls to getMemory().
- */
-@VintfStability
-interface IMemtrack {
-    /**
-     * getMemory() populates MemtrackRecord vector with the sizes of memory
-     * plus associated flags for that memory.
-     *
-     * A process collecting memory statistics will call getMemory for each
-     * combination of pid and memory type. For each memory type that it
-     * recognizes, the HAL must fill out an array of memtrack_record
-     * structures breaking down the statistics of that memory type as much as
-     * possible. For example,
-     * getMemory(<pid>, GL) might return:
-     * { { 4096,  ACCOUNTED | PRIVATE | SYSTEM },
-     *   { 40960, UNACCOUNTED | PRIVATE | SYSTEM },
-     *   { 8192,  ACCOUNTED | PRIVATE | DEDICATED },
-     *   { 8192,  UNACCOUNTED | PRIVATE | DEDICATED } }
-     * If the HAL cannot differentiate between SYSTEM and DEDICATED memory, it
-     * could return:
-     * { { 12288,  ACCOUNTED | PRIVATE },
-     *   { 49152,  UNACCOUNTED | PRIVATE } }
-     *
-     * Memory must not overlap between types. For example, a graphics buffer
-     * that has been mapped into the GPU as a surface must show up when
-     * GRAPHICS is requested and not when GL
-     * is requested.
-     *
-     * @param pid process for which memory information is requested
-     * @param type memory type that information is being requested about
-     * @return vector of MemtrackRecord containing memory information
-     */
-    MemtrackRecord[] getMemory(in int pid, in MemtrackType type);
-
-    /**
-     * getGpuDeviceInfo() populates DeviceInfo with the ID and name
-     * of each GPU device.
-     *
-     * For example, getGpuDeviceInfor, might return:
-     * { { 0, <gpu-device-name> },
-     *   { 1, <gpu-device-name> } }
-     *
-     * This information is used to identify GPU devices for GPU specific
-     * memory accounting (e.g. DMA buffer usage).
-     *
-     * @return vector of DeviceInfo populated for all GPU devices.
-     */
-     DeviceInfo[] getGpuDeviceInfo();
-}
diff --git a/memtrack/aidl/android/hardware/memtrack/MemtrackRecord.aidl b/memtrack/aidl/android/hardware/memtrack/MemtrackRecord.aidl
deleted file mode 100644
index 95254e9..0000000
--- a/memtrack/aidl/android/hardware/memtrack/MemtrackRecord.aidl
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2020 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.memtrack;
-
-/*
- * A vector of MemtrackRecord is returned by the function getMemory().
- * Each record consists of the size of the memory used by the process and
- * flags indicate all the MemtrackFlags that are valid for this record.
- * see getMemory() comments for further details.
- */
-@VintfStability
-parcelable MemtrackRecord {
-    /* Memtrack Flags */
-    const int FLAG_SMAPS_ACCOUNTED = 1 << 1;
-    const int FLAG_SMAPS_UNACCOUNTED = 1 << 2;
-    const int FLAG_SHARED = 1 << 3;
-    const int FLAG_SHARED_PSS = 1 << 4;
-    const int FLAG_PRIVATE = 1 << 5;
-    const int FLAG_SYSTEM = 1 << 6;
-    const int FLAG_DEDICATED = 1 << 7;
-    const int FLAG_NONSECURE = 1 << 8;
-    const int FLAG_SECURE = 1 << 9;
-
-    /* Bitfield indicating all flags that are valid for this record */
-    int flags;
-
-    long sizeInBytes;
-}
-
diff --git a/memtrack/aidl/android/hardware/memtrack/MemtrackType.aidl b/memtrack/aidl/android/hardware/memtrack/MemtrackType.aidl
deleted file mode 100644
index 715c6bf..0000000
--- a/memtrack/aidl/android/hardware/memtrack/MemtrackType.aidl
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- * Copyright (C) 2020 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.memtrack;
-
-/**
- * Tags which define the usage of the memory buffers.
- */
-@VintfStability
-@Backing(type="int")
-enum MemtrackType {
-    OTHER = 0,
-    GL = 1,
-    GRAPHICS = 2,
-    MULTIMEDIA = 3,
-    CAMERA = 4,
-    NUM_TYPES,
-}
diff --git a/memtrack/aidl/default/Android.bp b/memtrack/aidl/default/Android.bp
deleted file mode 100644
index 52f88c8..0000000
--- a/memtrack/aidl/default/Android.bp
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2020 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.
-
-cc_binary {
-    name: "android.hardware.memtrack-service.example",
-    relative_install_path: "hw",
-    init_rc: ["memtrack-default.rc"],
-    vintf_fragments: ["memtrack-default.xml"],
-    vendor: true,
-    shared_libs: [
-        "libbase",
-        "libbinder_ndk",
-        "android.hardware.memtrack-ndk_platform",
-    ],
-    srcs: [
-        "main.cpp",
-        "Memtrack.cpp",
-    ],
-}
diff --git a/memtrack/aidl/default/Memtrack.cpp b/memtrack/aidl/default/Memtrack.cpp
deleted file mode 100644
index 7361719..0000000
--- a/memtrack/aidl/default/Memtrack.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2020 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 "Memtrack.h"
-
-namespace aidl {
-namespace android {
-namespace hardware {
-namespace memtrack {
-
-ndk::ScopedAStatus Memtrack::getMemory(int pid, MemtrackType type,
-                                       std::vector<MemtrackRecord>* _aidl_return) {
-    if (pid < 0) {
-        return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_ILLEGAL_ARGUMENT));
-    }
-    if (type < MemtrackType::OTHER || type >= MemtrackType::NUM_TYPES) {
-        return ndk::ScopedAStatus(AStatus_fromExceptionCode(EX_UNSUPPORTED_OPERATION));
-    }
-    _aidl_return->clear();
-    return ndk::ScopedAStatus::ok();
-}
-
-ndk::ScopedAStatus Memtrack::getGpuDeviceInfo(std::vector<DeviceInfo>* _aidl_return) {
-    _aidl_return->clear();
-    return ndk::ScopedAStatus::ok();
-}
-
-}  // namespace memtrack
-}  // namespace hardware
-}  // namespace android
-}  // namespace aidl
diff --git a/memtrack/aidl/default/Memtrack.h b/memtrack/aidl/default/Memtrack.h
deleted file mode 100644
index f2ef60e..0000000
--- a/memtrack/aidl/default/Memtrack.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2020 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/memtrack/BnMemtrack.h>
-#include <aidl/android/hardware/memtrack/DeviceInfo.h>
-#include <aidl/android/hardware/memtrack/MemtrackRecord.h>
-#include <aidl/android/hardware/memtrack/MemtrackType.h>
-
-namespace aidl {
-namespace android {
-namespace hardware {
-namespace memtrack {
-
-class Memtrack : public BnMemtrack {
-    ndk::ScopedAStatus getMemory(int pid, MemtrackType type,
-                                 std::vector<MemtrackRecord>* _aidl_return) override;
-
-    ndk::ScopedAStatus getGpuDeviceInfo(std::vector<DeviceInfo>* _aidl_return) override;
-};
-
-}  // namespace memtrack
-}  // namespace hardware
-}  // namespace android
-}  // namespace aidl
diff --git a/memtrack/aidl/default/main.cpp b/memtrack/aidl/default/main.cpp
deleted file mode 100644
index d063d2a..0000000
--- a/memtrack/aidl/default/main.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2020 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 "Memtrack.h"
-
-#include <android-base/logging.h>
-#include <android/binder_manager.h>
-#include <android/binder_process.h>
-
-using aidl::android::hardware::memtrack::Memtrack;
-
-int main() {
-    ABinderProcess_setThreadPoolMaxThreadCount(0);
-    std::shared_ptr<Memtrack> memtrack = ndk::SharedRefBase::make<Memtrack>();
-
-    const std::string instance = std::string() + Memtrack::descriptor + "/default";
-    binder_status_t status =
-            AServiceManager_addService(memtrack->asBinder().get(), instance.c_str());
-    CHECK(status == STATUS_OK);
-
-    ABinderProcess_joinThreadPool();
-    return EXIT_FAILURE;  // Unreachable
-}
diff --git a/memtrack/aidl/default/memtrack-default.rc b/memtrack/aidl/default/memtrack-default.rc
deleted file mode 100644
index 1725cd0..0000000
--- a/memtrack/aidl/default/memtrack-default.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-service vendor.memtrack-default /vendor/bin/hw/android.hardware.memtrack-service.example
-    class hal
-    user nobody
-    group system
diff --git a/memtrack/aidl/default/memtrack-default.xml b/memtrack/aidl/default/memtrack-default.xml
deleted file mode 100644
index 3e3e0f6..0000000
--- a/memtrack/aidl/default/memtrack-default.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<manifest version="1.0" type="device">
-    <hal format="aidl">
-        <name>android.hardware.memtrack</name>
-        <fqname>IMemtrack/default</fqname>
-    </hal>
-</manifest>
-
diff --git a/memtrack/aidl/vts/Android.bp b/memtrack/aidl/vts/Android.bp
deleted file mode 100644
index ea36677..0000000
--- a/memtrack/aidl/vts/Android.bp
+++ /dev/null
@@ -1,17 +0,0 @@
-cc_test {
-    name: "VtsHalMemtrackTargetTest",
-    defaults: [
-        "VtsHalTargetTestDefaults",
-        "use_libaidlvintf_gtest_helper_static",
-    ],
-    srcs: ["VtsHalMemtrackTargetTest.cpp"],
-    shared_libs: [
-        "libbinder_ndk",
-    ],
-    static_libs: [
-        "android.hardware.memtrack-unstable-ndk_platform",
-    ],
-    test_suites: [
-        "vts-core",
-    ],
-}
diff --git a/memtrack/aidl/vts/VtsHalMemtrackTargetTest.cpp b/memtrack/aidl/vts/VtsHalMemtrackTargetTest.cpp
deleted file mode 100644
index a3bd293..0000000
--- a/memtrack/aidl/vts/VtsHalMemtrackTargetTest.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright (C) 2020 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 <aidl/Gtest.h>
-#include <aidl/Vintf.h>
-
-#include <aidl/android/hardware/memtrack/DeviceInfo.h>
-#include <aidl/android/hardware/memtrack/IMemtrack.h>
-#include <aidl/android/hardware/memtrack/MemtrackType.h>
-#include <android/binder_manager.h>
-#include <android/binder_process.h>
-
-using aidl::android::hardware::memtrack::DeviceInfo;
-using aidl::android::hardware::memtrack::IMemtrack;
-using aidl::android::hardware::memtrack::MemtrackRecord;
-using aidl::android::hardware::memtrack::MemtrackType;
-
-class MemtrackAidlTest : public testing::TestWithParam<std::string> {
-  public:
-    virtual void SetUp() override {
-        const auto instance = std::string() + IMemtrack::descriptor + "/default";
-        auto memtrackBinder = ndk::SpAIBinder(AServiceManager_getService(instance.c_str()));
-        memtrack_ = IMemtrack::fromBinder(memtrackBinder);
-        ASSERT_NE(memtrack_, nullptr);
-    }
-
-    std::shared_ptr<IMemtrack> memtrack_;
-};
-
-TEST_P(MemtrackAidlTest, GetMemoryInvalidPid) {
-    int pid = -1;
-    MemtrackType type = MemtrackType::OTHER;
-    std::vector<MemtrackRecord> records;
-
-    auto status = memtrack_->getMemory(pid, type, &records);
-
-    EXPECT_EQ(status.getExceptionCode(), EX_ILLEGAL_ARGUMENT);
-}
-
-TEST_P(MemtrackAidlTest, GetMemoryInvalidType) {
-    int pid = 1;
-    MemtrackType type = MemtrackType::NUM_TYPES;
-    std::vector<MemtrackRecord> records;
-
-    auto status = memtrack_->getMemory(pid, type, &records);
-
-    EXPECT_EQ(status.getExceptionCode(), EX_UNSUPPORTED_OPERATION);
-}
-
-TEST_P(MemtrackAidlTest, GetMemory) {
-    int pid = 1;
-    MemtrackType type = MemtrackType::OTHER;
-    std::vector<MemtrackRecord> records;
-
-    auto status = memtrack_->getMemory(pid, type, &records);
-
-    EXPECT_TRUE(status.isOk());
-}
-
-TEST_P(MemtrackAidlTest, GetGpuDeviceInfo) {
-    std::vector<DeviceInfo> device_info;
-
-    auto status = memtrack_->getGpuDeviceInfo(&device_info);
-
-    EXPECT_TRUE(status.isOk());
-}
-
-GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(MemtrackAidlTest);
-INSTANTIATE_TEST_SUITE_P(PerInstance, MemtrackAidlTest,
-                         testing::ValuesIn(android::getAidlHalInstanceNames(IMemtrack::descriptor)),
-                         android::PrintInstanceNameToString);
-
-int main(int argc, char** argv) {
-    ::testing::InitGoogleTest(&argc, argv);
-    ABinderProcess_setThreadPoolMaxThreadCount(1);
-    ABinderProcess_startThreadPool();
-    return RUN_ALL_TESTS();
-}
diff --git a/nfc/1.0/vts/functional/AndroidTest.xml b/nfc/1.0/vts/functional/AndroidTest.xml
index 364672b..76aca48 100644
--- a/nfc/1.0/vts/functional/AndroidTest.xml
+++ b/nfc/1.0/vts/functional/AndroidTest.xml
@@ -28,6 +28,6 @@
     <test class="com.android.tradefed.testtype.GTest" >
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="VtsHalNfcV1_0TargetTest" />
-        <option name="native-test-timeout" value="180000"/>
+        <option name="native-test-timeout" value="600000"/>
     </test>
 </configuration>
diff --git a/security/keymint/aidl/default/Android.bp b/security/keymint/aidl/default/Android.bp
index 491a2c1..79697c4 100644
--- a/security/keymint/aidl/default/Android.bp
+++ b/security/keymint/aidl/default/Android.bp
@@ -9,7 +9,7 @@
         "-Wextra",
     ],
     shared_libs: [
-        "android.hardware.security.keymint-ndk_platform",
+        "android.hardware.security.keymint-unstable-ndk_platform",
         "libbase",
         "libbinder_ndk",
         "libcppbor",
diff --git a/security/keymint/aidl/vts/functional/Android.bp b/security/keymint/aidl/vts/functional/Android.bp
index ef7adb1..c7cc380 100644
--- a/security/keymint/aidl/vts/functional/Android.bp
+++ b/security/keymint/aidl/vts/functional/Android.bp
@@ -25,13 +25,13 @@
         "VerificationTokenTest.cpp",
     ],
     shared_libs: [
-        "libbinder",
+        "libbinder_ndk",
         "libcrypto",
         "libkeymint",
         "libkeymint_support",
     ],
     static_libs: [
-        "android.hardware.security.keymint-cpp",
+        "android.hardware.security.keymint-unstable-ndk_platform",
         "libcppbor_external",
         "libkeymint_vts_test_utils",
     ],
@@ -54,13 +54,13 @@
         ".",
     ],
     shared_libs: [
-        "libbinder",
+        "libbinder_ndk",
         "libcrypto",
         "libkeymint",
         "libkeymint_support",
     ],
     static_libs: [
-        "android.hardware.security.keymint-cpp",
+        "android.hardware.security.keymint-unstable-ndk_platform",
         "libcppbor",
     ],
 }
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
index ea3a329..9ba4099 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.cpp
@@ -20,11 +20,12 @@
 #include <vector>
 
 #include <android-base/logging.h>
+#include <android/binder_manager.h>
 
 #include <keymint_support/key_param_output.h>
 #include <keymint_support/keymint_utils.h>
 
-namespace android::hardware::security::keymint {
+namespace aidl::android::hardware::security::keymint {
 
 using namespace std::literals::chrono_literals;
 using std::endl;
@@ -42,19 +43,19 @@
 
 namespace test {
 
-ErrorCode KeyMintAidlTestBase::GetReturnErrorCode(Status result) {
+ErrorCode KeyMintAidlTestBase::GetReturnErrorCode(const Status& result) {
     if (result.isOk()) return ErrorCode::OK;
 
-    if (result.exceptionCode() == binder::Status::EX_SERVICE_SPECIFIC) {
-        return static_cast<ErrorCode>(result.serviceSpecificErrorCode());
+    if (result.getExceptionCode() == EX_SERVICE_SPECIFIC) {
+        return static_cast<ErrorCode>(result.getServiceSpecificError());
     }
 
     return ErrorCode::UNKNOWN_ERROR;
 }
 
-void KeyMintAidlTestBase::InitializeKeyMint(sp<IKeyMintDevice> keyMint) {
+void KeyMintAidlTestBase::InitializeKeyMint(std::shared_ptr<IKeyMintDevice> keyMint) {
     ASSERT_NE(keyMint, nullptr);
-    keymint_ = keyMint;
+    keymint_ = std::move(keyMint);
 
     KeyMintHardwareInfo info;
     ASSERT_TRUE(keymint_->getHardwareInfo(&info).isOk());
@@ -68,8 +69,12 @@
 }
 
 void KeyMintAidlTestBase::SetUp() {
-    InitializeKeyMint(
-            android::waitForDeclaredService<IKeyMintDevice>(String16(GetParam().c_str())));
+    if (AServiceManager_isDeclared(GetParam().c_str())) {
+        ::ndk::SpAIBinder binder(AServiceManager_waitForService(GetParam().c_str()));
+        InitializeKeyMint(IKeyMintDevice::fromBinder(binder));
+    } else {
+        InitializeKeyMint(nullptr);
+    }
 }
 
 ErrorCode KeyMintAidlTestBase::GenerateKey(const AuthorizationSet& key_desc,
@@ -176,7 +181,7 @@
         *key_blob = vector<uint8_t>();
     }
 
-    EXPECT_TRUE(result.isOk()) << result.serviceSpecificErrorCode() << endl;
+    EXPECT_TRUE(result.isOk()) << result.getServiceSpecificError() << endl;
     return GetReturnErrorCode(result);
 }
 
@@ -186,7 +191,7 @@
 
 ErrorCode KeyMintAidlTestBase::DeleteAllKeys() {
     Status result = keymint_->deleteAllKeys();
-    EXPECT_TRUE(result.isOk()) << result.serviceSpecificErrorCode() << endl;
+    EXPECT_TRUE(result.isOk()) << result.getServiceSpecificError() << endl;
     return GetReturnErrorCode(result);
 }
 
@@ -201,7 +206,8 @@
 
 ErrorCode KeyMintAidlTestBase::Begin(KeyPurpose purpose, const vector<uint8_t>& key_blob,
                                      const AuthorizationSet& in_params,
-                                     AuthorizationSet* out_params, sp<IKeyMintOperation>& op) {
+                                     AuthorizationSet* out_params,
+                                     std::shared_ptr<IKeyMintOperation>& op) {
     SCOPED_TRACE("Begin");
     Status result;
     BeginResult out;
@@ -326,7 +332,7 @@
         output->append(oPut.begin(), oPut.end());
     }
 
-    op_.clear();  // So dtor doesn't Abort().
+    op_.reset();
     return GetReturnErrorCode(result);
 }
 
@@ -358,7 +364,7 @@
     return result;
 }
 
-ErrorCode KeyMintAidlTestBase::Abort(const sp<IKeyMintOperation>& op) {
+ErrorCode KeyMintAidlTestBase::Abort(const std::shared_ptr<IKeyMintOperation>& op) {
     SCOPED_TRACE("Abort");
 
     EXPECT_NE(op, nullptr);
@@ -368,7 +374,7 @@
 
     Status retval = op->abort();
     EXPECT_TRUE(retval.isOk());
-    return static_cast<ErrorCode>(retval.serviceSpecificErrorCode());
+    return static_cast<ErrorCode>(retval.getServiceSpecificError());
 }
 
 ErrorCode KeyMintAidlTestBase::Abort() {
@@ -380,14 +386,14 @@
     }
 
     Status retval = op_->abort();
-    return static_cast<ErrorCode>(retval.serviceSpecificErrorCode());
+    return static_cast<ErrorCode>(retval.getServiceSpecificError());
 }
 
 void KeyMintAidlTestBase::AbortIfNeeded() {
     SCOPED_TRACE("AbortIfNeeded");
     if (op_) {
         EXPECT_EQ(ErrorCode::OK, Abort());
-        op_.clear();
+        op_.reset();
     }
 }
 
@@ -522,7 +528,7 @@
     AuthorizationSet finish_out_params;
     EXPECT_EQ(ErrorCode::OK, Finish(finish_params, message.substr(consumed), signature,
                                     &finish_out_params, &output));
-    op_.clear();
+    op_.reset();
     EXPECT_TRUE(output.empty());
 }
 
@@ -750,4 +756,4 @@
 
 }  // namespace test
 
-}  // namespace android::hardware::security::keymint
+}  // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
index 052736b..f73c26d 100644
--- a/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
+++ b/security/keymint/aidl/vts/functional/KeyMintAidlTestBase.h
@@ -22,15 +22,15 @@
 #include <binder/ProcessState.h>
 #include <gtest/gtest.h>
 
-#include <android/hardware/security/keymint/ErrorCode.h>
-#include <android/hardware/security/keymint/IKeyMintDevice.h>
+#include <aidl/android/hardware/security/keymint/ErrorCode.h>
+#include <aidl/android/hardware/security/keymint/IKeyMintDevice.h>
 
 #include <keymint_support/authorization_set.h>
 
-namespace android::hardware::security::keymint::test {
+namespace aidl::android::hardware::security::keymint::test {
 
 using ::android::sp;
-using binder::Status;
+using Status = ::ndk::ScopedAStatus;
 using ::std::shared_ptr;
 using ::std::string;
 using ::std::vector;
@@ -49,12 +49,12 @@
         AbortIfNeeded();
     }
 
-    void InitializeKeyMint(sp<IKeyMintDevice> keyMint);
+    void InitializeKeyMint(std::shared_ptr<IKeyMintDevice> keyMint);
     IKeyMintDevice& keyMint() { return *keymint_; }
     uint32_t os_version() { return os_version_; }
     uint32_t os_patch_level() { return os_patch_level_; }
 
-    ErrorCode GetReturnErrorCode(Status result);
+    ErrorCode GetReturnErrorCode(const Status& result);
     ErrorCode GenerateKey(const AuthorizationSet& key_desc, vector<uint8_t>* key_blob,
                           KeyCharacteristics* key_characteristics);
 
@@ -80,7 +80,7 @@
 
     ErrorCode Begin(KeyPurpose purpose, const vector<uint8_t>& key_blob,
                     const AuthorizationSet& in_params, AuthorizationSet* out_params,
-                    sp<IKeyMintOperation>& op);
+                    std::shared_ptr<IKeyMintOperation>& op);
     ErrorCode Begin(KeyPurpose purpose, const vector<uint8_t>& key_blob,
                     const AuthorizationSet& in_params, AuthorizationSet* out_params);
     ErrorCode Begin(KeyPurpose purpose, const AuthorizationSet& in_params,
@@ -98,7 +98,7 @@
     ErrorCode Finish(string* output) { return Finish(string(), output); }
 
     ErrorCode Abort();
-    ErrorCode Abort(const sp<IKeyMintOperation>& op);
+    ErrorCode Abort(const shared_ptr<IKeyMintOperation>& op);
     void AbortIfNeeded();
 
     string ProcessMessage(const vector<uint8_t>& key_blob, KeyPurpose operation,
@@ -159,17 +159,17 @@
     vector<Digest> ValidDigests(bool withNone, bool withMD5);
 
     static vector<string> build_params() {
-        auto params = android::getAidlHalInstanceNames(IKeyMintDevice::descriptor);
+        auto params = ::android::getAidlHalInstanceNames(IKeyMintDevice::descriptor);
         return params;
     }
 
-    sp<IKeyMintOperation> op_;
+    std::shared_ptr<IKeyMintOperation> op_;
     vector<Certificate> certChain_;
     vector<uint8_t> key_blob_;
     KeyCharacteristics key_characteristics_;
 
   private:
-    sp<IKeyMintDevice> keymint_;
+    std::shared_ptr<IKeyMintDevice> keymint_;
     uint32_t os_version_;
     uint32_t os_patch_level_;
 
@@ -182,6 +182,6 @@
 #define INSTANTIATE_KEYMINT_AIDL_TEST(name)                                          \
     INSTANTIATE_TEST_SUITE_P(PerInstance, name,                                      \
                              testing::ValuesIn(KeyMintAidlTestBase::build_params()), \
-                             android::PrintInstanceNameToString)
+                             ::android::PrintInstanceNameToString)
 
-}  // namespace android::hardware::security::keymint::test
+}  // namespace aidl::android::hardware::security::keymint::test
diff --git a/security/keymint/aidl/vts/functional/KeyMintTest.cpp b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
index f9423a2..6e38539 100644
--- a/security/keymint/aidl/vts/functional/KeyMintTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyMintTest.cpp
@@ -26,7 +26,7 @@
 
 #include <cutils/properties.h>
 
-#include <android/hardware/security/keymint/KeyFormat.h>
+#include <aidl/android/hardware/security/keymint/KeyFormat.h>
 
 #include <keymint_support/attestation_record.h>
 #include <keymint_support/key_param_output.h>
@@ -37,21 +37,21 @@
 static bool arm_deleteAllKeys = false;
 static bool dump_Attestations = false;
 
-using android::hardware::security::keymint::AuthorizationSet;
-using android::hardware::security::keymint::KeyCharacteristics;
-using android::hardware::security::keymint::KeyFormat;
+using aidl::android::hardware::security::keymint::AuthorizationSet;
+using aidl::android::hardware::security::keymint::KeyCharacteristics;
+using aidl::android::hardware::security::keymint::KeyFormat;
 
-namespace android::hardware::security::keymint {
+namespace aidl::android::hardware::security::keymint {
 
 bool operator==(const keymint::AuthorizationSet& a, const keymint::AuthorizationSet& b) {
     return a.size() == b.size() && std::equal(a.begin(), a.end(), b.begin());
 }
 
-}  // namespace android::hardware::security::keymint
+}  // namespace aidl::android::hardware::security::keymint
 
 namespace std {
 
-using namespace android::hardware::security::keymint;
+using namespace aidl::android::hardware::security::keymint;
 
 template <>
 struct std::equal_to<KeyCharacteristics> {
@@ -73,7 +73,7 @@
 
 }  // namespace std
 
-namespace android::hardware::security::keymint::test {
+namespace aidl::android::hardware::security::keymint::test {
 
 namespace {
 
@@ -834,7 +834,7 @@
     EXPECT_EQ(ErrorCode::INVALID_OPERATION_HANDLE, Abort());
 
     // Set to sentinel, so TearDown() doesn't try to abort again.
-    op_.clear();
+    op_.reset();
 }
 
 /*
@@ -3115,7 +3115,7 @@
     EXPECT_EQ(ErrorCode::INVALID_TAG,
               Update(update_params, "", &update_out_params, &ciphertext, &input_consumed));
 
-    op_.clear();
+    op_.reset();
 }
 
 /*
@@ -3973,7 +3973,7 @@
 
     auto params = AuthorizationSetBuilder().Padding(PaddingMode::NONE);
     constexpr size_t max_operations = 100;  // set to arbituary large number
-    sp<IKeyMintOperation> op_handles[max_operations];
+    std::shared_ptr<IKeyMintOperation> op_handles[max_operations];
     AuthorizationSet out_params;
     ErrorCode result;
     size_t i;
@@ -4040,7 +4040,7 @@
 
 INSTANTIATE_KEYMINT_AIDL_TEST(TransportLimitTest);
 
-}  // namespace android::hardware::security::keymint::test
+}  // namespace aidl::android::hardware::security::keymint::test
 
 int main(int argc, char** argv) {
     ::testing::InitGoogleTest(&argc, argv);
diff --git a/security/keymint/aidl/vts/functional/VerificationTokenTest.cpp b/security/keymint/aidl/vts/functional/VerificationTokenTest.cpp
index 6d3a34e..0b1eccd 100644
--- a/security/keymint/aidl/vts/functional/VerificationTokenTest.cpp
+++ b/security/keymint/aidl/vts/functional/VerificationTokenTest.cpp
@@ -16,7 +16,7 @@
 
 #include "KeyMintAidlTestBase.h"
 
-namespace android::hardware::security::keymint::test {
+namespace aidl::android::hardware::security::keymint::test {
 
 class VerificationTokenTest : public KeyMintAidlTestBase {
   protected:
@@ -165,4 +165,4 @@
 
 INSTANTIATE_KEYMINT_AIDL_TEST(VerificationTokenTest);
 
-}  // namespace android::hardware::security::keymint::test
+}  // namespace aidl::android::hardware::security::keymint::test
diff --git a/security/keymint/support/Android.bp b/security/keymint/support/Android.bp
index ddac92f..0cfa798 100644
--- a/security/keymint/support/Android.bp
+++ b/security/keymint/support/Android.bp
@@ -31,7 +31,7 @@
         "include",
     ],
     shared_libs: [
-        "android.hardware.security.keymint-cpp",
+        "android.hardware.security.keymint-unstable-ndk_platform",
         "libbase",
         "libcrypto",
         "libutils",
diff --git a/security/keymint/support/attestation_record.cpp b/security/keymint/support/attestation_record.cpp
index 1b07495..596b097 100644
--- a/security/keymint/support/attestation_record.cpp
+++ b/security/keymint/support/attestation_record.cpp
@@ -18,8 +18,8 @@
 
 #include <assert.h>
 
-#include <android/hardware/security/keymint/Tag.h>
-#include <android/hardware/security/keymint/TagType.h>
+#include <aidl/android/hardware/security/keymint/Tag.h>
+#include <aidl/android/hardware/security/keymint/TagType.h>
 
 #include <android-base/logging.h>
 
@@ -33,7 +33,7 @@
 
 #define AT __FILE__ ":" << __LINE__
 
-namespace android::hardware::security::keymint {
+namespace aidl::android::hardware::security::keymint {
 
 struct stack_st_ASN1_TYPE_Delete {
     void operator()(stack_st_ASN1_TYPE* p) { sk_ASN1_TYPE_free(p); }
@@ -380,4 +380,4 @@
     return ErrorCode::OK;  // KM_ERROR_OK;
 }
 
-}  // namespace android::hardware::security::keymint
+}  // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/support/authorization_set.cpp b/security/keymint/support/authorization_set.cpp
index e2aac9a..37b6cd1 100644
--- a/security/keymint/support/authorization_set.cpp
+++ b/security/keymint/support/authorization_set.cpp
@@ -16,19 +16,13 @@
 
 #include <keymint_support/authorization_set.h>
 
-#include <assert.h>
-#include <sstream>
+#include <aidl/android/hardware/security/keymint/Algorithm.h>
+#include <aidl/android/hardware/security/keymint/BlockMode.h>
+#include <aidl/android/hardware/security/keymint/Digest.h>
+#include <aidl/android/hardware/security/keymint/KeyParameter.h>
+#include <aidl/android/hardware/security/keymint/KeyPurpose.h>
 
-#include <android-base/logging.h>
-
-#include <android/hardware/security/keymint/Algorithm.h>
-#include <android/hardware/security/keymint/BlockMode.h>
-#include <android/hardware/security/keymint/Digest.h>
-#include <android/hardware/security/keymint/KeyParameter.h>
-#include <android/hardware/security/keymint/KeyPurpose.h>
-#include <android/hardware/security/keymint/TagType.h>
-
-namespace android::hardware::security::keymint {
+namespace aidl::android::hardware::security::keymint {
 
 void AuthorizationSet::Sort() {
     std::sort(data_.begin(), data_.end());
@@ -218,7 +212,7 @@
 }
 
 AuthorizationSetBuilder& AuthorizationSetBuilder::BlockMode(
-        std::initializer_list<android::hardware::security::keymint::BlockMode> blockModes) {
+        std::initializer_list<aidl::android::hardware::security::keymint::BlockMode> blockModes) {
     for (auto mode : blockModes) {
         push_back(TAG_BLOCK_MODE, mode);
     }
@@ -240,4 +234,4 @@
     return *this;
 }
 
-}  // namespace android::hardware::security::keymint
+}  // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/support/include/keymint_support/attestation_record.h b/security/keymint/support/include/keymint_support/attestation_record.h
index 0739569..bc76c93 100644
--- a/security/keymint/support/include/keymint_support/attestation_record.h
+++ b/security/keymint/support/include/keymint_support/attestation_record.h
@@ -16,14 +16,14 @@
 
 #pragma once
 
-#include <android/hardware/security/keymint/ErrorCode.h>
-#include <android/hardware/security/keymint/IKeyMintDevice.h>
+#include <aidl/android/hardware/security/keymint/ErrorCode.h>
+#include <aidl/android/hardware/security/keymint/IKeyMintDevice.h>
 
 #include <keymint_support/attestation_record.h>
 #include <keymint_support/authorization_set.h>
 #include <keymint_support/openssl_utils.h>
 
-namespace android::hardware::security::keymint {
+namespace aidl::android::hardware::security::keymint {
 
 class AuthorizationSet;
 
@@ -84,4 +84,4 @@
                               VerifiedBoot* verified_boot_state, bool* device_locked,
                               std::vector<uint8_t>* verified_boot_hash);
 
-}  // namespace android::hardware::security::keymint
+}  // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/support/include/keymint_support/authorization_set.h b/security/keymint/support/include/keymint_support/authorization_set.h
index 0277200..c85f305 100644
--- a/security/keymint/support/include/keymint_support/authorization_set.h
+++ b/security/keymint/support/include/keymint_support/authorization_set.h
@@ -18,14 +18,14 @@
 
 #include <vector>
 
-#include <android/hardware/security/keymint/BlockMode.h>
-#include <android/hardware/security/keymint/Digest.h>
-#include <android/hardware/security/keymint/EcCurve.h>
-#include <android/hardware/security/keymint/PaddingMode.h>
+#include <aidl/android/hardware/security/keymint/BlockMode.h>
+#include <aidl/android/hardware/security/keymint/Digest.h>
+#include <aidl/android/hardware/security/keymint/EcCurve.h>
+#include <aidl/android/hardware/security/keymint/PaddingMode.h>
 
 #include <keymint_support/keymint_tags.h>
 
-namespace android::hardware::security::keymint {
+namespace aidl::android::hardware::security::keymint {
 
 using std::vector;
 
@@ -307,4 +307,4 @@
     }
 };
 
-}  // namespace android::hardware::security::keymint
+}  // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/support/include/keymint_support/key_param_output.h b/security/keymint/support/include/keymint_support/key_param_output.h
index b109105..6e0e35d 100644
--- a/security/keymint/support/include/keymint_support/key_param_output.h
+++ b/security/keymint/support/include/keymint_support/key_param_output.h
@@ -19,24 +19,24 @@
 #include <iostream>
 #include <vector>
 
-#include <android/hardware/security/keymint/Algorithm.h>
-#include <android/hardware/security/keymint/BlockMode.h>
-#include <android/hardware/security/keymint/Digest.h>
-#include <android/hardware/security/keymint/EcCurve.h>
-#include <android/hardware/security/keymint/ErrorCode.h>
-#include <android/hardware/security/keymint/HardwareAuthenticatorType.h>
-#include <android/hardware/security/keymint/KeyCharacteristics.h>
-#include <android/hardware/security/keymint/KeyOrigin.h>
-#include <android/hardware/security/keymint/KeyParameter.h>
-#include <android/hardware/security/keymint/KeyPurpose.h>
-#include <android/hardware/security/keymint/PaddingMode.h>
-#include <android/hardware/security/keymint/SecurityLevel.h>
-#include <android/hardware/security/keymint/Tag.h>
-#include <android/hardware/security/keymint/TagType.h>
+#include <aidl/android/hardware/security/keymint/Algorithm.h>
+#include <aidl/android/hardware/security/keymint/BlockMode.h>
+#include <aidl/android/hardware/security/keymint/Digest.h>
+#include <aidl/android/hardware/security/keymint/EcCurve.h>
+#include <aidl/android/hardware/security/keymint/ErrorCode.h>
+#include <aidl/android/hardware/security/keymint/HardwareAuthenticatorType.h>
+#include <aidl/android/hardware/security/keymint/KeyCharacteristics.h>
+#include <aidl/android/hardware/security/keymint/KeyOrigin.h>
+#include <aidl/android/hardware/security/keymint/KeyParameter.h>
+#include <aidl/android/hardware/security/keymint/KeyPurpose.h>
+#include <aidl/android/hardware/security/keymint/PaddingMode.h>
+#include <aidl/android/hardware/security/keymint/SecurityLevel.h>
+#include <aidl/android/hardware/security/keymint/Tag.h>
+#include <aidl/android/hardware/security/keymint/TagType.h>
 
 #include "keymint_tags.h"
 
-namespace android::hardware::security::keymint {
+namespace aidl::android::hardware::security::keymint {
 
 inline ::std::ostream& operator<<(::std::ostream& os, Algorithm value) {
     return os << toString(value);
@@ -96,4 +96,4 @@
     return os << toString(tag);
 }
 
-}  // namespace android::hardware::security::keymint
+}  // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/support/include/keymint_support/keymint_tags.h b/security/keymint/support/include/keymint_support/keymint_tags.h
index d418fec..4e3d7ff 100644
--- a/security/keymint/support/include/keymint_support/keymint_tags.h
+++ b/security/keymint/support/include/keymint_support/keymint_tags.h
@@ -16,20 +16,20 @@
 
 #pragma once
 
-#include <android/hardware/security/keymint/Algorithm.h>
-#include <android/hardware/security/keymint/BlockMode.h>
-#include <android/hardware/security/keymint/Digest.h>
-#include <android/hardware/security/keymint/EcCurve.h>
-#include <android/hardware/security/keymint/HardwareAuthenticatorType.h>
-#include <android/hardware/security/keymint/KeyOrigin.h>
-#include <android/hardware/security/keymint/KeyParameter.h>
-#include <android/hardware/security/keymint/KeyPurpose.h>
-#include <android/hardware/security/keymint/PaddingMode.h>
-#include <android/hardware/security/keymint/SecurityLevel.h>
-#include <android/hardware/security/keymint/Tag.h>
-#include <android/hardware/security/keymint/TagType.h>
+#include <aidl/android/hardware/security/keymint/Algorithm.h>
+#include <aidl/android/hardware/security/keymint/BlockMode.h>
+#include <aidl/android/hardware/security/keymint/Digest.h>
+#include <aidl/android/hardware/security/keymint/EcCurve.h>
+#include <aidl/android/hardware/security/keymint/HardwareAuthenticatorType.h>
+#include <aidl/android/hardware/security/keymint/KeyOrigin.h>
+#include <aidl/android/hardware/security/keymint/KeyParameter.h>
+#include <aidl/android/hardware/security/keymint/KeyPurpose.h>
+#include <aidl/android/hardware/security/keymint/PaddingMode.h>
+#include <aidl/android/hardware/security/keymint/SecurityLevel.h>
+#include <aidl/android/hardware/security/keymint/Tag.h>
+#include <aidl/android/hardware/security/keymint/TagType.h>
 
-namespace android::hardware::security::keymint {
+namespace aidl::android::hardware::security::keymint {
 
 constexpr TagType typeFromTag(Tag tag) {
     return static_cast<TagType>(static_cast<uint32_t>(tag) & static_cast<uint32_t>(0xf0000000));
@@ -325,4 +325,4 @@
     return accessTagValue(ttag, param);
 }
 
-}  // namespace android::hardware::security::keymint
+}  // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/support/include/keymint_support/keymint_utils.h b/security/keymint/support/include/keymint_support/keymint_utils.h
index 878b7df..53d5b96 100644
--- a/security/keymint/support/include/keymint_support/keymint_utils.h
+++ b/security/keymint/support/include/keymint_support/keymint_utils.h
@@ -16,9 +16,9 @@
 
 #pragma once
 
-#include <android/hardware/security/keymint/HardwareAuthToken.h>
+#include <aidl/android/hardware/security/keymint/HardwareAuthToken.h>
 
-namespace android::hardware::security::keymint {
+namespace aidl::android::hardware::security::keymint {
 
 using std::vector;
 
@@ -39,4 +39,4 @@
 uint32_t getOsVersion();
 uint32_t getOsPatchlevel();
 
-}  // namespace android::hardware::security::keymint
+}  // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/support/include/keymint_support/openssl_utils.h b/security/keymint/support/include/keymint_support/openssl_utils.h
index 0878810..9ae7e52 100644
--- a/security/keymint/support/include/keymint_support/openssl_utils.h
+++ b/security/keymint/support/include/keymint_support/openssl_utils.h
@@ -16,12 +16,12 @@
 
 #pragma once
 
-#include <android/hardware/security/keymint/Digest.h>
+#include <aidl/android/hardware/security/keymint/Digest.h>
 
 #include <openssl/evp.h>
 #include <openssl/x509.h>
 
-namespace android::hardware::security::keymint {
+namespace aidl::android::hardware::security::keymint {
 
 template <typename T, void (*F)(T*)>
 struct UniquePtrDeleter {
@@ -61,4 +61,4 @@
     return nullptr;
 }
 
-}  // namespace android::hardware::security::keymint
+}  // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/support/key_param_output.cpp b/security/keymint/support/key_param_output.cpp
index d8e2fff..c56e035 100644
--- a/security/keymint/support/key_param_output.cpp
+++ b/security/keymint/support/key_param_output.cpp
@@ -20,7 +20,7 @@
 
 #include <keymint_support/keymint_tags.h>
 
-namespace android::hardware::security::keymint {
+namespace aidl::android::hardware::security::keymint {
 
 using ::std::endl;
 using ::std::ostream;
@@ -69,4 +69,4 @@
     return os << "UNKNOWN TAG TYPE!";
 }
 
-}  // namespace android::hardware::security::keymint
+}  // namespace aidl::android::hardware::security::keymint
diff --git a/security/keymint/support/keymint_utils.cpp b/security/keymint/support/keymint_utils.cpp
index 63606f4..e73d602 100644
--- a/security/keymint/support/keymint_utils.cpp
+++ b/security/keymint/support/keymint_utils.cpp
@@ -16,14 +16,10 @@
 
 #include <regex.h>
 
-#include <arpa/inet.h>
-
 #include <android-base/properties.h>
 #include <hardware/hw_auth_token.h>
 
-#include <keymint_support/keymint_utils.h>
-
-namespace android::hardware::security::keymint {
+namespace aidl::android::hardware::security::keymint {
 
 namespace {
 
@@ -112,4 +108,4 @@
     return getOsPatchlevel(patchlevel.c_str());
 }
 
-}  // namespace android::hardware::security::keymint
+}  // namespace aidl::android::hardware::security::keymint
diff --git a/wifi/1.4/vts/functional/wifi_rtt_controller_hidl_test.cpp b/wifi/1.4/vts/functional/wifi_rtt_controller_hidl_test.cpp
index 3977cdd..72cde3c 100644
--- a/wifi/1.4/vts/functional/wifi_rtt_controller_hidl_test.cpp
+++ b/wifi/1.4/vts/functional/wifi_rtt_controller_hidl_test.cpp
@@ -191,6 +191,8 @@
     const auto& status =
         HIDL_INVOKE(wifi_rtt_controller_, rangeRequest_1_4, cmdId, configs);
     EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
+    // sleep for 2 seconds to wait for driver/firmware to complete RTT
+    sleep(2);
 }
 /*
  * rangeRequest_1_4
@@ -242,6 +244,8 @@
     const auto& status =
         HIDL_INVOKE(wifi_rtt_controller_, rangeRequest_1_4, cmdId, configs);
     EXPECT_EQ(WifiStatusCode::SUCCESS, status.code);
+    // sleep for 2 seconds to wait for driver/firmware to complete RTT
+    sleep(2);
 }
 
 /*
diff --git a/wifi/1.5/IWifiChip.hal b/wifi/1.5/IWifiChip.hal
index e9caa3d..80f2ca4 100644
--- a/wifi/1.5/IWifiChip.hal
+++ b/wifi/1.5/IWifiChip.hal
@@ -17,7 +17,6 @@
 package android.hardware.wifi@1.5;
 
 import @1.0::WifiStatus;
-import @1.0::IfaceType;
 import @1.5::IWifiApIface;
 import @1.0::IWifiIface;
 import @1.3::IWifiChip;
@@ -187,6 +186,12 @@
         NO_POWER_CAP = 0x7FFFFFFF,
     };
 
+    enum CoexRestriction : uint32_t {
+        WIFI_DIRECT = 1 << 0,
+        SOFTAP = 1 << 1,
+        WIFI_AWARE = 1 << 2
+    };
+
     /**
      * Invoked to indicate that the provided |CoexUnsafeChannels| should be avoided with the
      * specified restrictions.
@@ -194,13 +199,14 @@
      * Channel avoidance is a suggestion and should be done on a best-effort approach. If a provided
      * channel is used, then the specified power cap should be applied.
      *
-     * In addition, hard restrictions on the Wifi modes may be indicated by |IfaceType| bits
-     * (STA, AP, P2P, NAN, etc) in the |restrictions| bitfield. If a hard restriction is provided,
-     * then the channels should be completely avoided for the provided Wifi modes instead of by
-     * best-effort.
+     * In addition, hard restrictions on the Wifi modes may be indicated by |CoexRestriction| bits
+     * (WIFI_DIRECT, SOFTAP, WIFI_AWARE) in the |restrictions| bitfield. If a hard restriction is
+     * provided, then the channels should be completely avoided for the provided Wifi modes instead
+     * of by best-effort.
      *
      * @param unsafeChannels List of |CoexUnsafeChannels| to avoid.
-     * @param restrictions Bitset of |IfaceType| values indicating Wifi modes to completely avoid.
+     * @param restrictions Bitset of |CoexRestriction| values indicating Wifi interfaces to
+     *         completely avoid.
      * @return status WifiStatus of the operation.
      *         Possible status codes:
      *         |WifiStatusCode.SUCCESS|,
@@ -208,6 +214,6 @@
      *         |WifiStatusCode.ERROR_INVALID_ARGS|,
      */
     setCoexUnsafeChannels(
-        vec<CoexUnsafeChannel> unsafeChannels, bitfield<IfaceType> restrictions)
+        vec<CoexUnsafeChannel> unsafeChannels, bitfield<CoexRestriction> restrictions)
             generates (WifiStatus status);
 };
diff --git a/wifi/1.5/default/wifi_chip.cpp b/wifi/1.5/default/wifi_chip.cpp
index 1b0353b..6dd400c 100644
--- a/wifi/1.5/default/wifi_chip.cpp
+++ b/wifi/1.5/default/wifi_chip.cpp
@@ -116,8 +116,8 @@
     ifnames.push_back(buffer.data());
     if (is_bridged) {
         buffer.fill(0);
-        if (property_get("ro.vendor.wifi.sap.concurrent.interface",
-                         buffer.data(), nullptr) == 0) {
+        if (property_get("ro.vendor.wifi.sap.concurrent.iface", buffer.data(),
+                         nullptr) == 0) {
             return ifnames;
         }
         ifnames.push_back(buffer.data());
@@ -724,7 +724,7 @@
 
 Return<void> WifiChip::setCoexUnsafeChannels(
     const hidl_vec<CoexUnsafeChannel>& unsafeChannels,
-    hidl_bitfield<IfaceType> restrictions,
+    hidl_bitfield<CoexRestriction> restrictions,
     setCoexUnsafeChannels_cb hidl_status_cb) {
     return validateAndCall(this, WifiStatusCode::ERROR_WIFI_CHIP_INVALID,
                            &WifiChip::setCoexUnsafeChannelsInternal,
@@ -1463,8 +1463,18 @@
             unsafe_channels, &legacy_unsafe_channels)) {
         return createWifiStatus(WifiStatusCode::ERROR_INVALID_ARGS);
     }
+    uint32_t legacy_restrictions = 0;
+    if (restrictions & CoexRestriction::WIFI_DIRECT) {
+        legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_DIRECT;
+    }
+    if (restrictions & CoexRestriction::SOFTAP) {
+        legacy_restrictions |= legacy_hal::wifi_coex_restriction::SOFTAP;
+    }
+    if (restrictions & CoexRestriction::WIFI_AWARE) {
+        legacy_restrictions |= legacy_hal::wifi_coex_restriction::WIFI_AWARE;
+    }
     auto legacy_status = legacy_hal_.lock()->setCoexUnsafeChannels(
-        legacy_unsafe_channels, restrictions);
+        legacy_unsafe_channels, legacy_restrictions);
     return createWifiStatusFromLegacyError(legacy_status);
 }
 
@@ -1841,8 +1851,8 @@
     } else {
         int num_ifaces_need_to_allocate = 2 - instances.size();
         for (int i = 0; i < num_ifaces_need_to_allocate; i++) {
-            std::string instance_name =
-                allocateApOrStaIfaceName(IfaceType::AP, startIdxOfApIface());
+            std::string instance_name = allocateApOrStaIfaceName(
+                IfaceType::AP, startIdxOfApIface() + i);
             if (!instance_name.empty()) {
                 instances.push_back(instance_name);
             }
diff --git a/wifi/1.5/vts/functional/wifi_chip_hidl_test.cpp b/wifi/1.5/vts/functional/wifi_chip_hidl_test.cpp
index eeaa7e0..a065721 100644
--- a/wifi/1.5/vts/functional/wifi_chip_hidl_test.cpp
+++ b/wifi/1.5/vts/functional/wifi_chip_hidl_test.cpp
@@ -44,6 +44,7 @@
 using ::android::hardware::wifi::V1_0::WifiStatusCode;
 using ::android::hardware::wifi::V1_4::IWifiChipEventCallback;
 using ::android::hardware::wifi::V1_5::IWifiChip;
+using ::android::hardware::wifi::V1_5::WifiBand;
 
 /**
  * Fixture to use for all Wifi chip HIDL interface tests.
@@ -141,6 +142,37 @@
     }
 }
 
+/*
+ * setCoexUnsafeChannels
+ */
+TEST_P(WifiChipHidlTest, setCoexUnsafeChannels) {
+    // Test with empty vector of CoexUnsafeChannels
+    std::vector<IWifiChip::CoexUnsafeChannel> vec;
+    const auto& statusEmpty =
+        HIDL_INVOKE(wifi_chip_, setCoexUnsafeChannels, vec, 0);
+    if (statusEmpty.code != WifiStatusCode::SUCCESS) {
+        EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, statusEmpty.code);
+    }
+
+    // Test with non-empty vector of CoexUnsafeChannels
+    IWifiChip::CoexUnsafeChannel unsafeChannel24Ghz;
+    unsafeChannel24Ghz.band = WifiBand::BAND_24GHZ;
+    unsafeChannel24Ghz.channel = 6;
+    vec.push_back(unsafeChannel24Ghz);
+    IWifiChip::CoexUnsafeChannel unsafeChannel5Ghz;
+    unsafeChannel5Ghz.band = WifiBand::BAND_5GHZ;
+    unsafeChannel5Ghz.channel = 36;
+    vec.push_back(unsafeChannel5Ghz);
+    uint32_t restrictions = IWifiChip::CoexRestriction::WIFI_AWARE |
+                            IWifiChip::CoexRestriction::SOFTAP |
+                            IWifiChip::CoexRestriction::WIFI_DIRECT;
+    const auto& statusNonEmpty =
+        HIDL_INVOKE(wifi_chip_, setCoexUnsafeChannels, vec, restrictions);
+    if (statusNonEmpty.code != WifiStatusCode::SUCCESS) {
+        EXPECT_EQ(WifiStatusCode::ERROR_NOT_SUPPORTED, statusNonEmpty.code);
+    }
+}
+
 GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(WifiChipHidlTest);
 INSTANTIATE_TEST_SUITE_P(
     PerInstance, WifiChipHidlTest,