print log message for values retrieved from configstore am: 0dc72ecbb7
am: df7924635a

Change-Id: I89acd6b9e096ee9db4674a52d27dbf71bec01e20
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,
 
diff --git a/wifi/Android.bp b/wifi/Android.bp
index d4e0fda..523014f 100644
--- a/wifi/Android.bp
+++ b/wifi/Android.bp
@@ -2,5 +2,7 @@
 subdirs = [
     "1.0",
     "1.0/vts/functional",
+    "offload/1.0",
+    "offload/1.0/vts/functional",
     "supplicant/1.0",
 ]
diff --git a/wifi/offload/1.0/Android.bp b/wifi/offload/1.0/Android.bp
new file mode 100644
index 0000000..5e89ceb
--- /dev/null
+++ b/wifi/offload/1.0/Android.bp
@@ -0,0 +1,69 @@
+// This file is autogenerated by hidl-gen. Do not edit manually.
+
+filegroup {
+    name: "android.hardware.wifi.offload@1.0_hal",
+    srcs: [
+        "types.hal",
+        "IOffload.hal",
+        "IOffloadCallback.hal",
+    ],
+}
+
+genrule {
+    name: "android.hardware.wifi.offload@1.0_genc++",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi.offload@1.0",
+    srcs: [
+        ":android.hardware.wifi.offload@1.0_hal",
+    ],
+    out: [
+        "android/hardware/wifi/offload/1.0/types.cpp",
+        "android/hardware/wifi/offload/1.0/OffloadAll.cpp",
+        "android/hardware/wifi/offload/1.0/OffloadCallbackAll.cpp",
+    ],
+}
+
+genrule {
+    name: "android.hardware.wifi.offload@1.0_genc++_headers",
+    tools: ["hidl-gen"],
+    cmd: "$(location hidl-gen) -o $(genDir) -Lc++ -randroid.hardware:hardware/interfaces -randroid.hidl:system/libhidl/transport android.hardware.wifi.offload@1.0",
+    srcs: [
+        ":android.hardware.wifi.offload@1.0_hal",
+    ],
+    out: [
+        "android/hardware/wifi/offload/1.0/types.h",
+        "android/hardware/wifi/offload/1.0/IOffload.h",
+        "android/hardware/wifi/offload/1.0/IHwOffload.h",
+        "android/hardware/wifi/offload/1.0/BnHwOffload.h",
+        "android/hardware/wifi/offload/1.0/BpHwOffload.h",
+        "android/hardware/wifi/offload/1.0/BsOffload.h",
+        "android/hardware/wifi/offload/1.0/IOffloadCallback.h",
+        "android/hardware/wifi/offload/1.0/IHwOffloadCallback.h",
+        "android/hardware/wifi/offload/1.0/BnHwOffloadCallback.h",
+        "android/hardware/wifi/offload/1.0/BpHwOffloadCallback.h",
+        "android/hardware/wifi/offload/1.0/BsOffloadCallback.h",
+    ],
+}
+
+cc_library_shared {
+    name: "android.hardware.wifi.offload@1.0",
+    generated_sources: ["android.hardware.wifi.offload@1.0_genc++"],
+    generated_headers: ["android.hardware.wifi.offload@1.0_genc++_headers"],
+    export_generated_headers: ["android.hardware.wifi.offload@1.0_genc++_headers"],
+    shared_libs: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "liblog",
+        "libutils",
+        "libcutils",
+        "android.hidl.base@1.0",
+    ],
+    export_shared_lib_headers: [
+        "libhidlbase",
+        "libhidltransport",
+        "libhwbinder",
+        "libutils",
+        "android.hidl.base@1.0",
+    ],
+}
diff --git a/wifi/offload/1.0/IOffload.hal b/wifi/offload/1.0/IOffload.hal
new file mode 100644
index 0000000..7ad902c
--- /dev/null
+++ b/wifi/offload/1.0/IOffload.hal
@@ -0,0 +1,76 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.hardware.wifi.offload@1.0;
+
+import IOffloadCallback;
+
+interface IOffload {
+    /**
+     * Configure the offload module to perform scans and filter results
+     * Scans must not be triggered due to configuration of the module.
+     *
+     * @param ScanParam paramters for scanning
+     * @param ScanFilter settings to filter scan result
+     * @return boolean status indicating success (true) when configuration
+     *            is applied or failure (false) for invalid configuration
+     */
+    @entry
+    @callflow(next={"setEventCallback", "subscribeScanResults"})
+    configureScans(ScanParam param, ScanFilter filter);
+
+    /**
+     * Get scan statistics
+     *
+     * @return ScanStats statistics of scans performed
+     */
+    @exit
+    @callflow(next={"subscribeScanResults", "unsubscribeScanResults", "getScanStats"})
+    getScanStats() generates (ScanStats scanStats);
+
+    /**
+     * Subscribe to asynchronous scan events sent by offload module. This enables
+     * offload scans to be performed as per scan parameters, filtering the scan
+     * results based on configured scan filter and delivering the results after
+     * at least delayMs milliseconds from this call. If the client is already
+     * subscribed to the scan results, a call to this API must be a no-op.
+     *
+     * @param delayMs an integer expressing the minimum delay in mS after
+     *        subscribing when scan results must be delivered to the client
+     */
+    @callflow(next={"unsubscribeScanResults", "getScanStats"})
+    subscribeScanResults(uint32_t delayMs);
+
+    /**
+     * Unsubscribe to scan events sent by the offload module, hence disabling scans.
+     * If the client is already unsubscribed, a call to this API will be a no-op.
+     */
+    @exit
+    @callflow(next={"*"})
+    unsubscribeScanResults();
+
+    /**
+     * Setup the HIDL interface for reporting asynchronous scan events. A maximum
+     * of one callback interface is supported. Only one callback must be registered
+     * at any given time. If two consecutive calls are made with different callback
+     * interface objects, the latest one must be used to deliver events to client.
+     *
+     * @param cb An instance of the |IOffloadCallback| HIDL interface object
+     */
+    @entry
+    @callflow(next={"subscribeScanStats", "configureScans"})
+    setEventCallback(IOffloadCallback cb);
+};
diff --git a/wifi/offload/1.0/IOffloadCallback.hal b/wifi/offload/1.0/IOffloadCallback.hal
new file mode 100644
index 0000000..4599370
--- /dev/null
+++ b/wifi/offload/1.0/IOffloadCallback.hal
@@ -0,0 +1,25 @@
+/*
+ * Copyright 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.hardware.wifi.offload@1.0;
+
+interface IOffloadCallback {
+    /**
+     * Interface for the Offload HAL to return scan events to the client
+     *
+     * @param scanResult a vector of scan result objects
+     */
+    oneway onScanResult(vec<ScanResult> scanResult);
+};
diff --git a/wifi/offload/1.0/types.hal b/wifi/offload/1.0/types.hal
new file mode 100644
index 0000000..870d2d3
--- /dev/null
+++ b/wifi/offload/1.0/types.hal
@@ -0,0 +1,205 @@
+/*
+ * Copyright 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package android.hardware.wifi.offload@1.0;
+
+/**
+ * Defines a bitmap of security modes
+ */
+enum SecurityMode : uint8_t {
+    OPEN                    = 0x1 << 1,
+    WEP                     = 0x1 << 2,
+    PSK                     = 0x1 << 3,
+    EAP                     = 0x1 << 4,
+};
+
+/**
+ * SSID of the Access Point, maximum 32 characters
+ */
+typedef vec<uint8_t> Ssid;
+
+/**
+ * Preferred network information
+ * SSID and associated security mode(s)
+ */
+struct NetworkInfo {
+    Ssid ssid;
+    /* SecurityMode flags that are associated with this SSID
+     * More than one security mode can be supported, see SecurityMode */
+    bitfield<SecurityMode> flags;
+};
+
+/**
+ * This is a bit mask describing the capabilities of a BSS.
+ * See IEEE Std 802.11: 8.4.1.4
+ */
+enum Capability : uint16_t {
+    ESS                     = 1 << 0,
+    IBSS                    = 1 << 1,
+    CF_POLLABLE             = 1 << 2,
+    CF_PLL_REQ              = 1 << 3,
+    PRIVACY                 = 1 << 4,
+    SHORT_PREAMBLE          = 1 << 5,
+    PBCC                    = 1 << 6,
+    CHANNEL_AGILITY         = 1 << 7,
+    SPECTURM_MGMT           = 1 << 8,
+    QOS                     = 1 << 9,
+    SHORT_SLOT_TIME         = 1 << 10,
+    APSD                    = 1 << 11,
+    RADIO_MEASUREMENT       = 1 << 12,
+    DSSS_OFDM               = 1 << 13,
+    DELAYED_BLOCK_ACK       = 1 << 14,
+    IMMEDIATE_BLOCK_ACK     = 1 << 15,
+};
+
+/**
+ * Scan Results returned by the offload Hal
+ */
+struct ScanResult {
+    /* Information about this BSS
+     * SSID and security modes supported */
+    NetworkInfo networkInfo;
+    /* BSSID of the BSS */
+    uint8_t[6] bssid;
+    /* Can have multiple bits set, see Capability */
+    bitfield<Capability> capability;
+    /* Frequency scanned, in mHz */
+    uint32_t frequency;
+    /* Signal strength in dBm */
+    int8_t rssi;
+    /* TSF found in beacon/probe response */
+    uint64_t tsf;
+};
+
+
+/**
+ * Parameters for performing offload scans
+ */
+struct ScanParam {
+    /* Specify a list of SSIDs to scan, an empty list implies no preferred
+     * networks to scan */
+    vec<Ssid> ssidList;
+    /* Frequencies to scan, in mHz, an empty frequency list implies a full scan */
+    vec<uint32_t> frequencyList;
+    /* Periodicity of the scans to be performed by the offload module
+     * A value of zero indicates disable periodic scans. For this revision,
+     * where offload module is performing scans in disconnected mode, this value
+     * should not be zero. In future versions, periodic scans can be eliminated */
+    uint32_t disconnectedModeScanIntervalMs;
+};
+
+/**
+ * Instruction on how to filter the scan result before performing network
+ * selection and waking up the AP to connect
+ */
+struct ScanFilter {
+    /* Preferred network List of SSIDs and their security mode of interest
+     * The filter will drop the remaining scan results in the scan event.
+     * An empty list implies no filtering of scan result based on SSID and
+     * security mode. */
+    vec<NetworkInfo> preferredNetworkInfoList;
+    /* Minimum qualifying RSSI to be considered for network selection (dBm) */
+    int8_t rssiThreshold;
+};
+
+struct ScanRecord {
+    /* Amount of time spent scanning */
+    uint64_t durationMs;
+    /* Number of channels scanned */
+    uint32_t numChannelsScanned;
+    /* Number of entries aggregated into this record */
+    uint32_t numEntriesAggregated;
+};
+
+/**
+ * Enumerates the type of log that is recorded
+ */
+enum RecordName : uint32_t {
+    CMD_BASE                        = 0x00001000,
+    /* Record name corresponding to initialization */
+    CMD_INT                         = CMD_BASE + 0,
+   /* Record name corresponding to configureScans() API */
+    CMD_CONFIG_SCANS                = CMD_BASE + 1,
+    /* Record name corresponding to subscribeScanResults() API */
+    CMD_SUBSCRIBE_SCAN_RESULTS      = CMD_BASE + 2,
+    /* Record name corresponding to unsubscribeScanResults() API */
+    CMD_UNSUBSCRIBE_SCAN_RESULTS    = CMD_BASE + 3,
+    /* Record name corresponding to getScanStats() API */
+    CMD_GET_SCAN_STATS              = CMD_BASE + 4,
+    /* Record name corresponding to a reset*/
+    CMD_RESET                       = CMD_BASE + 5,
+    /* Add new commands here */
+    EVENT_RECVD_BASE                = 0x00002000,
+    /* Record name corresponding to scan monitor event*/
+    EVENT_RECVD_SCAN_RESULT_ASYNC   = EVENT_RECVD_BASE + 0,
+    /* Record name corresponding to scan response event */
+    EVENT_RECVD_SCAN_RESULT         = EVENT_RECVD_BASE + 1,
+    /* Add new events received here */
+    EVENT_SENT_BASE                 = 0x00003000,
+    /* Record name corresponding to scan event sent */
+    EVENT_SENT_SCAN_RESULT          = EVENT_SENT_BASE + 0,
+    /* Record name corresponding to abort event sent */
+    EVENT_SENT_ABORT                = EVENT_SENT_BASE + 1,
+    /* Record name corresponding to error event sent */
+    EVENT_SENT_ERROR                = EVENT_SENT_BASE + 2,
+    /* Add new events sent here */
+    REQ_BASE                        = 0x00004000,
+    /* Record name corresponding to scan request sent*/
+    REQ_SCAN                        = REQ_BASE + 0,
+    /* Add new requests here */
+};
+
+/**
+ * Defines the structure of each log record
+ */
+struct LogRecord {
+    /* Indicates the log recorded */
+    RecordName recordName;
+    /* Platform reference time in milliseconds when the log is recorded */
+    uint64_t logTimeMs;
+};
+
+/**
+ * Defines the scan statistics to be returned to the framework
+ */
+struct ScanStats {
+    /* Incremented everytime a new scan is requested */
+    uint32_t numScansRequestedByWifi;
+    /* Incremented everytime the scan is serviced by performing a scan*/
+    uint32_t numScansServicedByWifi;
+    /* Incremented everytime the scan is serviced by the scan cache */
+    uint32_t numScansServicedbyCache;
+    /* The last (CHRE reference) time this data structure is updated */
+    uint64_t lastUpdated;
+    /* The last (CHRE reference) time this data structure is read */
+    uint64_t lastRead;
+    /* The total time when the Offload module could be performing scans (T2 - T1)
+     * T1 - time when the framework subscribes for scan result (includes delayMs)
+     * T2 - min (time when the framework unsubscribes for scan result,
+     * currentTime) */
+    uint64_t subscriptionDurationMs;
+    /* Histograms of the channels scanned, 802.11 and with an 8 bit
+     * representation, only 256 channels are available */
+    uint8_t[256] histogramChannelsScanned;
+    /* Scan Record for this subscribe duration */
+    vec<ScanRecord> scanRecord;
+    /* Vector of the logRecord entries */
+    vec<LogRecord> logRecord;
+};
+
+
+
+
+
diff --git a/wifi/offload/1.0/vts/functional/Android.bp b/wifi/offload/1.0/vts/functional/Android.bp
new file mode 100644
index 0000000..f907a89
--- /dev/null
+++ b/wifi/offload/1.0/vts/functional/Android.bp
@@ -0,0 +1,36 @@
+//
+// Copyright (C) 2017 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+cc_test {
+    name: "VtsHalWifiOffloadV1_0TargetTest",
+    defaults: ["hidl_defaults"],
+    srcs: ["VtsHalWifiOffloadV1_0TargetTest.cpp"],
+    shared_libs: [
+        "libbase",
+        "liblog",
+        "libcutils",
+        "libhidlbase",
+        "libhidltransport",
+        "libnativehelper",
+        "libutils",
+        "android.hardware.wifi.offload@1.0",
+    ],
+    static_libs: ["VtsHalHidlTargetTestBase"],
+    cflags: [
+        "-O0",
+        "-g",
+    ],
+}
diff --git a/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp b/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
new file mode 100644
index 0000000..630922a
--- /dev/null
+++ b/wifi/offload/1.0/vts/functional/VtsHalWifiOffloadV1_0TargetTest.cpp
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2016 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#define LOG_TAG "wifi_offload_hidl_hal_test"
+
+#include <android-base/logging.h>
+#include <android/hardware/wifi/offload/1.0/IOffload.h>
+#include <android/hardware/wifi/offload/1.0/IOffloadCallback.h>
+#include <android/hardware/wifi/offload/1.0/types.h>
+
+#include <VtsHalHidlTargetTestBase.h>
+
+#include <vector>
+
+using ::android::hardware::wifi::offload::V1_0::IOffload;
+using ::android::hardware::wifi::offload::V1_0::IOffloadCallback;
+using ::android::hardware::wifi::offload::V1_0::ScanResult;
+using ::android::hardware::wifi::offload::V1_0::ScanParam;
+using ::android::hardware::wifi::offload::V1_0::ScanFilter;
+using ::android::hardware::wifi::offload::V1_0::ScanStats;
+using ::android::hardware::Return;
+using ::android::hardware::Void;
+using ::android::hardware::hidl_vec;
+using ::android::sp;
+
+typedef std::function<void(const std::vector<ScanResult>& scanResult)>
+    OnOffloadScanResultsReadyHandler;
+
+// The main test class for WifiOffload HIDL HAL.
+class WifiOffloadHidlTest : public ::testing::VtsHalHidlTargetTestBase {
+   public:
+    virtual void SetUp() override {
+        wifi_offload_ =
+            ::testing::VtsHalHidlTargetTestBase::getService<IOffload>();
+        ASSERT_NE(wifi_offload_, nullptr);
+
+        wifi_offload_cb_ = new OffloadCallback(
+            [this](std::vector<ScanResult> scanResult) -> void {
+                this->reportScanResults(scanResult);
+            });
+        ASSERT_NE(wifi_offload_cb_, nullptr);
+
+        defaultSize = 0;
+    }
+
+    virtual void TearDown() override {}
+
+    void reportScanResults(std::vector<ScanResult> scanResult) {
+        defaultSize = scanResult.size();
+    }
+
+    /* Callback class for scanResult. */
+    class OffloadCallback : public IOffloadCallback {
+       public:
+        OffloadCallback(OnOffloadScanResultsReadyHandler handler)
+            : handler_(handler){};
+
+        virtual ~OffloadCallback() = default;
+
+        Return<void> onScanResult(
+            const hidl_vec<ScanResult>& scanResult) override {
+            const std::vector<ScanResult> scanResult_(scanResult);
+            handler_(scanResult_);
+            return Void();
+        };
+
+       private:
+        OnOffloadScanResultsReadyHandler handler_;
+    };
+
+    sp<IOffload> wifi_offload_;
+    sp<IOffloadCallback> wifi_offload_cb_;
+    int defaultSize = 0;
+};
+
+/*
+ * Verify that setEventCallback method returns without errors
+ */
+TEST_F(WifiOffloadHidlTest, setEventCallback) {
+    auto returnObject = wifi_offload_->setEventCallback(wifi_offload_cb_);
+    ASSERT_EQ(returnObject.isOk(), true);
+}
+
+/*
+ * Verify that subscribeScanResults method returns without errors
+ */
+TEST_F(WifiOffloadHidlTest, subscribeScanResults) {
+    auto returnObject = wifi_offload_->subscribeScanResults(0);
+    ASSERT_EQ(returnObject.isOk(), true);
+}
+
+/*
+ * Verify that unsubscribeScanResults method returns without errors
+ */
+TEST_F(WifiOffloadHidlTest, unsubscribeScanResults) {
+    auto returnObject = wifi_offload_->unsubscribeScanResults();
+    ASSERT_EQ(returnObject.isOk(), true);
+}
+
+/*
+ * Verify that configureScans method returns without errors
+ */
+TEST_F(WifiOffloadHidlTest, configureScans) {
+    ScanParam* pScanParam = new ScanParam();
+    ScanFilter* pScanFilter = new ScanFilter();
+    auto returnObject =
+        wifi_offload_->configureScans(*pScanParam, *pScanFilter);
+    ASSERT_EQ(returnObject.isOk(), true);
+}
+
+/*
+ * Verify that getScanStats returns without any errors
+ */
+TEST_F(WifiOffloadHidlTest, getScanStats) {
+    ScanStats* pScanStats = new ScanStats();
+    const auto& returnObject =
+        wifi_offload_->getScanStats([pScanStats](ScanStats scanStats) -> void {
+            *pScanStats = std::move(scanStats);
+        });
+    ASSERT_EQ(returnObject.isOk(), true);
+}
+
+// A class for test environment setup
+class WifiOffloadHalHidlEnvironment : public ::testing::Environment {
+   public:
+    virtual void SetUp() {}
+    virtual void TearDown() {}
+};
+
+int main(int argc, char** argv) {
+    ::testing::AddGlobalTestEnvironment(new WifiOffloadHalHidlEnvironment);
+    ::testing::InitGoogleTest(&argc, argv);
+
+    int status = RUN_ALL_TESTS();
+    LOG(INFO) << "Test result = " << status;
+
+    return status;
+}