aidl: vibrator: Add click and tick duration config properties

Change-Id: Ia1015931d19add236bc44fbec06e7ee51993c7b6
diff --git a/aidl/vibrator/Vibrator.cpp b/aidl/vibrator/Vibrator.cpp
index 11d7ff0..2498c54 100644
--- a/aidl/vibrator/Vibrator.cpp
+++ b/aidl/vibrator/Vibrator.cpp
@@ -7,6 +7,7 @@
 #include "Vibrator.h"
 
 #include <android-base/logging.h>
+#include <android-base/properties.h>
 
 #include <cmath>
 #include <fstream>
@@ -58,6 +59,9 @@
     mIsTimedOutVibrator = nodeExists(VIBRATOR_TIMEOUT_PATH);
     mHasTimedOutIntensity = nodeExists(VIBRATOR_INTENSITY_PATH);
     mHasTimedOutEffect = nodeExists(VIBRATOR_CP_TRIGGER_PATH);
+
+    mClickDuration = ::android::base::GetIntProperty("ro.vendor.vibrator_hal.click_duration", mClickDuration);
+    mTickDuration = ::android::base::GetIntProperty("ro.vendor.vibrator_hal.tick_duration", mTickDuration);
 }
 
 ndk::ScopedAStatus Vibrator::getCapabilities(int32_t* _aidl_return) {
@@ -277,9 +281,9 @@
     *status = ndk::ScopedAStatus::ok();
     switch (effect) {
         case Effect::CLICK:
-            return 10;
+            return mClickDuration;
         case Effect::TICK:
-            return 5;
+            return mTickDuration;
         default:
             break;
     }
diff --git a/aidl/vibrator/Vibrator.h b/aidl/vibrator/Vibrator.h
index 06f5166..3a26113 100644
--- a/aidl/vibrator/Vibrator.h
+++ b/aidl/vibrator/Vibrator.h
@@ -63,7 +63,7 @@
 
 private:
     ndk::ScopedAStatus activate(uint32_t ms);
-    static uint32_t effectToMs(Effect effect, ndk::ScopedAStatus* status);
+    uint32_t effectToMs(Effect effect, ndk::ScopedAStatus* status);
     static float strengthToAmplitude(EffectStrength strength, ndk::ScopedAStatus* status);
 
     bool mEnabled{false};
@@ -73,6 +73,9 @@
     bool mIsTimedOutVibrator;
     bool mHasTimedOutIntensity;
     bool mHasTimedOutEffect;
+
+    int mClickDuration = 10;
+    int mTickDuration = 5;
 };
 
 } // namespace vibrator