Merge "UsbGadget AIDL migration cleanup"
diff --git a/audio/aidl/Android.bp b/audio/aidl/Android.bp
index 56ac510..01af940 100644
--- a/audio/aidl/Android.bp
+++ b/audio/aidl/Android.bp
@@ -226,6 +226,7 @@
     srcs: [
         "android/hardware/audio/effect/AcousticEchoCanceler.aidl",
         "android/hardware/audio/effect/AutomaticGainControl.aidl",
+        "android/hardware/audio/effect/AutomaticGainControlV1.aidl",
         "android/hardware/audio/effect/BassBoost.aidl",
         "android/hardware/audio/effect/Capability.aidl",
         "android/hardware/audio/effect/CommandId.aidl",
@@ -243,6 +244,7 @@
         "android/hardware/audio/effect/Parameter.aidl",
         "android/hardware/audio/effect/PresetReverb.aidl",
         "android/hardware/audio/effect/Processing.aidl",
+        "android/hardware/audio/effect/Range.aidl",
         "android/hardware/audio/effect/State.aidl",
         "android/hardware/audio/effect/VendorExtension.aidl",
         "android/hardware/audio/effect/Virtualizer.aidl",
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl
similarity index 75%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl
index e1fb376..ff010c6 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/AutomaticGainControlV1.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 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.
@@ -31,10 +31,21 @@
 // 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.ims.media;
+package android.hardware.audio.effect;
 @VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+union AutomaticGainControlV1 {
+  android.hardware.audio.effect.VendorExtension vendor;
+  int targetPeakLevelDbFs;
+  int maxCompressionGainDb;
+  boolean enableLimiter;
+  @VintfStability
+  union Id {
+    int vendorExtensionTag;
+    android.hardware.audio.effect.AutomaticGainControlV1.Tag commonTag;
+  }
+  @VintfStability
+  parcelable Capability {
+    ParcelableHolder extension;
+    android.hardware.audio.effect.Range[] ranges;
+  }
 }
diff --git a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl
index 397f897..1cf92ef 100644
--- a/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/NoiseSuppression.aidl
@@ -50,5 +50,6 @@
     LOW,
     MEDIUM,
     HIGH,
+    VERY_HIGH,
   }
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl
similarity index 69%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl
index e1fb376..531d3a1 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/audio/aidl/aidl_api/android.hardware.audio.effect/current/android/hardware/audio/effect/Range.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 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.
@@ -31,10 +31,36 @@
 // 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.ims.media;
+package android.hardware.audio.effect;
 @VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+parcelable Range {
+  int tag;
+  android.hardware.audio.effect.Range.Types types;
+  @VintfStability
+  parcelable Int {
+    int min;
+    int max;
+  }
+  @VintfStability
+  parcelable Float {
+    float min;
+    float max;
+  }
+  @VintfStability
+  parcelable Long {
+    long min;
+    long max;
+  }
+  @VintfStability
+  parcelable Byte {
+    byte min;
+    byte max;
+  }
+  @VintfStability
+  union Types {
+    android.hardware.audio.effect.Range.Int rangeInt;
+    android.hardware.audio.effect.Range.Float rangeFloat;
+    android.hardware.audio.effect.Range.Long rangeLong;
+    android.hardware.audio.effect.Range.Byte rangeByte;
+  }
 }
diff --git a/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl
new file mode 100644
index 0000000..d6e0648
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/AutomaticGainControlV1.aidl
@@ -0,0 +1,82 @@
+/*
+ * Copyright (C) 2023 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.audio.effect;
+
+import android.hardware.audio.effect.Range;
+import android.hardware.audio.effect.VendorExtension;
+
+/**
+ * Automatic Gain Control (AGC) is an audio pre-processor which automatically normalizes the output
+ * of the captured signal by boosting or lowering input from the microphone to match a preset level
+ * so that the output signal level is virtually constant. AGC can be used by applications where the
+ * input signal dynamic range is not important but where a constant strong capture level is desired.
+ *
+ * All parameters defined in union AutomaticGainControlV1 must be gettable and settable. The
+ * capabilities defined in AutomaticGainControlV1.Capability can only acquired with
+ * IEffect.getDescriptor() and not settable.
+ */
+@VintfStability
+union AutomaticGainControlV1 {
+    /**
+     * Effect parameter tag to identify the parameters for getParameter().
+     */
+    @VintfStability
+    union Id {
+        int vendorExtensionTag;
+        AutomaticGainControlV1.Tag commonTag;
+    }
+
+    /**
+     * Vendor AutomaticGainControlV1 implementation definition for additional parameters.
+     */
+    VendorExtension vendor;
+
+    /**
+     * Capability supported by AutomaticGainControlV1 implementation.
+     */
+    @VintfStability
+    parcelable Capability {
+        /**
+         * AutomaticGainControlV1 capability extension, vendor can use this extension in case
+         * existing capability definition not enough.
+         */
+        ParcelableHolder extension;
+        /**
+         * Supported range for parameters.
+         */
+        Range[] ranges;
+    }
+
+    /**
+     * Target peak level (or envelope) of the AGC implementation in dBFs (dB relative to full
+     * scale).
+     * Must be in range of AutomaticGainControlV1.Capability.ranges with targetPeakLevelDbFs tag.
+     */
+    int targetPeakLevelDbFs;
+    /*
+     * Sets the maximum gain the digital compression stage may apply, in dB. A higher number
+     * corresponds to greater compression, while a value of 0 will leave the signal uncompressed.
+     * Must be in range of AutomaticGainControlV1.Capability.ranges with maxCompressionGainDb tag.
+     */
+    int maxCompressionGainDb;
+    /**
+     * Enable or disable limiter.
+     * When enabled, the compression stage will hard limit the signal to the target level.
+     * Otherwise, the signal will be compressed but not limited above the target level.
+     */
+    boolean enableLimiter;
+}
diff --git a/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl b/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl
index 946fa87..9969a0b 100644
--- a/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl
+++ b/audio/aidl/android/hardware/audio/effect/NoiseSuppression.aidl
@@ -62,7 +62,7 @@
      * suppression, NsConfig::SuppressionLevel::k12dB for MEDIUM, and
      * NsConfig::SuppressionLevel::k18dB for HIGH.
      */
-    @VintfStability @Backing(type="int") enum Level { LOW, MEDIUM, HIGH }
+    @VintfStability @Backing(type="int") enum Level { LOW, MEDIUM, HIGH, VERY_HIGH }
 
     /**
      * The NS level.
diff --git a/audio/aidl/android/hardware/audio/effect/Range.aidl b/audio/aidl/android/hardware/audio/effect/Range.aidl
new file mode 100644
index 0000000..c052502
--- /dev/null
+++ b/audio/aidl/android/hardware/audio/effect/Range.aidl
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2023 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.audio.effect;
+
+/**
+ * Define the range (min and max) of a certain field, identified by tag.
+ * Can be used by effect capabilities to define supported value ranges.
+ */
+@VintfStability
+parcelable Range {
+    /**
+     * The union tag name which the range is defined for.
+     * For example: if used in AutomaticGainControlV1.Capability, value of Range.tag could be
+     * targetLevelDbFs or compressionGainDb.
+     */
+    int tag;
+
+    @VintfStability
+    parcelable Int {
+        int min;
+        int max;
+    }
+
+    @VintfStability
+    parcelable Float {
+        float min;
+        float max;
+    }
+
+    @VintfStability
+    parcelable Long {
+        long min;
+        long max;
+    }
+
+    @VintfStability
+    parcelable Byte {
+        byte min;
+        byte max;
+    }
+
+    @VintfStability
+    union Types {
+        Int rangeInt;
+        Float rangeFloat;
+        Long rangeLong;
+        Byte rangeByte;
+    }
+
+    Types types;
+}
diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp
index 6d5357b..7b2deb7 100644
--- a/audio/aidl/default/Configuration.cpp
+++ b/audio/aidl/default/Configuration.cpp
@@ -393,4 +393,73 @@
     return std::make_unique<Configuration>(configuration);
 }
 
+// Usb configuration:
+//
+// Device ports:
+//  * "USB Headset Out", OUT_HEADSET, CONNECTION_USB
+//    - no profiles specified
+//  * "USB Headset In", IN_HEADSET, CONNECTION_USB
+//    - no profiles specified
+//
+// Mix ports:
+//  * "usb_headset output", 1 max open, 1 max active stream
+//    - no profiles specified
+//  * "usb_headset input", 1 max open, 1 max active stream
+//    - no profiles specified
+//
+// Profiles for device port connected state:
+//  * USB Headset Out":
+//    - profile PCM 16-bit; MONO, STEREO, INDEX_MASK_1, INDEX_MASK_2; 44100, 48000
+//    - profile PCM 24-bit; MONO, STEREO, INDEX_MASK_1, INDEX_MASK_2; 44100, 48000
+//  * USB Headset In":
+//    - profile PCM 16-bit; MONO, STEREO, INDEX_MASK_1, INDEX_MASK_2; 44100, 48000
+//    - profile PCM 24-bit; MONO, STEREO, INDEX_MASK_1, INDEX_MASK_2; 44100, 48000
+//
+std::unique_ptr<Configuration> getUsbConfiguration() {
+    static const Configuration configuration = []() {
+        const std::vector<AudioProfile> standardPcmAudioProfiles = {
+                createProfile(PcmType::INT_16_BIT,
+                              {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO,
+                               AudioChannelLayout::INDEX_MASK_1, AudioChannelLayout::INDEX_MASK_2},
+                              {44100, 48000}),
+                createProfile(PcmType::INT_24_BIT,
+                              {AudioChannelLayout::LAYOUT_MONO, AudioChannelLayout::LAYOUT_STEREO,
+                               AudioChannelLayout::INDEX_MASK_1, AudioChannelLayout::INDEX_MASK_2},
+                              {44100, 48000})};
+        Configuration c;
+
+        // Device ports
+
+        AudioPort usbOutHeadset =
+                createPort(c.nextPortId++, "USB Headset Out", 0, false,
+                           createDeviceExt(AudioDeviceType::OUT_HEADSET, 0,
+                                           AudioDeviceDescription::CONNECTION_USB));
+        c.ports.push_back(usbOutHeadset);
+        c.connectedProfiles[usbOutHeadset.id] = standardPcmAudioProfiles;
+
+        AudioPort usbInHeadset =
+                createPort(c.nextPortId++, "USB Headset In", 0, true,
+                           createDeviceExt(AudioDeviceType::IN_HEADSET, 0,
+                                           AudioDeviceDescription::CONNECTION_USB));
+        c.ports.push_back(usbInHeadset);
+        c.connectedProfiles[usbInHeadset.id] = standardPcmAudioProfiles;
+
+        // Mix ports
+
+        AudioPort usbHeadsetOutMix =
+                createPort(c.nextPortId++, "usb_headset output", 0, false, createPortMixExt(1, 1));
+        c.ports.push_back(usbHeadsetOutMix);
+
+        AudioPort usbHeadsetInMix =
+                createPort(c.nextPortId++, "usb_headset input", 0, true, createPortMixExt(1, 1));
+        c.ports.push_back(usbHeadsetInMix);
+
+        c.routes.push_back(createRoute({usbHeadsetOutMix}, usbOutHeadset));
+        c.routes.push_back(createRoute({usbInHeadset}, usbHeadsetInMix));
+
+        return c;
+    }();
+    return std::make_unique<Configuration>(configuration);
+}
+
 }  // namespace aidl::android::hardware::audio::core::internal
diff --git a/audio/aidl/default/Module.cpp b/audio/aidl/default/Module.cpp
index 7e829e3..82d1ef8 100644
--- a/audio/aidl/default/Module.cpp
+++ b/audio/aidl/default/Module.cpp
@@ -259,6 +259,8 @@
             case Type::R_SUBMIX:
                 mConfig = std::move(internal::getRSubmixConfiguration());
                 break;
+            case Type::USB:
+                mConfig = std::move(internal::getUsbConfiguration());
         }
     }
     return *mConfig;
diff --git a/audio/aidl/default/android.hardware.audio.service-aidl.xml b/audio/aidl/default/android.hardware.audio.service-aidl.xml
index 46b665f..9636a58 100644
--- a/audio/aidl/default/android.hardware.audio.service-aidl.xml
+++ b/audio/aidl/default/android.hardware.audio.service-aidl.xml
@@ -12,6 +12,11 @@
   <hal format="aidl">
     <name>android.hardware.audio.core</name>
     <version>1</version>
+    <fqname>IModule/usb</fqname>
+  </hal>
+  <hal format="aidl">
+    <name>android.hardware.audio.core</name>
+    <version>1</version>
     <fqname>IConfig/default</fqname>
   </hal>
 </manifest>
diff --git a/audio/aidl/default/include/core-impl/Configuration.h b/audio/aidl/default/include/core-impl/Configuration.h
index 3b4c494..1aca1fe 100644
--- a/audio/aidl/default/include/core-impl/Configuration.h
+++ b/audio/aidl/default/include/core-impl/Configuration.h
@@ -44,5 +44,6 @@
 
 std::unique_ptr<Configuration> getPrimaryConfiguration();
 std::unique_ptr<Configuration> getRSubmixConfiguration();
+std::unique_ptr<Configuration> getUsbConfiguration();
 
 }  // namespace aidl::android::hardware::audio::core::internal
diff --git a/audio/aidl/default/include/core-impl/Module.h b/audio/aidl/default/include/core-impl/Module.h
index acdbe4f..80a22dc 100644
--- a/audio/aidl/default/include/core-impl/Module.h
+++ b/audio/aidl/default/include/core-impl/Module.h
@@ -31,7 +31,7 @@
   public:
     // This value is used for all AudioPatches and reported by all streams.
     static constexpr int32_t kLatencyMs = 10;
-    enum Type : int { DEFAULT, R_SUBMIX };
+    enum Type : int { DEFAULT, R_SUBMIX, USB };
 
     explicit Module(Type type) : mType(type) {}
 
diff --git a/audio/aidl/default/main.cpp b/audio/aidl/default/main.cpp
index b66c134..1933509 100644
--- a/audio/aidl/default/main.cpp
+++ b/audio/aidl/default/main.cpp
@@ -55,7 +55,8 @@
         return std::make_pair(module, moduleBinder);
     };
     auto modules = {createModule(Module::Type::DEFAULT, "default"),
-                    createModule(Module::Type::R_SUBMIX, "r_submix")};
+                    createModule(Module::Type::R_SUBMIX, "r_submix"),
+                    createModule(Module::Type::USB, "usb")};
 
     ABinderProcess_joinThreadPool();
     return EXIT_FAILURE;  // should not reach
diff --git a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp
index 3cab204..2706c49 100644
--- a/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp
+++ b/automotive/evs/aidl/vts/VtsHalEvsTargetTest.cpp
@@ -619,6 +619,7 @@
         getPhysicalCameraIds(cam.id, isLogicalCam);
         if (mIsHwModule && isLogicalCam) {
             LOG(INFO) << "Skip a logical device " << cam.id << " for HW target.";
+            ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk());
             continue;
         }
 
@@ -1437,7 +1438,8 @@
         ASSERT_TRUE(pCam1->getParameterList(&cam1Cmds).isOk());
         if (cam0Cmds.size() < 1 || cam1Cmds.size() < 1) {
             // Cannot execute this test.
-            return;
+            ASSERT_TRUE(mEnumerator->closeDisplay(pDisplay).isOk());
+            continue;
         }
 
         // Set up a frame receiver object which will fire up its own thread.
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl
index ec9587f..dde9a88 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyAccess.aidl
@@ -34,8 +34,8 @@
 package android.hardware.automotive.vehicle;
 @Backing(type="int") @VintfStability
 enum VehiclePropertyAccess {
-  NONE = 0,
-  READ = 1,
-  WRITE = 2,
-  READ_WRITE = 3,
+  NONE = 0x00,
+  READ = 0x01,
+  WRITE = 0x02,
+  READ_WRITE = 0x03,
 }
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl
index 5455fdd..2f9d107 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.aidl
@@ -34,7 +34,7 @@
 package android.hardware.automotive.vehicle;
 @Backing(type="int") @VintfStability
 enum VehiclePropertyChangeMode {
-  STATIC = 0,
-  ON_CHANGE = 1,
-  CONTINUOUS = 2,
+  STATIC = 0x00,
+  ON_CHANGE = 0x01,
+  CONTINUOUS = 0x02,
 }
diff --git a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl
index 6d0e041..642ce83 100644
--- a/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl
+++ b/automotive/vehicle/aidl/aidl_api/android.hardware.automotive.vehicle/current/android/hardware/automotive/vehicle/VehiclePropertyStatus.aidl
@@ -34,7 +34,7 @@
 package android.hardware.automotive.vehicle;
 @Backing(type="int") @VintfStability
 enum VehiclePropertyStatus {
-  AVAILABLE = 0,
-  UNAVAILABLE = 1,
-  ERROR = 2,
+  AVAILABLE = 0x00,
+  UNAVAILABLE = 0x01,
+  ERROR = 0x02,
 }
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
index a6cb861..aef5fe7 100644
--- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
+++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
@@ -240,6 +240,7 @@
         {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess::READ_WRITE},
         {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess::READ},
         {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE},
+        {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ},
         {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE},
         {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE},
         {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess::READ_WRITE},
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
index d3bf5f2..4a58404 100644
--- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
+++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
@@ -240,6 +240,7 @@
         {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
         {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE},
         {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
+        {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode::ON_CHANGE},
         {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
         {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
         {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
diff --git a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
index 1a1ce5e..eec9daf 100644
--- a/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
+++ b/automotive/vehicle/aidl/generated_lib/java/AccessForVehicleProperty.java
@@ -232,6 +232,7 @@
         Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyAccess.READ_WRITE),
         Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyAccess.READ),
         Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE),
+        Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess.READ),
         Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE),
         Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyAccess.READ_WRITE),
         Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyAccess.READ_WRITE),
diff --git a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
index c8abc14..91c3637 100644
--- a/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
+++ b/automotive/vehicle/aidl/generated_lib/java/ChangeModeForVehicleProperty.java
@@ -232,6 +232,7 @@
         Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
         Map.entry(VehicleProperty.AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode.ON_CHANGE),
         Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
