Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f493a1f8 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 11367679 from 3289d267 to 24Q2-release

Change-Id: I43f8438521ef88b1bd36350bd9c16f0da3a07638
parents 38bfc3c6 3289d267
Loading
Loading
Loading
Loading
+833 −0

File changed.

Preview size limit exceeded, changes collapsed.

+1 −1
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ enum VehicleProperty {
  VEHICLE_MAP_SERVICE = (((0x0C00 + 0x10000000) + 0x01000000) + 0x00e00000) /* 299895808 */,
  LOCATION_CHARACTERIZATION = (((0x0C10 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.GLOBAL) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32) /* 289410064 */,
  ULTRASONICS_SENSOR_POSITION = (((0x0C20 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.VENDOR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32_VEC) /* 406916128 */,
  ULTRASONICS_SENSOR_ORIENTATION = (((0x0C21 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.VENDOR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32_VEC) /* 406916129 */,
  ULTRASONICS_SENSOR_ORIENTATION = (((0x0C21 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.VENDOR) + android.hardware.automotive.vehicle.VehiclePropertyType.FLOAT_VEC) /* 409013281 */,
  ULTRASONICS_SENSOR_FIELD_OF_VIEW = (((0x0C22 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.VENDOR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32_VEC) /* 406916130 */,
  ULTRASONICS_SENSOR_DETECTION_RANGE = (((0x0C23 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.VENDOR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32_VEC) /* 406916131 */,
  ULTRASONICS_SENSOR_SUPPORTED_RANGES = (((0x0C24 + android.hardware.automotive.vehicle.VehiclePropertyGroup.SYSTEM) + android.hardware.automotive.vehicle.VehicleArea.VENDOR) + android.hardware.automotive.vehicle.VehiclePropertyType.INT32_VEC) /* 406916132 */,
+2 −2
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ enum VehicleProperty {
    INFO_MODEL = 0x0102 + 0x10000000 + 0x01000000
            + 0x00100000, // VehiclePropertyGroup:SYSTEM,VehicleArea:GLOBAL,VehiclePropertyType:STRING
    /**
     * Model year of vehicle.
     * Model year of vehicle in YYYY format based on the Gregorian calendar.
     *
     * @change_mode VehiclePropertyChangeMode.STATIC
     * @access VehiclePropertyAccess.READ
@@ -3561,7 +3561,7 @@ enum VehicleProperty {
     * @version 3
     */
    ULTRASONICS_SENSOR_ORIENTATION = 0x0C21 + VehiclePropertyGroup.SYSTEM + VehicleArea.VENDOR
            + VehiclePropertyType.INT32_VEC,
            + VehiclePropertyType.FLOAT_VEC,

    /**
     * Static data for the field of view of each ultrasonic sensor in degrees.
+76 −4
Original line number Diff line number Diff line
@@ -48,9 +48,11 @@ using ::aidl::android::hardware::automotive::vehicle::VehicleProperty;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyAccess;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyChangeMode;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyGroup;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyStatus;
using ::aidl::android::hardware::automotive::vehicle::VehiclePropertyType;
using ::aidl::android::hardware::automotive::vehicle::VersionForVehicleProperty;
using ::android::getAidlHalInstanceNames;
using ::android::uptimeMillis;
using ::android::base::ScopedLockAssertion;
using ::android::base::StringPrintf;
using ::android::frameworks::automotive::vhal::ErrorCode;
@@ -59,6 +61,7 @@ using ::android::frameworks::automotive::vhal::IHalPropConfig;
using ::android::frameworks::automotive::vhal::IHalPropValue;
using ::android::frameworks::automotive::vhal::ISubscriptionCallback;
using ::android::frameworks::automotive::vhal::IVhalClient;
using ::android::frameworks::automotive::vhal::VhalClientResult;
using ::android::hardware::getAllHalInstanceNames;
using ::android::hardware::Sanitize;
using ::android::hardware::automotive::vehicle::isSystemProp;
@@ -67,6 +70,8 @@ using ::android::hardware::automotive::vehicle::toInt;
using ::testing::Ge;

constexpr int32_t kInvalidProp = 0x31600207;
// The timeout for retrying getting prop value after setting prop value.
constexpr int64_t kRetryGetPropAfterSetPropTimeoutMillis = 10'000;

struct ServiceDescriptor {
    std::string name;
@@ -124,6 +129,10 @@ class VtsHalAutomotiveVehicleTargetTest : public testing::TestWithParam<ServiceD
  protected:
    bool checkIsSupported(int32_t propertyId);

    static bool isUnavailable(const VhalClientResult<std::unique_ptr<IHalPropValue>>& result);
    static bool isResultOkayWithValue(
            const VhalClientResult<std::unique_ptr<IHalPropValue>>& result, int32_t value);

  public:
    void verifyProperty(VehicleProperty propId, VehiclePropertyAccess access,
                        VehiclePropertyChangeMode changeMode, VehiclePropertyGroup group,
@@ -269,6 +278,30 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, getInvalidProp) {
            "Expect failure to get property for invalid prop: %" PRId32, kInvalidProp);
}

bool VtsHalAutomotiveVehicleTargetTest::isResultOkayWithValue(
        const VhalClientResult<std::unique_ptr<IHalPropValue>>& result, int32_t value) {
    return result.ok() && result.value() != nullptr &&
           result.value()->getStatus() == VehiclePropertyStatus::AVAILABLE &&
           result.value()->getInt32Values().size() == 1 &&
           result.value()->getInt32Values()[0] == value;
}

bool VtsHalAutomotiveVehicleTargetTest::isUnavailable(
        const VhalClientResult<std::unique_ptr<IHalPropValue>>& result) {
    if (result.ok()) {
        return false;
    }
    if (result.error().code() == ErrorCode::NOT_AVAILABLE_FROM_VHAL) {
        return true;
    }
    if (result.value() != nullptr &&
        result.value()->getStatus() == VehiclePropertyStatus::UNAVAILABLE) {
        return true;
    }

    return false;
}

// Test set() on read_write properties.
TEST_P(VtsHalAutomotiveVehicleTargetTest, setProp) {
    ALOGD("VtsHalAutomotiveVehicleTargetTest::setProp");
@@ -296,6 +329,14 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, setProp) {
            auto propToGet = mVhalClient->createHalPropValue(propId);
            auto getValueResult = mVhalClient->getValueSync(*propToGet);

            if (isUnavailable(getValueResult)) {
                ALOGW("getProperty for %" PRId32
                      " returns NOT_AVAILABLE, "
                      "skip testing setProp",
                      propId);
                return;
            }

            ASSERT_TRUE(getValueResult.ok())
                    << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s",
                                    propId, getValueResult.error().message().c_str());
@@ -308,17 +349,48 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, setProp) {
                    "Expect exactly 1 int value for boolean property: %" PRId32 ", got %zu", propId,
                    intValueSize);

            int setValue = value.getInt32Values()[0] == 1 ? 0 : 1;
            int32_t setValue = value.getInt32Values()[0] == 1 ? 0 : 1;
            auto propToSet = mVhalClient->createHalPropValue(propId);
            propToSet->setInt32Values({setValue});
            auto setValueResult = mVhalClient->setValueSync(*propToSet);

            if (!setValueResult.ok() &&
                setValueResult.error().code() == ErrorCode::NOT_AVAILABLE_FROM_VHAL) {
                ALOGW("setProperty for %" PRId32
                      " returns NOT_AVAILABLE, "
                      "skip verifying getProperty returns the same value",
                      propId);
                return;
            }

            ASSERT_TRUE(setValueResult.ok())
                    << StringPrintf("Failed to set value for property: %" PRId32 ", error: %s",
                                    propId, setValueResult.error().message().c_str());
            // Retry getting the value until we pass the timeout. getValue might not return
            // the expected value immediately since setValue is async.
            auto timeoutMillis = uptimeMillis() + kRetryGetPropAfterSetPropTimeoutMillis;

            // check set success
            while (true) {
                getValueResult = mVhalClient->getValueSync(*propToGet);
                if (isResultOkayWithValue(getValueResult, setValue)) {
                    break;
                }
                if (uptimeMillis() >= timeoutMillis) {
                    // Reach timeout, the following assert should fail.
                    break;
                }
                // Sleep for 100ms between each getValueSync retry.
                std::this_thread::sleep_for(std::chrono::milliseconds(100));
            }

            if (isUnavailable(getValueResult)) {
                ALOGW("getProperty for %" PRId32
                      " returns NOT_AVAILABLE, "
                      "skip verifying the return value",
                      propId);
                return;
            }

            ASSERT_TRUE(getValueResult.ok())
                    << StringPrintf("Failed to get value for property: %" PRId32 ", error: %s",
                                    propId, getValueResult.error().message().c_str());
@@ -598,7 +670,7 @@ TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorPositionConfig)
TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorOrientationConfig) {
    verifyProperty(VehicleProperty::ULTRASONICS_SENSOR_ORIENTATION, VehiclePropertyAccess::READ,
                   VehiclePropertyChangeMode::STATIC, VehiclePropertyGroup::SYSTEM,
                   VehicleArea::VENDOR, VehiclePropertyType::INT32_VEC);
                   VehicleArea::VENDOR, VehiclePropertyType::FLOAT_VEC);
}

TEST_P(VtsHalAutomotiveVehicleTargetTest, verifyUltrasonicsSensorFieldOfViewConfig) {
+9 −5
Original line number Diff line number Diff line
@@ -35,12 +35,16 @@ int main(int /* argc */, char** /* argv */) {
      ndk::SharedRefBase::make<BluetoothFinder>();
  std::string instance =
      std::string() + BluetoothFinder::descriptor + "/default";
  if (AServiceManager_isDeclared(instance.c_str())) {
    auto result =
        AServiceManager_addService(service->asBinder().get(), instance.c_str());
  if (result == STATUS_OK) {
    ABinderProcess_joinThreadPool();
  } else {
    if (result != STATUS_OK) {
      ALOGE("Could not register as a service!");
    }
  } else {
    ALOGE("Could not register as a service because it's not declared.");
  }
  // Keep running
  ABinderProcess_joinThreadPool();
  return 0;
}
Loading