Rename EmulatedUserHal to FakeUserHal.
EmulatedUserHal is a library that allows setting and getting fake
user HAL properties, and has nothing to do with emulator. So we
rename it to FakeUserHal to be clearer.
Test: Local build.
Bug: 194340549
Change-Id: I29bf3ceb9e4cacb0a1da96699bd4ba843cab883d
diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp
index f96654f..3cf41dc 100644
--- a/automotive/vehicle/2.0/default/Android.bp
+++ b/automotive/vehicle/2.0/default/Android.bp
@@ -97,7 +97,7 @@
local_include_dirs: ["common/include/vhal_v2_0"],
export_include_dirs: ["impl"],
whole_static_libs: [
- "android.hardware.automotive.vehicle@2.0-emulated-user-hal-lib",
+ "android.hardware.automotive.vehicle@2.0-fake-user-hal-lib",
"android.hardware.automotive.vehicle@2.0-manager-lib",
],
shared_libs: [
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 7bc7198..318e9dd 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
@@ -86,7 +86,7 @@
const VehiclePropValue& requestedPropValue, StatusCode* outStatus) {
auto propId = requestedPropValue.prop;
ALOGI("get(): getting value for prop %d from User HAL", propId);
- const auto& ret = mEmulatedUserHal.onGetProperty(requestedPropValue);
+ const auto& ret = mFakeUserHal.onGetProperty(requestedPropValue);
VehicleHal::VehiclePropValuePtr v = nullptr;
if (!ret.ok()) {
ALOGE("get(): User HAL returned error: %s", ret.error().message().c_str());
@@ -110,7 +110,7 @@
auto propId = requestedPropValue.prop;
ALOGV("get(%d)", propId);
- if (mEmulatedUserHal.isSupported(propId)) {
+ if (mFakeUserHal.isSupported(propId)) {
return getUserHalProp(requestedPropValue, outStatus);
}
@@ -155,8 +155,8 @@
if (options.size() > 0) {
if (options[0] == "--help") {
std::string buffer;
- buffer += "Emulated user hal usage:\n";
- buffer += mEmulatedUserHal.showDumpHelp();
+ buffer += "Fake user hal usage:\n";
+ buffer += mFakeUserHal.showDumpHelp();
buffer += "\n";
buffer += "VHAL server debug usage:\n";
buffer += "--debughal: send debug command to VHAL server, see '--debughal --help'\n";
@@ -164,15 +164,15 @@
dprintf(nativeFd, "%s", buffer.c_str());
return false;
} else if (options[0] == kUserHalDumpOption) {
- dprintf(nativeFd, "%s", mEmulatedUserHal.dump("").c_str());
+ dprintf(nativeFd, "%s", mFakeUserHal.dump("").c_str());
return false;
}
} else {
- // No options, dump the emulated user hal state first and then send command to VHAL server
+ // No options, dump the fake user hal state first and then send command to VHAL server
// to dump its state.
std::string buffer;
- buffer += "Emulator user hal state:\n";
- buffer += mEmulatedUserHal.dump(" ");
+ buffer += "Fake user hal state:\n";
+ buffer += mFakeUserHal.dump(" ");
buffer += "\n";
dprintf(nativeFd, "%s", buffer.c_str());
}
@@ -338,7 +338,7 @@
StatusCode DefaultVehicleHal::setUserHalProp(const VehiclePropValue& propValue) {
ALOGI("onSetProperty(): property %d will be handled by UserHal", propValue.prop);
- const auto& ret = mEmulatedUserHal.onSetProperty(propValue);
+ const auto& ret = mFakeUserHal.onSetProperty(propValue);
if (!ret.ok()) {
ALOGE("onSetProperty(): HAL returned error: %s", ret.error().message().c_str());
return StatusCode(ret.error().code());
@@ -360,7 +360,7 @@
return StatusCode::INVALID_ARG;
}
- if (mEmulatedUserHal.isSupported(propValue.prop)) {
+ if (mFakeUserHal.isSupported(propValue.prop)) {
return setUserHalProp(propValue);
}
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 7cd7ac2..4d3036e 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
@@ -21,7 +21,7 @@
#include <vhal_v2_0/VehicleHal.h>
#include <vhal_v2_0/VehiclePropertyStore.h>
-#include "EmulatedUserHal.h"
+#include "FakeUserHal.h"
#include "VehicleHalClient.h"
namespace android {
@@ -56,7 +56,7 @@
VehiclePropertyStore* mPropStore;
RecurrentTimer mRecurrentTimer;
VehicleHalClient* mVehicleClient;
- EmulatedUserHal mEmulatedUserHal;
+ FakeUserHal mFakeUserHal;
// The callback that would be called when a property value is updated. This function could
// be extended to handle specific property update event.
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/Android.bp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/Android.bp
index 0058d33..bb28fdf 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/Android.bp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/Android.bp
@@ -14,10 +14,10 @@
// Library used to emulate User HAL behavior through lshal debug requests.
cc_library {
- name: "android.hardware.automotive.vehicle@2.0-emulated-user-hal-lib",
+ name: "android.hardware.automotive.vehicle@2.0-fake-user-hal-lib",
vendor: true,
defaults: ["vhal_v2_0_target_defaults"],
- srcs: ["EmulatedUserHal.cpp"],
+ srcs: ["FakeUserHal.cpp"],
shared_libs: [
"libbase",
"libutils",
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/EmulatedUserHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/FakeUserHal.cpp
similarity index 92%
rename from automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/EmulatedUserHal.cpp
rename to automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/FakeUserHal.cpp
index 55dc01a..e9ebcc6 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/EmulatedUserHal.cpp
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/FakeUserHal.cpp
@@ -13,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#define LOG_TAG "EmulatedUserHal"
+#define LOG_TAG "FakeUserHal"
#include <cutils/log.h>
#include <utils/SystemClock.h>
#include "UserHalHelper.h"
-#include "EmulatedUserHal.h"
+#include "FakeUserHal.h"
namespace android {
namespace hardware {
@@ -60,7 +60,7 @@
} // namespace
-bool EmulatedUserHal::isSupported(int32_t prop) {
+bool FakeUserHal::isSupported(int32_t prop) {
switch (prop) {
case INITIAL_USER_INFO:
case SWITCH_USER:
@@ -73,7 +73,7 @@
}
}
-Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetProperty(
+Result<std::unique_ptr<VehiclePropValue>> FakeUserHal::onSetProperty(
const VehiclePropValue& value) {
ALOGV("onSetProperty(): %s", toString(value).c_str());
@@ -95,7 +95,7 @@
}
}
-Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onGetProperty(
+Result<std::unique_ptr<VehiclePropValue>> FakeUserHal::onGetProperty(
const VehiclePropValue& value) {
ALOGV("onGetProperty(%s)", toString(value).c_str());
switch (value.prop) {
@@ -113,7 +113,7 @@
}
}
-Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onGetUserIdentificationAssociation(
+Result<std::unique_ptr<VehiclePropValue>> FakeUserHal::onGetUserIdentificationAssociation(
const VehiclePropValue& value) {
if (mSetUserIdentificationAssociationResponseFromCmd == nullptr) {
return defaultUserIdentificationAssociation(value);
@@ -132,7 +132,7 @@
return newValue;
}
-Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetInitialUserInfoResponse(
+Result<std::unique_ptr<VehiclePropValue>> FakeUserHal::onSetInitialUserInfoResponse(
const VehiclePropValue& value) {
auto requestId = getRequestId(value);
if (!requestId.ok()) {
@@ -164,7 +164,7 @@
return updatedValue;
}
-Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetSwitchUserResponse(
+Result<std::unique_ptr<VehiclePropValue>> FakeUserHal::onSetSwitchUserResponse(
const VehiclePropValue& value) {
auto requestId = getRequestId(value);
if (!requestId.ok()) {
@@ -217,7 +217,7 @@
return updatedValue;
}
-Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetCreateUserResponse(
+Result<std::unique_ptr<VehiclePropValue>> FakeUserHal::onSetCreateUserResponse(
const VehiclePropValue& value) {
auto requestId = getRequestId(value);
if (!requestId.ok()) {
@@ -248,7 +248,7 @@
return updatedValue;
}
-Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::onSetUserIdentificationAssociation(
+Result<std::unique_ptr<VehiclePropValue>> FakeUserHal::onSetUserIdentificationAssociation(
const VehiclePropValue& value) {
auto requestId = getRequestId(value);
if (!requestId.ok()) {
@@ -277,14 +277,14 @@
return defaultUserIdentificationAssociation(value);
}
-Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::defaultUserIdentificationAssociation(
+Result<std::unique_ptr<VehiclePropValue>> FakeUserHal::defaultUserIdentificationAssociation(
const VehiclePropValue& request) {
// TODO(b/159498909): return a response with NOT_ASSOCIATED_ANY_USER for all requested types
ALOGE("no lshal response for %s; replying with NOT_AVAILABLE", toString(request).c_str());
return Error(static_cast<int>(StatusCode::NOT_AVAILABLE)) << "not set by lshal";
}
-Result<std::unique_ptr<VehiclePropValue>> EmulatedUserHal::sendUserHalResponse(
+Result<std::unique_ptr<VehiclePropValue>> FakeUserHal::sendUserHalResponse(
std::unique_ptr<VehiclePropValue> response, int32_t requestId) {
switch (response->areaId) {
case 1:
@@ -311,11 +311,11 @@
return response;
}
-std::string EmulatedUserHal::showDumpHelp() {
+std::string FakeUserHal::showDumpHelp() {
return fmt::format("{}: dumps state used for user management\n", kUserHalDumpOption);
}
-std::string EmulatedUserHal::dump(std::string indent) {
+std::string FakeUserHal::dump(std::string indent) {
std::string info;
if (mInitialUserResponseFromCmd != nullptr) {
info += fmt::format("{}InitialUserInfo response: {}\n", indent.c_str(),
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/include/EmulatedUserHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/include/FakeUserHal.h
similarity index 94%
rename from automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/include/EmulatedUserHal.h
rename to automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/include/FakeUserHal.h
index 46f6d0f..122aee8 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/include/EmulatedUserHal.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/userhal/include/FakeUserHal.h
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#ifndef android_hardware_automotive_vehicle_V2_0_impl_EmulatedUserHal_H_
-#define android_hardware_automotive_vehicle_V2_0_impl_EmulatedUserHal_H_
+#ifndef android_hardware_automotive_vehicle_V2_0_impl_FakeUserHal_H_
+#define android_hardware_automotive_vehicle_V2_0_impl_FakeUserHal_H_
#include <android-base/format.h>
#include <android-base/result.h>
@@ -35,11 +35,11 @@
/**
* Class used to emulate a real User HAL behavior through lshal debug requests.
*/
-class EmulatedUserHal {
+class FakeUserHal {
public:
- EmulatedUserHal() {}
+ FakeUserHal() {}
- ~EmulatedUserHal() = default;
+ ~FakeUserHal() = default;
/**
* Checks if the emulator can handle the property.
@@ -149,4 +149,4 @@
} // namespace hardware
} // namespace android
-#endif // android_hardware_automotive_vehicle_V2_0_impl_EmulatedUserHal_H_
+#endif // android_hardware_automotive_vehicle_V2_0_impl_FakeUserHal_H_