From ddfe879b783ad72603308e28e8f683454464684e Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Thu, 27 Aug 2009 13:27:08 -0700 Subject: [PATCH] Don't activate keyguard if screen is turned off while proximity sensor is active. Signed-off-by: Mike Lockwood --- core/java/android/view/WindowManagerPolicy.java | 2 ++ services/java/com/android/server/PowerManagerService.java | 3 +++ 2 files changed, 5 insertions(+) diff --git a/core/java/android/view/WindowManagerPolicy.java b/core/java/android/view/WindowManagerPolicy.java index ea08f33f7f10c..dd4b65f34c4b2 100644 --- a/core/java/android/view/WindowManagerPolicy.java +++ b/core/java/android/view/WindowManagerPolicy.java @@ -355,6 +355,8 @@ public interface WindowManagerPolicy { public final int OFF_BECAUSE_OF_USER = 1; /** Screen turned off because of timeout */ public final int OFF_BECAUSE_OF_TIMEOUT = 2; + /** Screen turned off because of proximity sensor */ + public final int OFF_BECAUSE_OF_PROXIMITY_SENSOR = 3; /** * Magic constant to {@link IWindowManager#setRotation} to not actually diff --git a/services/java/com/android/server/PowerManagerService.java b/services/java/com/android/server/PowerManagerService.java index 621f497623cb7..38df47b418953 100644 --- a/services/java/com/android/server/PowerManagerService.java +++ b/services/java/com/android/server/PowerManagerService.java @@ -949,6 +949,9 @@ class PowerManagerService extends IPowerManager.Stub private void sendNotificationLocked(boolean on, int why) { + if (mProximitySensorActive) { + why = WindowManagerPolicy.OFF_BECAUSE_OF_PROXIMITY_SENSOR; + } if (!on) { mStillNeedSleepNotification = false; }