Skip to content

Commit 93aa70c

Browse files
Steven RossAndroid (Google) Code Review
authored andcommitted
Merge "Only poke the wakelock for FUL if the screen is on fixes 7222901" into jb-mr1-dev
2 parents 0d5cad7 + acbe41f commit 93aa70c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

policy/src/com/android/internal/policy/impl/keyguard/FaceUnlock.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import android.os.IBinder;
3030
import android.os.Looper;
3131
import android.os.Message;
32+
import android.os.PowerManager;
3233
import android.os.RemoteException;
3334
import android.util.Log;
3435
import 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
/**

0 commit comments

Comments
 (0)