File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
policy/src/com/android/internal/policy/impl/keyguard Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 2929import android .os .IBinder ;
3030import android .os .Looper ;
3131import android .os .Message ;
32+ import android .os .PowerManager ;
3233import android .os .RemoteException ;
3334import android .util .Log ;
3435import android .view .View ;
@@ -128,6 +129,8 @@ public void show(long timeoutMillis) {
128129 */
129130 public void hide () {
130131 if (DEBUG ) Log .d (TAG , "hide()" );
132+ // Removes any wakelock messages to make sure they don't cause the screen to turn back on.
133+ mHandler .removeMessages (MSG_POKE_WAKELOCK );
131134 // Remove messages to prevent a delayed show message from undo-ing the hide
132135 removeDisplayMessages ();
133136 mHandler .sendEmptyMessage (MSG_HIDE_FACE_UNLOCK_VIEW );
@@ -384,10 +387,14 @@ void handleExposeFallback() {
384387 }
385388
386389 /**
387- * Pokes the wakelock to keep the screen alive and active for a specific amount of time.
390+ * If the screen is on, pokes the wakelock to keep the screen alive and active for a specific
391+ * amount of time.
388392 */
389393 void handlePokeWakelock (int millis ) {
394+ PowerManager powerManager = (PowerManager ) mContext .getSystemService (Context .POWER_SERVICE );
395+ if (powerManager .isScreenOn ()) {
390396 mKeyguardScreenCallback .userActivity (millis );
397+ }
391398 }
392399
393400 /**
You can’t perform that action at this time.
0 commit comments