From 2c21b64961a770a438a3862bd4767584d5d2a651 Mon Sep 17 00:00:00 2001 From: Manidweep Date: Tue, 28 Jan 2025 16:01:51 -0500 Subject: [PATCH] OPlusExtras: Adapt to Lineage Change paths required for touch gesture functionality according to LineageOS Source --- Android.bp | 2 ++ .../oplus/OPlusExtras/touch/KeyHandler.java | 15 ++++++++++----- .../touch/TouchscreenGestureSettings.java | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Android.bp b/Android.bp index dd62740..0a4dd63 100644 --- a/Android.bp +++ b/Android.bp @@ -23,6 +23,8 @@ android_app { static_libs: [ "androidx.core_core", "androidx.preference_preference", + "org.lineageos.platform.internal", + "org.lineageos.settings.resources", "particles", ], diff --git a/src/org/evolution/oplus/OPlusExtras/touch/KeyHandler.java b/src/org/evolution/oplus/OPlusExtras/touch/KeyHandler.java index 8ff1cdb..227c861 100644 --- a/src/org/evolution/oplus/OPlusExtras/touch/KeyHandler.java +++ b/src/org/evolution/oplus/OPlusExtras/touch/KeyHandler.java @@ -36,6 +36,8 @@ import android.view.KeyEvent; import com.android.internal.os.DeviceKeyHandler; +import lineageos.providers.LineageSettings; + public class KeyHandler implements DeviceKeyHandler { private static final String TAG = KeyHandler.class.getSimpleName(); @@ -229,7 +231,7 @@ public class KeyHandler implements DeviceKeyHandler { private void launchCamera() { mGestureWakeLock.acquire(GESTURE_WAKELOCK_DURATION); - final Intent intent = new Intent(android.content.Intent.ACTION_SCREEN_CAMERA_GESTURE); + final Intent intent = new Intent(lineageos.content.Intent.ACTION_SCREEN_CAMERA_GESTURE); mContext.sendBroadcastAsUser(intent, UserHandle.CURRENT, Manifest.permission.STATUS_BAR_SERVICE); doHapticFeedback(); @@ -317,10 +319,13 @@ public class KeyHandler implements DeviceKeyHandler { return; } - final boolean enabled = Settings.System.getInt(mContext.getContentResolver(), - Settings.System.TOUCHSCREEN_GESTURE_HAPTIC_FEEDBACK, 1) != 0; - if (enabled) { - mVibrator.vibrate(VibrationEffect.get(VibrationEffect.EFFECT_CLICK)); + if (mAudioManager.getRingerMode() != AudioManager.RINGER_MODE_SILENT) { + final boolean enabled = LineageSettings.System.getInt(mContext.getContentResolver(), + LineageSettings.System.TOUCHSCREEN_GESTURE_HAPTIC_FEEDBACK, 1) != 0; + if (enabled) { + mVibrator.vibrate(VibrationEffect.createOneShot(50, + VibrationEffect.DEFAULT_AMPLITUDE)); + } } } diff --git a/src/org/evolution/oplus/OPlusExtras/touch/TouchscreenGestureSettings.java b/src/org/evolution/oplus/OPlusExtras/touch/TouchscreenGestureSettings.java index 8f4573c..365dce6 100644 --- a/src/org/evolution/oplus/OPlusExtras/touch/TouchscreenGestureSettings.java +++ b/src/org/evolution/oplus/OPlusExtras/touch/TouchscreenGestureSettings.java @@ -22,8 +22,8 @@ import androidx.preference.Preference; import androidx.preference.PreferenceFragment; import androidx.preference.PreferenceManager; -import com.android.internal.aospextended.hardware.LineageHardwareManager; -import com.android.internal.aospextended.hardware.TouchscreenGesture; +import lineageos.hardware.LineageHardwareManager; +import lineageos.hardware.TouchscreenGesture; import com.android.settingslib.collapsingtoolbar.CollapsingToolbarBaseActivity;