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

Commit 1eb56992 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add support for IVibration.performVendorEffect" into main

parents 4d1a90dc f172ea15
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ package {
cc_defaults {
    name: "idlcli-defaults",
    shared_libs: [
        "android.hardware.vibrator-V2-ndk",
        "android.hardware.vibrator-V3-ndk",
        "android.hardware.vibrator@1.0",
        "android.hardware.vibrator@1.1",
        "android.hardware.vibrator@1.2",
+1 −1
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ inline ndk::ScopedAStatus NullptrStatus() {
template <typename I>
inline auto getService(std::string name) {
    const auto instance = std::string() + I::descriptor + "/" + name;
    auto vibBinder = ndk::SpAIBinder(AServiceManager_getService(instance.c_str()));
    auto vibBinder = ndk::SpAIBinder(AServiceManager_checkService(instance.c_str()));
    return I::fromBinder(vibBinder);
}

+1 −1
Original line number Diff line number Diff line
@@ -45,7 +45,7 @@ cc_library_shared {
        "libhidlbase",
        "liblog",
        "libutils",
        "android.hardware.vibrator-V2-ndk",
        "android.hardware.vibrator-V3-ndk",
        "android.hardware.vibrator@1.0",
        "android.hardware.vibrator@1.1",
        "android.hardware.vibrator@1.2",
+14 −1
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ using aidl::android::hardware::vibrator::CompositePrimitive;
using aidl::android::hardware::vibrator::Effect;
using aidl::android::hardware::vibrator::EffectStrength;
using aidl::android::hardware::vibrator::PrimitivePwle;
using aidl::android::hardware::vibrator::VendorEffect;

using std::chrono::milliseconds;

@@ -96,6 +97,11 @@ Info HalWrapper::getInfo() {
    return mInfoCache.get();
}

HalResult<void> HalWrapper::performVendorEffect(const VendorEffect&, const std::function<void()>&) {
    ALOGV("Skipped performVendorEffect because it's not available in Vibrator HAL");
    return HalResult<void>::unsupported();
}

HalResult<milliseconds> HalWrapper::performComposedEffect(const std::vector<CompositeEffect>&,
                                                          const std::function<void()>&) {
    ALOGV("Skipped performComposedEffect because it's not available in Vibrator HAL");
@@ -271,6 +277,13 @@ HalResult<milliseconds> AidlHalWrapper::performEffect(
    return ret;
}

HalResult<void> AidlHalWrapper::performVendorEffect(
        const VendorEffect& effect, const std::function<void()>& completionCallback) {
    // This method should always support callbacks, so no need to double check.
    auto cb = ndk::SharedRefBase::make<HalCallbackWrapper>(completionCallback);
    return HalResultFactory::fromStatus(getHal()->performVendorEffect(effect, cb));
}

HalResult<milliseconds> AidlHalWrapper::performComposedEffect(
        const std::vector<CompositeEffect>& primitives,
        const std::function<void()>& completionCallback) {
@@ -351,7 +364,7 @@ HalResult<std::vector<milliseconds>> AidlHalWrapper::getPrimitiveDurationsIntern
        }
        if (halResult.isFailed()) {
            // Fail entire request if one request has failed.
            return HalResult<std::vector<milliseconds>>::failed(status.getMessage());
            return HalResult<std::vector<milliseconds>>::failed(halResult.errorMessage());
        }
        durations[primitiveIdx] = milliseconds(duration);
    }
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ cc_benchmark {
        "liblog",
        "libutils",
        "libvibratorservice",
        "android.hardware.vibrator-V2-ndk",
        "android.hardware.vibrator-V3-ndk",
        "android.hardware.vibrator@1.0",
        "android.hardware.vibrator@1.1",
        "android.hardware.vibrator@1.2",
Loading