Merge changes from topic "contexthub_hal_1_2"

* changes:
  Add VTS tests for Context Hub HAL 1.2
  Adds default (mock) Context Hub HAL 1.2 impl
  Adds Context Hub HAL v1.2
diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp
index 9a0d89d..590adc5 100644
--- a/automotive/vehicle/2.0/default/Android.bp
+++ b/automotive/vehicle/2.0/default/Android.bp
@@ -137,7 +137,6 @@
     local_include_dirs: ["common/include/vhal_v2_0"],
     export_include_dirs: ["impl"],
     srcs: [
-        "impl/vhal_v2_0/EmulatedUserHal.cpp",
         "impl/vhal_v2_0/GeneratorHub.cpp",
         "impl/vhal_v2_0/JsonFakeValueGenerator.cpp",
         "impl/vhal_v2_0/LinearFakeValueGenerator.cpp",
diff --git a/automotive/vehicle/2.0/default/VehicleService.cpp b/automotive/vehicle/2.0/default/VehicleService.cpp
index 62a4f20..7e8deb6 100644
--- a/automotive/vehicle/2.0/default/VehicleService.cpp
+++ b/automotive/vehicle/2.0/default/VehicleService.cpp
@@ -31,7 +31,7 @@
 
 int main(int /* argc */, char* /* argv */ []) {
     auto store = std::make_unique<VehiclePropertyStore>();
-    auto connector = impl::makeEmulatedPassthroughConnector();
+    auto connector = std::make_unique<impl::EmulatedVehicleConnector>();
     auto userHal = connector->getEmulatedUserHal();
     auto hal = std::make_unique<impl::EmulatedVehicleHal>(store.get(), connector.get(), userHal);
     auto emulator = std::make_unique<impl::VehicleEmulator>(hal.get());
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp
index 7f9362f..ed3f4a2 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.cpp
@@ -35,13 +35,33 @@
 
 namespace impl {
 
-class EmulatedPassthroughConnector : public PassthroughConnector {
-  public:
-    bool onDump(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
-};
+EmulatedUserHal* EmulatedVehicleConnector::getEmulatedUserHal() {
+    return &mEmulatedUserHal;
+}
 
-bool EmulatedPassthroughConnector::onDump(const hidl_handle& handle,
-                                          const hidl_vec<hidl_string>& options) {
+StatusCode EmulatedVehicleConnector::onSetProperty(const VehiclePropValue& value,
+                                                   bool updateStatus) {
+    if (mEmulatedUserHal.isSupported(value.prop)) {
+        LOG(INFO) << "onSetProperty(): property " << value.prop << " will be handled by UserHal";
+
+        const auto& ret = mEmulatedUserHal.onSetProperty(value);
+        if (!ret.ok()) {
+            LOG(ERROR) << "onSetProperty(): HAL returned error: " << ret.error().message();
+            return StatusCode(ret.error().code());
+        }
+        auto updatedValue = ret.value().get();
+        if (updatedValue != nullptr) {
+            LOG(INFO) << "onSetProperty(): updating property returned by HAL: "
+                      << toString(*updatedValue);
+            onPropertyValueFromCar(*updatedValue, updateStatus);
+        }
+        return StatusCode::OK;
+    }
+    return this->VehicleHalServer::onSetProperty(value, updateStatus);
+}
+
+bool EmulatedVehicleConnector::onDump(const hidl_handle& handle,
+                                      const hidl_vec<hidl_string>& options) {
     int fd = handle->data[0];
 
     if (options.size() > 0) {
@@ -68,10 +88,6 @@
     return true;
 }
 
-PassthroughConnectorPtr makeEmulatedPassthroughConnector() {
-    return std::make_unique<EmulatedPassthroughConnector>();
-}
-
 }  // namespace impl
 
 }  // namespace V2_0
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h
index 57cbb8b..4c6c661 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleConnector.h
@@ -19,6 +19,7 @@
 
 #include <vhal_v2_0/VehicleConnector.h>
 
+#include "EmulatedUserHal.h"
 #include "VehicleHalClient.h"
 #include "VehicleHalServer.h"
 
@@ -30,10 +31,20 @@
 
 namespace impl {
 
-using PassthroughConnector = IPassThroughConnector<VehicleHalClient, VehicleHalServer>;
-using PassthroughConnectorPtr = std::unique_ptr<PassthroughConnector>;
+class EmulatedVehicleConnector : public IPassThroughConnector<VehicleHalClient, VehicleHalServer> {
+  public:
+    EmulatedVehicleConnector() {}
 
-PassthroughConnectorPtr makeEmulatedPassthroughConnector();
+    EmulatedUserHal* getEmulatedUserHal();
+
+    // Methods from VehicleHalServer
+    StatusCode onSetProperty(const VehiclePropValue& value, bool updateStatus) override;
+
+    bool onDump(const hidl_handle& fd, const hidl_vec<hidl_string>& options) override;
+
+  private:
+    EmulatedUserHal mEmulatedUserHal;
+};
 
 }  // namespace impl
 
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.cpp
index 36f2534..0ee1835 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.cpp
@@ -41,10 +41,6 @@
     return mValuePool;
 }
 
-EmulatedUserHal* VehicleHalServer::getEmulatedUserHal() {
-    return &mEmulatedUserHal;
-}
-
 void VehicleHalServer::setValuePool(VehiclePropValuePool* valuePool) {
     if (!valuePool) {
         LOG(WARNING) << __func__ << ": Setting value pool to nullptr!";
@@ -185,22 +181,6 @@
 }
 
 StatusCode VehicleHalServer::onSetProperty(const VehiclePropValue& value, bool updateStatus) {
-    if (mEmulatedUserHal.isSupported(value.prop)) {
-        LOG(INFO) << "onSetProperty(): property " << value.prop << " will be handled by UserHal";
-
-        const auto& ret = mEmulatedUserHal.onSetProperty(value);
-        if (!ret.ok()) {
-            LOG(ERROR) << "onSetProperty(): HAL returned error: " << ret.error().message();
-            return StatusCode(ret.error().code());
-        }
-        auto updatedValue = ret.value().get();
-        if (updatedValue != nullptr) {
-            LOG(INFO) << "onSetProperty(): updating property returned by HAL: "
-                      << toString(*updatedValue);
-            onPropertyValueFromCar(*updatedValue, updateStatus);
-        }
-        return StatusCode::OK;
-    }
     LOG(DEBUG) << "onSetProperty(" << value.prop << ")";
 
     // Some properties need to be treated non-trivially
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.h
index fca78bc..117eadb 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/VehicleHalServer.h
@@ -19,7 +19,6 @@
 #include <vhal_v2_0/VehicleObjectPool.h>
 #include <vhal_v2_0/VehicleServer.h>
 
-#include "EmulatedUserHal.h"
 #include "GeneratorHub.h"
 
 namespace android::hardware::automotive::vehicle::V2_0::impl {
@@ -38,8 +37,6 @@
     // Set the Property Value Pool used in this server
     void setValuePool(VehiclePropValuePool* valuePool);
 
-    EmulatedUserHal* getEmulatedUserHal();
-
   private:
     using VehiclePropValuePtr = recyclable_ptr<VehiclePropValue>;
 
@@ -56,11 +53,6 @@
     VehiclePropValuePtr createHwInputKeyProp(VehicleHwKeyInputAction action, int32_t keyCode,
                                              int32_t targetDisplay);
 
-    // data members
-
-  protected:
-    EmulatedUserHal mEmulatedUserHal;
-
   private:
     GeneratorHub mGeneratorHub{
             std::bind(&VehicleHalServer::onFakeValueGenerated, this, std::placeholders::_1)};
diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml
index b2a8680..dc0051c 100644
--- a/compatibility_matrices/compatibility_matrix.current.xml
+++ b/compatibility_matrices/compatibility_matrix.current.xml
@@ -381,7 +381,7 @@
         </interface>
     </hal>
     <hal format="aidl" optional="true">
-        <name>android.hardware.powerstats</name>
+        <name>android.hardware.power.stats</name>
         <interface>
             <name>IPowerStats</name>
             <instance>default</instance>
diff --git a/power/stats/aidl/Android.bp b/power/stats/aidl/Android.bp
index 1aa58cb..1688b12 100644
--- a/power/stats/aidl/Android.bp
+++ b/power/stats/aidl/Android.bp
@@ -13,10 +13,10 @@
 // limitations under the License.
 
 aidl_interface {
-    name: "android.hardware.powerstats",
+    name: "android.hardware.power.stats",
     vendor_available: true,
     srcs: [
-        "android/hardware/powerstats/*.aidl",
+        "android/hardware/power/stats/*.aidl",
     ],
     stability: "vintf",
     backend: {
diff --git a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/ChannelInfo.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/ChannelInfo.aidl
similarity index 96%
rename from power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/ChannelInfo.aidl
rename to power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/ChannelInfo.aidl
index 51ac7bf..209bec4 100644
--- a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/ChannelInfo.aidl
+++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/ChannelInfo.aidl
@@ -15,7 +15,7 @@
 // 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.powerstats;
+package android.hardware.power.stats;
 @VintfStability
 parcelable ChannelInfo {
   int channelId;
diff --git a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/EnergyConsumerId.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/EnergyConsumerId.aidl
similarity index 96%
rename from power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/EnergyConsumerId.aidl
rename to power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/EnergyConsumerId.aidl
index 21e7057..7ca3b15 100644
--- a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/EnergyConsumerId.aidl
+++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/EnergyConsumerId.aidl
@@ -15,7 +15,7 @@
 // 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.powerstats;
+package android.hardware.power.stats;
 @Backing(type="int") @VintfStability
 enum EnergyConsumerId {
   DISPLAY = 0,
diff --git a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/EnergyConsumerResult.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/EnergyConsumerResult.aidl
similarity index 91%
rename from power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/EnergyConsumerResult.aidl
rename to power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/EnergyConsumerResult.aidl
index 4794898..6289a08 100644
--- a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/EnergyConsumerResult.aidl
+++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/EnergyConsumerResult.aidl
@@ -15,10 +15,10 @@
 // with such a backward incompatible change, it has a high risk of breaking
 // later when a module using the interface is updated, e.g., Mainline modules.
 
-package android.hardware.powerstats;
+package android.hardware.power.stats;
 @VintfStability
 parcelable EnergyConsumerResult {
-  android.hardware.powerstats.EnergyConsumerId energyConsumerId;
+  android.hardware.power.stats.EnergyConsumerId energyConsumerId;
   long timestampMs;
   long energyUWs;
 }
diff --git a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/EnergyMeasurement.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/EnergyMeasurement.aidl
similarity index 96%
rename from power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/EnergyMeasurement.aidl
rename to power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/EnergyMeasurement.aidl
index 3b1031b..341909e 100644
--- a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/EnergyMeasurement.aidl
+++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/EnergyMeasurement.aidl
@@ -15,7 +15,7 @@
 // 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.powerstats;
+package android.hardware.power.stats;
 @VintfStability
 parcelable EnergyMeasurement {
   int channelId;
diff --git a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/IPowerStats.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/IPowerStats.aidl
similarity index 65%
rename from power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/IPowerStats.aidl
rename to power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/IPowerStats.aidl
index cc668ea..07013b0 100644
--- a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/IPowerStats.aidl
+++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/IPowerStats.aidl
@@ -15,13 +15,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.powerstats;
+package android.hardware.power.stats;
 @VintfStability
 interface IPowerStats {
-  android.hardware.powerstats.PowerEntityInfo[] getPowerEntityInfo();
-  android.hardware.powerstats.StateResidencyResult[] getStateResidency(in int[] powerEntityIds);
-  android.hardware.powerstats.EnergyConsumerId[] getEnergyConsumerInfo();
-  android.hardware.powerstats.EnergyConsumerResult[] getEnergyConsumed(in android.hardware.powerstats.EnergyConsumerId[] energyConsumerIds);
-  android.hardware.powerstats.ChannelInfo[] getEnergyMeterInfo();
-  android.hardware.powerstats.EnergyMeasurement[] readEnergyMeters(in int[] channelIds);
+  android.hardware.power.stats.PowerEntityInfo[] getPowerEntityInfo();
+  android.hardware.power.stats.StateResidencyResult[] getStateResidency(in int[] powerEntityIds);
+  android.hardware.power.stats.EnergyConsumerId[] getEnergyConsumerInfo();
+  android.hardware.power.stats.EnergyConsumerResult[] getEnergyConsumed(in android.hardware.power.stats.EnergyConsumerId[] energyConsumerIds);
+  android.hardware.power.stats.ChannelInfo[] getEnergyMeterInfo();
+  android.hardware.power.stats.EnergyMeasurement[] readEnergyMeters(in int[] channelIds);
 }
diff --git a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityInfo.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/PowerEntityInfo.aidl
similarity index 92%
rename from power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityInfo.aidl
rename to power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/PowerEntityInfo.aidl
index 28939a3..3b16362 100644
--- a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/PowerEntityInfo.aidl
+++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/PowerEntityInfo.aidl
@@ -15,10 +15,10 @@
 // with such a backward incompatible change, it has a high risk of breaking
 // later when a module using the interface is updated, e.g., Mainline modules.
 
-package android.hardware.powerstats;
+package android.hardware.power.stats;
 @VintfStability
 parcelable PowerEntityInfo {
   int powerEntityId;
   @utf8InCpp String powerEntityName;
-  android.hardware.powerstats.StateInfo[] states;
+  android.hardware.power.stats.StateInfo[] states;
 }
diff --git a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/StateInfo.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/StateInfo.aidl
similarity index 96%
rename from power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/StateInfo.aidl
rename to power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/StateInfo.aidl
index 46d89ee..0db9ab1 100644
--- a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/StateInfo.aidl
+++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/StateInfo.aidl
@@ -15,7 +15,7 @@
 // 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.powerstats;
+package android.hardware.power.stats;
 @VintfStability
 parcelable StateInfo {
   int stateId;
diff --git a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/StateResidency.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/StateResidency.aidl
similarity index 96%
rename from power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/StateResidency.aidl
rename to power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/StateResidency.aidl
index c87547c..206c974 100644
--- a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/StateResidency.aidl
+++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/StateResidency.aidl
@@ -15,7 +15,7 @@
 // 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.powerstats;
+package android.hardware.power.stats;
 @VintfStability
 parcelable StateResidency {
   int stateId;
diff --git a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/StateResidencyResult.aidl b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/StateResidencyResult.aidl
similarity index 91%
rename from power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/StateResidencyResult.aidl
rename to power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/StateResidencyResult.aidl
index b57d965..dc41fef 100644
--- a/power/stats/aidl/aidl_api/android.hardware.powerstats/current/android/hardware/powerstats/StateResidencyResult.aidl
+++ b/power/stats/aidl/aidl_api/android.hardware.power.stats/current/android/hardware/power/stats/StateResidencyResult.aidl
@@ -15,9 +15,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.powerstats;
+package android.hardware.power.stats;
 @VintfStability
 parcelable StateResidencyResult {
   int powerEntityId;
-  android.hardware.powerstats.StateResidency[] stateResidencyData;
+  android.hardware.power.stats.StateResidency[] stateResidencyData;
 }
diff --git a/power/stats/aidl/android/hardware/powerstats/ChannelInfo.aidl b/power/stats/aidl/android/hardware/power/stats/ChannelInfo.aidl
similarity index 95%
rename from power/stats/aidl/android/hardware/powerstats/ChannelInfo.aidl
rename to power/stats/aidl/android/hardware/power/stats/ChannelInfo.aidl
index 61cce85..a2ca6a6 100644
--- a/power/stats/aidl/android/hardware/powerstats/ChannelInfo.aidl
+++ b/power/stats/aidl/android/hardware/power/stats/ChannelInfo.aidl
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.hardware.powerstats;
+package android.hardware.power.stats;
 
 @VintfStability
 parcelable ChannelInfo {
diff --git a/power/stats/aidl/android/hardware/powerstats/EnergyConsumerId.aidl b/power/stats/aidl/android/hardware/power/stats/EnergyConsumerId.aidl
similarity index 94%
rename from power/stats/aidl/android/hardware/powerstats/EnergyConsumerId.aidl
rename to power/stats/aidl/android/hardware/power/stats/EnergyConsumerId.aidl
index 2839a19..4a6a677 100644
--- a/power/stats/aidl/android/hardware/powerstats/EnergyConsumerId.aidl
+++ b/power/stats/aidl/android/hardware/power/stats/EnergyConsumerId.aidl
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.hardware.powerstats;
+package android.hardware.power.stats;
 
 @VintfStability
 @Backing(type="int")
diff --git a/power/stats/aidl/android/hardware/powerstats/EnergyConsumerResult.aidl b/power/stats/aidl/android/hardware/power/stats/EnergyConsumerResult.aidl
similarity index 91%
rename from power/stats/aidl/android/hardware/powerstats/EnergyConsumerResult.aidl
rename to power/stats/aidl/android/hardware/power/stats/EnergyConsumerResult.aidl
index c52e638..d2b902a 100644
--- a/power/stats/aidl/android/hardware/powerstats/EnergyConsumerResult.aidl
+++ b/power/stats/aidl/android/hardware/power/stats/EnergyConsumerResult.aidl
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package android.hardware.powerstats;
+package android.hardware.power.stats;
 
-import android.hardware.powerstats.EnergyConsumerId;
+import android.hardware.power.stats.EnergyConsumerId;
 
 @VintfStability
 parcelable EnergyConsumerResult {
diff --git a/power/stats/aidl/android/hardware/powerstats/EnergyMeasurement.aidl b/power/stats/aidl/android/hardware/power/stats/EnergyMeasurement.aidl
similarity index 95%
rename from power/stats/aidl/android/hardware/powerstats/EnergyMeasurement.aidl
rename to power/stats/aidl/android/hardware/power/stats/EnergyMeasurement.aidl
index 7c98646..f873849 100644
--- a/power/stats/aidl/android/hardware/powerstats/EnergyMeasurement.aidl
+++ b/power/stats/aidl/android/hardware/power/stats/EnergyMeasurement.aidl
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.hardware.powerstats;
+package android.hardware.power.stats;
 
 @VintfStability
 parcelable EnergyMeasurement {
diff --git a/power/stats/aidl/android/hardware/powerstats/IPowerStats.aidl b/power/stats/aidl/android/hardware/power/stats/IPowerStats.aidl
similarity index 92%
rename from power/stats/aidl/android/hardware/powerstats/IPowerStats.aidl
rename to power/stats/aidl/android/hardware/power/stats/IPowerStats.aidl
index bb13b8e..85a2ce0 100644
--- a/power/stats/aidl/android/hardware/powerstats/IPowerStats.aidl
+++ b/power/stats/aidl/android/hardware/power/stats/IPowerStats.aidl
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package android.hardware.powerstats;
+package android.hardware.power.stats;
 
-import android.hardware.powerstats.ChannelInfo;
-import android.hardware.powerstats.EnergyConsumerId;
-import android.hardware.powerstats.EnergyConsumerResult;
-import android.hardware.powerstats.EnergyMeasurement;
-import android.hardware.powerstats.PowerEntityInfo;
-import android.hardware.powerstats.StateResidencyResult;
+import android.hardware.power.stats.ChannelInfo;
+import android.hardware.power.stats.EnergyConsumerId;
+import android.hardware.power.stats.EnergyConsumerResult;
+import android.hardware.power.stats.EnergyMeasurement;
+import android.hardware.power.stats.PowerEntityInfo;
+import android.hardware.power.stats.StateResidencyResult;
 
 @VintfStability
 interface IPowerStats {
diff --git a/power/stats/aidl/android/hardware/powerstats/PowerEntityInfo.aidl b/power/stats/aidl/android/hardware/power/stats/PowerEntityInfo.aidl
similarity index 91%
rename from power/stats/aidl/android/hardware/powerstats/PowerEntityInfo.aidl
rename to power/stats/aidl/android/hardware/power/stats/PowerEntityInfo.aidl
index bd09d66..002b343 100644
--- a/power/stats/aidl/android/hardware/powerstats/PowerEntityInfo.aidl
+++ b/power/stats/aidl/android/hardware/power/stats/PowerEntityInfo.aidl
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package android.hardware.powerstats;
+package android.hardware.power.stats;
 
-import android.hardware.powerstats.StateInfo;
+import android.hardware.power.stats.StateInfo;
 
 @VintfStability
 parcelable PowerEntityInfo {
diff --git a/power/stats/aidl/android/hardware/powerstats/StateInfo.aidl b/power/stats/aidl/android/hardware/power/stats/StateInfo.aidl
similarity index 95%
rename from power/stats/aidl/android/hardware/powerstats/StateInfo.aidl
rename to power/stats/aidl/android/hardware/power/stats/StateInfo.aidl
index 5035f7c..5703f1e 100644
--- a/power/stats/aidl/android/hardware/powerstats/StateInfo.aidl
+++ b/power/stats/aidl/android/hardware/power/stats/StateInfo.aidl
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.hardware.powerstats;
+package android.hardware.power.stats;
 
 @VintfStability
 parcelable StateInfo {
diff --git a/power/stats/aidl/android/hardware/powerstats/StateResidency.aidl b/power/stats/aidl/android/hardware/power/stats/StateResidency.aidl
similarity index 96%
rename from power/stats/aidl/android/hardware/powerstats/StateResidency.aidl
rename to power/stats/aidl/android/hardware/power/stats/StateResidency.aidl
index 2a8f541..a85ca33 100644
--- a/power/stats/aidl/android/hardware/powerstats/StateResidency.aidl
+++ b/power/stats/aidl/android/hardware/power/stats/StateResidency.aidl
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.hardware.powerstats;
+package android.hardware.power.stats;
 
 /**
  * Contains residency data for a single state
diff --git a/power/stats/aidl/android/hardware/powerstats/StateResidencyResult.aidl b/power/stats/aidl/android/hardware/power/stats/StateResidencyResult.aidl
similarity index 90%
rename from power/stats/aidl/android/hardware/powerstats/StateResidencyResult.aidl
rename to power/stats/aidl/android/hardware/power/stats/StateResidencyResult.aidl
index b3a9f03..3356405 100644
--- a/power/stats/aidl/android/hardware/powerstats/StateResidencyResult.aidl
+++ b/power/stats/aidl/android/hardware/power/stats/StateResidencyResult.aidl
@@ -14,9 +14,9 @@
  * limitations under the License.
  */
 
-package android.hardware.powerstats;
+package android.hardware.power.stats;
 
-import android.hardware.powerstats.StateResidency;
+import android.hardware.power.stats.StateResidency;
 
 @VintfStability
 parcelable StateResidencyResult {
diff --git a/power/stats/aidl/default/Android.bp b/power/stats/aidl/default/Android.bp
index caecd88..40b9447 100644
--- a/power/stats/aidl/default/Android.bp
+++ b/power/stats/aidl/default/Android.bp
@@ -13,15 +13,15 @@
 // limitations under the License.
 
 cc_binary {
-    name: "android.hardware.powerstats-service.example",
+    name: "android.hardware.power.stats-service.example",
     relative_install_path: "hw",
-    init_rc: ["powerstats-default.rc"],
-    vintf_fragments: ["powerstats-default.xml"],
+    init_rc: ["power.stats-default.rc"],
+    vintf_fragments: ["power.stats-default.xml"],
     vendor: true,
     shared_libs: [
         "libbase",
         "libbinder_ndk",
-        "android.hardware.powerstats-ndk_platform",
+        "android.hardware.power.stats-ndk_platform",
     ],
     srcs: [
         "main.cpp",
diff --git a/power/stats/aidl/default/PowerStats.cpp b/power/stats/aidl/default/PowerStats.cpp
index d1c97db..367ee95 100644
--- a/power/stats/aidl/default/PowerStats.cpp
+++ b/power/stats/aidl/default/PowerStats.cpp
@@ -21,7 +21,8 @@
 namespace aidl {
 namespace android {
 namespace hardware {
-namespace powerstats {
+namespace power {
+namespace stats {
 
 ndk::ScopedAStatus PowerStats::getPowerEntityInfo(std::vector<PowerEntityInfo>* _aidl_return) {
     (void)_aidl_return;
@@ -60,7 +61,8 @@
     return ndk::ScopedAStatus::ok();
 }
 
-}  // namespace powerstats
+}  // namespace stats
+}  // namespace power
 }  // namespace hardware
 }  // namespace android
 }  // namespace aidl
diff --git a/power/stats/aidl/default/PowerStats.h b/power/stats/aidl/default/PowerStats.h
index 6d2d460..76ab2cb 100644
--- a/power/stats/aidl/default/PowerStats.h
+++ b/power/stats/aidl/default/PowerStats.h
@@ -16,17 +16,18 @@
 
 #pragma once
 
-#include <aidl/android/hardware/powerstats/BnPowerStats.h>
+#include <aidl/android/hardware/power/stats/BnPowerStats.h>
 
 namespace aidl {
 namespace android {
 namespace hardware {
-namespace powerstats {
+namespace power {
+namespace stats {
 
 class PowerStats : public BnPowerStats {
   public:
     PowerStats() = default;
-    // Methods from aidl::android::hardware::powerstats::IPowerStats
+    // Methods from aidl::android::hardware::power::stats::IPowerStats
     ndk::ScopedAStatus getPowerEntityInfo(std::vector<PowerEntityInfo>* _aidl_return) override;
     ndk::ScopedAStatus getStateResidency(const std::vector<int32_t>& in_powerEntityIds,
                                          std::vector<StateResidencyResult>* _aidl_return) override;
@@ -38,7 +39,8 @@
                                         std::vector<EnergyMeasurement>* _aidl_return) override;
 };
 
-}  // namespace powerstats
+}  // namespace stats
+}  // namespace power
 }  // namespace hardware
 }  // namespace android
 }  // namespace aidl
diff --git a/power/stats/aidl/default/main.cpp b/power/stats/aidl/default/main.cpp
index 1496805..0469b4c 100644
--- a/power/stats/aidl/default/main.cpp
+++ b/power/stats/aidl/default/main.cpp
@@ -20,7 +20,7 @@
 #include <android/binder_manager.h>
 #include <android/binder_process.h>
 
-using aidl::android::hardware::powerstats::PowerStats;
+using aidl::android::hardware::power::stats::PowerStats;
 
 int main() {
     ABinderProcess_setThreadPoolMaxThreadCount(0);
diff --git a/power/stats/aidl/default/power.stats-default.rc b/power/stats/aidl/default/power.stats-default.rc
new file mode 100644
index 0000000..6ff6754
--- /dev/null
+++ b/power/stats/aidl/default/power.stats-default.rc
@@ -0,0 +1,4 @@
+service vendor.power.stats-default /vendor/bin/hw/android.hardware.power.stats-service.example
+    class hal
+    user system
+    group system
diff --git a/power/stats/aidl/default/powerstats-default.xml b/power/stats/aidl/default/power.stats-default.xml
similarity index 72%
rename from power/stats/aidl/default/powerstats-default.xml
rename to power/stats/aidl/default/power.stats-default.xml
index e07513d..3b1a216 100644
--- a/power/stats/aidl/default/powerstats-default.xml
+++ b/power/stats/aidl/default/power.stats-default.xml
@@ -1,6 +1,6 @@
 <manifest version="1.0" type="device">
     <hal format="aidl">
-        <name>android.hardware.powerstats</name>
+        <name>android.hardware.power.stats</name>
         <fqname>IPowerStats/default</fqname>
     </hal>
 </manifest>
diff --git a/power/stats/aidl/default/powerstats-default.rc b/power/stats/aidl/default/powerstats-default.rc
deleted file mode 100644
index 9b04be3..0000000
--- a/power/stats/aidl/default/powerstats-default.rc
+++ /dev/null
@@ -1,4 +0,0 @@
-service vendor.powerstats-default /vendor/bin/hw/android.hardware.powerstats-service.example
-    class hal
-    user system
-    group system
diff --git a/power/stats/aidl/vts/Android.bp b/power/stats/aidl/vts/Android.bp
index c61022e..930709f 100644
--- a/power/stats/aidl/vts/Android.bp
+++ b/power/stats/aidl/vts/Android.bp
@@ -23,7 +23,7 @@
         "libbinder_ndk",
     ],
     static_libs: [
-        "android.hardware.powerstats-ndk_platform",
+        "android.hardware.power.stats-ndk_platform",
     ],
     test_suites: [
         "general-tests",
diff --git a/power/stats/aidl/vts/VtsHalPowerStatsTargetTest.cpp b/power/stats/aidl/vts/VtsHalPowerStatsTargetTest.cpp
index e71e495..1d30821 100644
--- a/power/stats/aidl/vts/VtsHalPowerStatsTargetTest.cpp
+++ b/power/stats/aidl/vts/VtsHalPowerStatsTargetTest.cpp
@@ -16,16 +16,16 @@
 #include <aidl/Gtest.h>
 #include <aidl/Vintf.h>
 
-#include <aidl/android/hardware/powerstats/IPowerStats.h>
+#include <aidl/android/hardware/power/stats/IPowerStats.h>
 #include <android-base/properties.h>
 #include <android/binder_manager.h>
 #include <android/binder_process.h>
 
-using aidl::android::hardware::powerstats::ChannelInfo;
-using aidl::android::hardware::powerstats::EnergyMeasurement;
-using aidl::android::hardware::powerstats::IPowerStats;
-using aidl::android::hardware::powerstats::PowerEntityInfo;
-using aidl::android::hardware::powerstats::StateResidencyResult;
+using aidl::android::hardware::power::stats::ChannelInfo;
+using aidl::android::hardware::power::stats::EnergyMeasurement;
+using aidl::android::hardware::power::stats::IPowerStats;
+using aidl::android::hardware::power::stats::PowerEntityInfo;
+using aidl::android::hardware::power::stats::StateResidencyResult;
 
 using ndk::SpAIBinder;
 
diff --git a/tv/tuner/1.1/default/Frontend.cpp b/tv/tuner/1.1/default/Frontend.cpp
index 971e335..7c6f8c6 100644
--- a/tv/tuner/1.1/default/Frontend.cpp
+++ b/tv/tuner/1.1/default/Frontend.cpp
@@ -122,9 +122,12 @@
             V1_1::IFrontendCallback::castFrom(mCallback);
     if (frontendCallback_v1_1 != NULL) {
         V1_1::FrontendScanMessageExt1_1 msg;
-        msg.dvbc(FrontendDvbcModulation::MOD_16QAM);
+        msg.modulation().dvbc(FrontendDvbcModulation::MOD_16QAM);
         frontendCallback_v1_1->onScanMessageExt1_1(V1_1::FrontendScanMessageTypeExt1_1::MODULATION,
                                                    msg);
+        msg.isHighPriority(true);
+        frontendCallback_v1_1->onScanMessageExt1_1(
+                V1_1::FrontendScanMessageTypeExt1_1::HIGH_PRIORITY, msg);
     } else {
         ALOGD("[Filter] Couldn't cast to V1_1 IFrontendCallback");
     }
diff --git a/tv/tuner/1.1/types.hal b/tv/tuner/1.1/types.hal
index b20e625..f8fe2aa 100644
--- a/tv/tuner/1.1/types.hal
+++ b/tv/tuner/1.1/types.hal
@@ -555,6 +555,11 @@
 
 enum FrontendScanMessageTypeExt1_1 : uint32_t {
     MODULATION = @1.0::FrontendScanMessageType:ATSC3_PLP_INFO + 1,
+    HIGH_PRIORITY,
 };
 
-typedef FrontendModulation FrontendScanMessageExt1_1;
+safe_union FrontendScanMessageExt1_1 {
+    FrontendModulation modulation;
+
+    bool isHighPriority;
+};
diff --git a/tv/tuner/1.1/vts/functional/FrontendTests.cpp b/tv/tuner/1.1/vts/functional/FrontendTests.cpp
index 3bc7114..e5793c1 100644
--- a/tv/tuner/1.1/vts/functional/FrontendTests.cpp
+++ b/tv/tuner/1.1/vts/functional/FrontendTests.cpp
@@ -51,9 +51,12 @@
                                                    const FrontendScanMessageExt1_1& message) {
     android::Mutex::Autolock autoLock(mMsgLock);
     ALOGD("[vts] frontend ext1_1 scan message. Type: %d", type);
-    switch (type) {
-        case FrontendScanMessageTypeExt1_1::MODULATION:
-            readFrontendScanMessageExt1_1Modulation(message);
+    switch (message.getDiscriminator()) {
+        case FrontendScanMessageExt1_1::hidl_discriminator::modulation:
+            readFrontendScanMessageExt1_1Modulation(message.modulation());
+            break;
+        case FrontendScanMessageExt1_1::hidl_discriminator::isHighPriority:
+            ALOGD("[vts] frontend ext1_1 scan message high priority: %d", message.isHighPriority());
             break;
         default:
             break;