From 6658f5fd20477a7513f8c7d8022226b838ad01bd Mon Sep 17 00:00:00 2001 From: XJIOP Date: Tue, 17 Dec 2019 19:50:21 +0100 Subject: [PATCH] fixed issues with sound volume on lock screen --- .idea/vcs.xml | 6 ++++ README.md | 3 ++ app/.gitignore | 2 ++ app/build.gradle | 5 ++- .../oneplusaoddoubletapmod/KeyService.java | 32 +++++++++++++++---- 5 files changed, 38 insertions(+), 10 deletions(-) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index adca525..97b3e8c 100644 --- a/README.md +++ b/README.md @@ -4,3 +4,6 @@ Always on Display (AOD) Double Tap to Lock Screen **Install** - Download and install [apk](https://github.com/XJIOP/OnePlus-AOD-DoubleTap-Mod/releases) - Activate this mod in Android Settings -> System -> Accessibility +- In fingerprint settings need enable option -> Tap the screen to show +- Now one tap it shows AOD, double tap from AOD to show screen lock +- Enjoy! diff --git a/app/.gitignore b/app/.gitignore index 796b96d..7b7f1b1 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1 +1,3 @@ /build +/debug +/release diff --git a/app/build.gradle b/app/build.gradle index 794c6db..e9e39ce 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,9 +6,8 @@ android { applicationId "org.xjiop.oneplusaoddoubletapmod" minSdkVersion 21 targetSdkVersion 29 - versionCode 1 - versionName "1.0" - testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + versionCode 11 + versionName "1.1" } buildTypes { release { diff --git a/app/src/main/java/org/xjiop/oneplusaoddoubletapmod/KeyService.java b/app/src/main/java/org/xjiop/oneplusaoddoubletapmod/KeyService.java index ede82ec..bf09bdf 100644 --- a/app/src/main/java/org/xjiop/oneplusaoddoubletapmod/KeyService.java +++ b/app/src/main/java/org/xjiop/oneplusaoddoubletapmod/KeyService.java @@ -3,22 +3,36 @@ import android.accessibilityservice.AccessibilityService; import android.content.Context; import android.os.PowerManager; +import android.util.Log; import android.view.KeyEvent; import android.view.accessibility.AccessibilityEvent; public class KeyService extends AccessibilityService { + private final String TAG = "KeyService"; + private long CLICK_DELAY; @Override - public void onAccessibilityEvent(AccessibilityEvent event) {} + public void onAccessibilityEvent(AccessibilityEvent event) { + //Log.d(TAG, "onAccessibilityEvent: " + event); + } @Override - public void onInterrupt() {} + public void onInterrupt() { + //Log.d(TAG, "onInterrupt"); + } @Override protected boolean onKeyEvent(KeyEvent event) { - return doubleClick(); + //Log.d(TAG, "onKeyEvent: " + event); + + boolean result = false; + + if(event.getKeyCode() == KeyEvent.KEYCODE_F4) + result = doubleClick(); + + return result; } private boolean doubleClick() { @@ -31,16 +45,20 @@ private boolean doubleClick() { CLICK_DELAY = -1; result = true; - PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); - PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK |PowerManager.ACQUIRE_CAUSES_WAKEUP, getPackageName()+":double_tap"); - wl.acquire(500L); - wl.release(); + PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE); + if(powerManager != null) { + PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, getPackageName() + ":double_tap"); + wakeLock.acquire(500L); + wakeLock.release(); + } } else { CLICK_DELAY = thisTime; result = false; } + //Log.d(TAG, "doubleClick: " + result); + return result; } }