Merge "Camera: HAL1: remove libbinder usage" into oc-dev am: 73bae67b5d
am: cb95ee248b

Change-Id: I09a4cd697dd7a738776a3d6927167e276356ea2a
diff --git a/automotive/vehicle/2.0/default/Android.mk b/automotive/vehicle/2.0/default/Android.mk
index b8535bd..2cbb992 100644
--- a/automotive/vehicle/2.0/default/Android.mk
+++ b/automotive/vehicle/2.0/default/Android.mk
@@ -96,6 +96,7 @@
     $(vhal_v2_0) \
 
 LOCAL_STATIC_LIBRARIES := \
+    libqemu_pipe \
     $(vhal_v2_0)-libproto-native \
 
 LOCAL_CFLAGS += -Wall -Wextra -Werror
@@ -160,6 +161,7 @@
     $(vhal_v2_0)-manager-lib \
     $(vhal_v2_0)-default-impl-lib \
     $(vhal_v2_0)-libproto-native \
+    libqemu_pipe \
 
 LOCAL_CFLAGS += -Wall -Wextra -Werror
 
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index 545de39..b7ef896 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -33,176 +33,257 @@
     toInt(VehicleProperty::HVAC_FAN_DIRECTION),
 };
 
-const VehiclePropConfig kVehicleProperties[] = {
+struct ConfigDeclaration {
+    VehiclePropConfig config;
+
+    /* This value will be used as an initial value for the property. If this field is specified for
+     * property that supports multiple areas then it will be used for all areas unless particular
+     * area is overridden in initialAreaValue field. */
+    VehiclePropValue::RawValue initialValue;
+    /* Use initialAreaValues if it is necessary to specify different values per each area. */
+    std::map<int32_t, VehiclePropValue::RawValue> initialAreaValues;
+};
+
+const ConfigDeclaration kVehicleProperties[] {
     {
-        .prop = toInt(VehicleProperty::INFO_MAKE),
-        .access = VehiclePropertyAccess::READ,
-        .changeMode = VehiclePropertyChangeMode::STATIC,
+        .config = {
+            .prop = toInt(VehicleProperty::INFO_MAKE),
+            .access = VehiclePropertyAccess::READ,
+            .changeMode = VehiclePropertyChangeMode::STATIC,
+        },
+        .initialValue = { .stringValue = "Toy Vehicle" }
+    },
+    {
+        .config = {
+            .prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED),
+            .access = VehiclePropertyAccess::READ,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+        },
+        .initialValue = { .int32Values = {0} }
     },
 
     {
-        .prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED),
-        .access = VehiclePropertyAccess::READ,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+        .config = {
+            .prop = toInt(VehicleProperty::CURRENT_GEAR),
+            .access = VehiclePropertyAccess::READ,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+        },
+        .initialValue = { .int32Values = { toInt(VehicleGear::GEAR_PARK) } }
     },
 
     {
-        .prop = toInt(VehicleProperty::CURRENT_GEAR),
-        .access = VehiclePropertyAccess::READ,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+        .config = {
+            .prop = toInt(VehicleProperty::PARKING_BRAKE_ON),
+            .access = VehiclePropertyAccess::READ,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+        },
+        .initialValue = { .int32Values = {1} }
     },
 
     {
-        .prop = toInt(VehicleProperty::PARKING_BRAKE_ON),
-        .access = VehiclePropertyAccess::READ,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+        .config = {
+            .prop = toInt(VehicleProperty::FUEL_LEVEL_LOW),
+            .access = VehiclePropertyAccess::READ,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+        },
+        .initialValue = { .int32Values = {0} }
     },
 
     {
-        .prop = toInt(VehicleProperty::FUEL_LEVEL_LOW),
-        .access = VehiclePropertyAccess::READ,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+        .config = {
+            .prop = toInt(VehicleProperty::HVAC_POWER_ON),
+            .access = VehiclePropertyAccess::READ_WRITE,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+            .supportedAreas = toInt(VehicleAreaZone::ROW_1),
+            // TODO(bryaneyler): Ideally, this is generated dynamically from
+            // kHvacPowerProperties.
+            .configString = "0x12400500,0x12400501"  // HVAC_FAN_SPEED,HVAC_FAN_DIRECTION
+        },
+        .initialValue = { .int32Values = {1} }
     },
 
     {
-        .prop = toInt(VehicleProperty::HVAC_POWER_ON),
-        .access = VehiclePropertyAccess::READ_WRITE,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-        .supportedAreas = toInt(VehicleAreaZone::ROW_1),
-        // TODO(bryaneyler): Ideally, this is generated dynamically from
-        // kHvacPowerProperties.
-        .configString = "0x12400500,0x12400501"  // HVAC_FAN_SPEED,HVAC_FAN_DIRECTION
+        .config = {
+            .prop = toInt(VehicleProperty::HVAC_DEFROSTER),
+            .access = VehiclePropertyAccess::READ_WRITE,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+            .supportedAreas =
+            VehicleAreaWindow::FRONT_WINDSHIELD
+            | VehicleAreaWindow::REAR_WINDSHIELD
+        },
+        .initialValue = { .int32Values = {0} }  // Will be used for all areas.
     },
 
     {
-        .prop = toInt(VehicleProperty::HVAC_DEFROSTER),
-        .access = VehiclePropertyAccess::READ_WRITE,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-        .supportedAreas =
-                VehicleAreaWindow::FRONT_WINDSHIELD
-                | VehicleAreaWindow::REAR_WINDSHIELD
+        .config = {
+            .prop = toInt(VehicleProperty::HVAC_RECIRC_ON),
+            .access = VehiclePropertyAccess::READ_WRITE,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+            .supportedAreas = toInt(VehicleAreaZone::ROW_1)
+        },
+        .initialValue = { .int32Values = {1} }
     },
 
     {
-        .prop = toInt(VehicleProperty::HVAC_RECIRC_ON),
-        .access = VehiclePropertyAccess::READ_WRITE,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-        .supportedAreas = toInt(VehicleAreaZone::ROW_1)
+        .config = {
+            .prop = toInt(VehicleProperty::HVAC_AC_ON),
+            .access = VehiclePropertyAccess::READ_WRITE,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+            .supportedAreas = toInt(VehicleAreaZone::ROW_1)
+        },
+        .initialValue = { .int32Values = {1} }
     },
 
     {
-        .prop = toInt(VehicleProperty::HVAC_AC_ON),
-        .access = VehiclePropertyAccess::READ_WRITE,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-        .supportedAreas = toInt(VehicleAreaZone::ROW_1)
+        .config = {
+            .prop = toInt(VehicleProperty::HVAC_AUTO_ON),
+            .access = VehiclePropertyAccess::READ_WRITE,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+            .supportedAreas = toInt(VehicleAreaZone::ROW_1)
+        },
+        .initialValue = { .int32Values = {1} }
     },
 
     {
-        .prop = toInt(VehicleProperty::HVAC_AUTO_ON),
-        .access = VehiclePropertyAccess::READ_WRITE,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-        .supportedAreas = toInt(VehicleAreaZone::ROW_1)
+        .config = {
+            .prop = toInt(VehicleProperty::HVAC_FAN_SPEED),
+            .access = VehiclePropertyAccess::READ_WRITE,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+            .supportedAreas = toInt(VehicleAreaZone::ROW_1),
+            .areaConfigs = {
+                VehicleAreaConfig {
+                    .areaId = toInt(VehicleAreaZone::ROW_1),
+                    .minInt32Value = 1,
+                    .maxInt32Value = 7
+                }
+            }
+        },
+        .initialValue = { .int32Values = {3} }
     },
 
     {
-        .prop = toInt(VehicleProperty::HVAC_FAN_SPEED),
-        .access = VehiclePropertyAccess::READ_WRITE,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-        .supportedAreas = toInt(VehicleAreaZone::ROW_1),
-        .areaConfigs = {
-            VehicleAreaConfig {
-                .areaId = toInt(VehicleAreaZone::ROW_1),
-                .minInt32Value = 1,
-                .maxInt32Value = 7
+        .config = {
+            .prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION),
+            .access = VehiclePropertyAccess::READ_WRITE,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+            .supportedAreas = toInt(VehicleAreaZone::ROW_1),
+        },
+        .initialValue = { .int32Values = { toInt(VehicleHvacFanDirection::FACE) } }
+    },
+
+    {
+        .config = {
+            .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET),
+            .access = VehiclePropertyAccess::READ_WRITE,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+            .supportedAreas =
+            VehicleAreaZone::ROW_1_LEFT
+            | VehicleAreaZone::ROW_1_RIGHT,
+            .areaConfigs = {
+                VehicleAreaConfig {
+                    .areaId = toInt(VehicleAreaZone::ROW_1_LEFT),
+                    .minFloatValue = 16,
+                    .maxFloatValue = 32,
+                },
+                VehicleAreaConfig {
+                    .areaId = toInt(VehicleAreaZone::ROW_1_RIGHT),
+                    .minFloatValue = 16,
+                    .maxFloatValue = 32,
+                }
+            }
+        },
+        .initialAreaValues = {
+            {
+                toInt(VehicleAreaZone::ROW_1_LEFT),
+                { .int32Values = {16} }
+            }, {
+                toInt(VehicleAreaZone::ROW_1_RIGHT),
+                {.int32Values = {20} }
             }
         }
     },
 
     {
-        .prop = toInt(VehicleProperty::HVAC_FAN_DIRECTION),
-        .access = VehiclePropertyAccess::READ_WRITE,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-        .supportedAreas = toInt(VehicleAreaZone::ROW_1),
+        .config = {
+            .prop = toInt(VehicleProperty::ENV_OUTSIDE_TEMPERATURE),
+            .access = VehiclePropertyAccess::READ,
+            // TODO(bryaneyler): Support ON_CHANGE as well.
+            .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
+            .minSampleRate = 1.0f,
+            .maxSampleRate = 2.0f,
+        },
+        .initialValue = { .floatValues = {25.0f} }
     },
 
     {
-        .prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET),
-        .access = VehiclePropertyAccess::READ_WRITE,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-        .supportedAreas =
-                VehicleAreaZone::ROW_1_LEFT
-                | VehicleAreaZone::ROW_1_RIGHT,
-        .areaConfigs = {
-            VehicleAreaConfig {
-                .areaId = toInt(VehicleAreaZone::ROW_1_LEFT),
-                .minFloatValue = 16,
-                .maxFloatValue = 32,
-            },
-            VehicleAreaConfig {
-                .areaId = toInt(VehicleAreaZone::ROW_1_RIGHT),
-                .minFloatValue = 16,
-                .maxFloatValue = 32,
+        .config = {
+            .prop = toInt(VehicleProperty::NIGHT_MODE),
+            .access = VehiclePropertyAccess::READ,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+        },
+        .initialValue = { .int32Values = {0} }
+    },
+
+    {
+        .config = {
+            .prop = toInt(VehicleProperty::DRIVING_STATUS),
+            .access = VehiclePropertyAccess::READ,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+        },
+        .initialValue = { .int32Values = { toInt(VehicleDrivingStatus::UNRESTRICTED) } }
+    },
+
+    {
+        .config = {
+            .prop = toInt(VehicleProperty::GEAR_SELECTION),
+            .access = VehiclePropertyAccess::READ,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+        },
+        .initialValue = { .int32Values = { toInt(VehicleGear::GEAR_PARK) } }
+    },
+
+    {
+        .config = {
+            .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
+            .access = VehiclePropertyAccess::READ,
+            .changeMode = VehiclePropertyChangeMode::STATIC,
+        },
+        .initialValue = { .floatValues = { 123000.0f } }  // In Milliliters
+    },
+
+    {
+        .config = {
+            .prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS),
+            .access = VehiclePropertyAccess::READ_WRITE,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+            .areaConfigs = {
+                VehicleAreaConfig {
+                    .minInt32Value = 0,
+                    .maxInt32Value = 10
+                }
             }
-        }
+        },
+        .initialValue = { .int32Values = {7} }
     },
 
     {
-        .prop = toInt(VehicleProperty::ENV_OUTSIDE_TEMPERATURE),
-        .access = VehiclePropertyAccess::READ,
-        // TODO(bryaneyler): Support ON_CHANGE as well.
-        .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
-        .minSampleRate = 1.0f,
-        .maxSampleRate = 2.0f,
+        .config = {
+            .prop = toInt(VehicleProperty::IGNITION_STATE),
+            .access = VehiclePropertyAccess::READ,
+            .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+        },
+        .initialValue = { .int32Values = { toInt(VehicleIgnitionState::ON) } }
     },
 
     {
-        .prop = toInt(VehicleProperty::NIGHT_MODE),
-        .access = VehiclePropertyAccess::READ,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-    },
-
-    {
-        .prop = toInt(VehicleProperty::DRIVING_STATUS),
-        .access = VehiclePropertyAccess::READ,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-    },
-
-    {
-        .prop = toInt(VehicleProperty::GEAR_SELECTION),
-        .access = VehiclePropertyAccess::READ,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-    },
-
-    {
-        .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
-        .access = VehiclePropertyAccess::READ,
-        .changeMode = VehiclePropertyChangeMode::STATIC,
-    },
-
-    {
-        .prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS),
-        .access = VehiclePropertyAccess::READ_WRITE,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-        .areaConfigs = {
-            VehicleAreaConfig {
-                .minInt32Value = 0,
-                .maxInt32Value = 10
-            }
-        }
-    },
-
-    {
-        .prop = toInt(VehicleProperty::IGNITION_STATE),
-        .access = VehiclePropertyAccess::READ,
-        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
-    },
-
-    {
-        .prop = toInt(VehicleProperty::ENGINE_OIL_TEMP),
-        .access = VehiclePropertyAccess::READ,
-        .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
-        .minSampleRate = 0.1, // 0.1 Hz, every 10 seconds
-        .maxSampleRate = 10,  // 10 Hz, every 100 ms
+        .config = {
+            .prop = toInt(VehicleProperty::ENGINE_OIL_TEMP),
+            .access = VehiclePropertyAccess::READ,
+            .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
+            .minSampleRate = 0.1, // 0.1 Hz, every 10 seconds
+            .maxSampleRate = 10,  // 10 Hz, every 100 ms
+        },
+        .initialValue = { .floatValues = {101.0f} }
     }
 };
 
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
index 03a65f3..e174932 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
@@ -353,80 +353,6 @@
     }
 }
 
