summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp59
-rw-r--r--automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h4
-rw-r--r--automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp24
-rw-r--r--automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h3
4 files changed, 1 insertions, 89 deletions
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
index bdc52448e7..a983c7117d 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp
@@ -15,13 +15,8 @@
*/
#define LOG_TAG "DefaultVehicleHal_v2_0"
-#include <android-base/macros.h>
-#include <android-base/properties.h>
#include <android/log.h>
-#include <dirent.h>
-#include <sys/system_properties.h>
-#include <fstream>
-#include <regex>
+#include <android-base/macros.h>
#include "EmulatedVehicleHal.h"
#include "JsonFakeValueGenerator.h"
@@ -105,30 +100,6 @@ EmulatedVehicleHal::EmulatedVehicleHal(VehiclePropertyStore* propStore, VehicleH
mVehicleClient->registerPropertyValueCallback(std::bind(&EmulatedVehicleHal::onPropertyValue,
this, std::placeholders::_1,
std::placeholders::_2));
-
- mInitVhalValueOverride =
- android::base::GetBoolProperty("persist.vendor.vhal_init_value_override", false);
- if (mInitVhalValueOverride) {
- getAllPropertiesOverride();
- }
-}
-
-void EmulatedVehicleHal::getAllPropertiesOverride() {
- if (auto dir = opendir("/vendor/etc/vhaloverride/")) {
- std::regex reg_json(".*[.]json", std::regex::icase);
- while (auto f = readdir(dir)) {
- if (!regex_match(f->d_name, reg_json)) {
- continue;
- }
- std::string file = "/vendor/etc/vhaloverride/" + std::string(f->d_name);
- JsonFakeValueGenerator tmpGenerator(file);
-
- std::vector<VehiclePropValue> propvalues = tmpGenerator.getAllEvents();
- mVehiclePropertiesOverride.insert(std::end(mVehiclePropertiesOverride),
- std::begin(propvalues), std::end(propvalues));
- }
- closedir(dir);
- }
}
VehicleHal::VehiclePropValuePtr EmulatedVehicleHal::get(
@@ -217,14 +188,6 @@ StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) {
return StatusCode::NOT_AVAILABLE;
}
- if (mInEmulator && propValue.prop == toInt(VehicleProperty::DISPLAY_BRIGHTNESS)) {
- // Emulator does not support remote brightness control, b/139959479
- // do not send it down so that it does not bring unnecessary property change event
- // return other error code, such NOT_AVAILABLE, causes Emulator to be freezing
- // TODO: return StatusCode::NOT_AVAILABLE once the above issue is fixed
- return StatusCode::OK;
- }
-
/**
* After checking all conditions, such as the property is available, a real vhal will
* sent the events to Car ECU to take actions.
@@ -250,17 +213,6 @@ static bool isDiagnosticProperty(VehiclePropConfig propConfig) {
return false;
}
-// determine if it's running inside Android Emulator
-static bool isInEmulator() {
- char propValue[PROP_VALUE_MAX];
- bool isEmulator = (__system_property_get("ro.kernel.qemu", propValue) != 0);
- if (!isEmulator) {
- isEmulator = (__system_property_get("ro.hardware", propValue) != 0) &&
- (!strcmp(propValue, "ranchu") || !strcmp(propValue, "goldfish"));
- }
- return isEmulator;
-}
-
// Parse supported properties list and generate vector of property values to hold current values.
void EmulatedVehicleHal::onCreate() {
static constexpr bool shouldUpdateStatus = true;
@@ -305,21 +257,12 @@ void EmulatedVehicleHal::onCreate() {
}
} else {
prop.value = it.initialValue;
- if (mInitVhalValueOverride) {
- for (auto& itOverride : mVehiclePropertiesOverride) {
- if (itOverride.prop == cfg.prop) {
- prop.value = itOverride.value;
- }
- }
- }
}
mPropStore->writeValue(prop, shouldUpdateStatus);
}
}
initObd2LiveFrame(*mPropStore->getConfigOrDie(OBD2_LIVE_FRAME));
initObd2FreezeFrame(*mPropStore->getConfigOrDie(OBD2_FREEZE_FRAME));
- mInEmulator = isInEmulator();
- ALOGD("mInEmulator=%s", mInEmulator ? "true" : "false");
}
std::vector<VehiclePropConfig> EmulatedVehicleHal::listProperties() {
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h
index cba4b8ae11..ebf19951b3 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h
@@ -62,7 +62,6 @@ public:
// Methods from EmulatedVehicleHalIface
bool setPropertyFromVehicle(const VehiclePropValue& propValue) override;
std::vector<VehiclePropValue> getAllProperties() const override;
- void getAllPropertiesOverride();
private:
constexpr std::chrono::nanoseconds hertzToNanoseconds(float hz) const {
@@ -87,9 +86,6 @@ private:
std::unordered_set<int32_t> mHvacPowerProps;
RecurrentTimer mRecurrentTimer;
VehicleHalClient* mVehicleClient;
- bool mInEmulator;
- bool mInitVhalValueOverride;
- std::vector<VehiclePropValue> mVehiclePropertiesOverride;
};
} // impl
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp
index 890eb33643..8677f837f5 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.cpp
@@ -48,22 +48,6 @@ JsonFakeValueGenerator::JsonFakeValueGenerator(const VehiclePropValue& request)
mNumOfIterations = v.int32Values.size() < 2 ? -1 : v.int32Values[1];
}
-JsonFakeValueGenerator::JsonFakeValueGenerator(std::string path) {
- std::ifstream ifs(path);
- if (!ifs) {
- ALOGE("%s: couldn't open %s for parsing.", __func__, path.c_str());
- }
- mGenCfg = {
- .index = 0,
- .events = parseFakeValueJson(ifs),
- };
- mNumOfIterations = mGenCfg.events.size();
-}
-
-std::vector<VehiclePropValue> JsonFakeValueGenerator::getAllEvents() {
- return mGenCfg.events;
-}
-
VehiclePropValue JsonFakeValueGenerator::nextEvent() {
VehiclePropValue generatedValue;
if (!hasNext()) {
@@ -125,7 +109,6 @@ std::vector<VehiclePropValue> JsonFakeValueGenerator::parseFakeValueJson(std::is
Json::Value rawEventValue = rawEvent["value"];
auto& value = event.value;
- int32_t count;
switch (getPropType(event.prop)) {
case VehiclePropertyType::BOOLEAN:
case VehiclePropertyType::INT32:
@@ -143,13 +126,6 @@ std::vector<VehiclePropValue> JsonFakeValueGenerator::parseFakeValueJson(std::is
case VehiclePropertyType::STRING:
value.stringValue = rawEventValue.asString();
break;
- case VehiclePropertyType::INT32_VEC:
- value.int32Values.resize(rawEventValue.size());
- count = 0;
- for (auto& it : rawEventValue) {
- value.int32Values[count++] = it.asInt();
- }
- break;
case VehiclePropertyType::MIXED:
copyMixedValueJson(value, rawEventValue);
if (isDiagnosticProperty(event.prop)) {
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h
index dc8ff6680c..70575f77bf 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/JsonFakeValueGenerator.h
@@ -41,12 +41,9 @@ private:
public:
JsonFakeValueGenerator(const VehiclePropValue& request);
- JsonFakeValueGenerator(std::string path);
-
~JsonFakeValueGenerator() = default;
VehiclePropValue nextEvent();
- std::vector<VehiclePropValue> getAllEvents();
bool hasNext();