Update properties and FakeVehicleHardware to support multi-display

Bug: 255430764
Test: atest CarPropertyManagerTest
Test: atest FakeVehicleHardwareTest
Change-Id: I7e3db2e9e7e0cb58588b11d064e1fa14f2007a2a
Merged-In: I7e3db2e9e7e0cb58588b11d064e1fa14f2007a2a
diff --git a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
index b6d987e..5ac6029 100644
--- a/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
+++ b/automotive/vehicle/aidl/impl/default_config/config/DefaultProperties.json
@@ -1329,22 +1329,26 @@
         },
         {
             "property": "VehicleProperty::SEAT_OCCUPANCY",
+            "defaultValue": {
+                "int32Values": [
+                    "VehicleSeatOccupancyState::VACANT"
+                ]
+            },
             "areas": [
                 {
-                    "defaultValue": {
-                        "int32Values": [
-                            "VehicleSeatOccupancyState::VACANT"
-                        ]
-                    },
                     "areaId": "Constants::SEAT_1_LEFT"
                 },
                 {
-                    "defaultValue": {
-                        "int32Values": [
-                            "VehicleSeatOccupancyState::VACANT"
-                        ]
-                    },
                     "areaId": "Constants::SEAT_1_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER"
                 }
             ]
         },
@@ -1854,7 +1858,19 @@
             },
             "areas": [
                 {
-                    "areaId": "Constants::HVAC_ALL"
+                    "areaId": "Constants::SEAT_1_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_1_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER"
                 }
             ]
         },
@@ -1867,7 +1883,19 @@
             },
             "areas": [
                 {
-                    "areaId": "Constants::HVAC_ALL"
+                    "areaId": "Constants::SEAT_1_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_1_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER"
                 }
             ],
             "configArray": [
@@ -1918,7 +1946,19 @@
             },
             "areas": [
                 {
-                    "areaId": "Constants::HVAC_ALL"
+                    "areaId": "Constants::SEAT_1_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_1_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER"
                 }
             ]
         },
@@ -1931,7 +1971,19 @@
             },
             "areas": [
                 {
-                    "areaId": "Constants::HVAC_ALL"
+                    "areaId": "Constants::SEAT_1_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_1_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER"
                 }
             ]
         },
@@ -1944,7 +1996,19 @@
             },
             "areas": [
                 {
-                    "areaId": "Constants::HVAC_ALL"
+                    "areaId": "Constants::SEAT_1_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_1_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER"
                 }
             ]
         },
@@ -1957,7 +2021,19 @@
             },
             "areas": [
                 {
-                    "areaId": "Constants::HVAC_ALL"
+                    "areaId": "Constants::SEAT_1_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_1_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER"
                 }
             ]
         },
@@ -1970,7 +2046,19 @@
             },
             "areas": [
                 {
-                    "areaId": "Constants::HVAC_ALL"
+                    "areaId": "Constants::SEAT_1_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_1_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER"
                 }
             ]
         },
@@ -1983,7 +2071,19 @@
             },
             "areas": [
                 {
-                    "areaId": "Constants::HVAC_ALL"
+                    "areaId": "Constants::SEAT_1_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_1_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER"
                 }
             ]
         },
@@ -2009,7 +2109,27 @@
             },
             "areas": [
                 {
-                    "areaId": "Constants::HVAC_ALL",
+                    "areaId": "Constants::SEAT_1_LEFT",
+                    "minInt32Value": 1,
+                    "maxInt32Value": 7
+                },
+                {
+                    "areaId": "Constants::SEAT_1_RIGHT",
+                    "minInt32Value": 1,
+                    "maxInt32Value": 7
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT",
+                    "minInt32Value": 1,
+                    "maxInt32Value": 7
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT",
+                    "minInt32Value": 1,
+                    "maxInt32Value": 7
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER",
                     "minInt32Value": 1,
                     "maxInt32Value": 7
                 }
@@ -2024,7 +2144,19 @@
             },
             "areas": [
                 {
-                    "areaId": "Constants::HVAC_ALL"
+                    "areaId": "Constants::SEAT_1_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_1_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER"
                 }
             ]
         },
@@ -2043,7 +2175,19 @@
             },
             "areas": [
                 {
-                    "areaId": "Constants::HVAC_ALL"
+                    "areaId": "Constants::SEAT_1_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_1_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER"
                 }
             ]
         },
@@ -2064,6 +2208,21 @@
                     "areaId": "Constants::SEAT_1_RIGHT",
                     "minInt32Value": 0,
                     "maxInt32Value": 3
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT",
+                    "minInt32Value": 0,
+                    "maxInt32Value": 3
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT",
+                    "minInt32Value": 0,
+                    "maxInt32Value": 3
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER",
+                    "minInt32Value": 0,
+                    "maxInt32Value": 3
                 }
             ],
             "comment": "0 is off and +ve values indicate ventilation level."
@@ -2101,6 +2260,21 @@
                     "areaId": "Constants::SEAT_1_RIGHT",
                     "minInt32Value": -2,
                     "maxInt32Value": 2
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT",
+                    "minInt32Value": -2,
+                    "maxInt32Value": 2
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT",
+                    "minInt32Value": -2,
+                    "maxInt32Value": 2
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER",
+                    "minInt32Value": -2,
+                    "maxInt32Value": 2
                 }
             ],
             "comment": "+ve values for heating and -ve for cooling"
@@ -2122,45 +2296,59 @@
         },
         {
             "property": "VehicleProperty::HVAC_TEMPERATURE_CURRENT",
+            "defaultValue": {
+                "floatValues": [
+                    19.1
+                ]
+            },
             "areas": [
                 {
-                    "defaultValue": {
-                        "floatValues": [
-                            17.3
-                        ]
-                    },
-                    "areaId": 49
+                    "areaId": "Constants::SEAT_1_LEFT"
                 },
                 {
-                    "defaultValue": {
-                        "floatValues": [
-                            19.1
-                        ]
-                    },
-                    "areaId": 68
+                    "areaId": "Constants::SEAT_1_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT"
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER"
                 }
             ]
         },
         {
             "property": "VehicleProperty::HVAC_TEMPERATURE_SET",
+            "defaultValue": {
+                "floatValues": [
+                    17.0
+                ]
+            },
             "areas": [
                 {
-                    "defaultValue": {
-                        "floatValues": [
-                            16.0
-                        ]
-                    },
-                    "areaId": 49,
+                    "areaId": "Constants::SEAT_1_LEFT",
                     "minFloatValue": 16.0,
                     "maxFloatValue": 28.0
                 },
                 {
-                    "defaultValue": {
-                        "floatValues": [
-                            20.0
-                        ]
-                    },
-                    "areaId": 68,
+                    "areaId": "Constants::SEAT_1_RIGHT",
+                    "minFloatValue": 16.0,
+                    "maxFloatValue": 28.0
+                },
+                {
+                    "areaId": "Constants::SEAT_2_LEFT",
+                    "minFloatValue": 16.0,
+                    "maxFloatValue": 28.0
+                },
+                {
+                    "areaId": "Constants::SEAT_2_RIGHT",
+                    "minFloatValue": 16.0,
+                    "maxFloatValue": 28.0
+                },
+                {
+                    "areaId": "Constants::SEAT_2_CENTER",
                     "minFloatValue": 16.0,
                     "maxFloatValue": 28.0
                 }
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
index 956c7c0..6fd2367 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/include/FakeVehicleHardware.h
@@ -194,7 +194,7 @@
             const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
     ValueResultType getEchoReverseBytes(
             const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;
-    bool isHvacPropAndHvacNotAvailable(int32_t propId) const;
+    bool isHvacPropAndHvacNotAvailable(int32_t propId, int32_t areaId) const;
 
     std::unordered_map<int32_t, ConfigDeclaration> loadConfigDeclarations();
 
@@ -236,7 +236,7 @@
             const aidl::android::hardware::automotive::vehicle::SetValueRequest& request);
 
     std::string genFakeDataCommand(const std::vector<std::string>& options);
-    void sendHvacPropertiesCurrentValues();
+    void sendHvacPropertiesCurrentValues(int32_t areaId);
 
     static aidl::android::hardware::automotive::vehicle::VehiclePropValue createHwInputKeyProp(
             aidl::android::hardware::automotive::vehicle::VehicleHwKeyInputAction action,
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
index 7b4fa16..78c21e9 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp
@@ -298,16 +298,27 @@
     return {};
 }
 
-bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId) const {
+bool FakeVehicleHardware::isHvacPropAndHvacNotAvailable(int32_t propId, int32_t areaId) const {
     std::unordered_set<int32_t> powerProps(std::begin(HVAC_POWER_PROPERTIES),
                                            std::end(HVAC_POWER_PROPERTIES));
     if (powerProps.count(propId)) {
-        auto hvacPowerOnResult =
-                mServerSidePropStore->readValue(toInt(VehicleProperty::HVAC_POWER_ON), HVAC_ALL);
-
-        if (hvacPowerOnResult.ok() && hvacPowerOnResult.value()->value.int32Values.size() == 1 &&
-            hvacPowerOnResult.value()->value.int32Values[0] == 0) {
-            return true;
+        auto hvacPowerOnResults =
+                mServerSidePropStore->readValuesForProperty(toInt(VehicleProperty::HVAC_POWER_ON));
+        if (!hvacPowerOnResults.ok()) {
+            ALOGW("failed to get HVAC_POWER_ON 0x%x, error: %s",
+                  toInt(VehicleProperty::HVAC_POWER_ON), getErrorMsg(hvacPowerOnResults).c_str());
+            return false;
+        }
+        auto& hvacPowerOnValues = hvacPowerOnResults.value();
+        for (size_t j = 0; j < hvacPowerOnValues.size(); j++) {
+            auto hvacPowerOnValue = std::move(hvacPowerOnValues[j]);
+            if ((hvacPowerOnValue->areaId & areaId) == areaId) {
+                if (hvacPowerOnValue->value.int32Values.size() == 1 &&
+                    hvacPowerOnValue->value.int32Values[0] == 0) {
+                    return true;
+                }
+                break;
+            }
         }
     }
     return false;
@@ -369,7 +380,7 @@
         return getUserHalProp(value);
     }
 
-    if (isHvacPropAndHvacNotAvailable(propId)) {
+    if (isHvacPropAndHvacNotAvailable(propId, value.areaId)) {
         *isSpecialValue = true;
         return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available";
     }
@@ -419,7 +430,7 @@
     return std::move(gotValue);
 }
 
-void FakeVehicleHardware::sendHvacPropertiesCurrentValues() {
+void FakeVehicleHardware::sendHvacPropertiesCurrentValues(int32_t areaId) {
     for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
         int powerPropId = HVAC_POWER_PROPERTIES[i];
         auto powerPropResults = mServerSidePropStore->readValuesForProperty(powerPropId);
@@ -431,11 +442,13 @@
         auto& powerPropValues = powerPropResults.value();
         for (size_t j = 0; j < powerPropValues.size(); j++) {
             auto powerPropValue = std::move(powerPropValues[j]);
-            powerPropValue->status = VehiclePropertyStatus::AVAILABLE;
-            powerPropValue->timestamp = elapsedRealtimeNano();
-            // This will trigger a property change event for the current hvac property value.
-            mServerSidePropStore->writeValue(std::move(powerPropValue), /*updateStatus=*/true,
-                                             VehiclePropertyStore::EventMode::ALWAYS);
+            if ((powerPropValue->areaId & areaId) == powerPropValue->areaId) {
+                powerPropValue->status = VehiclePropertyStatus::AVAILABLE;
+                powerPropValue->timestamp = elapsedRealtimeNano();
+                // This will trigger a property change event for the current hvac property value.
+                mServerSidePropStore->writeValue(std::move(powerPropValue), /*updateStatus=*/true,
+                                                 VehiclePropertyStore::EventMode::ALWAYS);
+            }
         }
     }
 }
@@ -455,10 +468,10 @@
         value.value.int32Values[0] == 1) {
         // If we are turning HVAC power on, send current hvac property values through on change
         // event.
-        sendHvacPropertiesCurrentValues();
+        sendHvacPropertiesCurrentValues(value.areaId);
     }
 
-    if (isHvacPropAndHvacNotAvailable(propId)) {
+    if (isHvacPropAndHvacNotAvailable(propId, value.areaId)) {
         *isSpecialValue = true;
         return StatusError(StatusCode::NOT_AVAILABLE) << "hvac not available";
     }
diff --git a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
index f3593aa..93a63ad 100644
--- a/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
+++ b/automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp
@@ -1147,67 +1147,100 @@
 }
 
 TEST_F(FakeVehicleHardwareTest, testGetHvacPropNotAvailable) {
-    StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
-                                                  .areaId = HVAC_ALL,
-                                                  .value.int32Values = {0}});
+    int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT};
+    for (int areaId : seatAreaIds) {
+        StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+                                                      .areaId = areaId,
+                                                      .value.int32Values = {0}});
 
-    ASSERT_EQ(status, StatusCode::OK);
+        ASSERT_EQ(status, StatusCode::OK);
 
-    for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
-        int powerPropId = HVAC_POWER_PROPERTIES[i];
-        auto getValueResult = getValue(VehiclePropValue{
-                .prop = powerPropId,
-                .areaId = HVAC_ALL,
-        });
+        for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
+            int powerPropId = HVAC_POWER_PROPERTIES[i];
+            for (int powerDependentAreaId : seatAreaIds) {
+                auto getValueResult = getValue(VehiclePropValue{
+                        .prop = powerPropId,
+                        .areaId = powerDependentAreaId,
+                });
 
-        EXPECT_FALSE(getValueResult.ok());
-        EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE);
+                if (areaId == powerDependentAreaId) {
+                    EXPECT_FALSE(getValueResult.ok());
+                    EXPECT_EQ(getValueResult.error(), StatusCode::NOT_AVAILABLE);
+                } else {
+                    EXPECT_TRUE(getValueResult.ok());
+                }
+            }
+        }
+
+        // Resetting HVAC_POWER_ON at areaId back to ON state to ensure that there's no dependence
+        // on this value from any power dependent property values other than those with the same
+        // areaId.
+        setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+                                  .areaId = areaId,
+                                  .value.int32Values = {1}});
     }
 }
 
 TEST_F(FakeVehicleHardwareTest, testSetHvacPropNotAvailable) {
-    StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
-                                                  .areaId = HVAC_ALL,
-                                                  .value.int32Values = {0}});
+    int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT};
+    for (int areaId : seatAreaIds) {
+        StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+                                                      .areaId = areaId,
+                                                      .value.int32Values = {0}});
 