-// This function sets the default value of a property if we are interested in setting it.
-// TODO:  Co-locate the default values with the configuration structure, to make it easier to
-//          add new properties and their defaults.
-void DefaultVehicleHal::setDefaultValue(VehiclePropValue* prop) {
-    switch (prop->prop) {
-    case toInt(VehicleProperty::INFO_MAKE):
-        prop->value.stringValue = "Default Car";
-        break;
-    case toInt(VehicleProperty::PERF_VEHICLE_SPEED):
-        prop->value.floatValues[0] = 0;
-        break;
-    case toInt(VehicleProperty::CURRENT_GEAR):
-        prop->value.int32Values[0] = toInt(VehicleGear::GEAR_PARK);
-        break;
-    case toInt(VehicleProperty::PARKING_BRAKE_ON):
-        prop->value.int32Values[0] = 1;
-        break;
-    case toInt(VehicleProperty::FUEL_LEVEL_LOW):
-        prop->value.int32Values[0] = 0;
-        break;
-    case toInt(VehicleProperty::HVAC_POWER_ON):
-        prop->value.int32Values[0] = 1;
-        break;
-    case toInt(VehicleProperty::HVAC_DEFROSTER):
-        prop->value.int32Values[0] = 0;
-        break;
-    case toInt(VehicleProperty::HVAC_RECIRC_ON):
-        prop->value.int32Values[0] = 1;
-        break;
-    case toInt(VehicleProperty::HVAC_AC_ON):
-        prop->value.int32Values[0] = 1;
-        break;
-    case toInt(VehicleProperty::HVAC_AUTO_ON):
-        prop->value.int32Values[0] = 1;
-        break;
-    case toInt(VehicleProperty::HVAC_FAN_SPEED):
-        prop->value.int32Values[0] = 3;
-        break;
-    case toInt(VehicleProperty::HVAC_FAN_DIRECTION):
-        prop->value.int32Values[0] = toInt(VehicleHvacFanDirection::FACE);
-        break;
-    case toInt(VehicleProperty::HVAC_TEMPERATURE_SET):
-        prop->value.floatValues[0] = 16;
-        break;
-    case toInt(VehicleProperty::ENV_OUTSIDE_TEMPERATURE):
-        prop->value.floatValues[0] = 25;
-        break;
-    case toInt(VehicleProperty::NIGHT_MODE):
-        prop->value.int32Values[0] = 0;
-        break;
-    case toInt(VehicleProperty::DRIVING_STATUS):
-        prop->value.int32Values[0] = toInt(VehicleDrivingStatus::UNRESTRICTED);
-        break;
-    case toInt(VehicleProperty::GEAR_SELECTION):
-        prop->value.int32Values[0] = toInt(VehicleGear::GEAR_PARK);
-        break;
-    case toInt(VehicleProperty::INFO_FUEL_CAPACITY):
-        prop->value.floatValues[0] = 123000.0f;  // In milliliters
-        break;
-    case toInt(VehicleProperty::ENGINE_OIL_TEMP):
-        prop->value.floatValues[0] = 101;
-        break;
-    case toInt(VehicleProperty::DISPLAY_BRIGHTNESS):
-        prop->value.int32Values[0] = 7;
-        break;
-    case toInt(VehicleProperty::IGNITION_STATE):
-        prop->value.int32Values[0] = toInt(VehicleIgnitionState::ON);
-        break;
-    default:
-        ALOGW("%s: propId=0x%x not found", __func__, prop->prop);
-        break;
-    }
-}
-
 // Transmit a reply back to the emulator
 void DefaultVehicleHal::txMsg(emulator::EmulatorMessage& txMsg) {
     int numBytes = txMsg.ByteSize();
@@ -546,44 +472,9 @@
         mHvacPowerProps.insert(prop);
     }
 
