Created
January 8, 2015 15:02
-
-
Save invisiblek/10488f8f47f7a1bf4442 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Android.mk b/Android.mk | |
index b272445..b219493 100644 | |
--- a/Android.mk | |
+++ b/Android.mk | |
@@ -3,7 +3,10 @@ LOCAL_PATH:= $(call my-dir) | |
# Build the Telecom service. | |
include $(CLEAR_VARS) | |
-LOCAL_JAVA_LIBRARIES := telephony-common | |
+LOCAL_JAVA_LIBRARIES := \ | |
+ org.cyanogenmod.hardware \ | |
+ telephony-common | |
+ | |
LOCAL_STATIC_JAVA_LIBRARIES := \ | |
guava \ | |
diff --git a/src/com/android/server/telecom/ProximitySensorManager.java b/src/com/android/server/telecom/ProximitySensorManager.java | |
index 289366f..3b77c03 100644 | |
--- a/src/com/android/server/telecom/ProximitySensorManager.java | |
+++ b/src/com/android/server/telecom/ProximitySensorManager.java | |
@@ -18,6 +18,7 @@ package com.android.server.telecom; | |
import android.content.Context; | |
import android.os.PowerManager; | |
+import org.cyanogenmod.hardware.TapToWake; | |
/** | |
* This class manages the proximity sensor and allows callers to turn it on and off. | |
@@ -61,6 +62,9 @@ public class ProximitySensorManager extends CallsManagerListenerBase { | |
return; | |
} | |
if (!mProximityWakeLock.isHeld()) { | |
+ if (isTapToWakeSupported() && TapToWake.isEnabled()) { | |
+ TapToWake.setEnabled(false); | |
+ } | |
Log.i(this, "Acquiring proximity wake lock"); | |
mProximityWakeLock.acquire(); | |
} else { | |
@@ -77,6 +81,9 @@ public class ProximitySensorManager extends CallsManagerListenerBase { | |
return; | |
} | |
if (mProximityWakeLock.isHeld()) { | |
+ if (isTapToWakeSupported() && !TapToWake.isEnabled()) { | |
+ TapToWake.setEnabled(true); | |
+ } | |
Log.i(this, "Releasing proximity wake lock"); | |
int flags = | |
(screenOnImmediately ? 0 : PowerManager.RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY); | |
@@ -85,4 +92,13 @@ public class ProximitySensorManager extends CallsManagerListenerBase { | |
Log.i(this, "Proximity wake lock already released"); | |
} | |
} | |
+ | |
+ private static boolean isTapToWakeSupported() { | |
+ try { | |
+ return TapToWake.isSupported(); | |
+ } catch (NoClassDefFoundError e) { | |
+ // Hardware abstraction framework not installed | |
+ return false; | |
+ } | |
+ } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment