Merge "Add NB_IOT_NTN" into main
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index e96cf81..2be7f51 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -1049,6 +1049,23 @@
         return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
     }
 
+    auto& patches = getConfig().patches;
+    auto existing = patches.end();
+    if (in_requested.id != 0) {
+        existing = findById<AudioPatch>(patches, in_requested.id);
+        if (existing == patches.end()) {
+            LOG(ERROR) << __func__ << ": " << mType << ": not found existing patch id "
+                       << in_requested.id;
+            return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
+        }
+        if (in_requested == *existing) {
+            LOG(INFO) << __func__ << ": " << mType
+                      << ": requested patch has no changes compared to already existing one, id "
+                      << in_requested.id;
+            return ndk::ScopedAStatus::ok();
+        }
+    }
+
     auto& configs = getConfig().portConfigs;
     std::vector<int32_t> missingIds;
     auto sources =
@@ -1088,20 +1105,12 @@
     }
     RETURN_STATUS_IF_ERROR(checkAudioPatchEndpointsMatch(sources, sinks));
 
-    auto& patches = getConfig().patches;
-    auto existing = patches.end();
     std::optional<decltype(mPatches)> patchesBackup;
-    if (in_requested.id != 0) {
-        existing = findById<AudioPatch>(patches, in_requested.id);
-        if (existing != patches.end()) {
-            patchesBackup = mPatches;
-            cleanUpPatch(existing->id);
-        } else {
-            LOG(ERROR) << __func__ << ": " << mType << ": not found existing patch id "
-                       << in_requested.id;
-            return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
-        }
+    if (existing != patches.end()) {
+        patchesBackup = mPatches;
+        cleanUpPatch(existing->id);
     }
+
     // Validate the requested patch.
     for (const auto& [sinkPortId, nonExclusive] : allowedSinkPorts) {
         if (!nonExclusive && mPatches.count(sinkPortId) != 0) {
diff --git a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
index a10e0a6..18fc4b2 100644
--- a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
+++ b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.cpp
@@ -534,7 +534,8 @@
         direction_configurations,
     const std::vector<std::optional<AseDirectionRequirement>>& requirements,
     std::optional<std::vector<std::optional<AseDirectionConfiguration>>>&
-        valid_direction_configurations) {
+        valid_direction_configurations,
+    bool isExact) {
   if (!direction_configurations.has_value()) return;
 
   if (!valid_direction_configurations.has_value()) {
@@ -542,55 +543,93 @@
         std::vector<std::optional<AseDirectionConfiguration>>();
   }
 
-  // Exact matching process
-  // Need to respect the number of device
-  for (int i = 0; i < requirements.size(); ++i) {
-    auto requirement = requirements[i];
-    auto direction_configuration = direction_configurations.value()[i];
-    if (!direction_configuration.has_value()) {
-      valid_direction_configurations = std::nullopt;
-      return;
-    }
-    auto cfg = direction_configuration.value();
-    if (!filterMatchedAseConfiguration(cfg.aseConfiguration,
-                                       requirement.value().aseConfiguration)) {
-      valid_direction_configurations = std::nullopt;
-      return;  // No way to match
-    }
-    // For exact match, we require this direction to have the same allocation.
-    // If stereo, need stereo.
-    // If mono, need mono (modified to the correct required allocation)
-    auto req_allocation_bitmask = getLeAudioAseConfigurationAllocationBitmask(
-        requirement.value().aseConfiguration);
-    int req_channel_count = getCountFromBitmask(req_allocation_bitmask);
-    int cfg_bitmask =
-        getLeAudioAseConfigurationAllocationBitmask(cfg.aseConfiguration);
-    int cfg_channel_count = getCountFromBitmask(cfg_bitmask);
-    if (req_channel_count <= 1) {
-      // MONO case, is a match if also mono, modify to the same allocation
-      if (cfg_channel_count > 1) {
+  if (isExact) {
+    // Exact matching process
+    // Need to respect the number of device
+    for (int i = 0; i < requirements.size(); ++i) {
+      auto requirement = requirements[i];
+      auto direction_configuration = direction_configurations.value()[i];
+      if (!direction_configuration.has_value()) {
         valid_direction_configurations = std::nullopt;
-        return;  // Not a match
+        return;
       }
-      // Modify the bitmask to be the same as the requirement
-      for (auto& codec_cfg : cfg.aseConfiguration.codecConfiguration) {
-        if (codec_cfg.getTag() ==
-            CodecSpecificConfigurationLtv::Tag::audioChannelAllocation) {
-          codec_cfg
-              .get<CodecSpecificConfigurationLtv::Tag::audioChannelAllocation>()
-              .bitmask = req_allocation_bitmask;
-          break;
+      auto cfg = direction_configuration.value();
+      if (!filterMatchedAseConfiguration(
+              cfg.aseConfiguration, requirement.value().aseConfiguration)) {
+        valid_direction_configurations = std::nullopt;
+        return;  // No way to match
+      }
+      // For exact match, we require this direction to have the same allocation.
+      // If stereo, need stereo.
+      // If mono, need mono (modified to the correct required allocation)
+      auto req_allocation_bitmask = getLeAudioAseConfigurationAllocationBitmask(
+          requirement.value().aseConfiguration);
+      int req_channel_count = getCountFromBitmask(req_allocation_bitmask);
+      int cfg_bitmask =
+          getLeAudioAseConfigurationAllocationBitmask(cfg.aseConfiguration);
+      int cfg_channel_count = getCountFromBitmask(cfg_bitmask);
+      if (req_channel_count <= 1) {
+        // MONO case, is a match if also mono, modify to the same allocation
+        if (cfg_channel_count > 1) {
+          valid_direction_configurations = std::nullopt;
+          return;  // Not a match
+        }
+        // Modify the bitmask to be the same as the requirement
+        for (auto& codec_cfg : cfg.aseConfiguration.codecConfiguration) {
+          if (codec_cfg.getTag() ==
+              CodecSpecificConfigurationLtv::Tag::audioChannelAllocation) {
+            codec_cfg
+                .get<CodecSpecificConfigurationLtv::Tag::
+                         audioChannelAllocation>()
+                .bitmask = req_allocation_bitmask;
+            break;
+          }
+        }
+      } else {
+        // STEREO case, is a match if same allocation
+        if (req_allocation_bitmask != cfg_bitmask) {
+          valid_direction_configurations = std::nullopt;
+          return;  // Not a match
         }
       }
-    } else {
-      // STEREO case, is a match if same allocation
-      if (req_allocation_bitmask != cfg_bitmask) {
+      // Push to list if valid
+      valid_direction_configurations.value().push_back(cfg);
+    }
+  } else {
+    // Loose matching process
+    for (auto& requirement : requirements) {
+      if (!requirement.has_value()) continue;
+      auto req_allocation_bitmask = getLeAudioAseConfigurationAllocationBitmask(
+          requirement.value().aseConfiguration);
+      auto req_channel_count = getCountFromBitmask(req_allocation_bitmask);
+
+      auto temp = std::vector<AseDirectionConfiguration>();
+
+      for (auto direction_configuration : direction_configurations.value()) {
+        if (!direction_configuration.has_value()) continue;
+        if (!filterMatchedAseConfiguration(
+                direction_configuration.value().aseConfiguration,
+                requirement.value().aseConfiguration))
+          continue;
+        // Valid if match any requirement.
+        temp.push_back(direction_configuration.value());
+      }
+
+      // Get the best matching config based on channel allocation
+      auto total_cfg_channel_count = 0;
+      auto req_valid_configs = getValidConfigurationsFromAllocation(
+          req_allocation_bitmask, temp, isExact);
+      // Count and check required channel counts
+      for (auto& cfg : req_valid_configs) {
+        total_cfg_channel_count += getCountFromBitmask(
+            getLeAudioAseConfigurationAllocationBitmask(cfg.aseConfiguration));
+        valid_direction_configurations.value().push_back(cfg);
+      }
+      if (total_cfg_channel_count != req_channel_count) {
         valid_direction_configurations = std::nullopt;
-        return;  // Not a match
+        return;
       }
     }
-    // Push to list if valid
-    valid_direction_configurations.value().push_back(cfg);
   }
 }
 
@@ -650,8 +689,8 @@
 std::optional<LeAudioAseConfigurationSetting>
 LeAudioOffloadAudioProvider::getRequirementMatchedAseConfigurationSettings(
     IBluetoothAudioProvider::LeAudioAseConfigurationSetting& setting,
-    const IBluetoothAudioProvider::LeAudioConfigurationRequirement&
-        requirement) {
+    const IBluetoothAudioProvider::LeAudioConfigurationRequirement& requirement,
+    bool isExact) {
   // Create a new LeAudioAseConfigurationSetting to return
   // Make context the same as the requirement
   LeAudioAseConfigurationSetting filtered_setting{
@@ -664,25 +703,27 @@
   // is the number of device.
 
   // The exact matching process is as follow:
-  // 1. Setting direction has the same number of cfg (ignore when null require)
+  // 1. Setting direction has the same number of cfg (ignore when null
+  // require)
   // 2. For each index, it's a 1-1 filter / mapping.
+  if (isExact) {
+    if (requirement.sinkAseRequirement.has_value() &&
+        requirement.sinkAseRequirement.value().size() !=
+            setting.sinkAseConfiguration.value().size()) {
+      return std::nullopt;
+    }
 
-  if (requirement.sinkAseRequirement.has_value() &&
-      requirement.sinkAseRequirement.value().size() !=
-          setting.sinkAseConfiguration.value().size()) {
-    return std::nullopt;
-  }
-
-  if (requirement.sourceAseRequirement.has_value() &&
-      requirement.sourceAseRequirement.value().size() !=
-          setting.sourceAseConfiguration.value().size()) {
-    return std::nullopt;
+    if (requirement.sourceAseRequirement.has_value() &&
+        requirement.sourceAseRequirement.value().size() !=
+            setting.sourceAseConfiguration.value().size()) {
+      return std::nullopt;
+    }
   }
 
   if (requirement.sinkAseRequirement.has_value()) {
     filterRequirementAseDirectionConfiguration(
         setting.sinkAseConfiguration, requirement.sinkAseRequirement.value(),
-        filtered_setting.sinkAseConfiguration);
+        filtered_setting.sinkAseConfiguration, isExact);
     if (!filtered_setting.sinkAseConfiguration.has_value()) {
       return std::nullopt;
     }
@@ -692,7 +733,7 @@
     filterRequirementAseDirectionConfiguration(
         setting.sourceAseConfiguration,
         requirement.sourceAseRequirement.value(),
-        filtered_setting.sourceAseConfiguration);
+        filtered_setting.sourceAseConfiguration, isExact);
     if (!filtered_setting.sourceAseConfiguration.has_value()) {
       return std::nullopt;
     }
@@ -706,9 +747,10 @@
     std::vector<IBluetoothAudioProvider::LeAudioAseConfigurationSetting>&
         matched_ase_configuration_settings,
     const IBluetoothAudioProvider::LeAudioConfigurationRequirement& requirement,
-    bool isMatchContext) {
+    bool isMatchContext, bool isExact) {
   LOG(INFO) << __func__ << ": Trying to match for the requirement "
-            << requirement.toString() << ", match context = " << isMatchContext;
+            << requirement.toString() << ", match context = " << isMatchContext
+            << ", match exact = " << isExact;
   for (auto& setting : matched_ase_configuration_settings) {
     // Try to match context in metadata.
     if (isMatchContext) {
@@ -720,7 +762,8 @@
     }
 
     auto filtered_ase_configuration_setting =
-        getRequirementMatchedAseConfigurationSettings(setting, requirement);
+        getRequirementMatchedAseConfigurationSettings(setting, requirement,
+                                                      isExact);
     if (filtered_ase_configuration_setting.has_value()) {
       LOG(INFO) << __func__ << ": Result found: "
                 << getSettingOutputString(
@@ -811,26 +854,30 @@
 
     // Matching priority list:
     // Preferred context - exact match with allocation
+    // Preferred context - loose match with allocation
     // Any context - exact match with allocation
-    auto matched_setting_with_context = matchWithRequirement(
-        matched_ase_configuration_settings, requirement, true);
-    if (matched_setting_with_context.has_value()) {
-      result.push_back(matched_setting_with_context.value());
-    } else {
-      auto matched_setting = matchWithRequirement(
-          matched_ase_configuration_settings, requirement, false);
-      if (matched_setting.has_value()) {
-        result.push_back(matched_setting.value());
-      } else {
-        // Cannot find a match for this requirement
-        // Immediately return
-        LOG(ERROR)
-            << __func__
-            << ": Cannot find any match for this requirement, exitting...";
-        result.clear();
-        *_aidl_return = result;
-        return ndk::ScopedAStatus::ok();
+    // Any context - loose match with allocation
+    bool found = false;
+    for (bool match_context : {true, false}) {
+      for (bool match_exact : {true, false}) {
+        auto matched_setting =
+            matchWithRequirement(matched_ase_configuration_settings,
+                                 requirement, match_context, match_exact);
+        if (matched_setting.has_value()) {
+          result.push_back(matched_setting.value());
+          found = true;
+          break;
+        }
       }
+      if (found) break;
+    }
+
+    if (!found) {
+      LOG(ERROR) << __func__
+                 << ": Cannot find any match for this requirement, exitting...";
+      result.clear();
+      *_aidl_return = result;
+      return ndk::ScopedAStatus::ok();
     }
   }
 
diff --git a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h
index 798f183..3a82b73 100644
--- a/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h
+++ b/bluetooth/audio/aidl/default/LeAudioOffloadAudioProvider.h
@@ -139,7 +139,8 @@
           direction_configurations,
       const std::vector<std::optional<AseDirectionRequirement>>& requirements,
       std::optional<std::vector<std::optional<AseDirectionConfiguration>>>&
-          valid_direction_configurations);
+          valid_direction_configurations,
+      bool isExact);
   std::optional<LeAudioAseConfigurationSetting>
   getCapabilitiesMatchedAseConfigurationSettings(
       IBluetoothAudioProvider::LeAudioAseConfigurationSetting& setting,
@@ -149,7 +150,8 @@
   getRequirementMatchedAseConfigurationSettings(
       IBluetoothAudioProvider::LeAudioAseConfigurationSetting& setting,
       const IBluetoothAudioProvider::LeAudioConfigurationRequirement&
-          requirement);
+          requirement,
+      bool isExact);
   bool isMatchedQosRequirement(LeAudioAseQosConfiguration setting_qos,
                                AseQosDirectionRequirement requirement_qos);
   std::optional<LeAudioBroadcastConfigurationSetting>
@@ -173,7 +175,7 @@
           matched_ase_configuration_settings,
       const IBluetoothAudioProvider::LeAudioConfigurationRequirement&
           requirements,
-      bool isMatchContext);
+      bool isMatchContext, bool isExact);
 };
 
 class LeAudioOffloadOutputAudioProvider : public LeAudioOffloadAudioProvider {
diff --git a/compatibility_matrices/compatibility_matrix.202504.xml b/compatibility_matrices/compatibility_matrix.202504.xml
index 41ac390..8d5a50a 100644
--- a/compatibility_matrices/compatibility_matrix.202504.xml
+++ b/compatibility_matrices/compatibility_matrix.202504.xml
@@ -543,7 +543,7 @@
     </hal>
     <hal format="aidl">
         <name>android.hardware.sensors</name>
-        <version>2</version>
+        <version>2-3</version>
         <interface>
             <name>ISensors</name>
             <instance>default</instance>
diff --git a/compatibility_matrices/exclude/fcm_exclude.cpp b/compatibility_matrices/exclude/fcm_exclude.cpp
index 4995a72..57e039c 100644
--- a/compatibility_matrices/exclude/fcm_exclude.cpp
+++ b/compatibility_matrices/exclude/fcm_exclude.cpp
@@ -171,6 +171,7 @@
             "android.hardware.audio.core.sounddose@3",
             // This is only used by a trusty VM
             "android.hardware.security.see.authmgr@1",
+            "android.hardware.security.see.hdcp@1",
 
             // Deprecated HALs.
             "android.hardware.audio.sounddose@3",
diff --git a/drm/Android.bp b/drm/Android.bp
new file mode 100644
index 0000000..35c1b03
--- /dev/null
+++ b/drm/Android.bp
@@ -0,0 +1,5 @@
+dirgroup {
+    name: "trusty_dirgroup_hardware_interfaces_drm",
+    dirs: ["."],
+    visibility: ["//trusty/vendor/google/aosp/scripts"],
+}
diff --git a/drm/aidl/Android.bp b/drm/aidl/Android.bp
index 827621c..7ee8c34 100644
--- a/drm/aidl/Android.bp
+++ b/drm/aidl/Android.bp
@@ -27,6 +27,9 @@
         ndk: {
             min_sdk_version: "34",
         },
+        rust: {
+            enabled: true,
+        },
     },
     double_loadable: true,
     versions_with_info: [
diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl
index 548a793..d993040 100644
--- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl
+++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/HealthInfo.aidl
@@ -60,6 +60,6 @@
   android.hardware.health.BatteryChargingState chargingState;
   android.hardware.health.BatteryChargingPolicy chargingPolicy;
   @nullable android.hardware.health.BatteryHealthData batteryHealthData;
-  @nullable android.hardware.health.HingeInfo[] foldInfos;
+  @nullable android.hardware.health.HingeInfo[] hingeInfos;
   const int BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = (-1) /* -1 */;
 }
diff --git a/health/aidl/android/hardware/health/HealthInfo.aidl b/health/aidl/android/hardware/health/HealthInfo.aidl
index 12a397a..1c953ee 100644
--- a/health/aidl/android/hardware/health/HealthInfo.aidl
+++ b/health/aidl/android/hardware/health/HealthInfo.aidl
@@ -151,5 +151,5 @@
     /**
      * Information about foldable hinge health. Will be an empty vector if no hinges present
      */
-    @nullable HingeInfo[] foldInfos;
+    @nullable HingeInfo[] hingeInfos;
 }
diff --git a/health/aidl/android/hardware/health/HingeInfo.aidl b/health/aidl/android/hardware/health/HingeInfo.aidl
index 19b46df..ad38821 100644
--- a/health/aidl/android/hardware/health/HingeInfo.aidl
+++ b/health/aidl/android/hardware/health/HingeInfo.aidl
@@ -27,7 +27,9 @@
     /**
      * returns count of times a given hinge has been folded.
      *
-     * opening fully counts as 1 fold and closing fully counts as another
+     * opening fully counts as 1 fold and closing fully counts as another.
+     * The hinge has to engage in its full range of motion to be considered
+     * a fold. Partial folds must not be counted.
      */
     int numTimesFolded;
     /**
diff --git a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp
index c47ddca..a44cd5e 100644
--- a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp
+++ b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp
@@ -368,7 +368,8 @@
     ASSERT_THAT(status, AnyOf(IsOk(), ExceptionIs(EX_UNSUPPORTED_OPERATION)));
     if (!status.isOk()) return;
     for (auto& hinge : value) {
-        ASSERT_TRUE(hinge.expectedHingeLifespan > 0);
+        ASSERT_TRUE(hinge.expectedHingeLifespan >= 0);
+        ASSERT_TRUE(hinge.numTimesFolded >= 0);
     }
 }
 
diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfig.aidl
index bba6bdd..ded4835 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfig.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfig.aidl
@@ -53,4 +53,6 @@
   oneway void setResponseFunctions(in android.hardware.radio.config.IRadioConfigResponse radioConfigResponse, in android.hardware.radio.config.IRadioConfigIndication radioConfigIndication);
   oneway void setSimSlotsMapping(in int serial, in android.hardware.radio.config.SlotPortMapping[] slotMap);
   oneway void getSimultaneousCallingSupport(in int serial);
+  oneway void getSimTypeInfo(in int serial);
+  oneway void setSimType(in int serial, in android.hardware.radio.config.SimType[] simTypes);
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfigResponse.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfigResponse.aidl
index 6ff7bd0..4e0e133 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfigResponse.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/IRadioConfigResponse.aidl
@@ -43,4 +43,6 @@
   oneway void setPreferredDataModemResponse(in android.hardware.radio.RadioResponseInfo info);
   oneway void setSimSlotsMappingResponse(in android.hardware.radio.RadioResponseInfo info);
   oneway void getSimultaneousCallingSupportResponse(in android.hardware.radio.RadioResponseInfo info, in int[] enabledLogicalSlots);
+  oneway void getSimTypeInfoResponse(in android.hardware.radio.RadioResponseInfo info, in android.hardware.radio.config.SimTypeInfo[] simTypeInfo);
+  oneway void setSimTypeResponse(in android.hardware.radio.RadioResponseInfo info);
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimType.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimType.aidl
new file mode 100644
index 0000000..b27c86f
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimType.aidl
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.config;
+/* @hide */
+@Backing(type="int") @JavaDerive(toString=true) @VintfStability
+enum SimType {
+  UNKNOWN = 0,
+  PHYSICAL = (1 << 0) /* 1 */,
+  ESIM = (1 << 1) /* 2 */,
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimTypeInfo.aidl b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimTypeInfo.aidl
new file mode 100644
index 0000000..cba5dd9
--- /dev/null
+++ b/radio/aidl/aidl_api/android.hardware.radio.config/current/android/hardware/radio/config/SimTypeInfo.aidl
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.radio.config;
+/* @hide */
+@JavaDerive(toString=true) @VintfStability
+parcelable SimTypeInfo {
+  android.hardware.radio.config.SimType currentSimType = android.hardware.radio.config.SimType.UNKNOWN;
+  int supportedSimTypes;
+}
diff --git a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl
index 17d3fda..1f8cbdc 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.data/current/android/hardware/radio/data/DataCallFailCause.aidl
@@ -169,6 +169,9 @@
   MAX_PPP_INACTIVITY_TIMER_EXPIRED = 0x7FE,
   IPV6_ADDRESS_TRANSFER_FAILED = 0x7FF,
   TRAT_SWAP_FAILED = 0x800,
+  /**
+   * @deprecated Legacy CDMA is unsupported.
+   */
   EHRPD_TO_HRPD_FALLBACK = 0x801,
   MIP_CONFIG_FAILURE = 0x802,
   PDN_INACTIVITY_TIMER_EXPIRED = 0x803,
diff --git a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ResetNvType.aidl b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ResetNvType.aidl
index e9937f0..33c0d70 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ResetNvType.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.modem/current/android/hardware/radio/modem/ResetNvType.aidl
@@ -36,6 +36,12 @@
 @Backing(type="int") @JavaDerive(toString=true) @SuppressWarnings(value={"redundant-name"}) @VintfStability
 enum ResetNvType {
   RELOAD,
+  /**
+   * @deprecated NV APIs are deprecated starting from Android U.
+   */
   ERASE,
+  /**
+   * @deprecated NV APIs are deprecated starting from Android U.
+   */
   FACTORY_RESET,
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl
index 4276cb8..471916f 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioAccessFamily.aidl
@@ -39,7 +39,13 @@
   GPRS = (1 << android.hardware.radio.RadioTechnology.GPRS) /* 2 */,
   EDGE = (1 << android.hardware.radio.RadioTechnology.EDGE) /* 4 */,
   UMTS = (1 << android.hardware.radio.RadioTechnology.UMTS) /* 8 */,
+  /**
+   * @deprecated Legacy CDMA is unsupported.
+   */
   IS95A = (1 << android.hardware.radio.RadioTechnology.IS95A) /* 16 */,
+  /**
+   * @deprecated Legacy CDMA is unsupported.
+   */
   IS95B = (1 << android.hardware.radio.RadioTechnology.IS95B) /* 32 */,
   /**
    * @deprecated Legacy CDMA is unsupported.
@@ -60,6 +66,9 @@
    * @deprecated Legacy CDMA is unsupported.
    */
   EVDO_B = (1 << android.hardware.radio.RadioTechnology.EVDO_B) /* 4096 */,
+  /**
+   * @deprecated Legacy CDMA is unsupported.
+   */
   EHRPD = (1 << android.hardware.radio.RadioTechnology.EHRPD) /* 8192 */,
   LTE = (1 << android.hardware.radio.RadioTechnology.LTE) /* 16384 */,
   HSPAP = (1 << android.hardware.radio.RadioTechnology.HSPAP) /* 32768 */,
diff --git a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl
index ede020d..201e694 100644
--- a/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio/current/android/hardware/radio/RadioTechnology.aidl
@@ -39,7 +39,13 @@
   GPRS,
   EDGE,
   UMTS,
+  /**
+   * @deprecated Legacy CDMA is unsupported.
+   */
   IS95A,
+  /**
+   * @deprecated Legacy CDMA is unsupported.
+   */
   IS95B,
   /**
    * @deprecated Legacy CDMA is unsupported.
@@ -60,6 +66,9 @@
    * @deprecated Legacy CDMA is unsupported.
    */
   EVDO_B,
+  /**
+   * @deprecated Legacy CDMA is unsupported.
+   */
   EHRPD,
   LTE,
   HSPAP,
diff --git a/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl b/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl
index c728d85..8c10bb9 100644
--- a/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl
+++ b/radio/aidl/android/hardware/radio/RadioAccessFamily.aidl
@@ -27,7 +27,9 @@
     GPRS = 1 << RadioTechnology.GPRS,
     EDGE = 1 << RadioTechnology.EDGE,
     UMTS = 1 << RadioTechnology.UMTS,
+    /** @deprecated Legacy CDMA is unsupported. */
     IS95A = 1 << RadioTechnology.IS95A,
+    /** @deprecated Legacy CDMA is unsupported. */
     IS95B = 1 << RadioTechnology.IS95B,
     /** @deprecated Legacy CDMA is unsupported. */
     ONE_X_RTT = 1 << RadioTechnology.ONE_X_RTT,
@@ -40,6 +42,7 @@
     HSPA = 1 << RadioTechnology.HSPA,
     /** @deprecated Legacy CDMA is unsupported. */
     EVDO_B = 1 << RadioTechnology.EVDO_B,
+    /** @deprecated Legacy CDMA is unsupported. */
     EHRPD = 1 << RadioTechnology.EHRPD,
     LTE = 1 << RadioTechnology.LTE,
     HSPAP = 1 << RadioTechnology.HSPAP,
diff --git a/radio/aidl/android/hardware/radio/RadioTechnology.aidl b/radio/aidl/android/hardware/radio/RadioTechnology.aidl
index d6e5cd8..843bfd0 100644
--- a/radio/aidl/android/hardware/radio/RadioTechnology.aidl
+++ b/radio/aidl/android/hardware/radio/RadioTechnology.aidl
@@ -25,7 +25,9 @@
     GPRS,
     EDGE,
     UMTS,
+    /** @deprecated Legacy CDMA is unsupported. */
     IS95A,
+    /** @deprecated Legacy CDMA is unsupported. */
     IS95B,
     /** @deprecated Legacy CDMA is unsupported. */
     ONE_X_RTT,
@@ -38,6 +40,7 @@
     HSPA,
     /** @deprecated Legacy CDMA is unsupported. */
     EVDO_B,
+    /** @deprecated Legacy CDMA is unsupported. */
     EHRPD,
     LTE,
     /**
diff --git a/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl b/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl
index 936315c..e819fe0 100644
--- a/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl
+++ b/radio/aidl/android/hardware/radio/config/IRadioConfig.aidl
@@ -27,6 +27,7 @@
 
 import android.hardware.radio.config.IRadioConfigIndication;
 import android.hardware.radio.config.IRadioConfigResponse;
+import android.hardware.radio.config.SimType;
 import android.hardware.radio.config.SlotPortMapping;
 
 /** @hide */
@@ -208,4 +209,39 @@
      * This is available when android.hardware.telephony is defined.
      */
     void getSimultaneousCallingSupport(in int serial);
+
+    /**
+     * Get the sim type information.
+     *
+     * Response provides the current active sim type and supported sim types associated with each
+     * active physical slot ids.
+     *
+     * @param serial Serial number of request.
+     *
+     * Response callback is IRadioConfigResponse.getSimTypeInfoResponse()
+     *
+     * This is available when android.hardware.telephony.subscription is defined.
+     */
+    void getSimTypeInfo(in int serial);
+
+    /**
+     * Set the sim type associated with the physical slot id and activate if the sim type is
+     * currently inactive.
+     *
+     * Example: There are 2 active physical slot ids and 3 physical sims(2 pSIM and 1 eSIM). First
+     * physical slot id is always linked pSIM and 2nd physical slot id supports either pSIM/eSIM one
+     * at a time. In order to activate eSIM on 2nd physical slot id, caller should pass
+     * corresponding sim type.
+     *
+     * simTypes[0] = pSIM
+     * simTypes[1] = eSIM
+     *
+     * @param serial Serial number of request.
+     * @param simTypes SimType to be activated on each logical slot
+     *
+     * Response callback is IRadioConfigResponse.setSimTypeResponse()
+     *
+     * This is available when android.hardware.telephony.subscription is defined.
+     */
+    void setSimType(in int serial, in SimType[] simTypes);
 }
diff --git a/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl b/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl
index 8182cd1..d526c51 100644
--- a/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl
+++ b/radio/aidl/android/hardware/radio/config/IRadioConfigResponse.aidl
@@ -18,6 +18,7 @@
 
 import android.hardware.radio.config.PhoneCapability;
 import android.hardware.radio.config.SimSlotStatus;
+import android.hardware.radio.config.SimTypeInfo;
 
 /**
  * Interface declaring response functions to solicited radio config requests.
@@ -152,4 +153,40 @@
      */
     void getSimultaneousCallingSupportResponse(
             in android.hardware.radio.RadioResponseInfo info, in int[] enabledLogicalSlots);
+
+    /**
+     * Response to the asynchronous {@link IRadioConfig#getSimTypeInfo} request.
+     *
+     * @param info Response info struct containing response type, serial number and error
+     * @param simTypeInfos Currently active and supported sim types associated with active
+     * physical slot ids.
+     *
+     * Valid errors returned:
+     *   RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not
+     *                                    defined
+     *   RadioError:NONE
+     *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:NO_MEMORY
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:MODEM_ERR
+     */
+    void getSimTypeInfoResponse(
+            in android.hardware.radio.RadioResponseInfo info, in SimTypeInfo[] simTypeInfo);
+
+    /**
+     * Response to the asynchronous {@link IRadioConfig#setSimType} request.
+     *
+     * @param info Response info struct containing response type, serial number and error
+     *
+     * Valid errors returned:
+     *   RadioError:REQUEST_NOT_SUPPORTED when android.hardware.telephony.subscription is not
+     *                                    defined
+     *   RadioError:NONE
+     *   RadioError:RADIO_NOT_AVAILABLE
+     *   RadioError:NO_MEMORY
+     *   RadioError:INTERNAL_ERR
+     *   RadioError:INVALID_ARGUMENTS
+     *   RadioError:MODEM_ERR
+     */
+    void setSimTypeResponse(in android.hardware.radio.RadioResponseInfo info);
 }
diff --git a/radio/aidl/android/hardware/radio/config/SimType.aidl b/radio/aidl/android/hardware/radio/config/SimType.aidl
new file mode 100644
index 0000000..fc9915e
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/config/SimType.aidl
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2024 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.radio.config;
+
+/** @hide */
+@VintfStability
+@Backing(type="int")
+@JavaDerive(toString=true)
+enum SimType {
+    /**
+     * Unknown
+     **/
+    UNKNOWN = 0,
+    /**
+     * Physical SIM (can be eUICC capable)
+     **/
+    PHYSICAL = 1 << 0,
+    /**
+     * Embedded SIM
+     **/
+    ESIM = 1 << 1,
+}
diff --git a/radio/aidl/android/hardware/radio/config/SimTypeInfo.aidl b/radio/aidl/android/hardware/radio/config/SimTypeInfo.aidl
new file mode 100644
index 0000000..0534626
--- /dev/null
+++ b/radio/aidl/android/hardware/radio/config/SimTypeInfo.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2024 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.radio.config;
+
+import android.hardware.radio.config.SimType;
+
+/** @hide */
+@VintfStability
+@JavaDerive(toString=true)
+parcelable SimTypeInfo {
+    /**
+     * Current SimType on the physical slot id.
+     **/
+    SimType currentSimType = SimType.UNKNOWN;
+    /**
+     * Bitmask of the sim types supported by the physical slot id. Physical slot can support more
+     * than one SimType.
+     * Example:
+     * if the physical slot id supports either pSIM/eSIM and currently pSIM is active,
+     * currentSimType will be SimType::PHYSICAL and supportedSimTypes will be
+     * SimType::PHYSICAL | SimType::ESIM.
+     **/
+    int supportedSimTypes;
+}
diff --git a/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl
index 5ae057a..592fde6 100644
--- a/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl
+++ b/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl
@@ -421,6 +421,7 @@
     TRAT_SWAP_FAILED = 0x800,
     /**
      * Device falls back from eHRPD to HRPD.
+     * @deprecated Legacy CDMA is unsupported.
      */
     EHRPD_TO_HRPD_FALLBACK = 0x801,
     /**
diff --git a/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl b/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl
index 491657c..15a833e 100644
--- a/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl
+++ b/radio/aidl/android/hardware/radio/modem/IRadioModem.aidl
@@ -139,12 +139,13 @@
     void nvReadItem(in int serial, in NvItem itemId);
 
     /**
-     * Reset the radio NV configuration.
+     * Reboots modem.
      *
-     * This is also used to reboot the modem with ResetNvType.RELOAD.
+     * This was historically used to reset NV configuration, but starting from Android U, NV APIs
+     * are deprecated.
      *
      * @param serial Serial number of request.
-     * @param resetType Type of reset operation
+     * @param resetType Always ResetNvType.RELOAD.
      *
      * Response function is IRadioModemResponse.nvResetConfigResponse()
      */
diff --git a/radio/aidl/android/hardware/radio/modem/ResetNvType.aidl b/radio/aidl/android/hardware/radio/modem/ResetNvType.aidl
index 71736d8..95fa0d7 100644
--- a/radio/aidl/android/hardware/radio/modem/ResetNvType.aidl
+++ b/radio/aidl/android/hardware/radio/modem/ResetNvType.aidl
@@ -25,15 +25,21 @@
 @SuppressWarnings(value={"redundant-name"})
 enum ResetNvType {
     /**
-     * Reload all NV items. This may reboot modem.
+     * Reboot modem.
+     *
+     * Historically, this has been also reloading all NV items.
      */
     RELOAD,
     /**
      * Erase NV reset (SCRTN)
+     *
+     * @deprecated NV APIs are deprecated starting from Android U.
      */
     ERASE,
     /**
      * Factory reset (RTN)
+     *
+     * @deprecated NV APIs are deprecated starting from Android U.
      */
     FACTORY_RESET,
 }
diff --git a/radio/aidl/compat/libradiocompat/config/RadioConfig.cpp b/radio/aidl/compat/libradiocompat/config/RadioConfig.cpp
index 837c626..3834ecc 100644
--- a/radio/aidl/compat/libradiocompat/config/RadioConfig.cpp
+++ b/radio/aidl/compat/libradiocompat/config/RadioConfig.cpp
@@ -109,4 +109,19 @@
     return ok();
 }
 
+ScopedAStatus RadioConfig::getSimTypeInfo(int32_t serial) {
+    LOG_CALL << serial;
+    LOG(ERROR) << " getSimTypeInfo is unsupported by HIDL HALs";
+    respond()->getSimTypeInfoResponse(notSupported(serial), {});
+    return ok();
+}
+
+ScopedAStatus RadioConfig::setSimType(
+        int32_t serial, const std::vector<aidl::SimType>& /*simTypes*/) {
+    LOG_CALL << serial;
+    LOG(ERROR) << " setSimType is unsupported by HIDL HALs";
+    respond()->setSimTypeResponse(notSupported(serial));
+    return ok();
+}
+
 }  // namespace android::hardware::radio::compat
diff --git a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioConfig.h b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioConfig.h
index 17d5985..a1e48dc 100644
--- a/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioConfig.h
+++ b/radio/aidl/compat/libradiocompat/include/libradiocompat/RadioConfig.h
@@ -55,7 +55,11 @@
             int32_t serial,
             const std::vector<aidl::android::hardware::radio::config::SlotPortMapping>& slotMap)
             override;
-
+    ::ndk::ScopedAStatus getSimTypeInfo(int32_t serial) override;
+    ::ndk::ScopedAStatus setSimType(
+            int32_t serial,
+            const std::vector<aidl::android::hardware::radio::config::SimType>& simTypes)
+            override;
   protected:
     std::shared_ptr<::aidl::android::hardware::radio::config::IRadioConfigResponse> respond();
 
diff --git a/radio/aidl/vts/radio_config_response.cpp b/radio/aidl/vts/radio_config_response.cpp
index c532440..49439fa 100644
--- a/radio/aidl/vts/radio_config_response.cpp
+++ b/radio/aidl/vts/radio_config_response.cpp
@@ -75,3 +75,17 @@
     parent_config.notify(info.serial);
     return ndk::ScopedAStatus::ok();
 }
+
+ndk::ScopedAStatus RadioConfigResponse::getSimTypeInfoResponse(const RadioResponseInfo& info,
+        const std::vector<SimTypeInfo>& /* simTypeInfo */) {
+    rspInfo = info;
+    parent_config.notify(info.serial);
+    return ndk::ScopedAStatus::ok();
+}
+
+ndk::ScopedAStatus RadioConfigResponse::setSimTypeResponse(const RadioResponseInfo& info) {
+    rspInfo = info;
+    parent_config.notify(info.serial);
+    return ndk::ScopedAStatus::ok();
+}
+
diff --git a/radio/aidl/vts/radio_config_utils.h b/radio/aidl/vts/radio_config_utils.h
index 84c74fc..cdcc1bc 100644
--- a/radio/aidl/vts/radio_config_utils.h
+++ b/radio/aidl/vts/radio_config_utils.h
@@ -62,6 +62,11 @@
 
     virtual ndk::ScopedAStatus getHalDeviceCapabilitiesResponse(
             const RadioResponseInfo& info, bool modemReducedFeatureSet1) override;
+
+    virtual ndk::ScopedAStatus getSimTypeInfoResponse(
+            const RadioResponseInfo& info, const std::vector<SimTypeInfo>& simTypeInfo) override;
+
+    virtual ndk::ScopedAStatus setSimTypeResponse(const RadioResponseInfo& info) override;
 };
 
 /* Callback class for radio config indication */
diff --git a/security/see/hdcp/README.md b/security/see/hdcp/README.md
new file mode 100644
index 0000000..76b8670
--- /dev/null
+++ b/security/see/hdcp/README.md
@@ -0,0 +1,65 @@
+# IHDCPAuthControl as a Trusted HAL service
+
+IHDCPAuthControl is expected to be a service implemented in a TEE.
+We provide a default reference implementation and its integration in Trusty
+as an example.
+
+The VTS test for a Trusted HAL service ought to run in the VM.
+We provide an integration of the VTS test in a Trusty VM,
+and later in a Microdroid VM (b/380632474).
+
+This interface shall not be exposed to the host and thus shall be part of
+the list of excluded interfaces from
+[compatibility_matrices/exclude/fcm_exclude.cpp](../../../compatibility_matrices/exclude/fcm_exclude.cpp)
+
+## 1. Mock Implementation
+
+The mock implementation under default/src/lib.rs is expected to be integrated in a
+TEE. For AOSP testing we offer two virtual device testing options:
+
+- Cuttlefish AVD, where the reference implementation is integrated in an AVF VM, emulating a TEE.
+- Trusty QEMU AVD, where the reference implementation is integrated in a Trusty TEE image (executed in secure world)
+
+### 1.1. Cuttlefish: Integrate in an AVF HAL pVM (Trusty)
+
+In Cuttlefish, we emulate a TEE with an AVF Trusty pVM.
+The VM2TZ IPC is emulated with a vsock port forward utility (b/379582767).
+
+Until vsock port forwarding is supported, the trusty_test_vm is used temporarily.
+(VTS tests and HAL implementation will be in same pVM).
+
+TODO: complete when trusty_hal_vm is created
+
+In order to add the mock HdcpAuthControlService to the trusty_test_vm, make sure
+that `hardware/interfaces/security/see/hdcp/default` is added to the
+trusty_test_vm makefile, by adding it to
+[trusty/device/x86/generic-x86_64/project/generic-x86_64-inc.mk](../../../../../trusty/device/x86/generic-x86_64/project/generic-x86_64-inc.mk)
+
+### 1.2. Trusty QEMU AVD: Integrate as a TA in Trusty TEE
+
+In order to add the mock HdcpAuthControlService to the Trusty TEE, make sure
+that `hardware/interfaces/security/see/hdcp/default` is added to
+[trusty/device/arm/generic-arm64/project/generic-arm-inc.mk](../../../../../trusty/device/arm/generic-arm64/project/generic-arm-inc.mk)
+
+
+## 2. VTS Tests
+
+IHdcpAuthControl service is expected to only be exposed to AVF pVM.
+
+The VTS tests shall verify:
+
+- IHdcpAuthControl cannot be accessed from the Android Host:
+
+   see [aidl/vts/src/host_test.rs](aidl/vts/host_test.rs)
+
+- IHdcpAuthControl can be accessed from an AVF pVM:
+
+   see [aidl/vts/src/vm_test.rs](aidl/vts/src/vm_test.rs)
+   see [aidl/vts/AndroidTest.xml](aidl/vts/AndroidTest.xml)
+
+
+To integrate the VTS test in the trusty_test_vm:
+
+1.
+1. add the test to [hardware/interfaces/security/see/usertests-rust-inc.mk](../usertests-rust-inc.mk)
+
diff --git a/security/see/hdcp/aidl/Android.bp b/security/see/hdcp/aidl/Android.bp
new file mode 100644
index 0000000..ad1db37
--- /dev/null
+++ b/security/see/hdcp/aidl/Android.bp
@@ -0,0 +1,57 @@
+// Copyright (C) 2024 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 {
+    default_team: "trendy_team_trusty",
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+aidl_interface {
+    name: "android.hardware.security.see.hdcp",
+    vendor_available: true,
+    srcs: ["android/hardware/security/see/hdcp/*.aidl"],
+    imports: [
+        "android.hardware.drm.common-V1",
+    ],
+    stability: "vintf",
+    frozen: false,
+    backend: {
+        java: {
+            enabled: false,
+        },
+        cpp: {
+            enabled: false,
+        },
+        ndk: {
+            min_sdk_version: "34",
+        },
+        rust: {
+            enabled: true,
+            gen_mockall: true,
+            additional_rustlibs: [
+                "libmockall",
+            ],
+        },
+    },
+}
+
+// A rust_defaults that includes the latest hdcp AIDL library.
+// Modules that depend on hdcp directly can include this rust_defaults to avoid
+// managing dependency versions explicitly.
+rust_defaults {
+    name: "hdcp_use_latest_hal_aidl_rust",
+    rustlibs: [
+        "android.hardware.security.see.hdcp-V1-rust",
+    ],
+}
diff --git a/security/see/hdcp/aidl/aidl_api/android.hardware.security.see.hdcp/current/android/hardware/security/see/hdcp/IHdcpAuthControl.aidl b/security/see/hdcp/aidl/aidl_api/android.hardware.security.see.hdcp/current/android/hardware/security/see/hdcp/IHdcpAuthControl.aidl
new file mode 100644
index 0000000..b73d554
--- /dev/null
+++ b/security/see/hdcp/aidl/aidl_api/android.hardware.security.see.hdcp/current/android/hardware/security/see/hdcp/IHdcpAuthControl.aidl
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2024 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package android.hardware.security.see.hdcp;
+@VintfStability
+interface IHdcpAuthControl {
+  android.hardware.drm.HdcpLevels getHdcpLevels();
+  void trySetHdcpLevel(in android.hardware.drm.HdcpLevel level);
+  android.hardware.security.see.hdcp.IHdcpAuthControl.PendingHdcpLevelResult getPendingHdcpLevel();
+  parcelable HalErrorCode {
+    const int NO_ERROR = 0;
+    const int GENERIC_ERROR = (-1) /* -1 */;
+    const int BAD_STATE = (-2) /* -2 */;
+    const int UNSUPPORTED = (-3) /* -3 */;
+    const int SERIALIZATION_ERROR = (-4) /* -4 */;
+    const int ALLOCATION_ERROR = (-5) /* -5 */;
+    const int BAD_PARAMETER = (-7) /* -7 */;
+    const int UNAUTHORIZED = (-8) /* -8 */;
+  }
+  parcelable PendingHdcpLevelResult {
+    android.hardware.security.see.hdcp.IHdcpAuthControl.PendingHdcpLevelResult.Status status;
+    android.hardware.drm.HdcpLevel level;
+    enum Status {
+      NONE,
+      PENDING,
+    }
+  }
+}
diff --git a/security/see/hdcp/aidl/android/hardware/security/see/hdcp/IHdcpAuthControl.aidl b/security/see/hdcp/aidl/android/hardware/security/see/hdcp/IHdcpAuthControl.aidl
new file mode 100644
index 0000000..b9a1fe5
--- /dev/null
+++ b/security/see/hdcp/aidl/android/hardware/security/see/hdcp/IHdcpAuthControl.aidl
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2024 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.security.see.hdcp;
+
+/**
+ * IHdcpAuthControl is used by the OEMCrypto Trusted Application to interact
+ * with a HDCP Encryption Trusted Application in order to control the
+ * HDCP Authentication Levels.
+ */
+@VintfStability
+interface IHdcpAuthControl {
+    /*
+     * Service error codes. Will be returned as service specific errors.
+     */
+    parcelable HalErrorCode {
+        /* Success */
+        const int NO_ERROR = 0;
+
+        /* Generic error */
+        const int GENERIC_ERROR = -1;
+
+        /* Desired operation cannot be performed because of the server current state */
+        const int BAD_STATE = -2;
+
+        /* Operation or parameters are not supported by the server */
+        const int UNSUPPORTED = -3;
+
+        /* Error encountered when parsing parameters */
+        const int SERIALIZATION_ERROR = -4;
+
+        /* Server ran out of memory when performing operation */
+        const int ALLOCATION_ERROR = -5;
+
+        /* Bad parameter supplied for the desired operation */
+        const int BAD_PARAMETER = -7;
+
+        /* Caller is not authorized to make this call */
+        const int UNAUTHORIZED = -8;
+    }
+    /**
+     * Result returned from the getPendingHdcpLevelResult API.
+     */
+    parcelable PendingHdcpLevelResult {
+        enum Status {
+            /**
+             * No pending HdcpLevel request
+             */
+            NONE,
+            /**
+             * a HdcpLevel request is pending, its level is provided in the
+             * |level| attribute
+             */
+            PENDING,
+        }
+        Status status;
+        android.hardware.drm.HdcpLevel level;
+    }
+
+    /**
+     * Return the currently negotiated and max supported HDCP levels.
+     *
+     * The current level is based on the display(s) the device is connected to.
+     * If multiple HDCP-capable displays are simultaneously connected to
+     * separate interfaces, this method returns the lowest negotiated HDCP level
+     * of all interfaces.
+     *
+     * The maximum HDCP level is the highest level that can potentially be
+     * negotiated. It is a constant for any device, i.e. it does not depend on
+     * downstream receiving devices that could be connected. For example, if
+     * the device has HDCP 1.x keys and is capable of negotiating HDCP 1.x, but
+     * does not have HDCP 2.x keys, then the maximum HDCP capability would be
+     * reported as 1.x. If multiple HDCP-capable interfaces are present, it
+     * indicates the highest of the maximum HDCP levels of all interfaces.
+     *
+     * This method should only be used for informational purposes, not for
+     * enforcing compliance with HDCP requirements. Trusted enforcement of HDCP
+     * policies must be handled by the DRM system.
+     *
+     * @return HdcpLevels parcelable
+     */
+    android.hardware.drm.HdcpLevels getHdcpLevels();
+
+    /**
+     * Attempts to set the device's HDCP auth level to |level|.
+     *
+     * @param level: desired HDCP level
+     *
+     * @return:
+     *     a service specific error based on <code>HalErrorCode</code>,
+     *     specifically:
+     *       + BAD_PARAMETER: when HDCP_UNKNOWN is requested
+     *       + UNSUPPORTED: when |level| is greater than the MaxLevel supported
+     *       + BAD_STATE: when the HDCP's service currentLevel is HDCP_NO_OUTPUT
+     *
+     */
+    void trySetHdcpLevel(in android.hardware.drm.HdcpLevel level);
+
+    /**
+     * Retrieve the pending level currently being processed by the HDCP service.
+     * The pending HDCP protection level might be higher than the level initially
+     * requested. This can occur when multiple applications or services are
+     * using HDCP concurrently, and a higher level is needed to satisfy
+     * all requirements.
+     *
+     * @return:
+     *      PendingHdcpLevelResult on success, which contains a status
+     *      and an optional level; on error a service specific error based on
+     *      <code>HalErrorCode</code> otherwise.
+     *
+     */
+    PendingHdcpLevelResult getPendingHdcpLevel();
+}
diff --git a/security/see/hdcp/aidl/trusty/drm/rust/rules.mk b/security/see/hdcp/aidl/trusty/drm/rust/rules.mk
new file mode 100644
index 0000000..742b6ab
--- /dev/null
+++ b/security/see/hdcp/aidl/trusty/drm/rust/rules.mk
@@ -0,0 +1,39 @@
+# Copyright (C) 2024 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.
+#
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+AIDL_DIR := hardware/interfaces/drm/aidl
+
+MODULE_AIDL_FLAGS := \
+	--stability=vintf \
+	--version=1 \
+
+MODULE_CRATE_NAME := android_hardware_drm
+
+MODULE_AIDL_LANGUAGE := rust
+
+MODULE_AIDL_PACKAGE := android/hardware/drm
+
+MODULE_AIDL_INCLUDES := \
+	-I $(AIDL_DIR) \
+
+MODULE_AIDLS := \
+    $(AIDL_DIR)/$(MODULE_AIDL_PACKAGE)/HdcpLevel.aidl   \
+    $(AIDL_DIR)/$(MODULE_AIDL_PACKAGE)/HdcpLevels.aidl   \
+
+include make/aidl.mk
diff --git a/security/see/hdcp/aidl/trusty/hdcp/rust/rules.mk b/security/see/hdcp/aidl/trusty/hdcp/rust/rules.mk
new file mode 100644
index 0000000..beab655
--- /dev/null
+++ b/security/see/hdcp/aidl/trusty/hdcp/rust/rules.mk
@@ -0,0 +1,47 @@
+# Copyright (C) 2024 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.
+#
+
+LOCAL_DIR := $(GET_LOCAL_DIR)
+
+MODULE := $(LOCAL_DIR)
+
+AIDL_DIR := hardware/interfaces/security/see/hdcp/aidl
+DRM_AIDL_DIR := hardware/interfaces/drm/aidl
+
+MODULE_AIDL_FLAGS := \
+	--mockall \
+	--version=1 \
+
+MODULE_CRATE_NAME := android_hardware_security_see_hdcp
+
+MODULE_AIDL_LANGUAGE := rust
+
+MODULE_AIDL_PACKAGE := android/hardware/security/see/hdcp
+
+MODULE_AIDL_INCLUDES := \
+	-I $(AIDL_DIR) \
+	-I $(DRM_AIDL_DIR) \
+
+MODULE_AIDLS := \
+    $(AIDL_DIR)/$(MODULE_AIDL_PACKAGE)/IHdcpAuthControl.aidl   \
+
+MODULE_AIDL_RUST_DEPS := \
+	android_hardware_drm
+
+MODULE_LIBRARY_DEPS := \
+	hardware/interfaces/security/see/hdcp/aidl/trusty/drm/rust \
+	$(call FIND_CRATE,mockall) \
+
+include make/aidl.mk
diff --git a/security/see/hdcp/aidl/vts/Android.bp b/security/see/hdcp/aidl/vts/Android.bp
new file mode 100644
index 0000000..eadb9cd
--- /dev/null
+++ b/security/see/hdcp/aidl/vts/Android.bp
@@ -0,0 +1,36 @@
+// Copyright (C) 2024 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package {
+    // See: http://go/android-license-faq
+    // A large-scale-change added 'default_applicable_licenses' to import
+    // all of the 'license_kinds' from "hardware_interfaces_license"
+    // to get the below license kinds:
+    //   SPDX-license-identifier-Apache-2.0
+    default_applicable_licenses: ["Android-Apache-2.0"],
+    default_team: "trendy_team_trusty",
+}
+
+rust_test {
+    name: "VtsAidlHdcpNonExistentTest",
+    srcs: ["src/host_test.rs"],
+    require_root: true,
+    test_suites: [
+        "general-tests",
+        "vts",
+    ],
+    rustlibs: [
+        "libbinder_rs",
+    ],
+}
diff --git a/security/see/hdcp/aidl/vts/src/host_test.rs b/security/see/hdcp/aidl/vts/src/host_test.rs
new file mode 100644
index 0000000..f64de20
--- /dev/null
+++ b/security/see/hdcp/aidl/vts/src/host_test.rs
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2024 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.
+ */
+
+//! Test for asserting the non-existence of an IHdcpAuthControl.aidl
+
+#![cfg(test)]
+
+use binder;
+
+const HDCP_INTERFACE_NAME: &str = "android.hardware.security.see.hdcp.IHdcpAuthControl";
+
+#[test]
+fn test_hdcp_auth_control_non_existence() {
+    let hdcp_instances =  match binder::get_declared_instances(HDCP_INTERFACE_NAME) {
+        Ok(vec) => vec,
+        Err(e) => {
+            panic!("failed to retrieve the declared interfaces for HdcpAuthControl: {:?}", e);
+        }
+    };
+    assert!(hdcp_instances.is_empty());
+}
diff --git a/sensors/aidl/Android.bp b/sensors/aidl/Android.bp
index 8877e6e..63ace90 100644
--- a/sensors/aidl/Android.bp
+++ b/sensors/aidl/Android.bp
@@ -43,6 +43,6 @@
         },
 
     ],