-    // Get the list of configurations supported by this HAL
-    std::vector<VehiclePropConfig> configs = listProperties();
-
-    for (auto& cfg : configs) {
-        VehiclePropertyType propType = getPropType(cfg.prop);
+    for (auto& it : kVehicleProperties) {
+        VehiclePropConfig cfg = it.config;
         int32_t supportedAreas = cfg.supportedAreas;
-        int32_t vecSize;
-
-        // Set the vector size based on property type
-        switch (propType) {
-        case VehiclePropertyType::BOOLEAN:
-        case VehiclePropertyType::INT32:
-        case VehiclePropertyType::INT64:
-        case VehiclePropertyType::FLOAT:
-            vecSize = 1;
-            break;
-        case VehiclePropertyType::INT32_VEC:
-        case VehiclePropertyType::FLOAT_VEC:
-        case VehiclePropertyType::BYTES:
-            // TODO:  Add proper support for these types
-            vecSize = 1;
-            break;
-        case VehiclePropertyType::STRING:
-            // Require individual handling
-            vecSize = 0;
-            break;
-        case VehiclePropertyType::COMPLEX:
-            switch (cfg.prop) {
-            default:
-                // Need to handle each complex property separately
-                break;
-            }
-            continue;
-        default:
-            ALOGE("%s: propType=0x%x not found", __func__, propType);
-            vecSize = 0;
-            break;
-        }
 
         //  A global property will have supportedAreas = 0
         if (getPropArea(cfg.prop) == VehicleArea::GLOBAL) {
@@ -593,23 +484,29 @@
         // This loop is a do-while so it executes at least once to handle global properties
         do {
             int32_t curArea = supportedAreas;
-
-            // Clear the right-most bit of supportedAreas
-            supportedAreas &= supportedAreas - 1;
-
-            // Set curArea to the previously cleared bit
-            curArea ^= supportedAreas;
+            supportedAreas &= supportedAreas - 1;  // Clear the right-most bit of supportedAreas.
+            curArea ^= supportedAreas;  // Set curArea to the previously cleared bit.
 
             // Create a separate instance for each individual zone
-            std::unique_ptr<VehiclePropValue> prop = createVehiclePropValue(propType, vecSize);
-            prop->areaId = curArea;
-            prop->prop = cfg.prop;
-            setDefaultValue(prop.get());
-            std::unique_ptr<CustomVehiclePropertyHandler> handler;
-            handler.reset(new StoredValueCustomVehiclePropertyHandler());
-            handler->set(*prop);
-            mProps[std::make_pair(prop->prop, prop->areaId)] =
-                    std::move(handler);
+            VehiclePropValue prop = {
+                .prop = cfg.prop,
+                .areaId = curArea,
+            };
+            if (it.initialAreaValues.size() > 0) {
+                auto valueForAreaIt = it.initialAreaValues.find(curArea);
+                if (valueForAreaIt != it.initialAreaValues.end()) {
+                    prop.value = valueForAreaIt->second;
+                } else {
+                    ALOGW("%s failed to get default value for prop 0x%x area 0x%x",
+                            __func__, cfg.prop, curArea);
+                }
+            } else {
+                prop.value = it.initialValue;
+            }
+
+            auto handler = std::make_unique<StoredValueCustomVehiclePropertyHandler>();
+            handler->set(prop);
+            mProps[std::make_pair(prop.prop, prop.areaId)] = std::move(handler);
         } while (supportedAreas != 0);
     }
 
@@ -617,6 +514,14 @@
     mThread = std::thread(&DefaultVehicleHal::rxThread, this);
 }
 
+std::vector<VehiclePropConfig> DefaultVehicleHal::listProperties()  {
+    std::vector<VehiclePropConfig> configs(mPropConfigMap.size());
+    for (auto&& it : mPropConfigMap) {
+        configs.push_back(*it.second);
+    }
+    return configs;
+}
+
 void DefaultVehicleHal::onContinuousPropertyTimer(const std::vector<int32_t>& properties) {
     VehiclePropValuePtr v;
 
@@ -635,6 +540,12 @@
             if (VehiclePropertyType::FLOAT == getPropType(property)) {
                 // Just get some randomness to continuous properties to see slightly differnt values
                 // on the other end.
+                if (v->value.floatValues.size() == 0) {
+                    ALOGW("continuous property 0x%x is of type float but does not have a"
+                          " float value. defaulting to zero",
+                          property);
+                    v->value.floatValues = android::hardware::hidl_vec<float>{0.0f};
+                }
                 v->value.floatValues[0] = v->value.floatValues[0] + std::rand() % 5;
             }
         } else {
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h
index c8310b3..cdbaf48 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h
@@ -71,7 +71,8 @@
   DefaultVehicleHal() : mRecurrentTimer(
             std::bind(&DefaultVehicleHal::onContinuousPropertyTimer, this, std::placeholders::_1)) {
         for (size_t i = 0; i < arraysize(kVehicleProperties); i++) {
-            mPropConfigMap[kVehicleProperties[i].prop] = &kVehicleProperties[i];
+            const auto* config = &kVehicleProperties[i].config;
+            mPropConfigMap[config->prop] = config;
         }
     }
 
@@ -85,20 +86,12 @@
         mThread.join();
     }
 
-    std::vector<VehiclePropConfig> listProperties() override {
-        return std::vector<VehiclePropConfig>(std::begin(kVehicleProperties),
-                                              std::end(kVehicleProperties));
-    }
-
+    void onCreate() override;
+    std::vector<VehiclePropConfig> listProperties() override;
     VehiclePropValuePtr get(const VehiclePropValue& requestedPropValue,
                             StatusCode* outStatus) override;
-
-    void onCreate() override;
-
     StatusCode set(const VehiclePropValue& propValue) override;
-
     StatusCode subscribe(int32_t property, int32_t areas, float sampleRate) override;
-
     StatusCode unsubscribe(int32_t property) override;
 
     /**
@@ -125,17 +118,12 @@
      *                     this value at will
      * @return OK on success, an error code on failure
      */
-    virtual StatusCode addCustomProperty(
-        const VehiclePropValue& initialValue) {
-        std::unique_ptr<CustomVehiclePropertyHandler> handler;
-        handler.reset(new StoredValueCustomVehiclePropertyHandler());
-        StatusCode setResponse = handler->set(initialValue);
-        if (StatusCode::OK == setResponse) {
-          return addCustomProperty(initialValue.prop,
-                                   std::move(handler));
-        } else {
-          return setResponse;
-        }
+    virtual StatusCode addCustomProperty(const VehiclePropValue& initialValue) {
+        auto handler = std::make_unique<StoredValueCustomVehiclePropertyHandler>();
+        StatusCode response = handler->set(initialValue);
+        return StatusCode::OK == response
+               ? addCustomProperty(initialValue.prop, std::move(handler))
+               : response;
     }
 
 private:
@@ -152,7 +140,6 @@
                                     const VehiclePropConfig& cfg);
     void populateProtoVehiclePropValue(emulator::VehiclePropValue* protoVal,
                                        const VehiclePropValue* val);
-    void setDefaultValue(VehiclePropValue* prop);
     void rxMsg();
     void rxThread();
     void txMsg(emulator::EmulatorMessage& txMsg);
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.cpp
index 6f219fa..4da59a9 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/PipeComm.cpp
@@ -18,7 +18,7 @@
 
 #include <android/hardware/automotive/vehicle/2.0/IVehicle.h>
 #include <android/log.h>
-#include <system/qemu_pipe.h>
+#include <qemu_pipe.h>
 
 #include "PipeComm.h"
 
diff --git a/automotive/vehicle/2.1/default/Android.mk b/automotive/vehicle/2.1/default/Android.mk
index 51cb146..a1faeb7 100644
--- a/automotive/vehicle/2.1/default/Android.mk
+++ b/automotive/vehicle/2.1/default/Android.mk
@@ -65,6 +65,7 @@
 LOCAL_STATIC_LIBRARIES := \
     $(vhal_v2_0)-default-impl-lib \
     $(vhal_v2_0)-manager-lib \
+    libqemu_pipe \
     $(vhal_v2_1)-manager-lib \
     $(vhal_v2_0)-libproto-native
 
@@ -101,6 +102,7 @@
     $(vhal_v2_0)-manager-lib \
     $(vhal_v2_0)-default-impl-lib \
     $(vhal_v2_1)-default-impl-lib \
+    libqemu_pipe \
     $(vhal_v2_1)-manager-lib \
 
 LOCAL_SHARED_LIBRARIES := \
diff --git a/broadcastradio/1.1/ITuner.hal b/broadcastradio/1.1/ITuner.hal
index 82d45c6..dd7c844 100644
--- a/broadcastradio/1.1/ITuner.hal
+++ b/broadcastradio/1.1/ITuner.hal
@@ -47,8 +47,8 @@
      *
      * @return result OK if the scan was properly scheduled (this does not mean
      *                it successfully finished).
-     *                TEMPORARILY_UNAVAILABLE if the background scan is
-     *                temporarily unavailable, ie. due to ongoing foreground
+     *                UNAVAILABLE if the background scan is unavailable,
+     *                ie. temporarily due to ongoing foreground
      *                playback in single-tuner device.
      *                NOT_INITIALIZED other error, ie. HW failure.
      */
@@ -74,4 +74,33 @@
     getProgramList(string filter)
         generates (ProgramListResult result, vec<ProgramInfo> programList);
 
+    /**
+     * Checks, if the analog playback is forced, see setAnalogForced.
+     *
+     * The isForced value is only valid if result was OK.
+     *
+     * @return result OK if the call succeeded and isForced is valid.
+     *                INVALID_STATE if the switch is not supported at current
+     *                configuration.
+     *                NOT_INITIALIZED if any other error occurs.
+     * @return isForced true if analog is forced, false otherwise.
+     */
+    isAnalogForced() generates (Result result, bool isForced);
+
+    /**
+     * Forces the analog playback for the supporting radio technology.
+     *
+     * User may disable digital playback for FM HD Radio or hybrid FM/DAB with
+     * this option. This is purely user choice, ie. does not reflect digital-
+     * analog handover managed from the HAL implementation side.
+     *
+     * Some radio technologies may not support this, ie. DAB.
+     *
+     * @param isForced true to force analog, false for a default behaviour.
+     * @return result OK if the setting was successfully done.
+     *                INVALID_STATE if the switch is not supported at current
+     *                configuration.
+     *                NOT_INITIALIZED if any other error occurs.
+     */
+    setAnalogForced(bool isForced) generates (Result result);
 };
