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

Commit aa4b98a8 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Add new TEXTURE_TICK constant."

parents ad439a04 a4c94fd1
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -544,7 +544,8 @@ b47f90302595874dfddb19bd05a054727bf18b3a930bc810ea14957b859ae8bf android.hardwar
61bc302e7c974c59b25898c585c6e9685e8a81021b1bed3eedf5224198f2785a android.hardware.usb@1.2::IUsb
46996cd2a1c66261a75a1f6ecada77eeb5861eb264fa39b996548fe0a7f22dd3 android.hardware.usb@1.2::IUsbCallback
3bbaa8cbc5d6b1da21f5509b2b641e05fc7eeca1354751eb1bb3cf37f89aa32f android.hardware.usb@1.2::types
92c1a726c80970d623b891f7c2f9a989a40a15ee1244092b49f4eb6adcdce4e9 android.hardware.vibrator@1.3::IVibrator
0f7ff73793548d5154014059b7e0fe9ef6355d32218ace157954d02055f5248b android.hardware.vibrator@1.3::IVibrator
2e313dc27a1327a29862ab3e085917f75c9e996f7c8df5a0ce37b9a0ed076b80 android.hardware.vibrator@1.3::types
f19832856a3f53ced5ef91d3cc630a57fb7f4d4ce15f364dbed09099b89f6830 android.hardware.wifi@1.3::IWifi
7c6799c19bfdb3dec016b751556fe246cf7d37191ee7bb82a0091ab9fbf6f2fb android.hardware.wifi@1.3::IWifiChip
3bef30e8b61ab050c0f6fd26572712be5ebb7707d624c9aa6c74bbb9d6a5b4a9 android.hardware.wifi@1.3::IWifiStaIface
+1 −0
Original line number Diff line number Diff line
@@ -8,6 +8,7 @@ hidl_interface {
    },
    srcs: [
        "IVibrator.hal",
        "types.hal",
    ],
    interfaces: [
        "android.hardware.vibrator@1.0",
+15 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.hardware.vibrator@1.3;

import @1.0::EffectStrength;
import @1.0::Status;
import @1.2::IVibrator;

@@ -41,4 +42,18 @@ interface IVibrator extends @1.2::IVibrator {
   *                not supported by the device.
   */
  setExternalControl(bool enabled) generates (Status status);

  /**
   * Fire off a predefined haptic event.
   *
   * @param event The type of haptic event to trigger.
   * @return status Whether the effect was successfully performed or not. Must
   *     return Status::UNSUPPORTED_OPERATION if the effect is not supported.
   * @return lengthMs The length of time the event is expected to take in
   *     milliseconds. This doesn't need to be perfectly accurate, but should be a reasonable
   *     approximation. Should be a positive, non-zero value if the returned status is Status::OK,
   *     and set to 0 otherwise.
   */
  perform_1_3(Effect effect, EffectStrength strength)
          generates (Status status, uint32_t lengthMs);
};
+22 −16
Original line number Diff line number Diff line
@@ -74,22 +74,9 @@ Return<void> Vibrator::perform_1_1(V1_1::Effect_1_1 effect, EffectStrength stren

// Methods from ::android::hardware::vibrator::V1_2::IVibrator follow.

Return<void> Vibrator::perform_1_2(Effect effect, EffectStrength strength, perform_cb _hidl_cb) {
    uint8_t amplitude;
    uint32_t ms;
    Status status;

    ALOGI("Perform: Effect %s\n", effectToName(effect));

    amplitude = strengthToAmplitude(strength);
    setAmplitude(amplitude);

    ms = effectToMs(effect);
    status = activate(ms);

    _hidl_cb(status, ms);

    return Void();
Return<void> Vibrator::perform_1_2(V1_2::Effect effect, EffectStrength strength,
                                   perform_cb _hidl_cb) {
    return perform_1_3(static_cast<V1_3::Effect>(effect), strength, _hidl_cb);
}

// Methods from ::android::hardware::vibrator::V1_3::IVibrator follow.
@@ -110,6 +97,24 @@ Return<Status> Vibrator::setExternalControl(bool enabled) {
    }
}

Return<void> Vibrator::perform_1_3(Effect effect, EffectStrength strength, perform_cb _hidl_cb) {
    uint8_t amplitude;
    uint32_t ms;
    Status status;

    ALOGI("Perform: Effect %s\n", effectToName(effect));

    amplitude = strengthToAmplitude(strength);
    setAmplitude(amplitude);

    ms = effectToMs(effect);
    status = activate(ms);

    _hidl_cb(status, ms);

    return Void();
}

// Private methods follow.

Status Vibrator::enable(bool enabled) {
@@ -184,6 +189,7 @@ uint32_t Vibrator::effectToMs(Effect effect) {
        case Effect::DOUBLE_CLICK:
            return 15;
        case Effect::TICK:
        case Effect::TEXTURE_TICK:
            return 5;
        case Effect::THUD:
            return 5;
+3 −2
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@ namespace implementation {

using android::hardware::vibrator::V1_0::EffectStrength;
using android::hardware::vibrator::V1_0::Status;
using android::hardware::vibrator::V1_2::Effect;

class Vibrator : public IVibrator {
  public:
@@ -46,11 +45,13 @@ class Vibrator : public IVibrator {
                             perform_cb _hidl_cb) override;

    // Methods from ::android::hardware::vibrator::V1_2::IVibrator follow.
    Return<void> perform_1_2(Effect effect, EffectStrength strength, perform_cb _hidl_cb) override;
    Return<void> perform_1_2(V1_2::Effect effect, EffectStrength strength,
                             perform_cb _hidl_cb) override;

    // Methods from ::android::hardware::vibrator::V1_3::IVibrator follow.
    Return<bool> supportsExternalControl() override;
    Return<Status> setExternalControl(bool enabled) override;
    Return<void> perform_1_3(Effect effect, EffectStrength strength, perform_cb _hidl_cb) override;

  private:
    Status enable(bool enabled);
Loading