-    frozen: true,
+    frozen: false,
 
 }
diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/AdditionalInfo.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/AdditionalInfo.aidl
index 5184723..a35b54c 100644
--- a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/AdditionalInfo.aidl
+++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/AdditionalInfo.aidl
@@ -54,23 +54,23 @@
   enum AdditionalInfoType {
     AINFO_BEGIN = 0,
     AINFO_END = 1,
-    AINFO_UNTRACKED_DELAY = 65536,
-    AINFO_INTERNAL_TEMPERATURE = 65537,
-    AINFO_VEC3_CALIBRATION = 65538,
-    AINFO_SENSOR_PLACEMENT = 65539,
-    AINFO_SAMPLING = 65540,
-    AINFO_CHANNEL_NOISE = 131072,
-    AINFO_CHANNEL_SAMPLER = 131073,
-    AINFO_CHANNEL_FILTER = 131074,
-    AINFO_CHANNEL_LINEAR_TRANSFORM = 131075,
-    AINFO_CHANNEL_NONLINEAR_MAP = 131076,
-    AINFO_CHANNEL_RESAMPLER = 131077,
-    AINFO_LOCAL_GEOMAGNETIC_FIELD = 196608,
-    AINFO_LOCAL_GRAVITY = 196609,
-    AINFO_DOCK_STATE = 196610,
-    AINFO_HIGH_PERFORMANCE_MODE = 196611,
-    AINFO_MAGNETIC_FIELD_CALIBRATION = 196612,
-    AINFO_CUSTOM_START = 268435456,
-    AINFO_DEBUGGING_START = 1073741824,
+    AINFO_UNTRACKED_DELAY = 0x10000,
+    AINFO_INTERNAL_TEMPERATURE,
+    AINFO_VEC3_CALIBRATION,
+    AINFO_SENSOR_PLACEMENT,
+    AINFO_SAMPLING,
+    AINFO_CHANNEL_NOISE = 0x20000,
+    AINFO_CHANNEL_SAMPLER,
+    AINFO_CHANNEL_FILTER,
+    AINFO_CHANNEL_LINEAR_TRANSFORM,
+    AINFO_CHANNEL_NONLINEAR_MAP,
+    AINFO_CHANNEL_RESAMPLER,
+    AINFO_LOCAL_GEOMAGNETIC_FIELD = 0x30000,
+    AINFO_LOCAL_GRAVITY,
+    AINFO_DOCK_STATE,
+    AINFO_HIGH_PERFORMANCE_MODE,
+    AINFO_MAGNETIC_FIELD_CALIBRATION,
+    AINFO_CUSTOM_START = 0x10000000,
+    AINFO_DEBUGGING_START = 0x40000000,
   }
 }
diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensors.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensors.aidl
index b26040b..0566a64 100644
--- a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensors.aidl
+++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/ISensors.aidl
@@ -44,28 +44,28 @@
   int registerDirectChannel(in android.hardware.sensors.ISensors.SharedMemInfo mem);
   void setOperationMode(in android.hardware.sensors.ISensors.OperationMode mode);
   void unregisterDirectChannel(in int channelHandle);
-  const int ERROR_NO_MEMORY = -12;
-  const int ERROR_BAD_VALUE = -22;
+  const int ERROR_NO_MEMORY = (-12) /* -12 */;
+  const int ERROR_BAD_VALUE = (-22) /* -22 */;
   const int WAKE_LOCK_TIMEOUT_SECONDS = 1;
-  const int EVENT_QUEUE_FLAG_BITS_READ_AND_PROCESS = 1;
-  const int EVENT_QUEUE_FLAG_BITS_EVENTS_READ = 2;
-  const int WAKE_LOCK_QUEUE_FLAG_BITS_DATA_WRITTEN = 1;
-  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_FIELD = 0;
-  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_REPORT_TOKEN = 4;
-  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_SENSOR_TYPE = 8;
-  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_ATOMIC_COUNTER = 12;
-  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_TIMESTAMP = 16;
-  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_DATA = 24;
-  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_RESERVED = 88;
+  const int EVENT_QUEUE_FLAG_BITS_READ_AND_PROCESS = (1 << 0) /* 1 */;
+  const int EVENT_QUEUE_FLAG_BITS_EVENTS_READ = (1 << 1) /* 2 */;
+  const int WAKE_LOCK_QUEUE_FLAG_BITS_DATA_WRITTEN = (1 << 0) /* 1 */;
+  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_FIELD = 0x0;
+  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_REPORT_TOKEN = 0x4;
+  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_SENSOR_TYPE = 0x8;
+  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_ATOMIC_COUNTER = 0xC;
+  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_TIMESTAMP = 0x10;
+  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_DATA = 0x18;
+  const int DIRECT_REPORT_SENSOR_EVENT_OFFSET_SIZE_RESERVED = 0x58;
   const int DIRECT_REPORT_SENSOR_EVENT_TOTAL_LENGTH = 104;