diff --git a/broadcastradio/1.1/ITunerCallback.hal b/broadcastradio/1.1/ITunerCallback.hal
index 07ce984..158e217 100644
--- a/broadcastradio/1.1/ITunerCallback.hal
+++ b/broadcastradio/1.1/ITunerCallback.hal
@@ -40,11 +40,19 @@
     oneway afSwitch_1_1(ProgramInfo info);
 
     /**
+     * Called by the HAL when background scan feature becomes available or not.
+     *
+     * @param isAvailable true, if the tuner turned temporarily background-
+     *                    capable, false in the other case.
+     */
+    oneway backgroundScanAvailable(bool isAvailable);
+
+    /**
      * Called by the HAL when background scan initiated by startBackgroundScan
      * finishes. If the list was changed, programListChanged must be called too.
      * @param result OK if the scan succeeded, client may retrieve the actual
      *               list with ITuner::getProgramList.
-     *               TEMPORARILY_UNAVAILABLE if the scan was interrupted due to
+     *               UNAVAILABLE if the scan was interrupted due to
      *               hardware becoming temporarily unavailable.
      *               NOT_INITIALIZED other error, ie. HW failure.
      */
diff --git a/broadcastradio/1.1/default/Tuner.cpp b/broadcastradio/1.1/default/Tuner.cpp
index f280754..4a6c691 100644
--- a/broadcastradio/1.1/default/Tuner.cpp
+++ b/broadcastradio/1.1/default/Tuner.cpp
@@ -211,6 +211,17 @@
     return Void();
 }
 
