summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2013-09-19 05:24:42 -0700
committerSantos Cordon <santoscordon@google.com>2013-09-19 05:24:42 -0700
commitdbe82d60839a629ebaa7d21878901883b51b5e16 (patch)
tree4dca764237a25404958e734c98c5a0dfced73fcf
parent82d64da6612291b8a73db8e452c0b3a1c26abf92 (diff)
Tear down proximity sensors when no longer in use.
bug:10493709 Change-Id: I76e1940472aa503f1fe8c4a73c82852f8670b61c
-rw-r--r--InCallUI/src/com/android/incallui/InCallPresenter.java4
-rw-r--r--InCallUI/src/com/android/incallui/ProximitySensor.java10
2 files changed, 14 insertions, 0 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallPresenter.java b/InCallUI/src/com/android/incallui/InCallPresenter.java
index 8c52aab2c..7678372fb 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -435,6 +435,10 @@ public class InCallPresenter implements CallList.Listener {
}
mContactInfoCache = null;
+ if (mProximitySensor != null) {
+ removeListener(mProximitySensor);
+ mProximitySensor.tearDown();
+ }
mProximitySensor = null;
mAudioModeProvider = null;
diff --git a/InCallUI/src/com/android/incallui/ProximitySensor.java b/InCallUI/src/com/android/incallui/ProximitySensor.java
index 0dc54dccb..5895c291c 100644
--- a/InCallUI/src/com/android/incallui/ProximitySensor.java
+++ b/InCallUI/src/com/android/incallui/ProximitySensor.java
@@ -68,6 +68,16 @@ public class ProximitySensor implements AccelerometerListener.OrientationListene
mAudioModeProvider.addListener(this);
}
+ public void tearDown() {
+ mAudioModeProvider.removeListener(this);
+
+ mAccelerometerListener.enable(false);
+
+ if (mProximityWakeLock.isHeld()) {
+ mProximityWakeLock.release();
+ }
+ }
+
/**
* Called to identify when the device is laid down flat.
*/