summaryrefslogtreecommitdiff
path: root/InCallUI
diff options
context:
space:
mode:
authorSantos Cordon <santoscordon@google.com>2013-09-19 21:34:58 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-09-19 21:34:58 +0000
commitd3565c451b341f25e7328a20229079b1f0aab424 (patch)
tree0d78ae50906c7e5bf959864bf4ae92fc071eb098 /InCallUI
parent7b35331be8f517a072e2d38603f82caba49d9d91 (diff)
parentdbe82d60839a629ebaa7d21878901883b51b5e16 (diff)
Merge "Tear down proximity sensors when no longer in use." into klp-dev
Diffstat (limited to 'InCallUI')
-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 bdbdf6d91..4f687a86e 100644
--- a/InCallUI/src/com/android/incallui/InCallPresenter.java
+++ b/InCallUI/src/com/android/incallui/InCallPresenter.java
@@ -519,6 +519,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.
*/