Doze: Make proximity check configurable.
Default to true, but make it available for overlay or setting
at runtime.
Bug: 18373928
Change-Id: I6abc1924ea0f03620f4683dc055f64ede5782809
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
index 8f14abb..89b3e5b 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
@@ -202,6 +202,12 @@
// Here we need a wakelock to stay awake until the pulse is finished.
mWakeLock.acquire();
mPulsing = true;
+ if (!mDozeParameters.getProxCheckBeforePulse()) {
+ // skip proximity check
+ continuePulsing();
+ return;
+ }
+ // perform a proximity check before pulsing
final long start = SystemClock.uptimeMillis();
new ProximityCheck() {
@Override
@@ -216,28 +222,32 @@
}
// not in-pocket, continue pulsing
- mHost.pulseWhileDozing(new DozeHost.PulseCallback() {
- @Override
- public void onPulseStarted() {
- if (mPulsing && mDreaming) {
- turnDisplayOn();
- }
- }
-
- @Override
- public void onPulseFinished() {
- if (mPulsing && mDreaming) {
- mPulsing = false;
- turnDisplayOff();
- }
- mWakeLock.release(); // needs to be unconditional to balance acquire
- }
- });
+ continuePulsing();
}
}.check();
}
}
+ private void continuePulsing() {
+ mHost.pulseWhileDozing(new DozeHost.PulseCallback() {
+ @Override
+ public void onPulseStarted() {
+ if (mPulsing && mDreaming) {
+ turnDisplayOn();
+ }
+ }
+
+ @Override
+ public void onPulseFinished() {
+ if (mPulsing && mDreaming) {
+ mPulsing = false;
+ turnDisplayOff();
+ }
+ mWakeLock.release(); // needs to be unconditional to balance acquire
+ }
+ });
+ }
+
private void turnDisplayOff() {
if (DEBUG) Log.d(mTag, "Display off");
setDozeScreenState(Display.STATE_OFF);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
index 6fd6758..3d4a1e0 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/DozeParameters.java
@@ -55,6 +55,7 @@
pw.print(" getVibrateOnSigMotion(): "); pw.println(getVibrateOnSigMotion());
pw.print(" getPulseOnPickup(): "); pw.println(getPulseOnPickup());
pw.print(" getVibrateOnPickup(): "); pw.println(getVibrateOnPickup());
+ pw.print(" getProxCheckBeforePulse(): "); pw.println(getProxCheckBeforePulse());
pw.print(" getPulseOnNotifications(): "); pw.println(getPulseOnNotifications());
pw.print(" getPulseSchedule(): "); pw.println(getPulseSchedule());
pw.print(" getPulseScheduleResets(): "); pw.println(getPulseScheduleResets());
@@ -101,6 +102,10 @@
return SystemProperties.getBoolean("doze.vibrate.pickup", false);
}
+ public boolean getProxCheckBeforePulse() {
+ return getBoolean("doze.pulse.proxcheck", R.bool.doze_proximity_check_before_pulse);
+ }
+
public boolean getPulseOnNotifications() {
return getBoolean("doze.pulse.notifications", R.bool.doze_pulse_on_notifications);
}