-    ASSERT_EQ(status, StatusCode::OK);
+        ASSERT_EQ(status, StatusCode::OK);
 
-    for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
-        int powerPropId = HVAC_POWER_PROPERTIES[i];
-        status = setValue(VehiclePropValue{
-                .prop = powerPropId,
-                .areaId = HVAC_ALL,
-        });
+        for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
+            int powerPropId = HVAC_POWER_PROPERTIES[i];
+            for (int powerDependentAreaId : seatAreaIds) {
+                StatusCode status = setValue(VehiclePropValue{.prop = powerPropId,
+                                                              .areaId = powerDependentAreaId,
+                                                              .value.int32Values = {1}});
 
-        EXPECT_EQ(status, StatusCode::NOT_AVAILABLE);
+                if (areaId == powerDependentAreaId) {
+                    EXPECT_EQ(status, StatusCode::NOT_AVAILABLE);
+                } else {
+                    EXPECT_EQ(status, StatusCode::OK);
+                }
+            }
+        }
+
+        // Resetting HVAC_POWER_ON at areaId back to ON state to ensure that there's no dependence
+        // on this value from any power dependent property values other than those with the same
+        // areaId.
+        setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+                                  .areaId = areaId,
+                                  .value.int32Values = {1}});
     }
 }
 
 TEST_F(FakeVehicleHardwareTest, testHvacPowerOnSendCurrentHvacPropValues) {
-    StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
-                                                  .areaId = HVAC_ALL,
-                                                  .value.int32Values = {0}});
+    int seatAreaIds[5] = {SEAT_1_LEFT, SEAT_1_RIGHT, SEAT_2_LEFT, SEAT_2_CENTER, SEAT_2_RIGHT};
+    for (int areaId : seatAreaIds) {
+        StatusCode status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+                                                      .areaId = areaId,
+                                                      .value.int32Values = {0}});
 
-    ASSERT_EQ(status, StatusCode::OK);
+        ASSERT_EQ(status, StatusCode::OK);
 
-    clearChangedProperties();
+        clearChangedProperties();
+        setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
+                                  .areaId = areaId,
+                                  .value.int32Values = {1}});
 
-    status = setValue(VehiclePropValue{.prop = toInt(VehicleProperty::HVAC_POWER_ON),
-                                       .areaId = HVAC_ALL,
-                                       .value.int32Values = {1}});
+        auto events = getChangedProperties();
+        // If we turn HVAC power on, we expect to receive one property event for every HVAC prop
+        // areas plus one event for HVAC_POWER_ON.
+        std::vector<int32_t> changedPropIds;
+        for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
+            changedPropIds.push_back(HVAC_POWER_PROPERTIES[i]);
+        }
+        changedPropIds.push_back(toInt(VehicleProperty::HVAC_POWER_ON));
 
-    auto events = getChangedProperties();
-    // If we turn HVAC power on, we expect to receive one property event for every HVAC prop areas
-    // plus one event for HVAC_POWER_ON.
-    std::vector<int32_t> changedPropIds;
-    for (size_t i = 0; i < sizeof(HVAC_POWER_PROPERTIES) / sizeof(int32_t); i++) {
-        changedPropIds.push_back(HVAC_POWER_PROPERTIES[i]);
-    }
-    changedPropIds.push_back(toInt(VehicleProperty::HVAC_POWER_ON));
-    ASSERT_EQ(events.size(), changedPropIds.size());
-    for (const auto& event : events) {
-        EXPECT_EQ(event.areaId, HVAC_ALL);
-        EXPECT_THAT(event.prop, AnyOfArray(changedPropIds));
+        for (const auto& event : events) {
+            EXPECT_EQ(event.areaId, areaId);
+            EXPECT_THAT(event.prop, AnyOfArray(changedPropIds));
+        }
     }
 }