+Return<void> Tuner::isAnalogForced(isAnalogForced_cb _hidl_cb) {
+    // TODO(b/34348946): do the actual implementation.
+    _hidl_cb(Result::NOT_INITIALIZED, false);
+    return Void();
+}
+
+Return<Result> Tuner::setAnalogForced(bool isForced __unused) {
+    // TODO(b/34348946): do the actual implementation.
+    return Result::NOT_INITIALIZED;
+}
+
 } // namespace implementation
 }  // namespace V1_1
 }  // namespace broadcastradio
diff --git a/broadcastradio/1.1/default/Tuner.h b/broadcastradio/1.1/default/Tuner.h
index d7b4545..57eafd3 100644
--- a/broadcastradio/1.1/default/Tuner.h
+++ b/broadcastradio/1.1/default/Tuner.h
@@ -44,6 +44,8 @@
     Return<void> getProgramInformation_1_1(getProgramInformation_1_1_cb _hidl_cb) override;
     Return<ProgramListResult> startBackgroundScan() override;
     Return<void> getProgramList(const hidl_string& filter, getProgramList_cb _hidl_cb) override;
+    Return<void> isAnalogForced(isAnalogForced_cb _hidl_cb) override;
+    Return<Result> setAnalogForced(bool isForced) override;
 
     static void callback(radio_hal_event_t *halEvent, void *cookie);
     void onCallback(radio_hal_event_t *halEvent);