+        Map.entry(VehicleProperty.FORWARD_COLLISION_WARNING_STATE, VehiclePropertyChangeMode.ON_CHANGE),
         Map.entry(VehicleProperty.BLIND_SPOT_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
         Map.entry(VehicleProperty.LANE_DEPARTURE_WARNING_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
         Map.entry(VehicleProperty.LANE_KEEP_ASSIST_ENABLED, VehiclePropertyChangeMode.ON_CHANGE),
diff --git a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp
index a58d477..f39376b 100644
--- a/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp
+++ b/automotive/vehicle/aidl/impl/default_config/JsonConfigLoader/src/JsonConfigLoader.cpp
@@ -41,6 +41,7 @@
 using ::aidl::android::hardware::automotive::vehicle::EvConnectorType;
 using ::aidl::android::hardware::automotive::vehicle::EvsServiceState;
 using ::aidl::android::hardware::automotive::vehicle::EvsServiceType;
+using ::aidl::android::hardware::automotive::vehicle::ForwardCollisionWarningState;
 using ::aidl::android::hardware::automotive::vehicle::FuelType;
 using ::aidl::android::hardware::automotive::vehicle::GsrComplianceRequirementType;
 using ::aidl::android::hardware::automotive::vehicle::RawPropValues;
@@ -212,6 +213,8 @@
     mConstantParsersByType["ErrorState"] = std::make_unique<ConstantParser<ErrorState>>();
     mConstantParsersByType["AutomaticEmergencyBrakingState"] =
             std::make_unique<ConstantParser<AutomaticEmergencyBrakingState>>();
+    mConstantParsersByType["ForwardCollisionWarningState"] =
+            std::make_unique<ConstantParser<ForwardCollisionWarningState>>();
     mConstantParsersByType["Constants"] = std::make_unique<LocalVariableParser>();
 }
 
diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
index 080e6c0..50e2428 100644
--- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
+++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
@@ -3193,6 +3193,27 @@
             }
         },
         {
+            "property": "VehicleProperty::FORWARD_COLLISION_WARNING_STATE",
+            "defaultValue": {
+                "int32Values": [
+                    "ForwardCollisionWarningState::NO_WARNING"
+                ]
+            },
+            "areas": [
+                {
+                    "areaId": 0,
+                    "supportedEnumValues": [
+                        "ErrorState::NOT_AVAILABLE_SAFETY",
+                        "ErrorState::NOT_AVAILABLE_SPEED_HIGH",
+                        "ErrorState::NOT_AVAILABLE_SPEED_LOW",
+                        "ErrorState::NOT_AVAILABLE_DISABLED",
+                        "ForwardCollisionWarningState::NO_WARNING",
+                        "ForwardCollisionWarningState::WARNING"
+                    ]
+                }
+            ]
+        },
+        {
             "property": "VehicleProperty::BLIND_SPOT_WARNING_ENABLED",
             "defaultValue": {
                 "int32Values": [
diff --git a/automotive/vehicle/aidl/impl/default_config/config/README.md b/automotive/vehicle/aidl/impl/default_config/config/README.md
index 1318d6d..a5d8cdf 100644
--- a/automotive/vehicle/aidl/impl/default_config/config/README.md
+++ b/automotive/vehicle/aidl/impl/default_config/config/README.md
@@ -143,6 +143,8 @@
 
 * AutomaticEmergencyBrakingState
 
+* ForwardCollisionWarningState
+
 * ErrorState
 
 * Constants
diff --git a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h
index 567ffe9..5a84d58 100644
--- a/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h
+++ b/automotive/vehicle/aidl/impl/utils/common/include/VehicleHalTypes.h
@@ -25,6 +25,7 @@
 #include <aidl/android/hardware/automotive/vehicle/EvStoppingMode.h>
 #include <aidl/android/hardware/automotive/vehicle/EvsServiceState.h>
 #include <aidl/android/hardware/automotive/vehicle/EvsServiceType.h>
+#include <aidl/android/hardware/automotive/vehicle/ForwardCollisionWarningState.h>
 #include <aidl/android/hardware/automotive/vehicle/FuelType.h>
 #include <aidl/android/hardware/automotive/vehicle/GetValueRequest.h>
 #include <aidl/android/hardware/automotive/vehicle/GetValueResult.h>
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl
similarity index 87%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl
index e1fb376..371885d 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 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.
@@ -31,10 +31,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.radio.ims.media;
-@VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+package android.hardware.automotive.vehicle;
+@Backing(type="int") @VintfStability
+enum ForwardCollisionWarningState {
+  OTHER = 0,
+  NO_WARNING = 1,
+  WARNING = 2,
 }
diff --git a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
index 4931ab1..1039347 100644
--- a/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl_property/aidl_api/android.hardware.automotive.vehicle.property/current/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -240,6 +240,7 @@
   AUTOMATIC_EMERGENCY_BRAKING_ENABLED = 287313920,
   AUTOMATIC_EMERGENCY_BRAKING_STATE = 289411073,
   FORWARD_COLLISION_WARNING_ENABLED = 287313922,
+  FORWARD_COLLISION_WARNING_STATE = 289411075,
   BLIND_SPOT_WARNING_ENABLED = 287313924,
   LANE_DEPARTURE_WARNING_ENABLED = 287313926,
   LANE_KEEP_ASSIST_ENABLED = 287313928,
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl
new file mode 100644
index 0000000..b20cf25
--- /dev/null
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/ForwardCollisionWarningState.aidl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2023 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.vehicle;
+
+/**
+ * Used to enumerate the state of Forward Collision Warning State (FCW).
+ */
+@VintfStability
+@Backing(type="int")
+enum ForwardCollisionWarningState {
+
+    /**
+     * This state is used as an alternative to any ForwardCollisionWarningState value that is not
+     * defined in the platform. Ideally, implementations of
+     * VehicleProperty#FORWARD_COLLISION_WARNING_STATE should not use this state. The framework
+     * can use this field to remain backwards compatible if ForwardCollisionWarningState is
+     * extended to include additional states.
+     */
+    OTHER = 0,
+    /**
+     * FCW is enabled and monitoring safety, but no potential collision is detected.
+     */
+    NO_WARNING = 1,
+    /**
+     * FCW is enabled, detects a potential collision, and is actively warning the user.
+     */
+    WARNING = 2,
+}
diff --git a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
index 28deaf6..446a9fa 100644
--- a/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
+++ b/automotive/vehicle/aidl_property/android/hardware/automotive/vehicle/VehicleProperty.aidl
@@ -3429,9 +3429,9 @@
      * Set true to enable AEB and false to disable AEB. When AEB is enabled, the ADAS system in the
      * vehicle should be turned on and monitoring to avoid potential collisions.
      *
-     * IVehicle#get must not return any NOT_AVAILABLE value in StatusCode. Other StatusCode values
-     * like TRY_AGAIN may still be used as needed. For example, if AEB is not available because the
-     * vehicle speed is too low, IVehicle#get must return false.
+     * If AEB is not available, IVehicle#get must not return any NOT_AVAILABLE value in StatusCode.
+     * Other StatusCode values like TRY_AGAIN may still be used as needed. For example, if AEB is
+     * not available because the vehicle speed is too low, IVehicle#get must return false.
      *
      * This property is defined as read_write, but OEMs have the option to implement it as read
      * only.
@@ -3470,6 +3470,10 @@
      * Set true to enable FCW and false to disable FCW. When FCW is enabled, the ADAS system in the
      * vehicle should be turned on and monitoring for potential collisions.
      *
+     * If FCW is not available, IVehicle#get must not return any NOT_AVAILABLE value in StatusCode.
+     * Other StatusCode values like TRY_AGAIN may still be used as needed. For example, if FCW is
+     * not available because the vehicle speed is too low, IVehicle#get must return false.
+     *
      * This property is defined as read_write, but OEMs have the option to implement it as read
      * only.
      *
@@ -3480,6 +3484,25 @@
             0x1002 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.BOOLEAN,
 
     /**
+     * Forward Collision Warning (FCW) state.
+     *
+     * Returns the current state of FCW. This property must always return a valid state defined in
+     * ForwardCollisionWarningState or ErrorState. It must not surface errors through StatusCode
+     * and must use the supported error states instead.
+     *
+     * For the global area ID (0), the VehicleAreaConfig#supportedEnumValues array must be defined
+     * unless all states of both ForwardCollisionWarningState (including OTHER, which is not
+     * recommended) and ErrorState are supported.
+     *
+     * @change_mode VehiclePropertyChangeMode.ON_CHANGE
+     * @access VehiclePropertyAccess.READ
+     * @data_enum ForwardCollisionWarningState
+     * @data_enum ErrorState
+     */
+    FORWARD_COLLISION_WARNING_STATE =
+            0x1003 + VehiclePropertyGroup.SYSTEM + VehicleArea.GLOBAL + VehiclePropertyType.INT32,
+
+    /**
      * Enable and disable blind spot warning (BSW).
      *
      * Set true to enable BSW and false to disable BSW. When BSW is enabled, the ADAS system in the
diff --git a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
index 17edc1d..28b4dcf 100644
--- a/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
+++ b/automotive/vehicle/vts/src/VtsHalAutomotiveVehicle_TargetTest.cpp
@@ -696,6 +696,12 @@
                    VehiclePropertyGroup::SYSTEM, VehicleArea::GLOBAL, VehiclePropertyType::BOOLEAN);
 }
 
+TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyForwardCollisionWarningStateConfig) {
+    verifyProperty(VehicleProperty::FORWARD_COLLISION_WARNING_STATE, VehiclePropertyAccess::READ,
+                   VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
+                   VehicleArea::GLOBAL, VehiclePropertyType::INT32);
+}
+
 TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyBlindSpotWarningEnabledConfig) {
     verifyProperty(VehicleProperty::BLIND_SPOT_WARNING_ENABLED, VehiclePropertyAccess::READ_WRITE,
                    VehiclePropertyChangeMode::ON_CHANGE, VehiclePropertyGroup::SYSTEM,
diff --git a/bluetooth/aidl/TEST_MAPPING b/bluetooth/aidl/TEST_MAPPING
new file mode 100644
index 0000000..342a1e4
--- /dev/null
+++ b/bluetooth/aidl/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+  "presubmit" : [
+    {
+      "name" : "VtsHalBluetoothTargetTest"
+    }
+  ]
+}
diff --git a/bluetooth/aidl/default/BluetoothHci.cpp b/bluetooth/aidl/default/BluetoothHci.cpp
index dd102a1..eebbbc0 100644
--- a/bluetooth/aidl/default/BluetoothHci.cpp
+++ b/bluetooth/aidl/default/BluetoothHci.cpp
@@ -143,17 +143,17 @@
       [](const std::vector<uint8_t>& /* raw_command */) {
         LOG_ALWAYS_FATAL("Unexpected command!");
       },
+      [this](const std::vector<uint8_t>& raw_acl) {
+        mCb->aclDataReceived(raw_acl);
+      },
+      [this](const std::vector<uint8_t>& raw_sco) {
+        mCb->scoDataReceived(raw_sco);
+      },
       [this](const std::vector<uint8_t>& raw_event) {
         mCb->hciEventReceived(raw_event);
       },
-      [this](const std::vector<uint8_t>& raw_acl) {
-        mCb->hciEventReceived(raw_acl);
-      },
-      [this](const std::vector<uint8_t>& raw_sco) {
-        mCb->hciEventReceived(raw_sco);
-      },
       [this](const std::vector<uint8_t>& raw_iso) {
-        mCb->hciEventReceived(raw_iso);
+        mCb->isoDataReceived(raw_iso);
       },
       [this]() {
         ALOGI("HCI socket device disconnected");
diff --git a/bluetooth/aidl/vts/Android.bp b/bluetooth/aidl/vts/Android.bp
index c6c9b9e..414f707 100644
--- a/bluetooth/aidl/vts/Android.bp
+++ b/bluetooth/aidl/vts/Android.bp
@@ -15,12 +15,12 @@
     ],
     srcs: ["VtsHalBluetoothTargetTest.cpp"],
     shared_libs: [
-        "android.hardware.bluetooth-V1-ndk",
         "libbase",
         "libbinder_ndk",
         "libcutils",
     ],
     static_libs: [
+        "android.hardware.bluetooth-V1-ndk",
         "libbluetooth-types",
     ],
     test_config: "VtsHalBluetoothTargetTest.xml",
diff --git a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
index 27e6ebf..57a3361 100644
--- a/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
+++ b/bluetooth/aidl/vts/VtsHalBluetoothTargetTest.cpp
@@ -46,8 +46,13 @@
 // Bluetooth Core Specification 3.0 + HS
 static constexpr uint8_t kHciMinimumLmpVersion = 5;
 
+static constexpr size_t kNumHciCommandsBandwidth = 100;
+static constexpr size_t kNumScoPacketsBandwidth = 100;
+static constexpr size_t kNumAclPacketsBandwidth = 100;
 static constexpr std::chrono::milliseconds kWaitForInitTimeout(2000);
 static constexpr std::chrono::milliseconds kWaitForHciEventTimeout(2000);
+static constexpr std::chrono::milliseconds kWaitForScoDataTimeout(1000);
+static constexpr std::chrono::milliseconds kWaitForAclDataTimeout(1000);
 static constexpr std::chrono::milliseconds kInterfaceCloseDelayMs(200);
 
 static constexpr uint8_t kCommandHciShouldBeUnknown[] = {
@@ -55,15 +60,24 @@
 static constexpr uint8_t kCommandHciReadLocalVersionInformation[] = {0x01, 0x10,
                                                                      0x00};
 static constexpr uint8_t kCommandHciReadBufferSize[] = {0x05, 0x10, 0x00};
+static constexpr uint8_t kCommandHciWriteLoopbackModeLocal[] = {0x02, 0x18,
+                                                                0x01, 0x01};
 static constexpr uint8_t kCommandHciReset[] = {0x03, 0x0c, 0x00};
+static constexpr uint8_t kCommandHciSynchronousFlowControlEnable[] = {
+    0x2f, 0x0c, 0x01, 0x01};
+static constexpr uint8_t kCommandHciWriteLocalName[] = {0x13, 0x0c, 0xf8};
 static constexpr uint8_t kHciStatusSuccess = 0x00;
 static constexpr uint8_t kHciStatusUnknownHciCommand = 0x01;
 
+static constexpr uint8_t kEventConnectionComplete = 0x03;
 static constexpr uint8_t kEventCommandComplete = 0x0e;
 static constexpr uint8_t kEventCommandStatus = 0x0f;
 static constexpr uint8_t kEventNumberOfCompletedPackets = 0x13;
+static constexpr uint8_t kEventLoopbackCommand = 0x19;
 
 static constexpr size_t kEventCodeByte = 0;
+static constexpr size_t kEventLengthByte = 1;
+static constexpr size_t kEventFirstPayloadByte = 2;
 static constexpr size_t kEventCommandStatusStatusByte = 2;
 static constexpr size_t kEventCommandStatusOpcodeLsByte = 4;    // Bytes 4 and 5
 static constexpr size_t kEventCommandCompleteOpcodeLsByte = 3;  // Bytes 3 and 4
@@ -74,15 +88,33 @@
 static constexpr size_t kEventLocalLmpVersionByte =
     kEventLocalHciVersionByte + 3;
 
+static constexpr size_t kEventConnectionCompleteParamLength = 11;
+static constexpr size_t kEventConnectionCompleteType = 11;
+static constexpr size_t kEventConnectionCompleteTypeSco = 0;
+static constexpr size_t kEventConnectionCompleteTypeAcl = 1;
+static constexpr size_t kEventConnectionCompleteHandleLsByte = 3;
+
 static constexpr size_t kEventNumberOfCompletedPacketsNumHandles = 2;
 
+static constexpr size_t kAclBroadcastFlagOffset = 6;
+static constexpr uint8_t kAclBroadcastFlagPointToPoint = 0x0;
+static constexpr uint8_t kAclBroadcastPointToPoint =
+    (kAclBroadcastFlagPointToPoint << kAclBroadcastFlagOffset);
+
+static constexpr uint8_t kAclPacketBoundaryFlagOffset = 4;
+static constexpr uint8_t kAclPacketBoundaryFlagFirstAutoFlushable = 0x2;
+static constexpr uint8_t kAclPacketBoundaryFirstAutoFlushable =
+    kAclPacketBoundaryFlagFirstAutoFlushable << kAclPacketBoundaryFlagOffset;
+
 // To discard Qualcomm ACL debugging
 static constexpr uint16_t kAclHandleQcaDebugMessage = 0xedc;
 
 class ThroughputLogger {
  public:
   ThroughputLogger(std::string task)
-      : task_(task), start_time_(std::chrono::steady_clock::now()) {}
+      : total_bytes_(0),
+        task_(task),
+        start_time_(std::chrono::steady_clock::now()) {}
 
   ~ThroughputLogger() {
     if (total_bytes_ == 0) {
@@ -153,6 +185,7 @@
     ASSERT_TRUE(hci->close().isOk());
     std::this_thread::sleep_for(kInterfaceCloseDelayMs);
     handle_no_ops();
+    discard_qca_debugging();
     EXPECT_EQ(static_cast<size_t>(0), event_queue.size());
     EXPECT_EQ(static_cast<size_t>(0), sco_queue.size());
     EXPECT_EQ(static_cast<size_t>(0), acl_queue.size());
@@ -160,9 +193,18 @@
   }
 
   void setBufferSizes();
+  void setSynchronousFlowControlEnable();
+
+  // Functions called from within tests in loopback mode
+  void sendAndCheckHci(int num_packets);
+  void sendAndCheckSco(int num_packets, size_t size, uint16_t handle);
+  void sendAndCheckAcl(int num_packets, size_t size, uint16_t handle);
 
   // Helper functions to try to get a handle on verbosity
+  void reset();
+  void enterLoopbackMode();
   void handle_no_ops();
+  void discard_qca_debugging();
   void wait_for_event(bool timeout_is_error);
   void wait_for_command_complete_event(std::vector<uint8_t> cmd);
   int wait_for_completed_packets_event(uint16_t handle);
@@ -304,6 +346,9 @@
   int max_sco_data_packet_length;
   int max_acl_data_packets;
   int max_sco_data_packets;
+
+  std::vector<uint16_t> sco_connection_handles;
+  std::vector<uint16_t> acl_connection_handles;
 };
 
 // Discard NO-OPs from the event queue.
@@ -326,7 +371,10 @@
       break;
     }
   }
-  // Discard Qualcomm ACL debugging
+}
+
+// Discard Qualcomm ACL debugging
+void BluetoothAidlTest::discard_qca_debugging() {
   while (!acl_queue.empty()) {
     std::vector<uint8_t> acl_packet;
     acl_queue.front(acl_packet);
@@ -344,24 +392,28 @@
 
 // Receive an event, discarding NO-OPs.
 void BluetoothAidlTest::wait_for_event(bool timeout_is_error = true) {
-  if (timeout_is_error) {
-    ASSERT_TRUE(event_queue.waitWithTimeout(kWaitForHciEventTimeout));
-  } else {
-    event_queue.wait();
+  // Wait until we get something that's not a no-op.
+  while (true) {
+    bool event_ready = event_queue.waitWithTimeout(kWaitForHciEventTimeout);
+    ASSERT_TRUE(event_ready || !timeout_is_error);
+    if (event_queue.empty()) {
+      // waitWithTimeout timed out
+      return;
+    }
+    handle_no_ops();
+    if (!event_queue.empty()) {
+      // There's an event in the queue that's not a no-op.
+      return;
+    }
   }
-  ASSERT_LT(static_cast<size_t>(0), event_queue.size());
-  if (event_queue.empty()) {
-    // waitWithTimeout timed out
-    return;
-  }
-  handle_no_ops();
 }
 
 // Wait until a command complete is received.
 void BluetoothAidlTest::wait_for_command_complete_event(
     std::vector<uint8_t> cmd) {
-  wait_for_event();
+  ASSERT_NO_FATAL_FAILURE(wait_for_event());
   std::vector<uint8_t> event;
+  ASSERT_FALSE(event_queue.empty());
   ASSERT_TRUE(event_queue.pop(event));
 
   ASSERT_GT(event.size(), static_cast<size_t>(kEventCommandCompleteStatusByte));
@@ -378,7 +430,7 @@
       kCommandHciReadBufferSize + sizeof(kCommandHciReadBufferSize)};
   hci->sendHciCommand(cmd);
 
-  wait_for_event();
+  ASSERT_NO_FATAL_FAILURE(wait_for_event());
   if (event_queue.empty()) {
     return;
   }
@@ -406,6 +458,155 @@
         static_cast<int>(max_sco_data_packets));
 }
 
+// Enable flow control packets for SCO
+void BluetoothAidlTest::setSynchronousFlowControlEnable() {
+  std::vector<uint8_t> cmd{kCommandHciSynchronousFlowControlEnable,
+                           kCommandHciSynchronousFlowControlEnable +
+                               sizeof(kCommandHciSynchronousFlowControlEnable)};
+  hci->sendHciCommand(cmd);
+
+  wait_for_command_complete_event(cmd);
+}
+
+// Send an HCI command (in Loopback mode) and check the response.
+void BluetoothAidlTest::sendAndCheckHci(int num_packets) {
+  ThroughputLogger logger = {__func__};
+  int command_size = 0;
+  for (int n = 0; n < num_packets; n++) {
+    // Send an HCI packet
+    std::vector<uint8_t> write_name{
+        kCommandHciWriteLocalName,
+        kCommandHciWriteLocalName + sizeof(kCommandHciWriteLocalName)};
+    // With a name
+    char new_name[] = "John Jacob Jingleheimer Schmidt ___________________0";
+    size_t new_name_length = strlen(new_name);
+    for (size_t i = 0; i < new_name_length; i++) {
+      write_name.push_back(static_cast<uint8_t>(new_name[i]));
+    }
+    // And the packet number
+    size_t i = new_name_length - 1;
+    for (int digits = n; digits > 0; digits = digits / 10, i--) {
+      write_name[i] = static_cast<uint8_t>('0' + digits % 10);
+    }
+    // And padding
+    for (size_t i = 0; i < 248 - new_name_length; i++) {
+      write_name.push_back(static_cast<uint8_t>(0));
+    }
+
+    hci->sendHciCommand(write_name);
+
+    // Check the loopback of the HCI packet
+    ASSERT_NO_FATAL_FAILURE(wait_for_event());
+
+    std::vector<uint8_t> event;
+    ASSERT_TRUE(event_queue.pop(event));
+
+    size_t compare_length = (write_name.size() > static_cast<size_t>(0xff)
+                                 ? static_cast<size_t>(0xff)
+                                 : write_name.size());
+    ASSERT_GT(event.size(), compare_length + kEventFirstPayloadByte - 1);
+
+    ASSERT_EQ(kEventLoopbackCommand, event[kEventCodeByte]);
+    ASSERT_EQ(compare_length, event[kEventLengthByte]);
+
+    // Don't compare past the end of the event.
+    if (compare_length + kEventFirstPayloadByte > event.size()) {
+      compare_length = event.size() - kEventFirstPayloadByte;
+      ALOGE("Only comparing %d bytes", static_cast<int>(compare_length));
+    }
+
+    if (n == num_packets - 1) {
+      command_size = write_name.size();
+    }
+
+    for (size_t i = 0; i < compare_length; i++) {
+      ASSERT_EQ(write_name[i], event[kEventFirstPayloadByte + i]);
+    }
+  }
+  logger.setTotalBytes(command_size * num_packets * 2);
+}
+
+// Send a SCO data packet (in Loopback mode) and check the response.
+void BluetoothAidlTest::sendAndCheckSco(int num_packets, size_t size,
+                                        uint16_t handle) {
+  ThroughputLogger logger = {__func__};
+  for (int n = 0; n < num_packets; n++) {
+    // Send a SCO packet
+    std::vector<uint8_t> sco_packet;
+    sco_packet.push_back(static_cast<uint8_t>(handle & 0xff));
+    sco_packet.push_back(static_cast<uint8_t>((handle & 0x0f00) >> 8));
+    sco_packet.push_back(static_cast<uint8_t>(size & 0xff));
+    for (size_t i = 0; i < size; i++) {
+      sco_packet.push_back(static_cast<uint8_t>(i + n));
+    }
+    hci->sendScoData(sco_packet);
+
+    // Check the loopback of the SCO packet
+    std::vector<uint8_t> sco_loopback;
+    ASSERT_TRUE(
+        sco_queue.tryPopWithTimeout(sco_loopback, kWaitForScoDataTimeout));
+
+    ASSERT_EQ(sco_packet.size(), sco_loopback.size());
+    size_t successful_bytes = 0;
+
+    for (size_t i = 0; i < sco_packet.size(); i++) {
+      if (sco_packet[i] == sco_loopback[i]) {
+        successful_bytes = i;
+      } else {
+        ALOGE("Miscompare at %d (expected %x, got %x)", static_cast<int>(i),
+              sco_packet[i], sco_loopback[i]);
+        ALOGE("At %d (expected %x, got %x)", static_cast<int>(i + 1),
+              sco_packet[i + 1], sco_loopback[i + 1]);
+        break;
+      }
+    }
+    ASSERT_EQ(sco_packet.size(), successful_bytes + 1);
+  }
+  logger.setTotalBytes(num_packets * size * 2);
+}
+
+// Send an ACL data packet (in Loopback mode) and check the response.
+void BluetoothAidlTest::sendAndCheckAcl(int num_packets, size_t size,
+                                        uint16_t handle) {
+  ThroughputLogger logger = {__func__};
+  for (int n = 0; n < num_packets; n++) {
+    // Send an ACL packet
+    std::vector<uint8_t> acl_packet;
+    acl_packet.push_back(static_cast<uint8_t>(handle & 0xff));
+    acl_packet.push_back(static_cast<uint8_t>((handle & 0x0f00) >> 8) |
+                         kAclBroadcastPointToPoint |
+                         kAclPacketBoundaryFirstAutoFlushable);
+    acl_packet.push_back(static_cast<uint8_t>(size & 0xff));
+    acl_packet.push_back(static_cast<uint8_t>((size & 0xff00) >> 8));
+    for (size_t i = 0; i < size; i++) {
+      acl_packet.push_back(static_cast<uint8_t>(i + n));
+    }
+    hci->sendAclData(acl_packet);
+
+    std::vector<uint8_t> acl_loopback;
+    // Check the loopback of the ACL packet
+    ASSERT_TRUE(
+        acl_queue.tryPopWithTimeout(acl_loopback, kWaitForAclDataTimeout));
+
+    ASSERT_EQ(acl_packet.size(), acl_loopback.size());
+    size_t successful_bytes = 0;
+
+    for (size_t i = 0; i < acl_packet.size(); i++) {
+      if (acl_packet[i] == acl_loopback[i]) {
+        successful_bytes = i;
+      } else {
+        ALOGE("Miscompare at %d (expected %x, got %x)", static_cast<int>(i),
+              acl_packet[i], acl_loopback[i]);
+        ALOGE("At %d (expected %x, got %x)", static_cast<int>(i + 1),
+              acl_packet[i + 1], acl_loopback[i + 1]);
+        break;
+      }
+    }
+    ASSERT_EQ(acl_packet.size(), successful_bytes + 1);
+  }
+  logger.setTotalBytes(num_packets * size * 2);
+}
+
 // Return the number of completed packets reported by the controller.
 int BluetoothAidlTest::wait_for_completed_packets_event(uint16_t handle) {
   int packets_processed = 0;
@@ -429,11 +630,8 @@
   return packets_processed;
 }
 
-// Empty test: Initialize()/Close() are called in SetUp()/TearDown().
-TEST_P(BluetoothAidlTest, InitializeAndClose) {}
-
-// Send an HCI Reset with sendHciCommand and wait for a command complete event.
-TEST_P(BluetoothAidlTest, HciReset) {
+// Send the reset command and wait for a response.
+void BluetoothAidlTest::reset() {
   std::vector<uint8_t> reset{kCommandHciReset,
                              kCommandHciReset + sizeof(kCommandHciReset)};
   hci->sendHciCommand(reset);
@@ -441,17 +639,74 @@
   wait_for_command_complete_event(reset);
 }
 
+// Send local loopback command and initialize SCO and ACL handles.
+void BluetoothAidlTest::enterLoopbackMode() {
+  std::vector<uint8_t> cmd{kCommandHciWriteLoopbackModeLocal,
+                           kCommandHciWriteLoopbackModeLocal +
+                               sizeof(kCommandHciWriteLoopbackModeLocal)};
+  hci->sendHciCommand(cmd);
+
+  // Receive connection complete events with data channels
+  int connection_event_count = 0;
+  bool command_complete_received = false;
+  while (true) {
+    wait_for_event(false);
+    if (event_queue.empty()) {
+      // Fail if there was no event received or no connections completed.
+      ASSERT_TRUE(command_complete_received);
+      ASSERT_LT(0, connection_event_count);
+      return;
+    }
+    std::vector<uint8_t> event;
+    ASSERT_TRUE(event_queue.pop(event));
+    ASSERT_GT(event.size(),
+              static_cast<size_t>(kEventCommandCompleteStatusByte));
+    if (event[kEventCodeByte] == kEventConnectionComplete) {
+      ASSERT_GT(event.size(),
+                static_cast<size_t>(kEventConnectionCompleteType));
+      ASSERT_EQ(event[kEventLengthByte], kEventConnectionCompleteParamLength);
+      uint8_t connection_type = event[kEventConnectionCompleteType];
+
+      ASSERT_TRUE(connection_type == kEventConnectionCompleteTypeSco ||
+                  connection_type == kEventConnectionCompleteTypeAcl);
+
+      // Save handles
+      uint16_t handle = event[kEventConnectionCompleteHandleLsByte] |
+                        event[kEventConnectionCompleteHandleLsByte + 1] << 8;
+      if (connection_type == kEventConnectionCompleteTypeSco) {
+        sco_connection_handles.push_back(handle);
+      } else {
+        acl_connection_handles.push_back(handle);
+      }
+
+      ALOGD("Connect complete type = %d handle = %d",
+            event[kEventConnectionCompleteType], handle);
+      connection_event_count++;
+    } else {
+      ASSERT_EQ(kEventCommandComplete, event[kEventCodeByte]);
+      ASSERT_EQ(cmd[0], event[kEventCommandCompleteOpcodeLsByte]);
+      ASSERT_EQ(cmd[1], event[kEventCommandCompleteOpcodeLsByte + 1]);
+      ASSERT_EQ(kHciStatusSuccess, event[kEventCommandCompleteStatusByte]);
+      command_complete_received = true;
+    }
+  }
+}
+
+// Empty test: Initialize()/Close() are called in SetUp()/TearDown().
+TEST_P(BluetoothAidlTest, InitializeAndClose) {}
+
+// Send an HCI Reset with sendHciCommand and wait for a command complete event.
+TEST_P(BluetoothAidlTest, HciReset) { reset(); }
+
 // Read and check the HCI version of the controller.
 TEST_P(BluetoothAidlTest, HciVersionTest) {
+  reset();
   std::vector<uint8_t> cmd{kCommandHciReadLocalVersionInformation,
                            kCommandHciReadLocalVersionInformation +
                                sizeof(kCommandHciReadLocalVersionInformation)};
   hci->sendHciCommand(cmd);
 
-  wait_for_event();
-  if (event_queue.empty()) {
-    return;
-  }
+  ASSERT_NO_FATAL_FAILURE(wait_for_event());
 
   std::vector<uint8_t> event;
   ASSERT_TRUE(event_queue.pop(event));
@@ -468,15 +723,13 @@
 
 // Send an unknown HCI command and wait for the error message.
 TEST_P(BluetoothAidlTest, HciUnknownCommand) {
+  reset();
   std::vector<uint8_t> cmd{
       kCommandHciShouldBeUnknown,
       kCommandHciShouldBeUnknown + sizeof(kCommandHciShouldBeUnknown)};
   hci->sendHciCommand(cmd);
 
-  wait_for_event();
-  if (event_queue.empty()) {
-    return;
-  }
+  ASSERT_NO_FATAL_FAILURE(wait_for_event());
 
   std::vector<uint8_t> event;
   ASSERT_TRUE(event_queue.pop(event));
@@ -496,8 +749,121 @@
   }
 }
 
+// Enter loopback mode, but don't send any packets.
+TEST_P(BluetoothAidlTest, WriteLoopbackMode) {
+  reset();
+  enterLoopbackMode();
+}
+
+// Enter loopback mode and send a single command.
+TEST_P(BluetoothAidlTest, LoopbackModeSingleCommand) {
+  reset();
+  setBufferSizes();
+
+  enterLoopbackMode();
+
+  sendAndCheckHci(1);
+}
+
+// Enter loopback mode and send a single SCO packet.
+TEST_P(BluetoothAidlTest, LoopbackModeSingleSco) {
+  reset();
+  setBufferSizes();
+  setSynchronousFlowControlEnable();
+
+  enterLoopbackMode();
+
+  if (!sco_connection_handles.empty()) {
+    ASSERT_LT(0, max_sco_data_packet_length);
+    sendAndCheckSco(1, max_sco_data_packet_length, sco_connection_handles[0]);
+    int sco_packets_sent = 1;
+    int completed_packets =
+        wait_for_completed_packets_event(sco_connection_handles[0]);
+    if (sco_packets_sent != completed_packets) {
+      ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__,
+            sco_packets_sent, completed_packets);
+    }
+  }
+}
+
+// Enter loopback mode and send a single ACL packet.
+TEST_P(BluetoothAidlTest, LoopbackModeSingleAcl) {
+  reset();
+  setBufferSizes();
+
+  enterLoopbackMode();
+
+  if (!acl_connection_handles.empty()) {
+    ASSERT_LT(0, max_acl_data_packet_length);
+    sendAndCheckAcl(1, max_acl_data_packet_length - 1,
+                    acl_connection_handles[0]);
+    int acl_packets_sent = 1;
+    int completed_packets =
+        wait_for_completed_packets_event(acl_connection_handles[0]);
+    if (acl_packets_sent != completed_packets) {
+      ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__,
+            acl_packets_sent, completed_packets);
+    }
+  }
+  ASSERT_GE(acl_cb_count, 1);
+}
+
+// Enter loopback mode and send command packets for bandwidth measurements.
+TEST_P(BluetoothAidlTest, LoopbackModeCommandBandwidth) {
+  reset();
+  setBufferSizes();
+
+  enterLoopbackMode();
+
+  sendAndCheckHci(kNumHciCommandsBandwidth);
+}
+
+// Enter loopback mode and send SCO packets for bandwidth measurements.
+TEST_P(BluetoothAidlTest, LoopbackModeScoBandwidth) {
+  reset();
+  setBufferSizes();
+  setSynchronousFlowControlEnable();
+
+  enterLoopbackMode();
+
+  if (!sco_connection_handles.empty()) {
+    ASSERT_LT(0, max_sco_data_packet_length);
+    sendAndCheckSco(kNumScoPacketsBandwidth, max_sco_data_packet_length,
+                    sco_connection_handles[0]);
+    int sco_packets_sent = kNumScoPacketsBandwidth;
+    int completed_packets =
+        wait_for_completed_packets_event(sco_connection_handles[0]);
+    if (sco_packets_sent != completed_packets) {
+      ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__,
+            sco_packets_sent, completed_packets);
+    }
+  }
+}
+
+// Enter loopback mode and send packets for ACL bandwidth measurements.
+TEST_P(BluetoothAidlTest, LoopbackModeAclBandwidth) {
+  reset();
+  setBufferSizes();
+
+  enterLoopbackMode();
+
+  if (!acl_connection_handles.empty()) {
+    ASSERT_LT(0, max_acl_data_packet_length);
+    sendAndCheckAcl(kNumAclPacketsBandwidth, max_acl_data_packet_length - 1,
+                    acl_connection_handles[0]);
+    int acl_packets_sent = kNumAclPacketsBandwidth;
+    int completed_packets =
+        wait_for_completed_packets_event(acl_connection_handles[0]);
+    if (acl_packets_sent != completed_packets) {
+      ALOGW("%s: packets_sent (%d) != completed_packets (%d)", __func__,
+            acl_packets_sent, completed_packets);
+    }
+  }
+}
+
 // Set all bits in the event mask
 TEST_P(BluetoothAidlTest, SetEventMask) {
+  reset();
   std::vector<uint8_t> set_event_mask{
       0x01, 0x0c, 0x08 /*parameter bytes*/, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
       0xff, 0xff};
@@ -507,6 +873,7 @@
 
 // Set all bits in the LE event mask
 TEST_P(BluetoothAidlTest, SetLeEventMask) {
+  reset();
   std::vector<uint8_t> set_event_mask{
       0x20, 0x0c, 0x08 /*parameter bytes*/, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
       0xff, 0xff};
diff --git a/bluetooth/hci/h4_protocol.cc b/bluetooth/hci/h4_protocol.cc
index 97ba7aa..51a624f 100644
--- a/bluetooth/hci/h4_protocol.cc
+++ b/bluetooth/hci/h4_protocol.cc
@@ -58,10 +58,8 @@
   while (1) {
     ret = TEMP_FAILURE_RETRY(writev(uart_fd_, iov, 2));
     if (ret == -1) {
-      if (errno == EAGAIN) {
-        ALOGE("%s error writing to UART (%s)", __func__, strerror(errno));
-        continue;
-      }
+      LOG_ALWAYS_FATAL("%s error writing to UART (%s)", __func__,
+                       strerror(errno));
     } else if (ret == 0) {
       // Nothing written :(
       ALOGE("%s zero bytes written - something went wrong...", __func__);
diff --git a/camera/common/default/OWNERS b/camera/OWNERS
similarity index 65%
rename from camera/common/default/OWNERS
rename to camera/OWNERS
index f48a95c..b946264 100644
--- a/camera/common/default/OWNERS
+++ b/camera/OWNERS
@@ -1 +1,3 @@
+# Bug component: 41727
+
 include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/1.0/default/OWNERS b/camera/device/1.0/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/1.0/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/3.2/default/OWNERS b/camera/device/3.2/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/3.2/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/3.3/default/OWNERS b/camera/device/3.3/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/3.3/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/3.4/default/OWNERS b/camera/device/3.4/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/3.4/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/3.5/default/OWNERS b/camera/device/3.5/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/3.5/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/3.6/default/OWNERS b/camera/device/3.6/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/3.6/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/device/default/OWNERS b/camera/device/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/device/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/provider/2.4/default/OWNERS b/camera/provider/2.4/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/provider/2.4/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/provider/2.4/vts/OWNERS b/camera/provider/2.4/vts/OWNERS
deleted file mode 100644
index eb4f0e4..0000000
--- a/camera/provider/2.4/vts/OWNERS
+++ /dev/null
@@ -1,8 +0,0 @@
-# Bug component: 41727
-
-# Camera team
-include platform/frameworks/av:/camera/OWNERS
-
-# VTS team
-yim@google.com
-zhuoyao@google.com
diff --git a/camera/provider/2.4/vts/functional/OWNERS b/camera/provider/2.4/vts/functional/OWNERS
deleted file mode 100644
index 479f465..0000000
--- a/camera/provider/2.4/vts/functional/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Bug component: 41727
-epeev@google.com
diff --git a/camera/provider/2.5/default/OWNERS b/camera/provider/2.5/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/provider/2.5/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/camera/provider/aidl/vts/OWNERS b/camera/provider/aidl/vts/OWNERS
deleted file mode 100644
index 27d370b..0000000
--- a/camera/provider/aidl/vts/OWNERS
+++ /dev/null
@@ -1,6 +0,0 @@
-# Camera team
-include platform/frameworks/av:/camera/OWNERS
-
-# VTS team
-yim@google.com
-zhuoyao@google.com
\ No newline at end of file
diff --git a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
index 4d4bb26..50fb052 100644
--- a/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
+++ b/camera/provider/aidl/vts/VtsAidlHalCameraProvider_TargetTest.cpp
@@ -1847,7 +1847,6 @@
 // Generate and verify 10-bit dynamic range request
 TEST_P(CameraAidlTest, process10BitDynamicRangeRequest) {
     std::vector<std::string> cameraDeviceNames = getCameraDeviceNames(mProvider);
-    int64_t bufferId = 1;
     CameraMetadata settings;
 
     for (const auto& name : cameraDeviceNames) {
@@ -1928,12 +1927,12 @@
             // Stream as long as needed to fill the Hal inflight queue
             std::vector<CaptureRequest> requests(halStreams[0].maxBuffers);
 
-            for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) {
+            for (int32_t requestId = 0; requestId < requests.size(); requestId++) {
                 std::shared_ptr<InFlightRequest> inflightReq = std::make_shared<InFlightRequest>(
                         static_cast<ssize_t>(halStreams.size()), false, supportsPartialResults,
                         partialResultCount, std::unordered_set<std::string>(), resultQueue);
 
-                CaptureRequest& request = requests[frameNumber];
+                CaptureRequest& request = requests[requestId];
                 std::vector<StreamBuffer>& outputBuffers = request.outputBuffers;
                 outputBuffers.resize(halStreams.size());
 
@@ -1942,6 +1941,7 @@
                 std::vector<buffer_handle_t> graphicBuffers;
                 graphicBuffers.reserve(halStreams.size());
 
+                auto bufferId = requestId + 1; // Buffer id value 0 is not valid
                 for (const auto& halStream : halStreams) {
                     buffer_handle_t buffer_handle;
                     if (useHalBufManager) {
@@ -1960,14 +1960,13 @@
                         outputBuffers[k] = {halStream.id, bufferId,
                             android::makeToAidl(buffer_handle), BufferStatus::OK, NativeHandle(),
                             NativeHandle()};
-                        bufferId++;
                     }
                     k++;
                 }
 
                 request.inputBuffer = {
                         -1, 0, NativeHandle(), BufferStatus::ERROR, NativeHandle(), NativeHandle()};
-                request.frameNumber = frameNumber;
+                request.frameNumber = bufferId;
                 request.fmqSettingsSize = 0;
                 request.settings = settings;
                 request.inputWidth = 0;
@@ -1975,7 +1974,7 @@
 
                 {
                     std::unique_lock<std::mutex> l(mLock);
-                    mInflightMap[frameNumber] = inflightReq;
+                    mInflightMap[bufferId] = inflightReq;
                 }
 
             }
@@ -1991,7 +1990,10 @@
                     std::vector<int32_t> {halStreams[0].id});
             ASSERT_TRUE(returnStatus.isOk());
 
-            for (int32_t frameNumber = 0; frameNumber < requests.size(); frameNumber++) {
+            // We are keeping frame numbers and buffer ids consistent. Buffer id value of 0
+            // is used to indicate a buffer that is not present/available so buffer ids as well
+            // as frame numbers begin with 1.
+            for (int32_t frameNumber = 1; frameNumber <= requests.size(); frameNumber++) {
                 const auto& inflightReq = mInflightMap[frameNumber];
                 std::unique_lock<std::mutex> l(mLock);
                 while (!inflightReq->errorCodeValid &&
diff --git a/camera/provider/aidl/vts/camera_aidl_test.cpp b/camera/provider/aidl/vts/camera_aidl_test.cpp
index 974223d..6cad853 100644
--- a/camera/provider/aidl/vts/camera_aidl_test.cpp
+++ b/camera/provider/aidl/vts/camera_aidl_test.cpp
@@ -169,7 +169,7 @@
         ScopedAStatus physicalCameraDeviceStatusChange(
                 const std::string&, const std::string&,
                 ::aidl::android::hardware::camera::common::CameraDeviceStatus) override {
-            return ndk::ScopedAStatus();
+            return ScopedAStatus::ok();
         }
 
         std::vector<std::string> externalCameraDeviceNames;
diff --git a/camera/provider/aidl/vts/device_cb.cpp b/camera/provider/aidl/vts/device_cb.cpp
index 4698b4a..3ec96a1 100644
--- a/camera/provider/aidl/vts/device_cb.cpp
+++ b/camera/provider/aidl/vts/device_cb.cpp
@@ -429,10 +429,11 @@
         CameraAidlTest::InFlightRequest::StreamBufferAndTimestamp streamBufferAndTimestamp;
         auto outstandingBuffers = mUseHalBufManager ? mOutstandingBufferIds :
             request->mOutstandingBufferIds;
+        auto bufferId = mUseHalBufManager ? buffer.bufferId : results.frameNumber;
         auto outputBuffer = outstandingBuffers.empty() ? ::android::makeFromAidl(buffer.buffer) :
-            outstandingBuffers[buffer.streamId][buffer.bufferId];
+            outstandingBuffers[buffer.streamId][bufferId];
         streamBufferAndTimestamp.buffer = {buffer.streamId,
-                                           buffer.bufferId,
+                                           bufferId,
                                            outputBuffer,
                                            buffer.status,
                                            ::android::makeFromAidl(buffer.acquireFence),
diff --git a/camera/provider/default/OWNERS b/camera/provider/default/OWNERS
deleted file mode 100644
index f48a95c..0000000
--- a/camera/provider/default/OWNERS
+++ /dev/null
@@ -1 +0,0 @@
-include platform/frameworks/av:/camera/OWNERS
diff --git a/cas/OWNERS b/cas/OWNERS
new file mode 100644
index 0000000..473c8f26
--- /dev/null
+++ b/cas/OWNERS
@@ -0,0 +1 @@
+include /tv/input/OWNERS
diff --git a/cas/aidl/vts/AndroidTest.xml b/cas/aidl/vts/functional/AndroidTest.xml
similarity index 100%
rename from cas/aidl/vts/AndroidTest.xml
rename to cas/aidl/vts/functional/AndroidTest.xml
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index 5eee82c..5cbf85c 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -289,7 +289,7 @@
     </hal>
     <hal format="aidl" optional="false">
         <name>android.hardware.health</name>
-        <version>1</version>
+        <version>1-2</version>
         <interface>
             <name>IHealth</name>
             <instance>default</instance>
@@ -760,7 +760,6 @@
         <name>mapper</name>
         <version>5.0</version>
         <interface>
-            <name>I</name>
             <regex-instance>.*</regex-instance>
         </interface>
     </hal>
diff --git a/drm/README.md b/drm/README.md
new file mode 100644
index 0000000..d56288e
--- /dev/null
+++ b/drm/README.md
@@ -0,0 +1,13 @@
+# DRM HAL
+
+This is the underlying HAL implementation for `MediaDrm`/`MediaCrypto` (and
+their NDK counterparts).
+
+## Plugin-vendor-specific VTS modules
+
+The interface `DrmHalVTSVendorModule_V1` is compatible with all versions of the
+DRM HAL (hidl 1.0-1.4, aidl).
+
+Please see `./1.0/vts/doc/Drm_Vendor_Modules_v1.pdf`.
+
+TODO(b/266091099): convert `Drm_Vendor_Modules_v1.pdf` to Markdown.
\ No newline at end of file
diff --git a/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperEnrollResponse.aidl b/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperEnrollResponse.aidl
index 04bacf0..227210b 100644
--- a/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperEnrollResponse.aidl
+++ b/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperEnrollResponse.aidl
@@ -22,11 +22,12 @@
 @VintfStability
 parcelable GatekeeperEnrollResponse {
     /**
-     * Request completion status
+     * Request completion status. The status code can be IGatekeeper::STATUS_OK
+     * or IGatekeeper::ERROR_RETRY_TIMEOUT.
      */
     int statusCode;
     /**
-     * Retry timeout in ms, if code == ERROR_RETRY_TIMEOUT
+     * Retry timeout in ms, if code == IGatekeeper::ERROR_RETRY_TIMEOUT
      * otherwise unused (0)
      */
     int timeoutMs;
diff --git a/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperVerifyResponse.aidl b/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperVerifyResponse.aidl
index bcf2d76..f8dbeeb 100644
--- a/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperVerifyResponse.aidl
+++ b/gatekeeper/aidl/android/hardware/gatekeeper/GatekeeperVerifyResponse.aidl
@@ -24,11 +24,12 @@
 @VintfStability
 parcelable GatekeeperVerifyResponse {
     /**
-     * Request completion status
+     * Request completion status. The status code can be IGatekeeper::STATUS_OK
+     * or IGatekeeper::ERROR_RETRY_TIMEOUT or IGatekeeper::STATUS_REENROLL.
      */
     int statusCode;
     /**
-     * Retry timeout in ms, if code == ERROR_RETRY_TIMEOUT
+     * Retry timeout in ms, if code == IGatekeeper::ERROR_RETRY_TIMEOUT
      * otherwise unused (0)
      */
     int timeoutMs;
diff --git a/gnss/aidl/vts/gnss_hal_test_cases.cpp b/gnss/aidl/vts/gnss_hal_test_cases.cpp
index 48027b6..bed5a69 100644
--- a/gnss/aidl/vts/gnss_hal_test_cases.cpp
+++ b/gnss/aidl/vts/gnss_hal_test_cases.cpp
@@ -531,6 +531,11 @@
 
     EXPECT_EQ(gnssPowerIndicationCallback->capabilities_cbq_.calledCount(), 1);
 
+    if (gnssPowerIndicationCallback->last_capabilities_ == 0) {
+        // Skipping the test since GnssPowerIndication is not supported.
+        return;
+    }
+
     // Request and verify a GnssPowerStats is received
     gnssPowerIndicationCallback->gnss_power_stats_cbq_.reset();
     iGnssPowerIndication->requestGnssPowerStats();
diff --git a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl
index 3db134e..7d31ea3 100644
--- a/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl
+++ b/graphics/composer/aidl/aidl_api/android.hardware.graphics.composer3/current/android/hardware/graphics/composer3/OverlayProperties.aidl
@@ -38,6 +38,8 @@
   boolean supportMixedColorSpaces;
   parcelable SupportedBufferCombinations {
     android.hardware.graphics.common.PixelFormat[] pixelFormats;
-    android.hardware.graphics.common.Dataspace[] dataspaces;
+    android.hardware.graphics.common.Dataspace[] standards;
+    android.hardware.graphics.common.Dataspace[] transfers;
+    android.hardware.graphics.common.Dataspace[] ranges;
   }
 }
diff --git a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl
index 32688e2..c25eea4 100644
--- a/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl
+++ b/graphics/composer/aidl/android/hardware/graphics/composer3/OverlayProperties.aidl
@@ -19,16 +19,24 @@
 @VintfStability
 parcelable OverlayProperties {
     parcelable SupportedBufferCombinations {
-        // List of pixelformats and dataspaces that can be used together.
-        // All pixelformats and dataspaces stored inside are valid combinations.
+        // List of pixelformats, standards, transfers and ranges dataspaces that can be used
+        // together.
+        // The pixelformats, standards, transfers and ranges stored inside are valid
+        // combinations.
+        // Dataspace identifies three components of colors - standard, transfer and
+        // range.
         android.hardware.graphics.common.PixelFormat[] pixelFormats;
-        android.hardware.graphics.common.Dataspace[] dataspaces;
+        android.hardware.graphics.common.Dataspace[] standards;
+        android.hardware.graphics.common.Dataspace[] transfers;
+        android.hardware.graphics.common.Dataspace[] ranges;
     }
-    // Array of all valid pixelformat and dataspace combinations.
-    // If all supported formats work with all supported dataspaces,
+    // Array of all valid pixelformat, standard, transfer and range combinations.
+    // If all supported formats work with all standards, transfers and ranges,
     // then this list may only have 1 entry.
-    // If some dataspaces, e.g. scRGB, only work with specific formats,
-    // then this list may contain more than 1 entry.
+    // If some dataspaces, e.g. scRGB (STANDARD_BT709 | TRANSFER_SRGB | RANGE_EXTENDED),
+    // only work with specific formats, then this list may contain more than 1 entry.
+    // If some ranges, e.g. RANGE_LIMITED, only work with specific
+    // formats/standards/transfers, then this list may contain more than 1 entry.
     SupportedBufferCombinations[] combinations;
 
     // True if the DPU is able to color manage at least two overlays
diff --git a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
index 808bc59..55e0a13 100644
--- a/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
+++ b/graphics/composer/aidl/vts/VtsHalGraphicsComposer3_TargetTest.cpp
@@ -869,7 +869,7 @@
 }
 
 TEST_P(GraphicsComposerAidlTest, GetOverlaySupport) {
-    const auto& [status, _] = mComposerClient->getOverlaySupport();
+    const auto& [status, properties] = mComposerClient->getOverlaySupport();
     if (!status.isOk() && status.getExceptionCode() == EX_SERVICE_SPECIFIC &&
         status.getServiceSpecificError() == IComposerClient::EX_UNSUPPORTED) {
         GTEST_SUCCEED() << "getOverlaySupport is not supported";
@@ -877,6 +877,23 @@
     }
 
     ASSERT_TRUE(status.isOk());
+    for (const auto& i : properties.combinations) {
+        for (const auto standard : i.standards) {
+            const auto val = static_cast<int32_t>(standard) &
+                             static_cast<int32_t>(common::Dataspace::STANDARD_MASK);
+            ASSERT_TRUE(val == static_cast<int32_t>(standard));
+        }
+        for (const auto transfer : i.transfers) {
+            const auto val = static_cast<int32_t>(transfer) &
+                             static_cast<int32_t>(common::Dataspace::TRANSFER_MASK);
+            ASSERT_TRUE(val == static_cast<int32_t>(transfer));
+        }
+        for (const auto range : i.ranges) {
+            const auto val = static_cast<int32_t>(range) &
+                             static_cast<int32_t>(common::Dataspace::RANGE_MASK);
+            ASSERT_TRUE(val == static_cast<int32_t>(range));
+        }
+    }
 }
 
 TEST_P(GraphicsComposerAidlTest, GetDisplayPhysicalOrientation_BadDisplay) {
diff --git a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
index 5a450e3..1e7cb8e 100644
--- a/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
+++ b/graphics/mapper/4.0/vts/functional/VtsHalGraphicsMapperV4_0TargetTest.cpp
@@ -952,7 +952,6 @@
     EXPECT_EQ(PlaneLayoutComponentType::RAW,
               static_cast<PlaneLayoutComponentType>(planeLayoutComponent.type.value));
     EXPECT_EQ(0, planeLayoutComponent.offsetInBits % 8);
-    EXPECT_EQ(-1, planeLayoutComponent.sizeInBits);
 
     ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle)));
 }
@@ -994,7 +993,6 @@
     EXPECT_EQ(PlaneLayoutComponentType::RAW,
               static_cast<PlaneLayoutComponentType>(planeLayoutComponent.type.value));
     EXPECT_EQ(0, planeLayoutComponent.offsetInBits % 8);
-    EXPECT_EQ(-1, planeLayoutComponent.sizeInBits);
 
     ASSERT_NO_FATAL_FAILURE(fence.reset(mGralloc->unlock(bufferHandle)));
 }
diff --git a/graphics/mapper/stable-c/README.md b/graphics/mapper/stable-c/README.md
index 30f3ccc..0b9b499 100644
--- a/graphics/mapper/stable-c/README.md
+++ b/graphics/mapper/stable-c/README.md
@@ -15,7 +15,6 @@
         <name>mapper</name>
         <version>5.0</version>
         <interface>
-            <name>I</name>
             <instance>minigbm</instance>
         </interface>
     </hal>
diff --git a/graphics/mapper/stable-c/implutils/impltests.cpp b/graphics/mapper/stable-c/implutils/impltests.cpp
index f12b069..01a1db9 100644
--- a/graphics/mapper/stable-c/implutils/impltests.cpp
+++ b/graphics/mapper/stable-c/implutils/impltests.cpp
@@ -359,35 +359,35 @@
     auto mpbuf = encode<StandardMetadataType::BUFFER_ID>(42);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeBufferId(42, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, Name) {
     auto mpbuf = encode<StandardMetadataType::NAME>("Hello, Interop!");
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeName("Hello, Interop!", &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, Width) {
     auto mpbuf = encode<StandardMetadataType::WIDTH>(128);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeWidth(128, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, Height) {
     auto mpbuf = encode<StandardMetadataType::HEIGHT>(64);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeHeight(64, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, LayerCount) {
     auto mpbuf = encode<StandardMetadataType::LAYER_COUNT>(3);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeLayerCount(3, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, PixelFormatRequested) {
@@ -395,21 +395,21 @@
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodePixelFormatRequested(
                                 hardware::graphics::common::V1_2::PixelFormat::RGBX_8888, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, PixelFormatFourcc) {
     auto mpbuf = encode<StandardMetadataType::PIXEL_FORMAT_FOURCC>(DRM_FORMAT_ABGR8888);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodePixelFormatFourCC(DRM_FORMAT_ABGR8888, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, PixelFormatModifier) {
     auto mpbuf = encode<StandardMetadataType::PIXEL_FORMAT_MODIFIER>(123456);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodePixelFormatModifier(123456, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, Usage) {
@@ -420,21 +420,21 @@
                       static_cast<uint64_t>(
                               hardware::graphics::common::V1_2::BufferUsage::COMPOSER_OVERLAY),
                       &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, AllocationSize) {
     auto mpbuf = encode<StandardMetadataType::ALLOCATION_SIZE>(10200);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeAllocationSize(10200, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, ProtectedContent) {
     auto mpbuf = encode<StandardMetadataType::PROTECTED_CONTENT>(1);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeProtectedContent(1, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, Compression) {
@@ -443,14 +443,14 @@
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR,
               gralloc4::encodeCompression(gralloc4::Compression_DisplayStreamCompression, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, Interlaced) {
     auto mpbuf = encode<StandardMetadataType::INTERLACED>(gralloc4::Interlaced_TopBottom);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeInterlaced(gralloc4::Interlaced_TopBottom, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, ChromeSitting) {
@@ -459,14 +459,14 @@
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR,
               gralloc4::encodeChromaSiting(gralloc4::ChromaSiting_SitedInterstitial, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, PlaneLayouts) {
     auto mpbuf = encode<StandardMetadataType::PLANE_LAYOUTS>(fakePlaneLayouts());
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodePlaneLayouts(fakePlaneLayouts(), &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, Crop) {
@@ -474,21 +474,21 @@
     auto mpbuf = encode<StandardMetadataType::CROP>(cropRects);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeCrop(cropRects, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, Dataspace) {
     auto mpbuf = encode<StandardMetadataType::DATASPACE>(Dataspace::DISPLAY_P3);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeDataspace(Dataspace::DISPLAY_P3, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, BlendMode) {
     auto mpbuf = encode<StandardMetadataType::BLEND_MODE>(BlendMode::PREMULTIPLIED);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeBlendMode(BlendMode::PREMULTIPLIED, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, Smpte2086) {
@@ -498,7 +498,7 @@
     auto mpbuf = encode<StandardMetadataType::SMPTE2086>(hdrdata);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2086(hdrdata, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, Cta861_3) {
@@ -506,29 +506,29 @@
     auto mpbuf = encode<StandardMetadataType::CTA861_3>(hdrdata);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeCta861_3(hdrdata, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, Smpte2094_10) {
     auto mpbuf = encode<StandardMetadataType::SMPTE2094_10>(std::nullopt);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2094_10(std::nullopt, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 
     std::vector<uint8_t> hdrdata{1, 2, 3, 4, 5, 6};
     mpbuf = encode<StandardMetadataType::SMPTE2094_10>(hdrdata);
     ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2094_10(hdrdata, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
 
 TEST(MetadataGralloc4Interop, Smpte2094_40) {
     auto mpbuf = encode<StandardMetadataType::SMPTE2094_40>(std::nullopt);
     hidl_vec<uint8_t> g4buf;
     ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2094_40(std::nullopt, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 
     std::vector<uint8_t> hdrdata{1, 2, 3, 4, 5, 6};
     mpbuf = encode<StandardMetadataType::SMPTE2094_40>(hdrdata);
     ASSERT_EQ(NO_ERROR, gralloc4::encodeSmpte2094_40(hdrdata, &g4buf));
-    EXPECT_EQ(mpbuf, g4buf);
+    EXPECT_EQ(g4buf, mpbuf);
 }
diff --git a/health/aidl/Android.bp b/health/aidl/Android.bp
index 64d83f3..6d4f914 100644
--- a/health/aidl/Android.bp
+++ b/health/aidl/Android.bp
@@ -74,7 +74,7 @@
     name: "android.hardware.health-translate-ndk",
     defaults: ["android.hardware.health-translate-ndk_defaults"],
     shared_libs: [
-        "android.hardware.health-V1-ndk",
+        "android.hardware.health-V2-ndk",
     ],
 }
 
@@ -91,7 +91,7 @@
     name: "android.hardware.health-translate-java",
     srcs: ["android/hardware/health/Translate.java"],
     libs: [
-        "android.hardware.health-V1-java",
+        "android.hardware.health-V2-java",
         "android.hardware.health-V2.0-java",
         "android.hardware.health-V2.1-java",
     ],
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryChargingPolicy.aidl
similarity index 90%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryChargingPolicy.aidl
index e1fb376..42fbf95 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryChargingPolicy.aidl
@@ -31,10 +31,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.radio.ims.media;
-@VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+package android.hardware.health;
+@Backing(type="int") @VintfStability
+enum BatteryChargingPolicy {
+  INVALID = 0,
+  DEFAULT = 1,
+  LONG_LIFE = 2,
+  ADAPTIVE = 3,
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryChargingState.aidl
similarity index 86%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryChargingState.aidl
index e1fb376..e21eb28 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryChargingState.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2021 The Android Open Source Project
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -31,10 +31,13 @@
 // 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.ims.media;
-@VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+package android.hardware.health;
+@Backing(type="int") @VintfStability
+enum BatteryChargingState {
+  INVALID = 0,
+  NORMAL = 1,
+  TOO_COLD = 2,
+  TOO_HOT = 3,
+  LONG_LIFE = 4,
+  ADAPTIVE = 5,
 }
diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealth.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealth.aidl
index 4ce7952..8d13198 100644
--- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealth.aidl
+++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealth.aidl
@@ -41,4 +41,7 @@
   OVER_VOLTAGE = 5,
   UNSPECIFIED_FAILURE = 6,
   COLD = 7,
+  FAIR = 8,
+  NOT_AVAILABLE = 11,
+  INCONSISTENT = 12,
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl
similarity index 91%
rename from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
rename to health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl
index e1fb376..d523fad 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/BatteryHealthData.aidl
@@ -31,10 +31,9 @@
 // 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.ims.media;
+package android.hardware.health;
 @VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+parcelable BatteryHealthData {
+  long batteryManufacturingDateSeconds;
+  long batteryFirstUsageSeconds;
 }
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 97d9e84..664cc70 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
@@ -57,5 +57,9 @@
   android.hardware.health.BatteryCapacityLevel batteryCapacityLevel;
   long batteryChargeTimeToFullNowSeconds;
   int batteryFullChargeDesignCapacityUah;
+  int batteryStateOfHealth;
+  android.hardware.health.BatteryChargingState chargingState;
+  android.hardware.health.BatteryChargingPolicy chargingPolicy;
+  @nullable android.hardware.health.BatteryHealthData batteryHealthData;
   const int BATTERY_CHARGE_TIME_TO_FULL_NOW_SECONDS_UNSUPPORTED = -1;
 }
diff --git a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl
index 7016ae4..b49dfff 100644
--- a/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl
+++ b/health/aidl/aidl_api/android.hardware.health/current/android/hardware/health/IHealth.aidl
@@ -46,6 +46,9 @@
   android.hardware.health.StorageInfo[] getStorageInfo();
   android.hardware.health.DiskStats[] getDiskStats();
   android.hardware.health.HealthInfo getHealthInfo();
+  void setChargingPolicy(android.hardware.health.BatteryChargingPolicy in_value);
+  android.hardware.health.BatteryChargingPolicy getChargingPolicy();
+  android.hardware.health.BatteryHealthData getBatteryHealthData();
   const int STATUS_UNKNOWN = 2;
   const int STATUS_CALLBACK_DIED = 4;
 }
diff --git a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl b/health/aidl/android/hardware/health/BatteryChargingPolicy.aidl
similarity index 63%
copy from radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to health/aidl/android/hardware/health/BatteryChargingPolicy.aidl
index 61239d0..0aeee41 100644
--- a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/health/aidl/android/hardware/health/BatteryChargingPolicy.aidl
@@ -14,15 +14,25 @@
  * limitations under the License.
  */
 
-package android.hardware.radio.ims.media;
+package android.hardware.health;
 
+/**
+ * Battery charging policy.
+ */
 @VintfStability
-parcelable AnbrBitrate {
-    /** default value to represent NOT_SET */
-    const int INVALID_ANBR_BITRATE = -1;
-
-    /** Received bitrate in seconds for Uplink from NW or peer UE for ANBR */
-    int uplinkBps;
-    /** Received bitrate in secondsfor Downlink from NW or peer UE for ANBR */
-    int downlinkBps;
+@Backing(type="int")
+enum BatteryChargingPolicy {
+    INVALID = 0,
+    /**
+     * default policy
+     */
+    DEFAULT = 1,
+    /**
+     * @see BatteryChargingState.LONG_LIFE
+     */
+    LONG_LIFE = 2,
+    /**
+     * @see BatteryChargingState.ADAPTIVE
+     */
+    ADAPTIVE = 3,
 }
diff --git a/health/aidl/android/hardware/health/BatteryChargingState.aidl b/health/aidl/android/hardware/health/BatteryChargingState.aidl
new file mode 100644
index 0000000..af62077
--- /dev/null
+++ b/health/aidl/android/hardware/health/BatteryChargingState.aidl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.health;
+
+/**
+ * Possible values for Battery Health.
+ * Note: These are currently in sync with BatteryManager and must not
+ * be extended / altered.
+ */
+@VintfStability
+@Backing(type="int")
+enum BatteryChargingState {
+    INVALID = 0,
+    /**
+     * Default state.
+     */
+    NORMAL = 1,
+    /**
+     * Reported when the battery is too cold to charge at a normal
+     * rate or stopped charging due to low temperature.
+     */
+    TOO_COLD = 2,
+    /**
+     * Reported when the battery is too hot to charge at a normal
+     * rate or stopped charging due to hot temperature.
+     */
+    TOO_HOT = 3,
+    /**
+     * The device is using a special charging profile that designed
+     * to prevent accelerated aging.
+     */
+    LONG_LIFE = 4,
+    /**
+     * The device is using a special charging profile designed to
+     * improve battery cycle life, performances or both.
+     */
+    ADAPTIVE = 5,
+}
diff --git a/health/aidl/android/hardware/health/BatteryHealth.aidl b/health/aidl/android/hardware/health/BatteryHealth.aidl
index 2b6e51f..65abdc2 100644
--- a/health/aidl/android/hardware/health/BatteryHealth.aidl
+++ b/health/aidl/android/hardware/health/BatteryHealth.aidl
@@ -24,8 +24,15 @@
 @VintfStability
 @Backing(type="int")
 enum BatteryHealth {
+    /**
+     * Battery health is not supported from the device.
+     */
     UNKNOWN = 1,
     GOOD = 2,
+    /**
+     * Must be consistent with BatteryChargingState.
+     * If BatteryHealth is OVERHEAT, then BatteryChargingState must be TOO_HOT.
+     */
     OVERHEAT = 3,
     DEAD = 4,
     OVER_VOLTAGE = 5,
@@ -33,5 +40,28 @@
      * Battery experienced an unknown/unspecified failure.
      */
     UNSPECIFIED_FAILURE = 6,
+    /**
+     * Must be consistent with BatteryChargingState.
+     * If BatteryHealth is COLD, then BatteryChargingState must be TOO_COLD.
+     */
     COLD = 7,
+    /**
+     * Battery health is marginal.
+     */
+    FAIR = 8,
+    /**
+     * The reserve data below 10 are used to recognize the battery real health.
+     */
+    /**
+     * There is not enough information to determine an accurate
+     * value. The value might become UNSPECIFIED_FAILURE, DEAD
+     * or any other state except for UNKNOWN later.
+     */
+    NOT_AVAILABLE = 11,
+    /**
+     * The internal data is inconsistent and the battery needs to
+     * go through a recalibration process. The value might become
+     * UNSPECIFIED_FAILURE, DEAD or any other state except for UNKNOWN later.
+     */
+    INCONSISTENT = 12,
 }
diff --git a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl b/health/aidl/android/hardware/health/BatteryHealthData.aidl
similarity index 63%
copy from radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to health/aidl/android/hardware/health/BatteryHealthData.aidl
index 61239d0..fb17f63 100644
--- a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/health/aidl/android/hardware/health/BatteryHealthData.aidl
@@ -14,15 +14,19 @@
  * limitations under the License.
  */
 
-package android.hardware.radio.ims.media;
+package android.hardware.health;
 
+/*
+ * Battery health data
+ */
 @VintfStability
-parcelable AnbrBitrate {
-    /** default value to represent NOT_SET */
-    const int INVALID_ANBR_BITRATE = -1;
-
-    /** Received bitrate in seconds for Uplink from NW or peer UE for ANBR */
-    int uplinkBps;
-    /** Received bitrate in secondsfor Downlink from NW or peer UE for ANBR */
-    int downlinkBps;
+parcelable BatteryHealthData {
+    /**
+     * Battery manufacturing date is reported in epoch.
+     */
+    long batteryManufacturingDateSeconds;
+    /**
+     * The date of first usage is reported in epoch.
+     */
+    long batteryFirstUsageSeconds;
 }
diff --git a/health/aidl/android/hardware/health/HealthInfo.aidl b/health/aidl/android/hardware/health/HealthInfo.aidl
index 5b98baf..238f524 100644
--- a/health/aidl/android/hardware/health/HealthInfo.aidl
+++ b/health/aidl/android/hardware/health/HealthInfo.aidl
@@ -17,7 +17,10 @@
 package android.hardware.health;
 
 import android.hardware.health.BatteryCapacityLevel;
+import android.hardware.health.BatteryChargingPolicy;
+import android.hardware.health.BatteryChargingState;
 import android.hardware.health.BatteryHealth;
+import android.hardware.health.BatteryHealthData;
 import android.hardware.health.BatteryStatus;
 import android.hardware.health.DiskStats;
 import android.hardware.health.StorageInfo;
@@ -133,4 +136,23 @@
      * Value must be less than 100 000 000 µAh if known.
      */
     int batteryFullChargeDesignCapacityUah;
+    /**
+     * Measured battery state of health (remaining estimate full charge capacity
+     * relative to the rated capacity in %).
+     * Value must be 0 if batteryStatus is UNKNOWN.
+     * Otherwise, value must be in the range 0 to 100.
+     */
+    int batteryStateOfHealth;
+    /**
+     * Battery charging state
+     */
+    BatteryChargingState chargingState;
+    /**
+     * Battery charging policy. See {@link BatteryChargingPolicy} for more details.
+     */
+    BatteryChargingPolicy chargingPolicy;
+    /**
+     * Battery health data
+     */
+    @nullable BatteryHealthData batteryHealthData;
 }
diff --git a/health/aidl/android/hardware/health/IHealth.aidl b/health/aidl/android/hardware/health/IHealth.aidl
index d541eca..bdfe07a 100644
--- a/health/aidl/android/hardware/health/IHealth.aidl
+++ b/health/aidl/android/hardware/health/IHealth.aidl
@@ -16,6 +16,8 @@
 
 package android.hardware.health;
 
+import android.hardware.health.BatteryChargingPolicy;
+import android.hardware.health.BatteryHealthData;
 import android.hardware.health.BatteryStatus;
 import android.hardware.health.DiskStats;
 import android.hardware.health.HealthInfo;
@@ -102,7 +104,7 @@
      *           if this property is not supported
      *                 (e.g. the file that stores this property does not exist),
      *         - Return service specific error with code STATUS_UNKNOWN
-     *           for for other errors.
+     *           for other errors.
      */
     int getCurrentNowMicroamps();
 
@@ -120,7 +122,7 @@
      *           if this property is not supported
      *                 (e.g. the file that stores this property does not exist),
      *         - Return service specific error with code STATUS_UNKNOWN
-     *           for for other errors.
+     *           for other errors.
      */
     int getCurrentAverageMicroamps();
 
@@ -134,7 +136,7 @@
      *           if this property is not supported
      *                 (e.g. the file that stores this property does not exist),
      *         - Return service specific error with code STATUS_UNKNOWN
-     *           for for other errors.
+     *           for other errors.
      */
     int getCapacity();
 
@@ -146,7 +148,7 @@
      *         - Return exception with code EX_UNSUPPORTED_OPERATION
      *           if this property is not supported,
      *         - Return service specific error with code STATUS_UNKNOWN
-     *           for for other errors.
+     *           for other errors.
      */
     long getEnergyCounterNwh();
 
@@ -197,7 +199,47 @@
      *         - Return exception with code EX_UNSUPPORTED_OPERATION
      *           if this API is not supported,
      *         - Return service specific error with code STATUS_UNKNOWN
-     *           for for other errors.
+     *           for other errors.
      */
     HealthInfo getHealthInfo();
+
+    /**
+     * Set battery charging policy
+     *
+     * @return If error, return service specific error with code:
+     *         - Return exception with code EX_UNSUPPORTED_OPERATION
+     *           if this property is not supported
+     *                 (e.g. the file that stores this property does not exist),
+     *         - Return status with code INVALID_OPERATION
+     *           if the operation failed.
+     *         - Return service specific error with code STATUS_UNKNOWN
+     *           for other errors.
+     */
+    void setChargingPolicy(BatteryChargingPolicy in_value);
+
+    /**
+     * Get current battery charging policy
+     *
+     * @return current battery charging policy if successful.
+     *         If error:
+     *         - Return exception with code EX_UNSUPPORTED_OPERATION
+     *           if this property is not supported
+     *                 (e.g. the file that stores this property does not exist),
+     *         - Return service specific error with code STATUS_UNKNOWN
+     *           for other errors.
+     */
+    BatteryChargingPolicy getChargingPolicy();
+
+    /**
+     * Get battery health data
+     *
+     * @return Battery health data if successful.
+     *         If error:
+     *         - Return exception with code EX_UNSUPPORTED_OPERATION
+     *           if this property is not supported
+     *                 (e.g. the file that stores this property does not exist),
+     *         - Return service specific error with code STATUS_UNKNOWN
+     *           for other errors.
+     */
+    BatteryHealthData getBatteryHealthData();
 }
diff --git a/health/aidl/default/Android.bp b/health/aidl/default/Android.bp
index 4eb3cb1..b51e4f3 100644
--- a/health/aidl/default/Android.bp
+++ b/health/aidl/default/Android.bp
@@ -29,7 +29,7 @@
         "libcutils",
         "liblog",
         "libutils",
-        "android.hardware.health-V1-ndk",
+        "android.hardware.health-V2-ndk",
 
         // TODO(b/177269435): remove when BatteryMonitor works with AIDL HealthInfo.
         "libhidlbase",
@@ -48,7 +48,7 @@
     name: "libhealth_aidl_charger_defaults",
     shared_libs: [
         // common
-        "android.hardware.health-V1-ndk",
+        "android.hardware.health-V2-ndk",
         "libbase",
         "libcutils",
         "liblog",
@@ -195,7 +195,7 @@
         "service_fuzzer_defaults",
     ],
     static_libs: [
-        "android.hardware.health-V1-ndk",
+        "android.hardware.health-V2-ndk",
         "libbase",
         "liblog",
         "fuzz_libhealth_aidl_impl",
diff --git a/health/aidl/default/Health.cpp b/health/aidl/default/Health.cpp
index d41d01a..15a3dbc 100644
--- a/health/aidl/default/Health.cpp
+++ b/health/aidl/default/Health.cpp
@@ -115,6 +115,42 @@
                        BatteryStatus::UNKNOWN, out);
 }
 
+ndk::ScopedAStatus Health::setChargingPolicy(BatteryChargingPolicy in_value) {
+    ::android::status_t err = battery_monitor_.setChargingPolicy(static_cast<int>(in_value));
+
+    switch (err) {
+        case ::android::OK:
+            return ndk::ScopedAStatus::ok();
+        case ::android::NAME_NOT_FOUND:
+            return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
+        case ::android::BAD_VALUE:
+            return ndk::ScopedAStatus::fromStatus(::android::INVALID_OPERATION);
+        default:
+            return ndk::ScopedAStatus::fromServiceSpecificErrorWithMessage(
+                    IHealth::STATUS_UNKNOWN, ::android::statusToString(err).c_str());
+    }
+}
+
+ndk::ScopedAStatus Health::getChargingPolicy(BatteryChargingPolicy* out) {
+    return GetProperty(&battery_monitor_, ::android::BATTERY_PROP_CHARGING_POLICY,
+                       BatteryChargingPolicy::DEFAULT, out);
+}
+
+ndk::ScopedAStatus Health::getBatteryHealthData(BatteryHealthData* out) {
+    if (auto res =
+                GetProperty<int64_t>(&battery_monitor_, ::android::BATTERY_PROP_MANUFACTURING_DATE,
+                                     0, &out->batteryManufacturingDateSeconds);
+        !res.isOk()) {
+        LOG(WARNING) << "Cannot get Manufacturing_date: " << res.getDescription();
+    }
+    if (auto res = GetProperty<int64_t>(&battery_monitor_, ::android::BATTERY_PROP_FIRST_USAGE_DATE,
+                                        0, &out->batteryFirstUsageSeconds);
+        !res.isOk()) {
+        LOG(WARNING) << "Cannot get First_usage_date: " << res.getDescription();
+    }
+    return ndk::ScopedAStatus::ok();
+}
+
 ndk::ScopedAStatus Health::getDiskStats(std::vector<DiskStats>*) {
     // This implementation does not support DiskStats. An implementation may extend this
     // class and override this function to support disk stats.
diff --git a/health/aidl/default/android.hardware.health-service.example.xml b/health/aidl/default/android.hardware.health-service.example.xml
index 98026cb..1fe9b8d 100644
--- a/health/aidl/default/android.hardware.health-service.example.xml
+++ b/health/aidl/default/android.hardware.health-service.example.xml
@@ -1,7 +1,7 @@
 <manifest version="1.0" type="device">
     <hal format="aidl">
         <name>android.hardware.health</name>
-        <version>1</version>
+        <version>2</version>
         <fqname>IHealth/default</fqname>
     </hal>
 </manifest>
diff --git a/health/aidl/default/include/health-impl/Health.h b/health/aidl/default/include/health-impl/Health.h
index 6bd4946..dc3a0ef 100644
--- a/health/aidl/default/include/health-impl/Health.h
+++ b/health/aidl/default/include/health-impl/Health.h
@@ -72,6 +72,10 @@
     ndk::ScopedAStatus getDiskStats(std::vector<DiskStats>* out) override;
     ndk::ScopedAStatus getStorageInfo(std::vector<StorageInfo>* out) override;
 
+    ndk::ScopedAStatus setChargingPolicy(BatteryChargingPolicy in_value) override;
+    ndk::ScopedAStatus getChargingPolicy(BatteryChargingPolicy* out) override;
+    ndk::ScopedAStatus getBatteryHealthData(BatteryHealthData* out) override;
+
     // A subclass may override these to provide a different implementation.
     binder_status_t dump(int fd, const char** args, uint32_t num_args) override;
 
diff --git a/health/aidl/vts/functional/Android.bp b/health/aidl/vts/functional/Android.bp
index f9da79f..b735a87 100644
--- a/health/aidl/vts/functional/Android.bp
+++ b/health/aidl/vts/functional/Android.bp
@@ -39,7 +39,7 @@
         "libbinder_ndk",
     ],
     static_libs: [
-        "android.hardware.health-V1-ndk",
+        "android.hardware.health-V2-ndk",
         "libgmock",
     ],
     header_libs: [
diff --git a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp
index 3e07188..dd0bd81 100644
--- a/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp
+++ b/health/aidl/vts/functional/VtsHalHealthTargetTest.cpp
@@ -225,6 +225,61 @@
     ASSERT_THAT(value, IsValidEnum<BatteryStatus>());
 }
 
+/*
+ * Tests the values returned by getChargingPolicy() from interface IHealth.
+ */
+TEST_P(HealthAidl, getChargingPolicy) {
+    BatteryChargingPolicy value;
+    auto status = health->getChargingPolicy(&value);
+    ASSERT_THAT(status, AnyOf(IsOk(), ExceptionIs(EX_UNSUPPORTED_OPERATION)));
+    if (!status.isOk()) return;
+    ASSERT_THAT(value, IsValidEnum<BatteryChargingPolicy>());
+}
+
+/*
+ * Tests that setChargingPolicy() writes the value and compared the returned
+ * value by getChargingPolicy() from interface IHealth.
+ */
+TEST_P(HealthAidl, setChargingPolicy) {
+    BatteryChargingPolicy value;
+
+    /* set ChargingPolicy*/
+    auto status = health->setChargingPolicy(static_cast<BatteryChargingPolicy>(2));  // LONG_LIFE
+    ASSERT_THAT(status, AnyOf(IsOk(), ExceptionIs(EX_UNSUPPORTED_OPERATION)));
+    if (!status.isOk()) return;
+
+    /* get ChargingPolicy*/
+    status = health->getChargingPolicy(&value);
+    ASSERT_THAT(status, AnyOf(IsOk(), ExceptionIs(EX_UNSUPPORTED_OPERATION)));
+    if (!status.isOk()) return;
+    ASSERT_THAT(static_cast<int>(value), Eq(2));
+}
+
+MATCHER(IsValidHealthData, "") {
+    *result_listener << "value is " << arg.toString() << ".";
+    if (!ExplainMatchResult(Ge(-1), arg.batteryManufacturingDateSeconds, result_listener)) {
+        *result_listener << " for batteryManufacturingDateSeconds.";
+        return false;
+    }
+    if (!ExplainMatchResult(Ge(-1), arg.batteryFirstUsageSeconds, result_listener)) {
+        *result_listener << " for batteryFirstUsageSeconds.";
+        return false;
+    }
+
+    return true;
+}
+
+/*
+ * Tests the values returned by getBatteryHealthData() from interface IHealth.
+ */
+TEST_P(HealthAidl, getBatteryHealthData) {
+    BatteryHealthData value;
+    auto status = health->getBatteryHealthData(&value);
+    ASSERT_THAT(status, AnyOf(IsOk(), ExceptionIs(EX_UNSUPPORTED_OPERATION)));
+    if (!status.isOk()) return;
+    ASSERT_THAT(value, IsValidHealthData());
+}
+
 MATCHER(IsValidStorageInfo, "") {
     *result_listener << "value is " << arg.toString() << ".";
     if (!ExplainMatchResult(InClosedRange(0, 3), arg.eol, result_listener)) {
diff --git a/health/utils/libhealthshim/Android.bp b/health/utils/libhealthshim/Android.bp
index 3a1415f..14c32ae 100644
--- a/health/utils/libhealthshim/Android.bp
+++ b/health/utils/libhealthshim/Android.bp
@@ -34,7 +34,7 @@
         "-Werror",
     ],
     static_libs: [
-        "android.hardware.health-V1-ndk",
+        "android.hardware.health-V2-ndk",
         "android.hardware.health-translate-ndk",
         "android.hardware.health@1.0",
         "android.hardware.health@2.0",
diff --git a/health/utils/libhealthshim/include/health-shim/shim.h b/health/utils/libhealthshim/include/health-shim/shim.h
index f36fa5d..ff6849b 100644
--- a/health/utils/libhealthshim/include/health-shim/shim.h
+++ b/health/utils/libhealthshim/include/health-shim/shim.h
@@ -45,6 +45,9 @@
     ndk::ScopedAStatus getStorageInfo(std::vector<StorageInfo>* _aidl_return) override;
     ndk::ScopedAStatus getDiskStats(std::vector<DiskStats>* _aidl_return) override;
     ndk::ScopedAStatus getHealthInfo(HealthInfo* _aidl_return) override;
+    ndk::ScopedAStatus setChargingPolicy(BatteryChargingPolicy in_value) override;
+    ndk::ScopedAStatus getChargingPolicy(BatteryChargingPolicy* _aidl_return) override;
+    ndk::ScopedAStatus getBatteryHealthData(BatteryHealthData* _aidl_return) override;
 
   private:
     ::android::sp<HidlHealth> service_;
diff --git a/health/utils/libhealthshim/shim.cpp b/health/utils/libhealthshim/shim.cpp
index 1329679..6a5f512 100644
--- a/health/utils/libhealthshim/shim.cpp
+++ b/health/utils/libhealthshim/shim.cpp
@@ -217,4 +217,20 @@
     return ReturnAndResultToStatus(ret, out_result);
 }
 
+ScopedAStatus HealthShim::setChargingPolicy(BatteryChargingPolicy in_value) {
+    in_value = static_cast<BatteryChargingPolicy>(0);
+    return ResultToStatus(Result::NOT_SUPPORTED);
+}
+
+ScopedAStatus HealthShim::getChargingPolicy(BatteryChargingPolicy* out) {
+    *out = static_cast<BatteryChargingPolicy>(0);
+    return ResultToStatus(Result::NOT_SUPPORTED);
+}
+
+ScopedAStatus HealthShim::getBatteryHealthData(BatteryHealthData* out) {
+    out->batteryManufacturingDateSeconds = 0;
+    out->batteryFirstUsageSeconds = 0;
+    return ResultToStatus(Result::NOT_SUPPORTED);
+}
+
 }  // namespace aidl::android::hardware::health
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 0a5f8dd..8a3fd4f 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
@@ -285,7 +285,11 @@
   PDP_INACTIVE_TIMEOUT_EXPIRED = 0x873,
   PDP_LOWERLAYER_ERROR = 0x874,
   PDP_MODIFY_COLLISION = 0x875,
+  /**
+   * @deprecated use MAXIMUM_SIZE_OF_L2_MESSAGE_EXCEEDED instead.
+   */
   MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876,
+  MAXIMUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876,
   NAS_REQUEST_REJECTED_BY_NETWORK = 0x877,
   RRC_CONNECTION_INVALID_REQUEST = 0x878,
   RRC_CONNECTION_TRACKING_AREA_ID_CHANGED = 0x879,
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrMode.aidl
similarity index 90%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrMode.aidl
index e1fb376..c108c07 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrMode.aidl
@@ -32,9 +32,8 @@
 // later when a module using the interface is updated, e.g., Mainline modules.
 
 package android.hardware.radio.ims.media;
-@VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+@JavaDerive(toString=true) @VintfStability
+parcelable AnbrMode {
+  android.hardware.radio.ims.media.CodecMode anbrUplinkMode;
+  android.hardware.radio.ims.media.CodecMode anbrDownlinkMode;
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecMode.aidl
similarity index 90%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecMode.aidl
index e1fb376..0e9140f 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/CodecMode.aidl
@@ -32,9 +32,9 @@
 // later when a module using the interface is updated, e.g., Mainline modules.
 
 package android.hardware.radio.ims.media;
-@VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+@JavaDerive(toString=true) @VintfStability
+union CodecMode {
+  boolean noinit;
+  android.hardware.radio.ims.media.AmrMode amr;
+  android.hardware.radio.ims.media.EvsMode evs;
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
index ad8b86c..1a8921e 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/RtpConfig.aidl
@@ -39,5 +39,5 @@
   android.hardware.radio.ims.media.RtpAddress remoteAddress;
   android.hardware.radio.ims.media.RtpSessionParams sessionParams;
   android.hardware.radio.ims.media.RtcpConfig rtcpConfig;
-  android.hardware.radio.ims.media.AnbrBitrate anbrBitrateParams;
+  android.hardware.radio.ims.media.AnbrMode anbrModeParams;
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl
index 4e2fe45..3700de3 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl
+++ b/radio/aidl/aidl_api/android.hardware.radio.sim/current/android/hardware/radio/sim/CarrierRestrictions.aidl
@@ -38,7 +38,6 @@
   android.hardware.radio.sim.Carrier[] excludedCarriers;
   boolean allowedCarriersPrioritized;
   android.hardware.radio.sim.CarrierRestrictions.CarrierRestrictionStatus status;
-  int carrierId;
   @Backing(type="int") @VintfStability
   enum CarrierRestrictionStatus {
     UNKNOWN = 0,
diff --git a/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl b/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl
index 29ece76..071ce55 100644
--- a/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl
+++ b/radio/aidl/android/hardware/radio/data/DataCallFailCause.aidl
@@ -911,10 +911,14 @@
      */
     PDP_MODIFY_COLLISION = 0x875,
     /**
-     * Maximum size of the L2 message was exceeded.
+     * @deprecated use MAXIMUM_SIZE_OF_L2_MESSAGE_EXCEEDED instead.
      */
     MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876,
     /**
+     * Maximum size of the L2 message was exceeded.
+     */
+    MAXIMUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 0x876,
+    /**
      * Non-access stratum (NAS) request was rejected by the network.
      */
     NAS_REQUEST_REJECTED_BY_NETWORK = 0x877,
diff --git a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/android/hardware/radio/ims/media/AnbrMode.aidl
similarity index 63%
copy from radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to radio/aidl/android/hardware/radio/ims/media/AnbrMode.aidl
index 61239d0..f758cd4 100644
--- a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/radio/aidl/android/hardware/radio/ims/media/AnbrMode.aidl
@@ -16,13 +16,19 @@
 
 package android.hardware.radio.ims.media;
 
-@VintfStability
-parcelable AnbrBitrate {
-    /** default value to represent NOT_SET */
-    const int INVALID_ANBR_BITRATE = -1;
+import android.hardware.radio.ims.media.CodecMode;
 
-    /** Received bitrate in seconds for Uplink from NW or peer UE for ANBR */
-    int uplinkBps;
-    /** Received bitrate in secondsfor Downlink from NW or peer UE for ANBR */
-    int downlinkBps;
+@VintfStability
+@JavaDerive(toString=true)
+parcelable AnbrMode {
+    /**
+     * Codec mode converted from bitrate received for uplink
+     * from network or peer UE for ANBR
+     */
+    CodecMode anbrUplinkMode;
+    /**
+     * Codec mode converted from bitrate received for downlink
+     * from network or peer UE for ANBR
+     */
+    CodecMode anbrDownlinkMode;
 }
diff --git a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl b/radio/aidl/android/hardware/radio/ims/media/CodecMode.aidl
similarity index 63%
rename from radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl
rename to radio/aidl/android/hardware/radio/ims/media/CodecMode.aidl
index 61239d0..aa1b3a4 100644
--- a/radio/aidl/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/radio/aidl/android/hardware/radio/ims/media/CodecMode.aidl
@@ -16,13 +16,16 @@
 
 package android.hardware.radio.ims.media;
 
-@VintfStability
-parcelable AnbrBitrate {
-    /** default value to represent NOT_SET */
-    const int INVALID_ANBR_BITRATE = -1;
+import android.hardware.radio.ims.media.AmrMode;
+import android.hardware.radio.ims.media.EvsMode;
 
-    /** Received bitrate in seconds for Uplink from NW or peer UE for ANBR */
-    int uplinkBps;
-    /** Received bitrate in secondsfor Downlink from NW or peer UE for ANBR */
-    int downlinkBps;
+@VintfStability
+@JavaDerive(toString=true)
+union CodecMode {
+    /** Default value */
+    boolean noinit;
+    /** AMR codec mode to represent the bit rate. See 3ggp Specs 26.976 & 26.071 */
+    AmrMode amr;
+    /** EVS codec mode to represent the bit rate. See 3ggp Spec 26.952 Table 5.1 */
+    EvsMode evs;
 }
diff --git a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
index d0d849e..f6696f7 100644
--- a/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
+++ b/radio/aidl/android/hardware/radio/ims/media/RtpConfig.aidl
@@ -17,7 +17,7 @@
 package android.hardware.radio.ims.media;
 
 import android.hardware.radio.AccessNetwork;
-import android.hardware.radio.ims.media.AnbrBitrate;
+import android.hardware.radio.ims.media.AnbrMode;
 import android.hardware.radio.ims.media.MediaDirection;
 import android.hardware.radio.ims.media.RtcpConfig;
 import android.hardware.radio.ims.media.RtpAddress;
@@ -36,13 +36,14 @@
     /** RTCP configuration */
     RtcpConfig rtcpConfig;
     /**
-     * ANBR Bitrate parameters. This is set to valid only when its triggered,
+     * ANBR Mode parameters. This is set to valid only when its triggered,
      * otherwise it shall be set to NULL.
      *
      * This would be used in the following two cases
      * - IImsMediaSession#modifySession(RtpConfig) - When RAN wants to change the bit
-     *   rate via ANBR MAC layer signaling, ImsStack would set the values and direction
-     *   and pass it in the modifySession(). The underlying RTP stack shall adapt to
+     *   rate via ANBR MAC layer signaling, ImsStack converts the received bitrate
+     *   to the codec mode appropriately and passes the codec mode and direction
+     *   using modifySession(). The underlying RTP stack shall adapt to
      *   the changed bitrate.
      *
      * - IImsMediaSessionListener#triggerAnbrQuery(RtpConfig) - When the vendor RTP
@@ -50,5 +51,5 @@
      *   RTCP-APP or TMMBR, it triggers ANBRQ by setting the desired bitrate and the
      *   direction of the stream.
      */
-    AnbrBitrate anbrBitrateParams;
+    AnbrMode anbrModeParams;
 }
diff --git a/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl b/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl
index 5a79f0f..edbec2c 100644
--- a/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl
+++ b/radio/aidl/android/hardware/radio/sim/CarrierRestrictions.aidl
@@ -58,9 +58,4 @@
     boolean allowedCarriersPrioritized;
     /** Current restriction status as defined in CarrierRestrictionStatus enum */
     CarrierRestrictionStatus status;
-    /**
-    * Android carrier ID of the locked carrier.
-    * see https://source.android.com/docs/core/connect/carrierid
-    */
-    int carrierId;
 }
diff --git a/security/keymint/aidl/vts/functional/Android.bp b/security/keymint/aidl/vts/functional/Android.bp
index 58b0645..26e91bd 100644
--- a/security/keymint/aidl/vts/functional/Android.bp
+++ b/security/keymint/aidl/vts/functional/Android.bp
@@ -34,6 +34,7 @@
         "libbinder",
         "libbinder_ndk",
         "libcrypto",
+        "libbase",
         "packagemanager_aidl-cpp",
     ],
     static_libs: [
diff --git a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
index ea4ba18..970ae67 100644
--- a/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
+++ b/security/keymint/aidl/vts/functional/AttestKeyTest.cpp
@@ -15,6 +15,8 @@
  */
 
 #define LOG_TAG "keymint_1_attest_key_test"
+#include <android-base/logging.h>
+#include <android-base/strings.h>
 #include <cutils/log.h>
 #include <cutils/properties.h>
 
@@ -26,12 +28,61 @@
 namespace aidl::android::hardware::security::keymint::test {
 
 namespace {
+string TELEPHONY_CMD_GET_IMEI = "cmd phone get-imei ";
 
 bool IsSelfSigned(const vector<Certificate>& chain) {
     if (chain.size() != 1) return false;
     return ChainSignaturesAreValid(chain);
 }
 
+/*
+ * Run a shell command and collect the output of it. If any error, set an empty string as the
+ * output.
+ */
+string exec_command(string command) {
+    char buffer[128];
+    string result = "";
+
+    FILE* pipe = popen(command.c_str(), "r");
+    if (!pipe) {
+        LOG(ERROR) << "popen failed.";
+        return result;
+    }
+
+    // read till end of process:
+    while (!feof(pipe)) {
+        if (fgets(buffer, 128, pipe) != NULL) {
+            result += buffer;
+        }
+    }
+
+    pclose(pipe);
+    return result;
+}
+
+/*
+ * Get IMEI using Telephony service shell command. If any error while executing the command
+ * then empty string will be returned as output.
+ */
+string get_imei(int slot) {
+    string cmd = TELEPHONY_CMD_GET_IMEI + std::to_string(slot);
+    string output = exec_command(cmd);
+
+    if (output.empty()) {
+        LOG(ERROR) << "Command failed. Cmd: " << cmd;
+        return "";
+    }
+
+    vector<string> out = ::android::base::Tokenize(::android::base::Trim(output), "Device IMEI:");
+
+    if (out.size() != 1) {
+        LOG(ERROR) << "Error in parsing the command output. Cmd: " << cmd;
+        return "";
+    }
+
+    return ::android::base::Trim(out[0]);
+}
+
 }  // namespace
 
 class AttestKeyTest : public KeyMintAidlTestBase {
@@ -803,6 +854,11 @@
                       "ro.product.manufacturer");
     add_tag_from_prop(&attestation_id_tags, TAG_ATTESTATION_ID_MODEL, "ro.product.model");
 
+    string imei = get_imei(0);
+    if (!imei.empty()) {
+        attestation_id_tags.Authorization(TAG_ATTESTATION_ID_IMEI, imei.data(), imei.size());
+    }
+
     for (const KeyParameter& tag : attestation_id_tags) {
         SCOPED_TRACE(testing::Message() << "+tag-" << tag);
         // Use attestation key to sign an ECDSA key, but include an attestation ID field.
diff --git a/security/keymint/aidl/vts/functional/KeyBlobUpgradeTest.cpp b/security/keymint/aidl/vts/functional/KeyBlobUpgradeTest.cpp
index c952012..2091b4b 100644
--- a/security/keymint/aidl/vts/functional/KeyBlobUpgradeTest.cpp
+++ b/security/keymint/aidl/vts/functional/KeyBlobUpgradeTest.cpp
@@ -588,7 +588,7 @@
             ASSERT_EQ(ErrorCode::OK, DeleteKey(&keyblob));
 
             // Remove all files relating to the deleted key.
-            std::cerr << "Deleting files for deleted key '" << name << ";";
+            std::cerr << "Deleting files for deleted key '" << name << "';\n";
             delete_keyblob(subdir, name);
 
             // Attempting to use the keyblob after deletion should fail.
diff --git a/security/rkp/CHANGELOG.md b/security/rkp/CHANGELOG.md
index 715cf28..9409a6d 100644
--- a/security/rkp/CHANGELOG.md
+++ b/security/rkp/CHANGELOG.md
@@ -41,6 +41,7 @@
       payload and the implementation-defined payload itself. This is done by creating a typed
       `AuthenticatedRequest<T>` object representing the top level data required to authenticate
       the data provided in the payload, `T`.
+  * The new CSR format supports P-384 signing keys and SHA-384 hashes in the DICE chain.
 * RpcHardwareInfo
   * `supportedNumKeysInCsr` added to report the maximum number of keys supported in a CSR.
   * `supportedEekCurve` is no longer used, due to the removal of the EEK from the scheme.
diff --git a/security/rkp/README.md b/security/rkp/README.md
index 5fb4948..9090ac5 100644
--- a/security/rkp/README.md
+++ b/security/rkp/README.md
@@ -172,31 +172,28 @@
 
 *   ECDSA P-256 for attestation signing keys;
 *   Remote provisioning protocol signing keys:
-  *  Ed25519 / P-256
+  *  Ed25519 / P-256 / P-384
 *   ECDH keys:
   *  X25519 / P-256
 *   AES-GCM for all encryption;
-*   SHA-256 for all message digesting;
-*   HMAC-SHA-256 for all MACing; and
-*   HKDF-SHA-256 for all key derivation.
+*   SHA-256 / SHA-384 / SHA-512 for message digesting;
+*   HMAC with a supported message digest for all MACing; and
+*   HKDF with a supported message digest for all key derivation.
 
 We believe that Curve25519 offers the best tradeoff in terms of security,
 efficiency and global trustworthiness, and that it is now sufficiently
 widely-used and widely-implemented to make it a practical choice.
 
-However, since Secure Elements (SE) do not currently offer support for curve
-25519, we are allowing implementations to instead make use of EC P-256 for
-signing and ECDH. To put it simply, the device unique key pair will be a P-256
-key pair for ECDSA instead of Ed25519, and the ProtectedData COSE\_Encrypt
-message will have its payload encrypted with P-256 ECDH key exchange instead of
-X25519.
+However, since hardware such as Secure Elements (SE) do not currently offer
+support for curve 25519, we are allowing implementations to instead make use of
+ECDSA and ECDH.
 
 The CDDL in the rest of the document will use the '/' operator to show areas
-where either curve 25519 or P-256 may be used. Since there is no easy way to
-bind choices across different CDDL groups, it is important that the implementor
-stays consistent in which type is chosen. E.g. taking ES256 as the choice for
-algorithm implies the implementor should also choose the P256 public key group
-further down in the COSE structure.
+where either curve 25519, P-256 or P-384 may be used. Since there is no easy way
+to bind choices across different CDDL groups, it is important that the
+implementor stays consistent in which type is chosen. E.g. taking ES256 as the
+choice for algorithm implies the implementor should also choose the P256 public
+key group further down in the COSE structure.
 
 ### Testability
 
diff --git a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
index 75990da..5bd2145 100644
--- a/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
+++ b/security/rkp/aidl/android/hardware/security/keymint/IRemotelyProvisionedComponent.aidl
@@ -159,18 +159,27 @@
      *        IRemotelyProvisionedComponent must validate the MACs on each key.  If any entry in the
      *        array lacks a valid MAC, the method must return STATUS_INVALID_MAC.
      *
-     *        If testMode is true, the keysToCertify array must contain only keys flagged as test
+     *        If testMode is true, the keysToSign array must contain only keys flagged as test
      *        keys. Otherwise, the method must return STATUS_PRODUCTION_KEY_IN_TEST_REQUEST.
      *
-     *        If testMode is false, the keysToCertify array must not contain any keys flagged as
+     *        If testMode is false, the keysToSign array must not contain any keys flagged as
      *        test keys. Otherwise, the method must return STATUS_TEST_KEY_IN_PRODUCTION_REQUEST.
      *
-     * @param in endpointEncryptionKey contains an X25519 public key which will be used to encrypt
-     *        the BCC. For flexibility, this is represented as a certificate chain, represented as a
-     *        CBOR array of COSE_Sign1 objects, ordered from root to leaf. The leaf contains the
-     *        X25519 encryption key, each other element is an Ed25519 key signing the next in the
-     *        chain. The root is self-signed. An implementor may also choose to use P256 as an
-     *        alternative curve for signing and encryption instead of Curve 25519.
+     * @param in endpointEncryptionKey contains an X25519 or P-256 public key which will be used to
+     *        encrypt the BCC. For flexibility, this is represented as a certificate chain
+     *        in the form of a CBOR array of COSE_Sign1 objects, ordered from root to leaf.  An
+     *        implementor may also choose to use P256 as an alternative curve for signing and
+     *        encryption instead of Curve 25519, as indicated by the supportedEekCurve field in
+     *        RpcHardwareInfo; the contents of the EEK chain will match the specified
+     *        supportedEekCurve.
+     *
+     *        - For CURVE_25519 the leaf contains the X25519 agreement key, each other element is an
+     *          Ed25519 key signing the next in the chain.
+     *
+     *        - For CURVE_P256 the leaf contains the P-256 agreement key, each other element is a
+     *          P-256 key signing the next in the chain.
+     *
+     *        In either case, the root is self-signed.
      *
      *            EekChain = [ + SignedSignatureKey, SignedEek ]
      *
@@ -342,7 +351,7 @@
      *
      * ; COSE_Sign1 (untagged)
      * SignedData<Data> = [
-     *     protected: bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 },
+     *     protected: bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 / AlgorithmES384 },
      *     unprotected: {},
      *     payload: bstr .cbor Data / nil,
      *     signature: bstr      ; PureEd25519(CDI_Leaf_Priv, SignedDataSigStruct<Data>) /
@@ -352,7 +361,7 @@
      * ; Sig_structure for SignedData
      * SignedDataSigStruct<Data> = [
      *     context: "Signature1",
-     *     protected: bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 },
+     *     protected: bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 / AlgorithmES384 },
      *     external_aad: bstr .size 0,
      *     payload: bstr .cbor Data / nil,
      * ]
@@ -384,7 +393,7 @@
      * ; after the first describe a link in the boot chain (e.g. bootloaders: BL1, BL2, ... BLN)
      * ; Note that there is no DiceChainEntry for UDS_pub, only a "bare" COSE_key.
      * DiceCertChain = [
-     *     PubKeyEd25519 / PubKeyECDSA256,  ; UDS_Pub
+     *     PubKeyEd25519 / PubKeyECDSA256 / PubKeyECDSA384,  ; UDS_Pub
      *     + DiceChainEntry,                ; First CDI_Certificate -> Last CDI_Certificate
      *                                      ; Last certificate corresponds to KeyMint's DICE key.
      * ]
@@ -392,16 +401,17 @@
      * ; This is the signed payload for each entry in the DICE chain. Note that the "Configuration
      * ; Input Values" described by the Open Profile are not used here. Instead, the DICE chain
      * ; defines its own configuration values for the Configuration Descriptor field. See
-     * ; the Open Profile for DICE for more details on the fields. SHA256 and SHA512 are acceptable
-     * ; hash algorithms. The digest bstr values in the payload are the digest values without any
-     * ; padding. Note that for SHA256, this implies the digest bstr is 32 bytes. This is an
-     * ; intentional, minor deviation from Open Profile for DICE, which specifies all digests are
-     * ; 64 bytes.
+     * ; the Open Profile for DICE for more details on the fields. SHA256, SHA384 and SHA512 are
+     * ; acceptable hash algorithms. The digest bstr values in the payload are the digest values
+     * ; without any padding. Note that this implies that the digest is a 32-byte bstr for SHA256
+     * ; and a 48-byte bstr for SHA384. This is an intentional, minor deviation from Open Profile
+     * ; for DICE, which specifies all digests are 64 bytes.
      * DiceChainEntryPayload = {                    ; CWT [RFC8392]
      *     1 : tstr,                                ; Issuer
      *     2 : tstr,                                ; Subject
      *     -4670552 : bstr .cbor PubKeyEd25519 /
-     *                bstr .cbor PubKeyECDSA256,    ; Subject Public Key
+     *                bstr .cbor PubKeyECDSA256,
+     *                bstr .cbor PubKeyECDSA384,    ; Subject Public Key
      *     -4670553 : bstr                          ; Key Usage
      *
      *     ; NOTE: All of the following fields may be omitted for a "Degenerate DICE Chain", as
@@ -422,7 +432,7 @@
      * ; Each entry in the DICE chain is a DiceChainEntryPayload signed by the key from the previous
      * ; entry in the DICE chain array.
      * DiceChainEntry = [                            ; COSE_Sign1 (untagged)
-     *     protected : bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 },
+     *     protected : bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 / AlgorithmES384 },
      *     unprotected: {},
      *     payload: bstr .cbor DiceChainEntryPayload,
      *     signature: bstr ; PureEd25519(SigningKey, DiceChainEntryInput) /
@@ -433,7 +443,7 @@
      *
      * DiceChainEntryInput = [
      *     context: "Signature1",
-     *     protected: bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 },
+     *     protected: bstr .cbor { 1 : AlgorithmEdDSA / AlgorithmES256 / AlgorithmES384 },
      *     external_aad: bstr .size 0,
      *     payload: bstr .cbor DiceChainEntryPayload
      * ]
@@ -458,7 +468,16 @@
      *     -3 : bstr                    ; Y coordinate, big-endian
      * }
      *
+     * PubKeyECDSA384 = {               ; COSE_Key
+     *     1 : 2,                       ; Key type : EC2
+     *     3 : AlgorithmES384,          ; Algorithm : ECDSA w/ SHA-384
+     *     -1 : 2,                      ; Curve: P384
+     *     -2 : bstr,                   ; X coordinate
+     *     -3 : bstr                    ; Y coordinate
+     * }
+     *
      * AlgorithmES256 = -7
+     * AlgorithmES384 = -35
      * AlgorithmEdDSA = -8
      */
     byte[] generateCertificateRequestV2(in MacedPublicKey[] keysToSign, in byte[] challenge);
diff --git a/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl b/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl
index bfe8417..57ee8cf 100644
--- a/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl
+++ b/security/rkp/aidl/android/hardware/security/keymint/ProtectedData.aidl
@@ -50,6 +50,8 @@
      *                                     ; salt = null
      *                                     ; info = .cbor Context (see below)
      *                                     ; K = HKDF-SHA-256(ikm, salt, info)
+     *                                     ; AAD for the encryption is a CBOR-serialized
+     *                                     ; Enc_structure (RFC 8152 s5.3) with empty external_aad.
      *         recipients : [
      *             [                       ; COSE_Recipient
      *                 protected : bstr .cbor {
@@ -65,7 +67,10 @@
      *     ]
      *
      *     ; The COSE_KDF_Context that is used to derive the ProtectedData encryption key with
-     *     ; HKDF. See details on use in ProtectedData comments above.
+     *     ; HKDF. See details on use in ProtectedData comments above. The public key data
+     *     ; included in the other field of PartyUInfo / PartyVInfo is encoded as:
+     *     ;  - a raw 32-byte public key for X25519
+     *     ;  - uncompressed SEC-1 coordinate data (0x04 || x || y) for P-256
      *     Context = [
      *         AlgorithmID : 3             ; AES-GCM 256
      *         PartyUInfo : [
@@ -138,7 +143,7 @@
      *                                            ; bytes inclusive
      *         VerifiedDeviceInfo,
      *         tag: bstr                 ; This is the tag from COSE_Mac0 of
-     *                                   ; KeysToCertify, to tie the key set to
+     *                                   ; KeysToSign, to tie the key set to
      *                                   ; the signature.
      *     ]
      *
diff --git a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl
index c8a10d1..1d2ef4a 100644
--- a/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl
+++ b/tv/hdmi/connection/aidl/android/hardware/tv/hdmi/connection/HdmiPortInfo.aidl
@@ -24,7 +24,7 @@
 @VintfStability
 parcelable HdmiPortInfo {
     HdmiPortType type;
-    int portId; // Should start from 1 which corresponds to HDMI "port 1".
+    int portId; // Output ports should start from 1 which corresponds to HDMI "port 1".
     boolean cecSupported;
     boolean arcSupported;
     boolean eArcSupported;
diff --git a/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp b/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp
index db9f4c1..2bb2c78 100644
--- a/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp
+++ b/tv/hdmi/connection/aidl/default/HdmiConnectionMock.cpp
@@ -44,7 +44,7 @@
 ScopedAStatus HdmiConnectionMock::isConnected(int32_t portId, bool* _aidl_return) {
     // Maintain port connection status and update on hotplug event
     if (portId <= mTotalPorts && portId >= 1) {
-        *_aidl_return = mPortConnectionStatus[portId];
+        *_aidl_return = mPortConnectionStatus.at(portId - 1);
     } else {
         *_aidl_return = false;
     }
@@ -130,10 +130,10 @@
 
     ALOGD("[halimp_aidl] hot plug port id %x, is connected %x", (msgBuf[0] & 0xf),
           (msgBuf[3] & 0xf));
-    mPortConnectionStatus[portId] = connected;
-    if (mPortInfos[portId].type == HdmiPortType::OUTPUT) {
+    mPortConnectionStatus.at(portId - 1) = connected;
+    if (mPortInfos.at(portId - 1).type == HdmiPortType::OUTPUT) {
         mPhysicalAddress = (connected ? 0xffff : ((msgBuf[1] << 8) | (msgBuf[2])));
-        mPortInfos[portId].physicalAddress = mPhysicalAddress;
+        mPortInfos.at(portId - 1).physicalAddress = mPhysicalAddress;
         ALOGD("[halimp_aidl] hot plug physical address %x", mPhysicalAddress);
     }
 
diff --git a/tv/hdmi/earc/aidl/default/EArcMock.cpp b/tv/hdmi/earc/aidl/default/EArcMock.cpp
index 99a845e..a3ccabf 100644
--- a/tv/hdmi/earc/aidl/default/EArcMock.cpp
+++ b/tv/hdmi/earc/aidl/default/EArcMock.cpp
@@ -54,7 +54,7 @@
 ScopedAStatus EArcMock::getState(int32_t portId, IEArcStatus* _aidl_return) {
     // Maintain port connection status and update on hotplug event
     if (portId <= mTotalPorts && portId >= 1) {
-        *_aidl_return = mPortStatus[portId];
+        *_aidl_return = mPortStatus.at(portId - 1);
     } else {
         return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
     }
@@ -65,7 +65,7 @@
 ScopedAStatus EArcMock::getLastReportedAudioCapabilities(int32_t portId,
                                                          std::vector<uint8_t>* _aidl_return) {
     if (portId <= mTotalPorts && portId >= 1) {
-        *_aidl_return = mCapabilities[portId];
+        *_aidl_return = mCapabilities.at(portId - 1);
     } else {
         return ScopedAStatus::fromExceptionCode(EX_ILLEGAL_ARGUMENT);
     }
diff --git a/tv/input/OWNERS b/tv/input/OWNERS
index a02291a..ae65f67 100644
--- a/tv/input/OWNERS
+++ b/tv/input/OWNERS
@@ -1,3 +1,4 @@
+# Bug component: 105688
 hgchen@google.com
 shubang@google.com
 quxiangfang@google.com
diff --git a/tv/input/aidl/Android.bp b/tv/input/aidl/Android.bp
index 1987174..2591151 100644
--- a/tv/input/aidl/Android.bp
+++ b/tv/input/aidl/Android.bp
@@ -14,6 +14,7 @@
     imports: [
         "android.hardware.common-V2",
         "android.media.audio.common.types-V1",
+        "android.hardware.common.fmq-V1",
     ],
     stability: "vintf",
     backend: {
diff --git a/tv/input/aidl/TEST_MAPPING b/tv/input/aidl/TEST_MAPPING
new file mode 100644
index 0000000..981e46f
--- /dev/null
+++ b/tv/input/aidl/TEST_MAPPING
@@ -0,0 +1,7 @@
+{
+  "presubmit": [
+    {
+      "name": "VtsHalTvInputTargetTest"
+    }
+  ]
+}
diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl
index f8d5e05..84fe2fb 100644
--- a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInput.aidl
@@ -38,6 +38,8 @@
   android.hardware.tv.input.TvStreamConfig[] getStreamConfigurations(in int deviceId);
   android.hardware.common.NativeHandle openStream(in int deviceId, in int streamId);
   void setCallback(in android.hardware.tv.input.ITvInputCallback callback);
+  void setTvMessageEnabled(int deviceId, int streamId, in android.hardware.tv.input.TvMessageEventType type, boolean enabled);
+  void getTvMessageQueueDesc(out android.hardware.common.fmq.MQDescriptor<byte,android.hardware.common.fmq.SynchronizedReadWrite> queue, int deviceId, int streamId);
   const int STATUS_UNKNOWN = 1;
   const int STATUS_NO_RESOURCE = 2;
   const int STATUS_INVALID_ARGUMENTS = 3;
diff --git a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl
index 7f2aff6..9747013 100644
--- a/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/ITvInputCallback.aidl
@@ -35,4 +35,5 @@
 @VintfStability
 interface ITvInputCallback {
   void notify(in android.hardware.tv.input.TvInputEvent event);
+  void notifyTvMessageEvent(in android.hardware.tv.input.TvMessageEvent event);
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl
similarity index 88%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl
index e1fb376..637b01c 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessage.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright 2022 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.
@@ -31,10 +31,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.radio.ims.media;
+package android.hardware.tv.input;
 @VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+parcelable TvMessage {
+  String subType;
+  long groupId;
+  int dataLengthBytes;
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEvent.aidl
similarity index 87%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEvent.aidl
index e1fb376..94fe665 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEvent.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright 2022 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.
@@ -31,10 +31,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.radio.ims.media;
+package android.hardware.tv.input;
 @VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+parcelable TvMessageEvent {
+  android.hardware.tv.input.TvMessageEventType type;
+  int streamId;
+  android.hardware.tv.input.TvMessage[] messages;
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEventType.aidl
similarity index 87%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEventType.aidl
index e1fb376..a033903 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/tv/input/aidl/aidl_api/android.hardware.tv.input/current/android/hardware/tv/input/TvMessageEventType.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright 2022 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.
@@ -31,10 +31,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.radio.ims.media;
-@VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+package android.hardware.tv.input;
+@Backing(type="int") @VintfStability
+enum TvMessageEventType {
+  WATERMARK = 1,
+  CLOSED_CAPTION = 2,
+  OTHER = 3,
 }
diff --git a/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl b/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl
index 31d6586..cbaf066 100644
--- a/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl
+++ b/tv/input/aidl/android/hardware/tv/input/ITvInput.aidl
@@ -17,7 +17,10 @@
 package android.hardware.tv.input;
 
 import android.hardware.common.NativeHandle;
+import android.hardware.common.fmq.MQDescriptor;
+import android.hardware.common.fmq.SynchronizedReadWrite;
 import android.hardware.tv.input.ITvInputCallback;
+import android.hardware.tv.input.TvMessageEventType;
 import android.hardware.tv.input.TvStreamConfig;
 
 @VintfStability
@@ -73,4 +76,32 @@
      * @throws ServiceSpecificException with values from the ITvInput::STATUS_* constants
      */
     void setCallback(in ITvInputCallback callback);
+
+    /**
+     * Enables or disables TV message detection for the specified stream on the device.
+     *
+     * @param deviceId The ID of the device that contains the stream to set the flag for.
+     * @param streamId The ID of the stream to set the flag for.
+     * @param type The type of {@link android.hardware.tv.input.TvMessageEventType}.
+     * @param enabled {@code true} if you want to enable TV message detection
+     *                {@code false} otherwise.
+     */
+    void setTvMessageEnabled(
+            int deviceId, int streamId, in TvMessageEventType type, boolean enabled);
+
+    /**
+     * Gets the TV message queue for the specified stream on the device.
+     *
+     * The FMQ is used to relay events that are parsed from the specified stream to the
+     * app or service responsible for processing the message. The HAL implementation
+     * is expected to parse these messages and add them to the queue as new events are
+     * detected from the stream based on whether or not they are enabled by
+     * {@link #setTvMessageEnabled(int, int, TvMessageEventType, boolean)}.
+     *
+     * @param deviceId The ID of the device that contains the stream to get the queue for.
+     * @param streamId THe ID of the stream to get the queue for.
+     * @return The descriptor of the TV message queue.
+     */
+    void getTvMessageQueueDesc(
+            out MQDescriptor<byte, SynchronizedReadWrite> queue, int deviceId, int streamId);
 }
diff --git a/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl b/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl
index fc7492d..5d47317 100644
--- a/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl
+++ b/tv/input/aidl/android/hardware/tv/input/ITvInputCallback.aidl
@@ -17,6 +17,7 @@
 package android.hardware.tv.input;
 
 import android.hardware.tv.input.TvInputEvent;
+import android.hardware.tv.input.TvMessageEvent;
 
 @VintfStability
 interface ITvInputCallback {
@@ -27,4 +28,11 @@
      * @param event Event passed to the client.
      */
     void notify(in TvInputEvent event);
+    /**
+     * Notifies the client that an TV message event has occurred. For possible event types,
+     * check TvMessageEventType.
+     *
+     * @param event Event passed to the client.
+     */
+    void notifyTvMessageEvent(in TvMessageEvent event);
 }
diff --git a/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl b/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl
new file mode 100644
index 0000000..6df1f9a
--- /dev/null
+++ b/tv/input/aidl/android/hardware/tv/input/TvMessage.aidl
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2022 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.tv.input;
+
+@VintfStability
+parcelable TvMessage {
+    /**
+     * Extended data type, like “ATSC A/336 Watermark”, “ATSC_CC”, etc. This is opaque
+     * to the framework.
+     */
+    String subType;
+    /**
+     * This group id is used to optionally identify messages that belong together, such as
+     * headers and bodies of the same event. For messages that do not have a group, this value
+     * should be -1.
+     *
+     * As -1 is a reserved value, -1 should not be used as a valid groupId.
+     */
+    long groupId;
+    int dataLengthBytes;
+}
diff --git a/tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl b/tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl
new file mode 100644
index 0000000..74a078a
--- /dev/null
+++ b/tv/input/aidl/android/hardware/tv/input/TvMessageEvent.aidl
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2022 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.tv.input;
+
+import android.hardware.tv.input.TvMessage;
+import android.hardware.tv.input.TvMessageEventType;
+
+@VintfStability
+parcelable TvMessageEvent {
+    TvMessageEventType type;
+
+    int streamId;
+    TvMessage[] messages;
+}
diff --git a/tv/input/aidl/android/hardware/tv/input/TvMessageEventType.aidl b/tv/input/aidl/android/hardware/tv/input/TvMessageEventType.aidl
new file mode 100644
index 0000000..5a5f472
--- /dev/null
+++ b/tv/input/aidl/android/hardware/tv/input/TvMessageEventType.aidl
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2022 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.tv.input;
+
+@VintfStability
+@Backing(type="int")
+enum TvMessageEventType {
+    WATERMARK = 1,
+    CLOSED_CAPTION = 2,
+    OTHER = 3,
+}
diff --git a/tv/input/aidl/default/Android.bp b/tv/input/aidl/default/Android.bp
index 66148c8..05af6a9 100644
--- a/tv/input/aidl/default/Android.bp
+++ b/tv/input/aidl/default/Android.bp
@@ -13,6 +13,10 @@
     init_rc: ["input-default.rc"],
     vintf_fragments: ["input-default.xml"],
     vendor: true,
+    cflags: [
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
     srcs: [
         "TvInput.cpp",
         "service.cpp",
@@ -23,9 +27,11 @@
     shared_libs: [
         "libbase",
         "liblog",
+        "libfmq",
         "libutils",
         "libcutils",
         "libbinder_ndk",
         "android.hardware.tv.input-V1-ndk",
+        "android.hardware.common.fmq-V1-ndk",
     ],
 }
diff --git a/tv/input/aidl/default/TvInput.cpp b/tv/input/aidl/default/TvInput.cpp
index ed12cbc..c986ef1 100644
--- a/tv/input/aidl/default/TvInput.cpp
+++ b/tv/input/aidl/default/TvInput.cpp
@@ -65,6 +65,21 @@
     return ::ndk::ScopedAStatus::ok();
 }
 
+::ndk::ScopedAStatus TvInput::setTvMessageEnabled(int32_t deviceId, int32_t streamId,
+                                                  TvMessageEventType in_type, bool enabled) {
+    ALOGV("%s", __FUNCTION__);
+    // TODO: Implement this
+    return ::ndk::ScopedAStatus::ok();
+}
+
+::ndk::ScopedAStatus TvInput::getTvMessageQueueDesc(
+        MQDescriptor<int8_t, SynchronizedReadWrite>* out_queue, int32_t in_deviceId,
+        int32_t in_streamId) {
+    ALOGV("%s", __FUNCTION__);
+    // TODO: Implement this
+    return ::ndk::ScopedAStatus::ok();
+}
+
 ::ndk::ScopedAStatus TvInput::getStreamConfigurations(int32_t in_deviceId,
                                                       vector<TvStreamConfig>* _aidl_return) {
     ALOGV("%s", __FUNCTION__);
@@ -95,8 +110,8 @@
         return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_STATE);
     }
     mStreamConfigs[in_deviceId][in_streamId]->handle = createNativeHandle(in_streamId);
-    mStreamConfigs[in_deviceId][in_streamId]->isOpen = true;
     *_aidl_return = makeToAidl(mStreamConfigs[in_deviceId][in_streamId]->handle);
+    mStreamConfigs[in_deviceId][in_streamId]->isOpen = true;
     return ::ndk::ScopedAStatus::ok();
 }
 
@@ -112,27 +127,21 @@
         ALOGW("Stream with device id %d, stream id %d is already closed", in_deviceId, in_streamId);
         return ::ndk::ScopedAStatus::fromServiceSpecificError(STATUS_INVALID_STATE);
     }
-    releaseNativeHandle(mStreamConfigs[in_deviceId][in_streamId]->handle);
+    native_handle_delete(mStreamConfigs[in_deviceId][in_streamId]->handle);
     mStreamConfigs[in_deviceId][in_streamId]->handle = nullptr;
     mStreamConfigs[in_deviceId][in_streamId]->isOpen = false;
     return ::ndk::ScopedAStatus::ok();
 }
 
 native_handle_t* TvInput::createNativeHandle(int fd) {
-    native_handle_t* nativeHandle = native_handle_create(1, 0);
-    if (nativeHandle == nullptr) {
+    native_handle_t* handle = native_handle_create(1, 1);
+    if (handle == nullptr) {
         ALOGE("[TVInput] Failed to create native_handle %d", errno);
         return nullptr;
     }
-    if (nativeHandle->numFds > 0) {
-        nativeHandle->data[0] = dup(fd);
-    }
-    return nativeHandle;
-}
-
-void TvInput::releaseNativeHandle(native_handle_t* handle) {
-    native_handle_close(handle);
-    native_handle_delete(handle);
+    handle->data[0] = dup(0);
+    handle->data[1] = fd;
+    return handle;
 }
 
 }  // namespace input
diff --git a/tv/input/aidl/default/TvInput.h b/tv/input/aidl/default/TvInput.h
index a72bca3..92e7d4c 100644
--- a/tv/input/aidl/default/TvInput.h
+++ b/tv/input/aidl/default/TvInput.h
@@ -19,6 +19,8 @@
 #include <aidl/android/hardware/tv/input/BnTvInput.h>
 #include <utils/KeyedVector.h>
 
+#include <aidl/android/hardware/tv/input/TvMessageEventType.h>
+#include <fmq/AidlMessageQueue.h>
 #include <map>
 #include "TvInputDeviceInfoWrapper.h"
 #include "TvStreamConfigWrapper.h"
@@ -26,6 +28,9 @@
 using namespace android;
 using namespace std;
 using ::aidl::android::hardware::common::NativeHandle;
+using ::aidl::android::hardware::common::fmq::MQDescriptor;
+using ::aidl::android::hardware::common::fmq::SynchronizedReadWrite;
+using ::android::AidlMessageQueue;
 
 namespace aidl {
 namespace android {
@@ -38,6 +43,11 @@
     TvInput();
 
     ::ndk::ScopedAStatus setCallback(const shared_ptr<ITvInputCallback>& in_callback) override;
+    ::ndk::ScopedAStatus setTvMessageEnabled(int32_t deviceId, int32_t streamId,
+                                             TvMessageEventType in_type, bool enabled) override;
+    ::ndk::ScopedAStatus getTvMessageQueueDesc(
+            MQDescriptor<int8_t, SynchronizedReadWrite>* out_queue, int32_t in_deviceId,
+            int32_t in_streamId) override;
     ::ndk::ScopedAStatus getStreamConfigurations(int32_t in_deviceId,
                                                  vector<TvStreamConfig>* _aidl_return) override;
     ::ndk::ScopedAStatus openStream(int32_t in_deviceId, int32_t in_streamId,
@@ -48,7 +58,6 @@
 
   private:
     native_handle_t* createNativeHandle(int fd);
-    void releaseNativeHandle(native_handle_t* handle);
 
     shared_ptr<ITvInputCallback> mCallback;
     map<int32_t, shared_ptr<TvInputDeviceInfoWrapper>> mDeviceInfos;
diff --git a/tv/input/aidl/vts/functional/Android.bp b/tv/input/aidl/vts/functional/Android.bp
index 9829b6d..22487ea 100644
--- a/tv/input/aidl/vts/functional/Android.bp
+++ b/tv/input/aidl/vts/functional/Android.bp
@@ -9,10 +9,16 @@
 
 cc_test {
     name: "VtsHalTvInputTargetTest",
-    defaults: ["VtsHalTargetTestDefaults","use_libaidlvintf_gtest_helper_static",],
+    defaults: [
+        "VtsHalTargetTestDefaults",
+        "use_libaidlvintf_gtest_helper_static",
+    ],
+    cflags: [
+        "-Werror",
+        "-Wno-unused-parameter",
+    ],
     srcs: ["VtsHalTvInputTargetTest.cpp"],
     static_libs: [
-        "android.hardware.tv.input-V1-ndk",
         "android.media.audio.common.types-V1-ndk",
         "android.hardware.common-V2-ndk",
         "libaidlcommonsupport",
@@ -24,6 +30,9 @@
     shared_libs: [
         "libbinder_ndk",
         "libvndksupport",
+        "libfmq",
+        "android.hardware.common.fmq-V1-ndk",
+        "android.hardware.tv.input-V1-ndk",
     ],
     require_root: true,
 }
diff --git a/tv/input/aidl/vts/functional/AndroidTest.xml b/tv/input/aidl/vts/functional/AndroidTest.xml
new file mode 100644
index 0000000..5549102
--- /dev/null
+++ b/tv/input/aidl/vts/functional/AndroidTest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2023 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.
+-->
+<configuration description="Runs VtsHalTvInputTargetTest.">
+    <option name="test-suite-tag" value="apct" />
+    <option name="test-suite-tag" value="apct-native" />
+
+    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer">
+    </target_preparer>
+
+    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
+        <option name="cleanup" value="true" />
+        <option name="push" value="VtsHalTvInputTargetTest->/data/local/tmp/VtsHalTvInputTargetTest" />
+    </target_preparer>
+
+    <test class="com.android.tradefed.testtype.GTest" >
+        <option name="native-test-device-path" value="/data/local/tmp" />
+        <option name="module-name" value="VtsHalTvInputTargetTest" />
+        <option name="native-test-timeout" value="30m" />
+    </test>
+</configuration>
diff --git a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp
index ec83e29..a2415b4 100644
--- a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp
+++ b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.cpp
@@ -43,6 +43,11 @@
     return ::ndk::ScopedAStatus::ok();
 }
 
+::ndk::ScopedAStatus TvInputAidlTest::TvInputCallback::notifyTvMessageEvent(
+        const TvMessageEvent& in_event) {
+    return ::ndk::ScopedAStatus::ok();
+}
+
 void TvInputAidlTest::SetUp() {
     if (AServiceManager_isDeclared(GetParam().c_str())) {
         ::ndk::SpAIBinder binder(AServiceManager_waitForService(GetParam().c_str()));
@@ -158,10 +163,11 @@
         int32_t device_id = stream_config_.keyAt(j);
         vector<TvStreamConfig> config = stream_config_.valueAt(j);
         for (size_t i = 0; i < config.size(); i++) {
+            NativeHandle handle;
             int32_t stream_id = config[i].streamId;
             ALOGD("OpenAndCloseStreamTest: open stream, device_id=%d, stream_id=%d", device_id,
                   stream_id);
-            ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle_).isOk());
+            ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle).isOk());
             ALOGD("OpenAndCloseStreamTest: close stream, device_id=%d, stream_id=%d", device_id,
                   stream_id);
             ASSERT_TRUE(tv_input_->closeStream(device_id, stream_id).isOk());
@@ -190,9 +196,10 @@
                 ITvInput::STATUS_INVALID_ARGUMENTS);
 
     int32_t stream_id = 0;
+    NativeHandle handle;
 
     ALOGD("InvalidDeviceIdTest: open stream, device_id=%d, stream_id=%d", id, stream_id);
-    ASSERT_TRUE(tv_input_->openStream(id, stream_id, &handle_).getServiceSpecificError() ==
+    ASSERT_TRUE(tv_input_->openStream(id, stream_id, &handle).getServiceSpecificError() ==
                 ITvInput::STATUS_INVALID_ARGUMENTS);
 
     ALOGD("InvalidDeviceIdTest: close stream, device_id=%d, stream_id=%d", id, stream_id);
@@ -226,8 +233,10 @@
         id = getNumNotIn(stream_ids);
     }
 
+    NativeHandle handle;
+
     ALOGD("InvalidStreamIdTest: open stream, device_id=%d, stream_id=%d", device_id, id);
-    ASSERT_TRUE(tv_input_->openStream(device_id, id, &handle_).getServiceSpecificError() ==
+    ASSERT_TRUE(tv_input_->openStream(device_id, id, &handle).getServiceSpecificError() ==
                 ITvInput::STATUS_INVALID_ARGUMENTS);
 
     ALOGD("InvalidStreamIdTest: close stream, device_id=%d, stream_id=%d", device_id, id);
@@ -252,11 +261,13 @@
     int32_t device_id = stream_config_.keyAt(indices[0]);
     int32_t stream_id = stream_config_.valueAt(indices[0])[0].streamId;
 
-    ALOGD("OpenAnOpenedStreamsTest: open stream, device_id=%d, stream_id=%d", device_id, stream_id);
-    ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle_).isOk());
+    NativeHandle handle;
 
     ALOGD("OpenAnOpenedStreamsTest: open stream, device_id=%d, stream_id=%d", device_id, stream_id);
-    ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle_).getServiceSpecificError() ==
+    ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle).isOk());
+
+    ALOGD("OpenAnOpenedStreamsTest: open stream, device_id=%d, stream_id=%d", device_id, stream_id);
+    ASSERT_TRUE(tv_input_->openStream(device_id, stream_id, &handle).getServiceSpecificError() ==
                 ITvInput::STATUS_INVALID_STATE);
 
     // close stream as subsequent tests assume no open streams
diff --git a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h
index c76e568..20d9227 100644
--- a/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h
+++ b/tv/input/aidl/vts/functional/VtsHalTvInputTargetTest.h
@@ -25,15 +25,19 @@
 #include <aidl/android/hardware/tv/input/ITvInput.h>
 #include <aidl/android/hardware/tv/input/TvInputDeviceInfo.h>
 #include <aidl/android/hardware/tv/input/TvInputEvent.h>
+#include <aidl/android/hardware/tv/input/TvMessageEvent.h>
+#include <aidl/android/hardware/tv/input/TvMessageEventType.h>
 #include <aidl/android/hardware/tv/input/TvStreamConfig.h>
+#include <fmq/AidlMessageQueue.h>
 
 #include <log/log.h>
 #include <utils/KeyedVector.h>
 
 using namespace aidl::android::hardware::tv::input;
 using namespace std;
-
 using ::aidl::android::hardware::common::NativeHandle;
+using ::aidl::android::hardware::common::fmq::MQDescriptor;
+using ::android::AidlMessageQueue;
 
 #define WAIT_FOR_EVENT_TIMEOUT 5
 #define DEFAULT_ID INT32_MIN
@@ -46,6 +50,7 @@
       public:
         TvInputCallback(shared_ptr<TvInputAidlTest> parent);
         ::ndk::ScopedAStatus notify(const TvInputEvent& in_event) override;
+        ::ndk::ScopedAStatus notifyTvMessageEvent(const TvMessageEvent& in_event) override;
 
       private:
         shared_ptr<TvInputAidlTest> parent_;
@@ -84,7 +89,6 @@
     android::KeyedVector<int32_t, TvInputDeviceInfo> device_info_;
     android::KeyedVector<int32_t, vector<TvStreamConfig>> stream_config_;
     mutex mutex_;
-    NativeHandle handle_;
 };
 
 }  // namespace VtsHalTvInputTargetTest
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettings.aidl
similarity index 75%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettings.aidl
index e1fb376..73582f3 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettings.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright 2023 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.
@@ -31,10 +31,14 @@
 // 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.ims.media;
+package android.hardware.tv.tuner;
+/* @hide */
 @VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+parcelable FrontendIptvSettings {
+  android.hardware.tv.tuner.FrontendIptvSettingsProtocol protocol = android.hardware.tv.tuner.FrontendIptvSettingsProtocol.UNDEFINED;
+  android.hardware.tv.tuner.FrontendIptvSettingsFec fec;
+  android.hardware.tv.tuner.FrontendIptvSettingsIgmp igmp = android.hardware.tv.tuner.FrontendIptvSettingsIgmp.UNDEFINED;
+  long bitrate;
+  android.hardware.tv.tuner.DemuxIpAddress ipAddr;
+  String contentUrl;
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl
similarity index 87%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl
index e1fb376..c361377 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright 2023 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.
@@ -31,10 +31,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.radio.ims.media;
+package android.hardware.tv.tuner;
+/* @hide */
 @VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+parcelable FrontendIptvSettingsFec {
+  android.hardware.tv.tuner.FrontendIptvSettingsFecType type;
+  int fecColNum;
+  int fecRowNum;
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl
similarity index 87%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl
index e1fb376..50a1208 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright 2023 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.
@@ -31,10 +31,12 @@
 // 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.ims.media;
-@VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+package android.hardware.tv.tuner;
+/* @hide */
+@Backing(type="int") @VintfStability
+enum FrontendIptvSettingsFecType {
+  UNDEFINED = 0,
+  COLUMN = 1,
+  ROW = 2,
+  COLUMN_ROW = 4,
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl
similarity index 87%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl
index e1fb376..aa08496 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright 2023 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.
@@ -31,10 +31,12 @@
 // 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.ims.media;
-@VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+package android.hardware.tv.tuner;
+/* @hide */
+@Backing(type="int") @VintfStability
+enum FrontendIptvSettingsIgmp {
+  UNDEFINED = 0,
+  V1 = 1,
+  V2 = 2,
+  V3 = 4,
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl
similarity index 87%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl
index e1fb376..08a01f1 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright 2023 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.
@@ -31,10 +31,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.radio.ims.media;
-@VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+package android.hardware.tv.tuner;
+/* @hide */
+@Backing(type="int") @VintfStability
+enum FrontendIptvSettingsProtocol {
+  UNDEFINED = 0,
+  UDP = 1,
+  RTP = 2,
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendSettings.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendSettings.aidl
index 7eae9df..9810ba6 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendSettings.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendSettings.aidl
@@ -45,4 +45,5 @@
   android.hardware.tv.tuner.FrontendIsdbs3Settings isdbs3;
   android.hardware.tv.tuner.FrontendIsdbtSettings isdbt;
   android.hardware.tv.tuner.FrontendDtmbSettings dtmb;
+  @nullable android.hardware.tv.tuner.FrontendIptvSettings iptv;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl
index 1e0f5f0..b991ab6 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatus.aidl
@@ -77,4 +77,9 @@
   int[] streamIdList;
   int[] dvbtCellIds;
   android.hardware.tv.tuner.FrontendScanAtsc3PlpInfo[] allPlpInfo;
+  String iptvContentUrl = "";
+  long iptvPacketsReceived;
+  long iptvPacketsLost;
+  int iptvWorstJitterMs;
+  int iptvAverageJitterMs;
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl
index cd6ccb3..3791299 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendStatusType.aidl
@@ -77,4 +77,9 @@
   STREAM_ID_LIST = 39,
   DVBT_CELL_IDS = 40,
   ATSC3_ALL_PLP_INFO = 41,
+  IPTV_CONTENT_URL = 42,
+  IPTV_PACKETS_LOST = 43,
+  IPTV_PACKETS_RECEIVED = 44,
+  IPTV_WORST_JITTER_MS = 45,
+  IPTV_AVERAGE_JITTER_MS = 46,
 }
diff --git a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendType.aidl b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendType.aidl
index 99a120b..cbf5b47 100644
--- a/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendType.aidl
+++ b/tv/tuner/aidl/aidl_api/android.hardware.tv.tuner/current/android/hardware/tv/tuner/FrontendType.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright 2021 The Android Open Source Project
+ * Copyright 2023 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.
@@ -46,4 +46,5 @@
   ISDBS3 = 8,
   ISDBT = 9,
   DTMB = 10,
+  IPTV = 11,
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettings.aidl
new file mode 100644
index 0000000..782695a
--- /dev/null
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettings.aidl
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2023 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.tv.tuner;
+
+import android.hardware.tv.tuner.DemuxIpAddress;
+import android.hardware.tv.tuner.FrontendIptvSettingsFec;
+import android.hardware.tv.tuner.FrontendIptvSettingsFecType;
+import android.hardware.tv.tuner.FrontendIptvSettingsIgmp;
+import android.hardware.tv.tuner.FrontendIptvSettingsProtocol;
+
+/**
+ * Frontend Settings for IPTV.
+ * @hide
+ */
+@VintfStability
+parcelable FrontendIptvSettings {
+    FrontendIptvSettingsProtocol protocol = FrontendIptvSettingsProtocol.UNDEFINED;
+
+    FrontendIptvSettingsFec fec;
+
+    FrontendIptvSettingsIgmp igmp = FrontendIptvSettingsIgmp.UNDEFINED;
+
+    long bitrate;
+
+    /**
+     * Source and destination IP Address.
+     */
+    DemuxIpAddress ipAddr;
+
+    String contentUrl;
+}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl
new file mode 100644
index 0000000..e12f06f
--- /dev/null
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFec.aidl
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2023 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.tv.tuner;
+
+import android.hardware.tv.tuner.FrontendIptvSettingsFecType;
+
+/**
+ * Configuration details for IPTV FEC.
+ * @hide
+ */
+@VintfStability
+parcelable FrontendIptvSettingsFec {
+    FrontendIptvSettingsFecType type;
+
+    /**
+     * The number of columns in the source block as well as the type of the repair packet.
+     */
+    int fecColNum;
+
+    /**
+     * The number of rows in the source block as well as the type of the repair packet.
+     */
+    int fecRowNum;
+}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl
new file mode 100644
index 0000000..421cbf8
--- /dev/null
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsFecType.aidl
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2023 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.tv.tuner;
+
+/**
+ * FEC type for IPTV.
+ * TS 102 542-3-2 - V1.3.2
+ * @hide
+ */
+@VintfStability
+@Backing(type="int")
+enum FrontendIptvSettingsFecType {
+    UNDEFINED = 0,
+
+    COLUMN = 1 << 0,
+
+    ROW = 1 << 1,
+
+    COLUMN_ROW = 1 << 2,
+}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl
new file mode 100644
index 0000000..f6e39c8
--- /dev/null
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsIgmp.aidl
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2023 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.tv.tuner;
+
+/**
+ * IGMP type for IPTV.
+ * @hide
+ */
+@VintfStability
+@Backing(type="int")
+enum FrontendIptvSettingsIgmp {
+    UNDEFINED = 0,
+
+    V1 = 1 << 0,
+
+    V2 = 1 << 1,
+
+    V3 = 1 << 2,
+}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl
new file mode 100644
index 0000000..0283445
--- /dev/null
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendIptvSettingsProtocol.aidl
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2023 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.tv.tuner;
+
+/**
+ * Protocol for IPTV.
+ * @hide
+ */
+@VintfStability
+@Backing(type="int")
+enum FrontendIptvSettingsProtocol {
+    UNDEFINED = 0,
+
+    UDP = 1 << 0,
+
+    RTP = 1 << 1,
+}
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendSettings.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendSettings.aidl
index f78b2ae..e5a99e1 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendSettings.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendSettings.aidl
@@ -19,13 +19,14 @@
 import android.hardware.tv.tuner.FrontendAnalogSettings;
 import android.hardware.tv.tuner.FrontendAtsc3Settings;
 import android.hardware.tv.tuner.FrontendAtscSettings;
+import android.hardware.tv.tuner.FrontendDtmbSettings;
 import android.hardware.tv.tuner.FrontendDvbcSettings;
 import android.hardware.tv.tuner.FrontendDvbsSettings;
 import android.hardware.tv.tuner.FrontendDvbtSettings;
+import android.hardware.tv.tuner.FrontendIptvSettings;
 import android.hardware.tv.tuner.FrontendIsdbs3Settings;
 import android.hardware.tv.tuner.FrontendIsdbsSettings;
 import android.hardware.tv.tuner.FrontendIsdbtSettings;
-import android.hardware.tv.tuner.FrontendDtmbSettings;
 
 /**
  * Signal Settings for Frontend.
@@ -52,4 +53,6 @@
     FrontendIsdbtSettings isdbt;
 
     FrontendDtmbSettings dtmb;
+
+    @nullable FrontendIptvSettings iptv;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl
index b5d0201..391f29b 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatus.aidl
@@ -26,8 +26,8 @@
 import android.hardware.tv.tuner.FrontendModulation;
 import android.hardware.tv.tuner.FrontendModulationStatus;
 import android.hardware.tv.tuner.FrontendRollOff;
-import android.hardware.tv.tuner.FrontendSpectralInversion;
 import android.hardware.tv.tuner.FrontendScanAtsc3PlpInfo;
+import android.hardware.tv.tuner.FrontendSpectralInversion;
 import android.hardware.tv.tuner.FrontendStatusAtsc3PlpInfo;
 import android.hardware.tv.tuner.FrontendTransmissionMode;
 import android.hardware.tv.tuner.LnbVoltage;
@@ -247,4 +247,29 @@
      * and not tuned PLPs for currently watching service.
      */
     FrontendScanAtsc3PlpInfo[] allPlpInfo;
+
+    /**
+     * IPTV Content URL
+     */
+    String iptvContentUrl = "";
+
+    /**
+     * Packets Received (IPTV - UDP/RTP).
+     */
+    long iptvPacketsReceived;
+
+    /**
+     * Packets Lost (IPTV - RTP).
+     */
+    long iptvPacketsLost;
+
+    /**
+     * Worst jitter (milliseconds).
+     */
+    int iptvWorstJitterMs;
+
+    /**
+     * Average jitter (milliseconds).
+     */
+    int iptvAverageJitterMs;
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusType.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusType.aidl
index 8f3f2c5..6804b2d 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusType.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendStatusType.aidl
@@ -234,4 +234,29 @@
      * and not tuned PLPs for currently watching service.
      */
     ATSC3_ALL_PLP_INFO,
+
+    /**
+     * IPTV Content URL.
+     */
+    IPTV_CONTENT_URL,
+
+    /**
+     * Number of packets lost.
+     */
+    IPTV_PACKETS_LOST,
+
+    /**
+     * Number of packets received.
+     */
+    IPTV_PACKETS_RECEIVED,
+
+    /**
+     * Worst jitter (milliseconds).
+     */
+    IPTV_WORST_JITTER_MS,
+
+    /**
+     * Average jitter (milliseconds).
+     */
+    IPTV_AVERAGE_JITTER_MS,
 }
diff --git a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendType.aidl b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendType.aidl
index 8ade389..e8d343e 100644
--- a/tv/tuner/aidl/android/hardware/tv/tuner/FrontendType.aidl
+++ b/tv/tuner/aidl/android/hardware/tv/tuner/FrontendType.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright 2021 The Android Open Source Project
+ * Copyright 2023 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.
@@ -79,4 +79,9 @@
      * DTMB (Digital Terrestrial Multimedia Broadcast) standard.
      */
     DTMB,
+
+    /**
+     * ITU IPTV (ITU-T FG IPTV)
+     */
+    IPTV,
 }
diff --git a/tv/tuner/aidl/default/Frontend.cpp b/tv/tuner/aidl/default/Frontend.cpp
index 997d9de..d140b74 100644
--- a/tv/tuner/aidl/default/Frontend.cpp
+++ b/tv/tuner/aidl/default/Frontend.cpp
@@ -875,6 +875,26 @@
                 status.set<FrontendStatus::allPlpInfo>(infos);
                 break;
             }
+            case FrontendStatusType::IPTV_CONTENT_URL: {
+                status.set<FrontendStatus::iptvContentUrl>("");
+                break;
+            }
+            case FrontendStatusType::IPTV_PACKETS_LOST: {
+                status.set<FrontendStatus::iptvPacketsLost>(5);
+                break;
+            }
+            case FrontendStatusType::IPTV_PACKETS_RECEIVED: {
+                status.set<FrontendStatus::iptvPacketsReceived>(5);
+                break;
+            }
+            case FrontendStatusType::IPTV_WORST_JITTER_MS: {
+                status.set<FrontendStatus::iptvWorstJitterMs>(5);
+                break;
+            }
+            case FrontendStatusType::IPTV_AVERAGE_JITTER_MS: {
+                status.set<FrontendStatus::iptvAverageJitterMs>(5);
+                break;
+            }
             default: {
                 continue;
             }
diff --git a/tv/tuner/aidl/default/Tuner.cpp b/tv/tuner/aidl/default/Tuner.cpp
index 0c1ae2d..197d866 100644
--- a/tv/tuner/aidl/default/Tuner.cpp
+++ b/tv/tuner/aidl/default/Tuner.cpp
@@ -38,7 +38,7 @@
 void Tuner::init() {
     // Static Frontends array to maintain local frontends information
     // Array index matches their FrontendId in the default impl
-    mFrontendSize = 10;
+    mFrontendSize = 11;
     mFrontends[0] = ndk::SharedRefBase::make<Frontend>(FrontendType::ISDBS, 0);
     mFrontends[1] = ndk::SharedRefBase::make<Frontend>(FrontendType::ATSC3, 1);
     mFrontends[2] = ndk::SharedRefBase::make<Frontend>(FrontendType::DVBC, 2);
@@ -49,6 +49,7 @@
     mFrontends[7] = ndk::SharedRefBase::make<Frontend>(FrontendType::ATSC, 7);
     mFrontends[8] = ndk::SharedRefBase::make<Frontend>(FrontendType::ISDBS3, 8);
     mFrontends[9] = ndk::SharedRefBase::make<Frontend>(FrontendType::DTMB, 9);
+    mFrontends[10] = ndk::SharedRefBase::make<Frontend>(FrontendType::IPTV, 10);
 
     mMaxUsableFrontends[FrontendType::ISDBS] = 1;
     mMaxUsableFrontends[FrontendType::ATSC3] = 1;
@@ -60,6 +61,7 @@
     mMaxUsableFrontends[FrontendType::ATSC] = 1;
     mMaxUsableFrontends[FrontendType::ISDBS3] = 1;
     mMaxUsableFrontends[FrontendType::DTMB] = 1;
+    mMaxUsableFrontends[FrontendType::IPTV] = 1;
 
     mDemuxes[0] =
             ndk::SharedRefBase::make<Demux>(0, (static_cast<int32_t>(DemuxFilterMainType::TS) |
diff --git a/tv/tuner/aidl/vts/functional/FrontendTests.cpp b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
index 2ff0c3d..b0f614e 100644
--- a/tv/tuner/aidl/vts/functional/FrontendTests.cpp
+++ b/tv/tuner/aidl/vts/functional/FrontendTests.cpp
@@ -434,6 +434,31 @@
                         expectStatuses[i].get<FrontendStatus::Tag::allPlpInfo>().begin()));
                 break;
             }
+            case FrontendStatusType::IPTV_CONTENT_URL: {
+                ASSERT_TRUE(realStatuses[i].get<FrontendStatus::Tag::iptvContentUrl>() ==
+                            expectStatuses[i].get<FrontendStatus::Tag::iptvContentUrl>());
+                break;
+            }
+            case FrontendStatusType::IPTV_PACKETS_LOST: {
+                ASSERT_TRUE(realStatuses[i].get<FrontendStatus::Tag::iptvPacketsLost>() ==
+                            expectStatuses[i].get<FrontendStatus::Tag::iptvPacketsLost>());
+                break;
+            }
+            case FrontendStatusType::IPTV_PACKETS_RECEIVED: {
+                ASSERT_TRUE(realStatuses[i].get<FrontendStatus::Tag::iptvPacketsReceived>() ==
+                            expectStatuses[i].get<FrontendStatus::Tag::iptvPacketsReceived>());
+                break;
+            }
+            case FrontendStatusType::IPTV_WORST_JITTER_MS: {
+                ASSERT_TRUE(realStatuses[i].get<FrontendStatus::Tag::iptvWorstJitterMs>() ==
+                            expectStatuses[i].get<FrontendStatus::Tag::iptvWorstJitterMs>());
+                break;
+            }
+            case FrontendStatusType::IPTV_AVERAGE_JITTER_MS: {
+                ASSERT_TRUE(realStatuses[i].get<FrontendStatus::Tag::iptvAverageJitterMs>() ==
+                            expectStatuses[i].get<FrontendStatus::Tag::iptvAverageJitterMs>());
+                break;
+            }
             default: {
                 continue;
             }
diff --git a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl
index 8e9dd00..d25ee84 100644
--- a/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl
+++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/AltModeData.aidl
@@ -40,5 +40,7 @@
     android.hardware.usb.DisplayPortAltModeStatus partnerSinkStatus = android.hardware.usb.DisplayPortAltModeStatus.UNKNOWN;
     android.hardware.usb.DisplayPortAltModeStatus cableStatus = android.hardware.usb.DisplayPortAltModeStatus.UNKNOWN;
     android.hardware.usb.DisplayPortAltModePinAssignment pinAssignment = android.hardware.usb.DisplayPortAltModePinAssignment.NONE;
+    boolean hpd = false;
+    android.hardware.usb.LinkTrainingStatus linkTrainingStatus = android.hardware.usb.LinkTrainingStatus.UNKNOWN;
   }
 }
diff --git a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/LinkTrainingStatus.aidl
similarity index 87%
copy from radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
copy to usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/LinkTrainingStatus.aidl
index e1fb376..1f0b2dc 100644
--- a/radio/aidl/aidl_api/android.hardware.radio.ims.media/current/android/hardware/radio/ims/media/AnbrBitrate.aidl
+++ b/usb/aidl/aidl_api/android.hardware.usb/current/android/hardware/usb/LinkTrainingStatus.aidl
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2022 The Android Open Source Project
+ * Copyright (C) 2023 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.
@@ -31,10 +31,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.radio.ims.media;
-@VintfStability
-parcelable AnbrBitrate {
-  int uplinkBps;
-  int downlinkBps;
-  const int INVALID_ANBR_BITRATE = (-1);
+package android.hardware.usb;
+@Backing(type="int") @VintfStability
+enum LinkTrainingStatus {
+  UNKNOWN = 0,
+  SUCCESS = 1,
+  FAILURE = 2,
 }
diff --git a/usb/aidl/android/hardware/usb/AltModeData.aidl b/usb/aidl/android/hardware/usb/AltModeData.aidl
index e103ff9..0b1e06a 100644
--- a/usb/aidl/android/hardware/usb/AltModeData.aidl
+++ b/usb/aidl/android/hardware/usb/AltModeData.aidl
@@ -18,6 +18,7 @@
 
 import android.hardware.usb.DisplayPortAltModePinAssignment;
 import android.hardware.usb.DisplayPortAltModeStatus;
+import android.hardware.usb.LinkTrainingStatus;
 
 @VintfStability
 union AltModeData {
@@ -42,6 +43,18 @@
          * negotiated between the device, port partner, and cable.
          */
         DisplayPortAltModePinAssignment pinAssignment = DisplayPortAltModePinAssignment.NONE;
+        /**
+         * Indicates DisplayPort Hot Plug Detection (HPD) status for a partner
+         * sink device. If true, then a DisplayPort Alt Mode partner sink is
+         * connected and powered on, and if false, the partner sink is not
+         * powered or no partner sink is connected.
+         */
+        boolean hpd = false;
+        /**
+         * Indicates the current status of DisplayPort link training over USB-C
+         * for the attached DisplayPort Alt Mode partner sink.
+         */
+        LinkTrainingStatus linkTrainingStatus = LinkTrainingStatus.UNKNOWN;
     }
     DisplayPortAltModeData displayPortAltModeData;
 }
diff --git a/usb/aidl/android/hardware/usb/LinkTrainingStatus.aidl b/usb/aidl/android/hardware/usb/LinkTrainingStatus.aidl
new file mode 100644
index 0000000..9f3b3c3
--- /dev/null
+++ b/usb/aidl/android/hardware/usb/LinkTrainingStatus.aidl
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2023 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.usb;
+
+@VintfStability
+@Backing(type="int")
+/**
+ * Indicates the current status of DisplayPort link training over USB-C for the
+ * attached DisplayPort Alt Mode partner sink as described in DisplayPort
+ * v1.4/2.1.
+ */
+enum LinkTrainingStatus {
+    /*
+     * Indicates the link training result is not available because link training
+     * has not completed or initiated yet.
+     */
+    UNKNOWN = 0,
+    /*
+     * Indicates that link training has completed and optimal settings for data
+     * transmission between the sink and source device have successfully been
+     * negotiated.
+     */
+    SUCCESS = 1,
+    /*
+     * Indicates that link training has failed and the link initialization has
+     * terminated.
+     */
+    FAILURE = 2,
+}
diff --git a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp
index 480c826..e9aa65b 100644
--- a/usb/aidl/vts/VtsAidlUsbTargetTest.cpp
+++ b/usb/aidl/vts/VtsAidlUsbTargetTest.cpp
@@ -49,6 +49,7 @@
 using ::aidl::android::hardware::usb::DisplayPortAltModeStatus;
 using ::aidl::android::hardware::usb::IUsb;
 using ::aidl::android::hardware::usb::IUsbCallback;
+using ::aidl::android::hardware::usb::LinkTrainingStatus;
 using ::aidl::android::hardware::usb::PlugOrientation;
 using ::aidl::android::hardware::usb::PortDataRole;
 using ::aidl::android::hardware::usb::PortMode;
@@ -724,6 +725,10 @@
                   (int)DisplayPortAltModePinAssignment::NONE);
       EXPECT_TRUE((int)displayPortAltModeData.pinAssignment <=
                   (int)DisplayPortAltModePinAssignment::F);
+
+      EXPECT_TRUE((int)displayPortAltModeData.linkTrainingStatus >=
+                  (int)LinkTrainingStatus::UNKNOWN);
+      EXPECT_TRUE((int)displayPortAltModeData.pinAssignment <= (int)LinkTrainingStatus::FAILURE);
     }
   }