TWRP: Enable qti input haptics vibrators support

 * these type of vibrators are present in newer devices based on
   board sm8150 & above. Like Oneplus 7 series, Redmi K20 Pro, etc.
 * to enable it add TW_SUPPORT_INPUT_1_2_HAPTICS := true in Boardconfig.mk
 * you will need to add the vendor vibrator service to init and run it in your device tree
Change-Id: I0fe6612def149e70808ca41829b6f7ba0b23cd62
Signed-off-by: Mohd Faraz <androiabledroid@gmail.com>
(cherry picked from commit 909daa959c99cf3a6abbe224ec3fc45669df4440)
diff --git a/minuitwrp/events.cpp b/minuitwrp/events.cpp
index a2a3d16..955acf3 100755
--- a/minuitwrp/events.cpp
+++ b/minuitwrp/events.cpp
@@ -28,6 +28,10 @@
 #include <string.h>
 #include <fstream>
 
+#ifdef USE_QTI_HAPTICS
+#include <android/hardware/vibrator/1.2/IVibrator.h>
+#endif
+
 #include "../common.h"
 
 #include "minui.h"
@@ -130,12 +134,18 @@
     char tout[6];
     sprintf(tout, "%i", timeout_ms);
 
+#ifdef USE_QTI_HAPTICS
+    android::sp<android::hardware::vibrator::V1_2::IVibrator> vib = android::hardware::vibrator::V1_2::IVibrator::getService();
+    if (vib != nullptr) {
+        vib->on((uint32_t)timeout_ms);
+    }
+#else
     if (std::ifstream(LEDS_HAPTICS_ACTIVATE_FILE).good()) {
         write_to_file(LEDS_HAPTICS_DURATION_FILE, tout);
         write_to_file(LEDS_HAPTICS_ACTIVATE_FILE, "1");
     } else
         write_to_file(VIBRATOR_TIMEOUT_FILE, tout);
-
+#endif
     return 0;
 }
 #endif