diff --git a/broadcastradio/1.1/types.hal b/broadcastradio/1.1/types.hal
index 3021f2e..5577ea0 100644
--- a/broadcastradio/1.1/types.hal
+++ b/broadcastradio/1.1/types.hal
@@ -23,7 +23,7 @@
 enum ProgramListResult : Result {
     NOT_READY,
     NOT_STARTED,
-    TEMPORARILY_UNAVAILABLE,
+    UNAVAILABLE,
 };
 
 /**
@@ -53,6 +53,18 @@
      * it may not be available though, see startBackgroundScan.
      */
     bool supportsBackgroundScanning;
+
+    /**
+     * Opaque vendor-specific string, to be passed to front-end without changes.
+     * Format of this string can vary across vendors.
+     *
+     * It may be used for extra features, that's not supported by a platform,
+     * for example: "preset-slots=6;ultra-hd-capable=false".
+     *
+     * Front-end application MUST verify vendor/product name from the
+     * @1.0::Properties struct before doing any interpretation of this value.
+     */
+    string vendorExension;
 };
 
 /**
@@ -64,10 +76,14 @@
     bitfield<ProgramInfoFlags> flags;
 
     /**
-     * Vendors are allowed to define their own set of flags and store it in this
-     * field. They MUST verify vendor/product name from Properties struct
-     * (IBroadcastRadio::getProperties) before doing any interpretation
-     * of such values.
+     * Opaque vendor-specific string, to be passed to front-end without changes.
+     * Format of this string can vary across vendors.
+     *
+     * It may be used for extra features, that's not supported by a platform,
+     * for example: "paid-service=true;bitrate=320kbps".
+     *
+     * Front-end application MUST verify vendor/product name from the
+     * @1.0::Properties struct before doing any interpretation of this value.
      */
