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

Commit 100c75cb authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 7163567 from ec2fade1 to sc-release

Change-Id: I26a250f495ac62d6ea65beef52fbe00fc74f0f9c
parents 920ca850 ec2fade1
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -451,6 +451,7 @@ ndk::ScopedAStatus Vibrator::getCapabilities(int32_t *_aidl_return) {
    if (mHwApi->hasRtpInput()) {
        ret |= IVibrator::CAP_AMPLITUDE_CONTROL;
    }
    ret |= IVibrator::CAP_GET_RESONANT_FREQUENCY;
    *_aidl_return = ret;
    return ndk::ScopedAStatus::ok();
}
@@ -709,6 +710,24 @@ ndk::ScopedAStatus Vibrator::compose(const std::vector<CompositeEffect> & /*comp
    return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}

static float freqPeriodFormulaFloat(std::uint32_t in) {
    return static_cast<float>(1000000000) / static_cast<float>(24615 * in);
}

ndk::ScopedAStatus Vibrator::getResonantFrequency(float *resonantFreqHz) {
    uint32_t lraPeriod;
    if(!mHwCal->getLraPeriod(&lraPeriod)) {
        ALOGE("Failed to get resonant frequency (%d): %s", errno, strerror(errno));
        return ndk::ScopedAStatus::fromExceptionCode(EX_ILLEGAL_STATE);
    }
    *resonantFreqHz = freqPeriodFormulaFloat(lraPeriod);
    return ndk::ScopedAStatus::ok();
}

ndk::ScopedAStatus Vibrator::getQFactor(float * /*qFactor*/) {
    return ndk::ScopedAStatus::fromExceptionCode(EX_UNSUPPORTED_OPERATION);
}

}  // namespace vibrator
}  // namespace hardware
}  // namespace android
+2 −0
Original line number Diff line number Diff line
@@ -179,6 +179,8 @@ class Vibrator : public BnVibrator {
    ndk::ScopedAStatus getSupportedAlwaysOnEffects(std::vector<Effect> *_aidl_return) override;
    ndk::ScopedAStatus alwaysOnEnable(int32_t id, Effect effect, EffectStrength strength) override;
    ndk::ScopedAStatus alwaysOnDisable(int32_t id) override;
    ndk::ScopedAStatus getResonantFrequency(float *resonantFreqHz) override;
    ndk::ScopedAStatus getQFactor(float *qFactor) override;

    binder_status_t dump(int fd, const char **args, uint32_t numArgs) override;