-  const int RUNTIME_SENSORS_HANDLE_BASE = 1593835520;
-  const int RUNTIME_SENSORS_HANDLE_END = 1610612735;
+  const int RUNTIME_SENSORS_HANDLE_BASE = 0x5F000000;
+  const int RUNTIME_SENSORS_HANDLE_END = 0x5FFFFFFF;
   @Backing(type="int") @VintfStability
   enum RateLevel {
-    STOP = 0,
-    NORMAL = 1,
-    FAST = 2,
-    VERY_FAST = 3,
+    STOP,
+    NORMAL,
+    FAST,
+    VERY_FAST,
   }
   @Backing(type="int") @VintfStability
   enum OperationMode {
@@ -85,7 +85,7 @@
     @Backing(type="int") @VintfStability
     enum SharedMemType {
       ASHMEM = 1,
-      GRALLOC = 2,
+      GRALLOC,
     }
   }
 }
diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorInfo.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorInfo.aidl
index 996be3d..677e6c4 100644
--- a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorInfo.aidl
+++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorInfo.aidl
@@ -54,14 +54,14 @@
   const int SENSOR_FLAG_BITS_ON_CHANGE_MODE = 2;
   const int SENSOR_FLAG_BITS_ONE_SHOT_MODE = 4;
   const int SENSOR_FLAG_BITS_SPECIAL_REPORTING_MODE = 6;