-    uint32_t vendorFlags;
+    string vendorExension;
 };
diff --git a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
index d3c05c4..aa5ab54 100644
--- a/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
+++ b/broadcastradio/1.1/vts/functional/VtsHalBroadcastradioV1_1TargetTest.cpp
@@ -129,6 +129,10 @@
             return Void();
         }
 
+        virtual Return<void> backgroundScanAvailable(bool isAvailable __unused) {
+            return Void();
+        }
+
         virtual Return<void> backgroundScanComplete(ProgramListResult result __unused) {
             return Void();
         }
diff --git a/graphics/common/1.0/types.hal b/graphics/common/1.0/types.hal
index 979e4c4..8aa0779 100644
--- a/graphics/common/1.0/types.hal
+++ b/graphics/common/1.0/types.hal
@@ -181,9 +181,17 @@
      *    - GRALLOC_USAGE_SW_*
      *    - GRALLOC_USAGE_RENDERSCRIPT
      *
-     * When used with ANativeWindow, the dataSpace should be
-     * HAL_DATASPACE_ARBITRARY, as raw image sensor buffers require substantial
-     * extra metadata to define.
+     * When used with ANativeWindow, the mapping of the dataSpace field to
+     * buffer contents for RAW16 is as follows:
+     *
+     *  dataSpace value               | Buffer contents
+     * -------------------------------+-----------------------------------------
+     *  HAL_DATASPACE_ARBITRARY       | Raw image sensor data, layout is as
+     *                                | defined above.
+     *  HAL_DATASPACE_DEPTH           | Unprocessed implementation-dependent raw
+     *                                | depth measurements, opaque with 16 bit
+     *                                | samples.
+     *  Other                         | Unsupported
      */
     RAW16 = 0x20,