diff --git a/Android.mk b/Android.mk
old mode 100644
new mode 100755
index 40364737..9b912355
--- a/Android.mk
+++ b/Android.mk
@@ -293,6 +293,9 @@ endif
ifeq ($(TW_NO_EXFAT_FUSE), true)
LOCAL_CFLAGS += -DTW_NO_EXFAT_FUSE
endif
+ifeq ($(TW_NO_HAPTICS), true)
+ LOCAL_CFLAGS += -DTW_NO_HAPTICS
+endif
ifeq ($(TW_INCLUDE_JB_CRYPTO), true)
TW_INCLUDE_CRYPTO := true
endif
diff --git a/data.cpp b/data.cpp
old mode 100644
new mode 100755
index d9239a47..cf8349ba
--- a/data.cpp
+++ b/data.cpp
@@ -587,9 +587,16 @@ void DataManager::SetDefaultValues()
mConst.SetValue("false", "0");
mConst.SetValue(TW_VERSION_VAR, TW_VERSION_STR);
+
+#ifndef TW_NO_HAPTICS
mPersist.SetValue("tw_button_vibrate", "80");
mPersist.SetValue("tw_keyboard_vibrate", "40");
mPersist.SetValue("tw_action_vibrate", "160");
+ mConst.SetValue("tw_disable_haptics", "0");
+#else
+ LOGINFO("TW_NO_HAPTICS := true\n");
+ mConst.SetValue("tw_disable_haptics", "1");
+#endif
TWPartition *store = PartitionManager.Get_Default_Storage_Partition();
if (store)
@@ -1110,9 +1117,11 @@ string DataManager::GetSettingsStoragePath(void)
void DataManager::Vibrate(const string& varName)
{
+#ifndef TW_NO_HAPTICS
int vib_value = 0;
GetValue(varName, vib_value);
if (vib_value) {
vibrate(vib_value);
}
+#endif
}
diff --git a/data.hpp b/data.hpp
old mode 100644
new mode 100755
diff --git a/gui/action.cpp b/gui/action.cpp
old mode 100644
new mode 100755
index d708dd46..11d9580f
--- a/gui/action.cpp
+++ b/gui/action.cpp
@@ -516,8 +516,12 @@ void GUIAction::operation_end(const int operation_status)
blankTimer.resetTimerAndUnblank();
property_set("twrp.action_complete", "1");
time(&Stop);
+
+#ifndef TW_NO_HAPTICS
if ((int) difftime(Stop, Start) > 10)
DataManager::Vibrate("tw_action_vibrate");
+#endif
+
LOGINFO("operation_end - status=%d\n", operation_status);
}
diff --git a/gui/button.cpp b/gui/button.cpp
old mode 100644
new mode 100755
index dfae5e23..7c7f69f1
--- a/gui/button.cpp
+++ b/gui/button.cpp
@@ -248,7 +248,10 @@ int GUIButton::NotifyTouch(TOUCH_STATE state, int x, int y)
} else {
if (last_state == 0) {
last_state = 1;
+
+#ifndef TW_NO_HAPTICS
DataManager::Vibrate("tw_button_vibrate");
+#endif
if (mButtonLabel != NULL)
mButtonLabel->isHighlighted = true;
if (mButtonImg != NULL)
diff --git a/gui/checkbox.cpp b/gui/checkbox.cpp
old mode 100644
new mode 100755
index de63cba3..025a803a
--- a/gui/checkbox.cpp
+++ b/gui/checkbox.cpp
@@ -179,7 +179,10 @@ int GUICheckbox::NotifyTouch(TOUCH_STATE state, int x __unused, int y __unused)
lastState = (lastState == 0) ? 1 : 0;
DataManager::SetValue(mVarName, lastState);
+#ifndef TW_NO_HAPTICS
DataManager::Vibrate("tw_button_vibrate");
+#endif
+
}
return 0;
}
diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp
old mode 100644
new mode 100755
index ca7006dc..b6a772b0
--- a/gui/keyboard.cpp
+++ b/gui/keyboard.cpp
@@ -549,7 +549,11 @@ int GUIKeyboard::NotifyTouch(TOUCH_STATE state, int x, int y)
bool repeatKey = false;
Layout& lay = layouts[currentLayout - 1];
if (state == TOUCH_RELEASE && was_held == 0) {
+
+#ifndef TW_NO_HAPTICS
DataManager::Vibrate("tw_keyboard_vibrate");
+#endif
+
if (key.layout > 0) {
// Switch layouts
if (lay.is_caps && key.layout == lay.revert_layout && !CapsLockOn) {
@@ -593,7 +597,11 @@ int GUIKeyboard::NotifyTouch(TOUCH_STATE state, int x, int y)
was_held = 1;
if (key.longpresskey > 0) {
// Long Press Key
+
+#ifndef TW_NO_HAPTICS
DataManager::Vibrate("tw_keyboard_vibrate");
+#endif
+
PageManager::NotifyCharInput(key.longpresskey);
}
else
diff --git a/gui/patternpassword.cpp b/gui/patternpassword.cpp
old mode 100644
new mode 100755
index 5559f9dd..a75ed156
--- a/gui/patternpassword.cpp
+++ b/gui/patternpassword.cpp
@@ -370,7 +370,11 @@ int GUIPatternPassword::NotifyTouch(TOUCH_STATE state, int x, int y)
mTrackingTouch = true;
ResetActiveDots();
ConnectDot(dot_idx);
+
+#ifndef TW_NO_HAPTICS
DataManager::Vibrate("tw_button_vibrate");
+#endif
+
mCurLineX = x;
mCurLineY = y;
mNeedRender = true;
@@ -386,7 +390,11 @@ int GUIPatternPassword::NotifyTouch(TOUCH_STATE state, int x, int y)
{
ConnectIntermediateDots(dot_idx);
ConnectDot(dot_idx);
+
+#ifndef TW_NO_HAPTICS
DataManager::Vibrate("tw_button_vibrate");
+#endif
+
}
mCurLineX = x;
diff --git a/gui/scrolllist.cpp b/gui/scrolllist.cpp
old mode 100644
new mode 100755
index ecfb5fe8..bf5a9b06
--- a/gui/scrolllist.cpp
+++ b/gui/scrolllist.cpp
@@ -508,7 +508,10 @@ int GUIScrollList::NotifyTouch(TOUCH_STATE state, int x, int y)
NotifySelect(selectedItem);
mUpdate = 1;
+#ifndef TW_NO_HAPTICS
DataManager::Vibrate("tw_button_vibrate");
+#endif
+
selectedItem = NO_ITEM;
} else {
// Start kinetic scrolling
diff --git a/gui/slider.cpp b/gui/slider.cpp
old mode 100644
new mode 100755
index fab5a2ea..3c5f6526
--- a/gui/slider.cpp
+++ b/gui/slider.cpp
@@ -208,7 +208,11 @@ int GUISlider::NotifyTouch(TOUCH_STATE state, int x, int y)
return 0;
if (sCurTouchX >= mRenderX + mRenderW - sTouchW) {
+
+#ifndef TW_NO_HAPTICS
DataManager::Vibrate("tw_button_vibrate");
+#endif
+
sAction->doActions();
}
diff --git a/gui/terminal.cpp b/gui/terminal.cpp
old mode 100644
new mode 100755
index b1799ce6..a4fed910
--- a/gui/terminal.cpp
+++ b/gui/terminal.cpp
@@ -530,7 +530,11 @@ private:
switch (ch)
{
case 7: // BEL
+
+#ifndef TW_NO_HAPTICS
DataManager::Vibrate("tw_button_vibrate");
+#endif
+
break;
case 8: // BS
left();
diff --git a/gui/theme/common/landscape.xml b/gui/theme/common/landscape.xml
old mode 100644
new mode 100755
index 5bbfe902..f6f14bc5
--- a/gui/theme/common/landscape.xml
+++ b/gui/theme/common/landscape.xml
@@ -3166,19 +3166,28 @@
+
+
+
+ {@vibration_disabled=Vibration Disabled for Device}
+
+
+
{@button_vibration=Button Vibration:}
+
{@kb_vibration=Keyboard Vibration:}
+
{@act_vibration=Action Vibration:}
diff --git a/gui/theme/common/languages/en.xml b/gui/theme/common/languages/en.xml
old mode 100644
new mode 100755
index afba59a0..03d4e084
--- a/gui/theme/common/languages/en.xml
+++ b/gui/theme/common/languages/en.xml
@@ -318,6 +318,7 @@
Time Zone
Screen
Screen Brightness
+ Vibration is disabled for this device
Vibration
Language
Time Zone
diff --git a/gui/theme/common/portrait.xml b/gui/theme/common/portrait.xml
old mode 100644
new mode 100755
index 11769227..09b7c6b7
--- a/gui/theme/common/portrait.xml
+++ b/gui/theme/common/portrait.xml
@@ -3329,19 +3329,28 @@
+
+
+
+ {@vibration_disabled=Vibration Disabled for Device}
+
+
+
{@button_vibration=Button Vibration:}
+
{@kb_vibration=Keyboard Vibration:}
+
{@act_vibration=Action Vibration:}
diff --git a/gui/theme/common/watch.xml b/gui/theme/common/watch.xml
old mode 100644
new mode 100755
index 83f4b63f..d36bb2d5
--- a/gui/theme/common/watch.xml
+++ b/gui/theme/common/watch.xml
@@ -3518,6 +3518,7 @@