-  const int SENSOR_FLAG_BITS_DATA_INJECTION = 16;
-  const int SENSOR_FLAG_BITS_DYNAMIC_SENSOR = 32;
-  const int SENSOR_FLAG_BITS_ADDITIONAL_INFO = 64;
-  const int SENSOR_FLAG_BITS_DIRECT_CHANNEL_ASHMEM = 1024;
-  const int SENSOR_FLAG_BITS_DIRECT_CHANNEL_GRALLOC = 2048;
-  const int SENSOR_FLAG_BITS_MASK_REPORTING_MODE = 14;
-  const int SENSOR_FLAG_BITS_MASK_DIRECT_REPORT = 896;
-  const int SENSOR_FLAG_BITS_MASK_DIRECT_CHANNEL = 3072;
+  const int SENSOR_FLAG_BITS_DATA_INJECTION = 0x10;
+  const int SENSOR_FLAG_BITS_DYNAMIC_SENSOR = 0x20;
+  const int SENSOR_FLAG_BITS_ADDITIONAL_INFO = 0x40;
+  const int SENSOR_FLAG_BITS_DIRECT_CHANNEL_ASHMEM = 0x400;
+  const int SENSOR_FLAG_BITS_DIRECT_CHANNEL_GRALLOC = 0x800;
+  const int SENSOR_FLAG_BITS_MASK_REPORTING_MODE = 0xE;
+  const int SENSOR_FLAG_BITS_MASK_DIRECT_REPORT = 0x380;
+  const int SENSOR_FLAG_BITS_MASK_DIRECT_CHANNEL = 0xC00;
   const int SENSOR_FLAG_SHIFT_REPORTING_MODE = 1;
   const int SENSOR_FLAG_SHIFT_DATA_INJECTION = 4;
   const int SENSOR_FLAG_SHIFT_DYNAMIC_SENSOR = 5;
diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorStatus.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorStatus.aidl
index 4521710..f401dac 100644
--- a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorStatus.aidl
+++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorStatus.aidl
@@ -34,7 +34,7 @@
 package android.hardware.sensors;
 @Backing(type="byte") @VintfStability
 enum SensorStatus {
-  NO_CONTACT = -1,
+  NO_CONTACT = (-1) /* -1 */,
   UNRELIABLE = 0,
   ACCURACY_LOW = 1,
   ACCURACY_MEDIUM = 2,
diff --git a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl
index 8c864e9..9332c63 100644
--- a/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl
+++ b/sensors/aidl/aidl_api/android.hardware.sensors/current/android/hardware/sensors/SensorType.aidl
@@ -76,5 +76,6 @@
   ACCELEROMETER_LIMITED_AXES_UNCALIBRATED = 40,
   GYROSCOPE_LIMITED_AXES_UNCALIBRATED = 41,
   HEADING = 42,
-  DEVICE_PRIVATE_BASE = 65536,
+  MOISTURE_INTRUSION = 43,
+  DEVICE_PRIVATE_BASE = 0x10000,
 }
diff --git a/sensors/aidl/android/hardware/sensors/Event.aidl b/sensors/aidl/android/hardware/sensors/Event.aidl
index b95299c..7775cfc 100644
--- a/sensors/aidl/android/hardware/sensors/Event.aidl
+++ b/sensors/aidl/android/hardware/sensors/Event.aidl
@@ -88,7 +88,7 @@
          * SensorType::GLANCE_GESTURE, SensorType::PICK_UP_GESTURE,
          * SensorType::WRIST_TILT_GESTURE, SensorType::STATIONARY_DETECT,
          * SensorType::MOTION_DETECT, SensorType::HEART_BEAT,
