Loading automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp +24 −2 Original line number Diff line number Diff line Loading @@ -15,8 +15,9 @@ */ #define LOG_TAG "DefaultVehicleHal_v2_0" #include <android/log.h> #include <android-base/macros.h> #include <android/log.h> #include <sys/system_properties.h> #include "EmulatedVehicleHal.h" #include "JsonFakeValueGenerator.h" Loading Loading @@ -203,8 +204,16 @@ StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) { } getEmulatorOrDie()->doSetValueFromClient(propValue); doHalEvent(getValuePool()->obtain(propValue)); 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; } doHalEvent(getValuePool()->obtain(propValue)); return StatusCode::OK; } Loading @@ -219,6 +228,17 @@ 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; Loading Loading @@ -269,6 +289,8 @@ void EmulatedVehicleHal::onCreate() { } 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() { Loading automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ private: std::unordered_set<int32_t> mHvacPowerProps; RecurrentTimer mRecurrentTimer; GeneratorHub mGeneratorHub; bool mInEmulator; }; } // impl Loading camera/common/1.0/default/Exif.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -632,13 +632,13 @@ bool ExifUtilsImpl::setGpsTimestamp(const struct tm& t) { } bool ExifUtilsImpl::setImageHeight(uint32_t length) { SET_LONG(EXIF_IFD_0, EXIF_TAG_IMAGE_LENGTH, length); SET_SHORT(EXIF_IFD_0, EXIF_TAG_IMAGE_LENGTH, length); SET_LONG(EXIF_IFD_EXIF, EXIF_TAG_PIXEL_Y_DIMENSION, length); return true; } bool ExifUtilsImpl::setImageWidth(uint32_t width) { SET_LONG(EXIF_IFD_0, EXIF_TAG_IMAGE_WIDTH, width); SET_SHORT(EXIF_IFD_0, EXIF_TAG_IMAGE_WIDTH, width); SET_LONG(EXIF_IFD_EXIF, EXIF_TAG_PIXEL_X_DIMENSION, width); return true; } Loading gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ #include <condition_variable> #include <mutex> #include <cutils/properties.h> using android::hardware::Return; using android::hardware::Void; Loading @@ -36,6 +38,12 @@ using android::hardware::gnss::V1_0::IGnssDebug; using android::hardware::gnss::V1_0::IGnssMeasurement; using android::sp; static bool IsAutomotiveDevice() { char buffer[PROPERTY_VALUE_MAX] = {0}; property_get("ro.hardware.type", buffer, ""); return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0; } #define TIMEOUT_SEC 2 // for basic commands/responses // for command line argument on how strictly to run the test Loading Loading @@ -444,7 +452,7 @@ TEST_P(GnssHalTest, GetAllExtensions) { auto gnssDebug = gnss_hal_->getExtensionGnssDebug(); ASSERT_TRUE(gnssDebug.isOk()); if (info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { if (!IsAutomotiveDevice() && info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { sp<IGnssDebug> iGnssDebug = gnssDebug; EXPECT_NE(iGnssDebug, nullptr); } Loading gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <VtsHalHidlTargetTestBase.h> #include <android/hardware/gnss/1.1/IGnssConfiguration.h> #include <cutils/properties.h> using android::hardware::hidl_vec; Loading @@ -33,6 +34,12 @@ using android::hardware::gnss::V1_0::IGnssDebug; using android::hardware::gnss::V1_1::IGnssConfiguration; using android::hardware::gnss::V1_1::IGnssMeasurement; static bool IsAutomotiveDevice() { char buffer[PROPERTY_VALUE_MAX] = {0}; property_get("ro.hardware.type", buffer, ""); return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0; } /* * SetupTeardownCreateCleanup: * Requests the gnss HAL then calls cleanup Loading Loading @@ -488,7 +495,7 @@ TEST_F(GnssHalTest, InjectBestLocation) { TEST_F(GnssHalTest, GnssDebugValuesSanityTest) { auto gnssDebug = gnss_hal_->getExtensionGnssDebug(); ASSERT_TRUE(gnssDebug.isOk()); if (info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { if (!IsAutomotiveDevice() && info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { sp<IGnssDebug> iGnssDebug = gnssDebug; EXPECT_NE(iGnssDebug, nullptr); Loading Loading
automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.cpp +24 −2 Original line number Diff line number Diff line Loading @@ -15,8 +15,9 @@ */ #define LOG_TAG "DefaultVehicleHal_v2_0" #include <android/log.h> #include <android-base/macros.h> #include <android/log.h> #include <sys/system_properties.h> #include "EmulatedVehicleHal.h" #include "JsonFakeValueGenerator.h" Loading Loading @@ -203,8 +204,16 @@ StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) { } getEmulatorOrDie()->doSetValueFromClient(propValue); doHalEvent(getValuePool()->obtain(propValue)); 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; } doHalEvent(getValuePool()->obtain(propValue)); return StatusCode::OK; } Loading @@ -219,6 +228,17 @@ 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; Loading Loading @@ -269,6 +289,8 @@ void EmulatedVehicleHal::onCreate() { } 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() { Loading
automotive/vehicle/2.0/default/impl/vhal_v2_0/EmulatedVehicleHal.h +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ private: std::unordered_set<int32_t> mHvacPowerProps; RecurrentTimer mRecurrentTimer; GeneratorHub mGeneratorHub; bool mInEmulator; }; } // impl Loading
camera/common/1.0/default/Exif.cpp +2 −2 Original line number Diff line number Diff line Loading @@ -632,13 +632,13 @@ bool ExifUtilsImpl::setGpsTimestamp(const struct tm& t) { } bool ExifUtilsImpl::setImageHeight(uint32_t length) { SET_LONG(EXIF_IFD_0, EXIF_TAG_IMAGE_LENGTH, length); SET_SHORT(EXIF_IFD_0, EXIF_TAG_IMAGE_LENGTH, length); SET_LONG(EXIF_IFD_EXIF, EXIF_TAG_PIXEL_Y_DIMENSION, length); return true; } bool ExifUtilsImpl::setImageWidth(uint32_t width) { SET_LONG(EXIF_IFD_0, EXIF_TAG_IMAGE_WIDTH, width); SET_SHORT(EXIF_IFD_0, EXIF_TAG_IMAGE_WIDTH, width); SET_LONG(EXIF_IFD_EXIF, EXIF_TAG_PIXEL_X_DIMENSION, width); return true; } Loading
gnss/1.0/vts/functional/VtsHalGnssV1_0TargetTest.cpp +11 −3 Original line number Diff line number Diff line Loading @@ -25,6 +25,8 @@ #include <condition_variable> #include <mutex> #include <cutils/properties.h> using android::hardware::Return; using android::hardware::Void; Loading @@ -36,6 +38,12 @@ using android::hardware::gnss::V1_0::IGnssDebug; using android::hardware::gnss::V1_0::IGnssMeasurement; using android::sp; static bool IsAutomotiveDevice() { char buffer[PROPERTY_VALUE_MAX] = {0}; property_get("ro.hardware.type", buffer, ""); return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0; } #define TIMEOUT_SEC 2 // for basic commands/responses // for command line argument on how strictly to run the test Loading Loading @@ -444,7 +452,7 @@ TEST_P(GnssHalTest, GetAllExtensions) { auto gnssDebug = gnss_hal_->getExtensionGnssDebug(); ASSERT_TRUE(gnssDebug.isOk()); if (info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { if (!IsAutomotiveDevice() && info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { sp<IGnssDebug> iGnssDebug = gnssDebug; EXPECT_NE(iGnssDebug, nullptr); } Loading
gnss/1.1/vts/functional/gnss_hal_test_cases.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ #include <VtsHalHidlTargetTestBase.h> #include <android/hardware/gnss/1.1/IGnssConfiguration.h> #include <cutils/properties.h> using android::hardware::hidl_vec; Loading @@ -33,6 +34,12 @@ using android::hardware::gnss::V1_0::IGnssDebug; using android::hardware::gnss::V1_1::IGnssConfiguration; using android::hardware::gnss::V1_1::IGnssMeasurement; static bool IsAutomotiveDevice() { char buffer[PROPERTY_VALUE_MAX] = {0}; property_get("ro.hardware.type", buffer, ""); return strncmp(buffer, "automotive", PROPERTY_VALUE_MAX) == 0; } /* * SetupTeardownCreateCleanup: * Requests the gnss HAL then calls cleanup Loading Loading @@ -488,7 +495,7 @@ TEST_F(GnssHalTest, InjectBestLocation) { TEST_F(GnssHalTest, GnssDebugValuesSanityTest) { auto gnssDebug = gnss_hal_->getExtensionGnssDebug(); ASSERT_TRUE(gnssDebug.isOk()); if (info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { if (!IsAutomotiveDevice() && info_called_count_ > 0 && last_info_.yearOfHw >= 2017) { sp<IGnssDebug> iGnssDebug = gnssDebug; EXPECT_NE(iGnssDebug, nullptr); Loading