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

Commit 3a00bdb9 authored by Xin Li's avatar Xin Li
Browse files

Merge Android 14 QPR1

Merged-In: Id9f746bc66671d274afaedb10854d88123a04af0
Bug: 315507370
Change-Id: If5b27e2d03b1d0fca02a7f67091692e986097e29
parents be8bf80c b1e0c41c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ service vendor.audio-hal /vendor/bin/hw/android.hardware.audio.service
    class hal
    user audioserver
    # media gid needed for /dev/fm (radio) and for /data/misc/media (tee)
    group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock context_hub
    group audio camera drmrpc inet media mediadrm net_bt net_bt_admin net_bw_acct wakelock context_hub system
    capabilities BLOCK_SUSPEND SYS_NICE
    # setting RLIMIT_RTPRIO allows binder RT priority inheritance
    rlimit rtprio 10 10
+1 −1
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ class LinearFakeValueGenerator : public FakeValueGenerator {
        float dispersion;    //  Defines minimum and maximum value based on initial value.
        float increment;     //  Value that we will be added to currentValue with each timer tick.
        int64_t interval;
        long lastEventTimestamp;
        int64_t lastEventTimestamp;
    };

    GeneratorCfg mGenCfg;
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ std::optional<VehiclePropValue> LinearFakeValueGenerator::nextEvent() {
    if (mGenCfg.lastEventTimestamp == 0) {
        mGenCfg.lastEventTimestamp = elapsedRealtimeNano();
    } else {
        long nextEventTime = mGenCfg.lastEventTimestamp + mGenCfg.interval;
        int64_t nextEventTime = mGenCfg.lastEventTimestamp + mGenCfg.interval;
        // Prevent overflow.
        assert(nextEventTime > mGenCfg.lastEventTimestamp);
        mGenCfg.lastEventTimestamp = nextEventTime;
+5 −2
Original line number Diff line number Diff line
@@ -99,12 +99,17 @@ class FakeVehicleHardware : public IVehicleHardware {
    const std::shared_ptr<VehiclePropValuePool> mValuePool;
    const std::shared_ptr<VehiclePropertyStore> mServerSidePropStore;

    const std::string mDefaultConfigDir;
    const std::string mOverrideConfigDir;

    ValueResultType getValue(
            const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value) const;

    VhalResult<void> setValue(
            const aidl::android::hardware::automotive::vehicle::VehiclePropValue& value);

    bool UseOverrideConfigDir();

  private:
    // Expose private methods to unit test.
    friend class FakeVehicleHardwareTestHelper;
@@ -156,8 +161,6 @@ class FakeVehicleHardware : public IVehicleHardware {
                                  aidl::android::hardware::automotive::vehicle::SetValueRequest>
            mPendingSetValueRequests;

    const std::string mDefaultConfigDir;
    const std::string mOverrideConfigDir;
    const bool mForceOverride;
    bool mAddExtraTestVendorConfigs;

+27 −18
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@
#include <dirent.h>
#include <inttypes.h>
#include <sys/types.h>
#include <fstream>
#include <regex>
#include <unordered_set>
#include <vector>
@@ -205,9 +204,10 @@ void FakeVehicleHardware::storePropInitialValue(const ConfigDeclaration& config)

        // Create a separate instance for each individual zone
        VehiclePropValue prop = {
                .timestamp = elapsedRealtimeNano(),
                .areaId = curArea,
                .prop = propId,
                .timestamp = elapsedRealtimeNano(),
                .value = {},
        };

        if (config.initialAreaValues.empty()) {
@@ -240,6 +240,8 @@ FakeVehicleHardware::FakeVehicleHardware(std::string defaultConfigDir,
                                         std::string overrideConfigDir, bool forceOverride)
    : mValuePool(std::make_unique<VehiclePropValuePool>()),
      mServerSidePropStore(new VehiclePropertyStore(mValuePool)),
      mDefaultConfigDir(defaultConfigDir),
      mOverrideConfigDir(overrideConfigDir),
      mFakeObd2Frame(new obd2frame::FakeObd2Frame(mServerSidePropStore)),
      mFakeUserHal(new FakeUserHal(mValuePool)),
      mRecurrentTimer(new RecurrentTimer()),
@@ -247,8 +249,6 @@ FakeVehicleHardware::FakeVehicleHardware(std::string defaultConfigDir,
              [this](const VehiclePropValue& value) { eventFromVehicleBus(value); })),
      mPendingGetValueRequests(this),
      mPendingSetValueRequests(this),
      mDefaultConfigDir(defaultConfigDir),
      mOverrideConfigDir(overrideConfigDir),
      mForceOverride(forceOverride) {
    init();
}
@@ -259,11 +259,15 @@ FakeVehicleHardware::~FakeVehicleHardware() {
    mGeneratorHub.reset();
}

bool FakeVehicleHardware::UseOverrideConfigDir() {
    return mForceOverride ||
           android::base::GetBoolProperty(OVERRIDE_PROPERTY, /*default_value=*/false);
}

std::unordered_map<int32_t, ConfigDeclaration> FakeVehicleHardware::loadConfigDeclarations() {
    std::unordered_map<int32_t, ConfigDeclaration> configsByPropId;
    loadPropConfigsFromDir(mDefaultConfigDir, &configsByPropId);
    if (mForceOverride ||
        android::base::GetBoolProperty(OVERRIDE_PROPERTY, /*default_value=*/false)) {
    if (UseOverrideConfigDir()) {
        loadPropConfigsFromDir(mOverrideConfigDir, &configsByPropId);
    }
    return configsByPropId;
@@ -938,7 +942,7 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::getValue(
                   << StringPrintf("failed to get special value: %d, error: %s", value.prop,
                                   getErrorMsg(result).c_str());
        } else {
            return std::move(result);
            return result;
        }
    }

@@ -953,7 +957,7 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::getValue(
        }
    }

    return std::move(readResult);
    return readResult;
}

DumpResult FakeVehicleHardware::dump(const std::vector<std::string>& options) {
@@ -990,9 +994,11 @@ DumpResult FakeVehicleHardware::dump(const std::vector<std::string>& options) {
    } else if (EqualsIgnoreCase(option, "--genTestVendorConfigs")) {
        mAddExtraTestVendorConfigs = true;
        result.refreshPropertyConfigs = true;
        result.buffer = "successfully generated vendor configs";
    } else if (EqualsIgnoreCase(option, "--restoreVendorConfigs")) {
        mAddExtraTestVendorConfigs = false;
        result.refreshPropertyConfigs = true;
        result.buffer = "successfully restored vendor configs";
    } else {
        result.buffer = StringPrintf("Invalid option: %s\n", option.c_str());
    }
@@ -1328,9 +1334,9 @@ std::string FakeVehicleHardware::genFakeDataCommand(const std::vector<std::strin
VehiclePropValue FakeVehicleHardware::createHwInputKeyProp(VehicleHwKeyInputAction action,
                                                           int32_t keyCode, int32_t targetDisplay) {
    VehiclePropValue value = {
            .prop = toInt(VehicleProperty::HW_KEY_INPUT),
            .areaId = 0,
            .timestamp = elapsedRealtimeNano(),
            .areaId = 0,
            .prop = toInt(VehicleProperty::HW_KEY_INPUT),
            .status = VehiclePropertyStatus::AVAILABLE,
            .value.int32Values = {toInt(action), keyCode, targetDisplay},
    };
@@ -1340,9 +1346,9 @@ VehiclePropValue FakeVehicleHardware::createHwInputKeyProp(VehicleHwKeyInputActi
VehiclePropValue FakeVehicleHardware::createHwKeyInputV2Prop(int32_t area, int32_t targetDisplay,
                                                             int32_t keyCode, int32_t action,
                                                             int32_t repeatCount) {
    VehiclePropValue value = {.prop = toInt(VehicleProperty::HW_KEY_INPUT_V2),
    VehiclePropValue value = {.timestamp = elapsedRealtimeNano(),
                              .areaId = area,
                              .timestamp = elapsedRealtimeNano(),
                              .prop = toInt(VehicleProperty::HW_KEY_INPUT_V2),
                              .status = VehiclePropertyStatus::AVAILABLE,
                              .value.int32Values = {targetDisplay, keyCode, action, repeatCount},
                              .value.int64Values = {elapsedRealtimeNano()}};
@@ -1380,9 +1386,9 @@ VehiclePropValue FakeVehicleHardware::createHwMotionInputProp(
        floatValues.push_back(size[i]);
    }

    VehiclePropValue value = {.prop = toInt(VehicleProperty::HW_MOTION_INPUT),
    VehiclePropValue value = {.timestamp = elapsedRealtimeNano(),
                              .areaId = area,
                              .timestamp = elapsedRealtimeNano(),
                              .prop = toInt(VehicleProperty::HW_MOTION_INPUT),
                              .status = VehiclePropertyStatus::AVAILABLE,
                              .value.int32Values = intValues,
                              .value.floatValues = floatValues,
@@ -1451,8 +1457,9 @@ std::string FakeVehicleHardware::dumpOnePropertyByConfig(int rowNumber,

std::string FakeVehicleHardware::dumpOnePropertyById(int32_t propId, int32_t areaId) {
    VehiclePropValue value = {
            .prop = propId,
            .areaId = areaId,
            .prop = propId,
            .value = {},
    };
    bool isSpecialValue = false;
    auto result = maybeGetSpecialValue(value, &isSpecialValue);
@@ -1523,12 +1530,12 @@ std::vector<std::string> FakeVehicleHardware::getOptionValues(
    while (*index < options.size()) {
        std::string option = options[*index];
        if (SET_PROP_OPTIONS.find(option) != SET_PROP_OPTIONS.end()) {
            return std::move(values);
            return values;
        }
        values.push_back(option);
        (*index)++;
    }
    return std::move(values);
    return values;
}

Result<VehiclePropValue> FakeVehicleHardware::parsePropOptions(
@@ -1808,6 +1815,7 @@ void FakeVehicleHardware::registerOnPropertyChangeEvent(

void FakeVehicleHardware::registerOnPropertySetErrorEvent(
        std::unique_ptr<const PropertySetErrorCallback> callback) {
    // In FakeVehicleHardware, we will never use mOnPropertySetErrorCallback.
    if (mOnPropertySetErrorCallback != nullptr) {
        ALOGE("registerOnPropertySetErrorEvent must only be called once");
        return;
@@ -1836,8 +1844,9 @@ StatusCode FakeVehicleHardware::updateSampleRate(int32_t propId, int32_t areaId,
        // Refresh the property value. In real implementation, this should poll the latest value
        // from vehicle bus. Here, we are just refreshing the existing value with a new timestamp.
        auto result = getValue(VehiclePropValue{
                .prop = propId,
                .areaId = areaId,
                .prop = propId,
                .value = {},
        });
        if (!result.ok()) {
            // Failed to read current value, skip refreshing.
Loading