-         * SensorType::LOW_LATENCY_OFFBODY_DETECT
+         * SensorType::LOW_LATENCY_OFFBODY_DETECT, SensorType::MOISTURE_INTRUSION
          */
         float scalar;
 
diff --git a/sensors/aidl/android/hardware/sensors/SensorType.aidl b/sensors/aidl/android/hardware/sensors/SensorType.aidl
index 4904c3f..adaf8e6 100644
--- a/sensors/aidl/android/hardware/sensors/SensorType.aidl
+++ b/sensors/aidl/android/hardware/sensors/SensorType.aidl
@@ -718,6 +718,20 @@
     HEADING = 42,
 
     /**
+     * MOISTURE_INTRUSION
+     * trigger mode: on-change
+     *
+     * Detects moisture intrusion in the chassis of device. This detection is
+     * one-way and persistent. Once a device is detected to have water damage,
+     * it will always report 1 (across factory reset /reboot) even if moisture
+     * is no longer present, until the device has been repaired.
+     * The only allowed values to return are:
+     *   0.0: no moisture intrusion detected in relevant history
+     *   1.0: moisture intrusion detected now or previously
+     */
+    MOISTURE_INTRUSION = 43,
+
+    /**
      * Base of the range reserved for device manufacturers' private sensor
      * types. These sensor types aren't documented in the SDK.
      */
diff --git a/sensors/aidl/convert/Android.bp b/sensors/aidl/convert/Android.bp
index 7217b2f..548308e 100644
--- a/sensors/aidl/convert/Android.bp
+++ b/sensors/aidl/convert/Android.bp
@@ -36,7 +36,7 @@
         "libhardware",
         "libbase",
         "libutils",
-        "android.hardware.sensors-V2-ndk",
+        "android.hardware.sensors-V3-ndk",
     ],
     whole_static_libs: [
         "sensors_common_convert",
diff --git a/sensors/aidl/default/Android.bp b/sensors/aidl/default/Android.bp
index 6f011ee..4bdcfb0 100644
--- a/sensors/aidl/default/Android.bp
+++ b/sensors/aidl/default/Android.bp
@@ -32,7 +32,7 @@
         "libfmq",
         "libpower",
         "libbinder_ndk",
-        "android.hardware.sensors-V2-ndk",
+        "android.hardware.sensors-V3-ndk",
     ],
     export_include_dirs: ["include"],
     srcs: [
@@ -58,7 +58,7 @@
     static_libs: [
         "android.hardware.common-V2-ndk",
         "android.hardware.common.fmq-V1-ndk",
-        "android.hardware.sensors-V2-ndk",
+        "android.hardware.sensors-V3-ndk",
         "android.system.suspend-V1-ndk",
         "libbase",
         "libcutils",
diff --git a/sensors/aidl/default/multihal/Android.bp b/sensors/aidl/default/multihal/Android.bp
index 7482ffe..6ca81d9 100644
--- a/sensors/aidl/default/multihal/Android.bp
+++ b/sensors/aidl/default/multihal/Android.bp
@@ -39,7 +39,7 @@
         "android.hardware.sensors@1.0",
         "android.hardware.sensors@2.0",
         "android.hardware.sensors@2.1",
-        "android.hardware.sensors-V2-ndk",
+        "android.hardware.sensors-V3-ndk",
     ],
     export_include_dirs: ["include"],
     srcs: [
diff --git a/sensors/aidl/default/sensors-default.xml b/sensors/aidl/default/sensors-default.xml
index 36b28ed..bed2538 100644
--- a/sensors/aidl/default/sensors-default.xml
+++ b/sensors/aidl/default/sensors-default.xml
@@ -1,7 +1,7 @@
 <manifest version="1.0" type="device">
     <hal format="aidl">
         <name>android.hardware.sensors</name>
-        <version>2</version>
+        <version>3</version>
         <fqname>ISensors/default</fqname>
     </hal>
 </manifest>
diff --git a/sensors/aidl/multihal/Android.bp b/sensors/aidl/multihal/Android.bp
index cac5fc2..cee3db6 100644
--- a/sensors/aidl/multihal/Android.bp
+++ b/sensors/aidl/multihal/Android.bp
@@ -41,7 +41,7 @@
         "android.hardware.sensors@2.0-ScopedWakelock",
         "android.hardware.sensors@2.0",
         "android.hardware.sensors@2.1",
-        "android.hardware.sensors-V2-ndk",
+        "android.hardware.sensors-V3-ndk",
         "libbase",
         "libcutils",
         "libfmq",
diff --git a/sensors/aidl/multihal/android.hardware.sensors-multihal.xml b/sensors/aidl/multihal/android.hardware.sensors-multihal.xml
index 5da4fbd..9186f64 100644
--- a/sensors/aidl/multihal/android.hardware.sensors-multihal.xml
+++ b/sensors/aidl/multihal/android.hardware.sensors-multihal.xml
@@ -17,7 +17,7 @@
 <manifest version="1.0" type="device">
     <hal format="aidl">
         <name>android.hardware.sensors</name>
-        <version>2</version>
+        <version>3</version>
         <fqname>ISensors/default</fqname>
     </hal>
 </manifest>
diff --git a/sensors/aidl/vts/Android.bp b/sensors/aidl/vts/Android.bp
index 1f96bb4..63371cd 100644
--- a/sensors/aidl/vts/Android.bp
+++ b/sensors/aidl/vts/Android.bp
@@ -42,7 +42,7 @@
         "android.hardware.common.fmq-V1-ndk",
     ],
     static_libs: [
-        "android.hardware.sensors-V2-ndk",
+        "android.hardware.sensors-V3-ndk",
         "VtsHalSensorsTargetTestUtils",
         "libaidlcommonsupport",
     ],
diff --git a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/VendorParamCapability.aidl b/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/VendorParamCapability.aidl
index 9cf29a5..5f16de9 100644
--- a/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/VendorParamCapability.aidl
+++ b/tv/mediaquality/aidl/aidl_api/android.hardware.tv.mediaquality/current/android/hardware/tv/mediaquality/VendorParamCapability.aidl
@@ -34,7 +34,7 @@
 package android.hardware.tv.mediaquality;
 @VintfStability
 parcelable VendorParamCapability {
-  ParcelableHolder name;
+  android.hardware.tv.mediaquality.VendorParameterIdentifier identifier;
   boolean isSupported;
   @nullable android.hardware.tv.mediaquality.ParameterDefaultValue defaultValue;
   @nullable android.hardware.tv.mediaquality.ParameterRange range;
diff --git a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl
index 8a19544..06651e4 100644
--- a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl
+++ b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/IPictureProfileAdjustmentListener.aidl
@@ -39,7 +39,10 @@
     void onParamCapabilityChanged(long pictureProfileId, in ParamCapability[] caps);
 
     /**
-     * Notifies Media Quality Manager when venfor parameter capabilities changed.
+     * Notifies Media Quality Manager when vendor parameter capabilities changed.
+     *
+     * <p>This should be also called when the listener is registered to let the client know
+     * what vendor parameters are supported.
      *
      * @param pictureProfileId the ID of the profile used by the media content. -1 if there
      *                         is no associated profile.
diff --git a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl
index 373cfc1..2ab9c6c 100644
--- a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl
+++ b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/ISoundProfileAdjustmentListener.aidl
@@ -39,7 +39,10 @@
     void onParamCapabilityChanged(long soundProfileId, in ParamCapability[] caps);
 
     /**
-     * Notifies Media Quality Manager when venfor parameter capabilities changed.
+     * Notifies Media Quality Manager when vendor parameter capabilities changed.
+     *
+     * <p>This should be also called when the listener is registered to let the client know
+     * what vendor parameters are supported.
      *
      * @param soundProfileId the ID of the profile used by the media content. -1 if there
      *                         is no associated profile.
diff --git a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/VendorParamCapability.aidl b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/VendorParamCapability.aidl
index 1d9476d..bdc0188 100644
--- a/tv/mediaquality/aidl/android/hardware/tv/mediaquality/VendorParamCapability.aidl
+++ b/tv/mediaquality/aidl/android/hardware/tv/mediaquality/VendorParamCapability.aidl
@@ -18,14 +18,15 @@
 
 import android.hardware.tv.mediaquality.ParameterDefaultValue;
 import android.hardware.tv.mediaquality.ParameterRange;
+import android.hardware.tv.mediaquality.VendorParameterIdentifier;
 
 /**
  * Capability of vendor parameters.
  */
 @VintfStability
 parcelable VendorParamCapability {
-    /** Name of the parameter **/
-    ParcelableHolder name;
+    /** Identifier of the parameter **/
+    VendorParameterIdentifier identifier;
 
     /** true if this parameter is supported **/
     boolean isSupported;
diff --git a/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp b/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp
index 09deee6..84f798b 100644
--- a/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp
+++ b/tv/mediaquality/aidl/vts/functional/VtsHalMediaQualityTest.cpp
@@ -52,6 +52,7 @@
 using aidl::android::hardware::tv::mediaquality::SoundParameters;
 using aidl::android::hardware::tv::mediaquality::SoundProfile;
 using aidl::android::hardware::tv::mediaquality::VendorParamCapability;
+using aidl::android::hardware::tv::mediaquality::VendorParameterIdentifier;
 using android::ProcessState;
 using android::String16;
 using ndk::ScopedAStatus;