Skip to content

Commit 904732c

Browse files
author
Craig Mautner
committed
Call requestFocus and ensure that screenOn is set.
When maybeCreateKeyguardLocked was called from methods other than show(), the requestFocus() call on the new KeyguardHostView was never made. At boot time the screen on notification was not propagated to KeyguardViewManager because the showListener callback was null. This passes on the notification but does not make the callback if it is null. Bug: 7299119 fixed. Change-Id: Iaf058954473dc63fe4864ab1f435db4463b1110e
1 parent e13ae64 commit 904732c

File tree

2 files changed

+24
-22
lines changed

2 files changed

+24
-22
lines changed

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

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343

4444
/**
4545
* Manages creating, showing, hiding and resetting the keyguard. Calls back
46-
* via {@link com.android.internal.policy.impl.KeyguardViewCallback} to poke
46+
* via {@link KeyguardViewMediator.ViewMediatorCallback} to poke
4747
* the wake lock and report that the keyguard is done, which is in turn,
4848
* reported to this class by the current {@link KeyguardViewBase}.
4949
*/
@@ -233,6 +233,7 @@ private void inflateKeyguardView(Bundle options) {
233233

234234
if (mScreenOn) {
235235
mKeyguardView.show();
236+
mKeyguardView.requestFocus();
236237
}
237238
}
238239

@@ -314,22 +315,25 @@ public synchronized void onScreenTurnedOn(
314315

315316
// Caller should wait for this window to be shown before turning
316317
// on the screen.
317-
if (mKeyguardHost.getVisibility() == View.VISIBLE) {
318-
// Keyguard may be in the process of being shown, but not yet
319-
// updated with the window manager... give it a chance to do so.
320-
mKeyguardHost.post(new Runnable() {
321-
public void run() {
322-
if (mKeyguardHost.getVisibility() == View.VISIBLE) {
323-
showListener.onShown(mKeyguardHost.getWindowToken());
324-
} else {
325-
showListener.onShown(null);
318+
if (showListener != null) {
319+
if (mKeyguardHost.getVisibility() == View.VISIBLE) {
320+
// Keyguard may be in the process of being shown, but not yet
321+
// updated with the window manager... give it a chance to do so.
322+
mKeyguardHost.post(new Runnable() {
323+
@Override
324+
public void run() {
325+
if (mKeyguardHost.getVisibility() == View.VISIBLE) {
326+
showListener.onShown(mKeyguardHost.getWindowToken());
327+
} else {
328+
showListener.onShown(null);
329+
}
326330
}
327-
}
328-
});
329-
} else {
330-
showListener.onShown(null);
331+
});
332+
} else {
333+
showListener.onShown(null);
334+
}
331335
}
332-
} else {
336+
} else if (showListener != null) {
333337
showListener.onShown(null);
334338
}
335339
}
@@ -356,10 +360,9 @@ public boolean wakeWhenReadyTq(int keyCode) {
356360
if (mKeyguardView != null) {
357361
mKeyguardView.wakeWhenReadyTq(keyCode);
358362
return true;
359-
} else {
360-
Log.w(TAG, "mKeyguardView is null in wakeWhenReadyTq");
361-
return false;
362363
}
364+
Log.w(TAG, "mKeyguardView is null in wakeWhenReadyTq");
365+
return false;
363366
}
364367

365368
/**
@@ -382,6 +385,7 @@ public synchronized void hide() {
382385
final KeyguardViewBase lastView = mKeyguardView;
383386
mKeyguardView = null;
384387
mKeyguardHost.postDelayed(new Runnable() {
388+
@Override
385389
public void run() {
386390
synchronized (KeyguardViewManager.this) {
387391
lastView.cleanUp();

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -629,9 +629,7 @@ public void onScreenTurnedOn(KeyguardViewManager.ShowListener showListener) {
629629
mScreenOn = true;
630630
cancelDoKeyguardLaterLocked();
631631
if (DEBUG) Log.d(TAG, "onScreenTurnedOn, seq = " + mDelayedShowingSequence);
632-
if (showListener != null) {
633-
notifyScreenOnLocked(showListener);
634-
}
632+
notifyScreenOnLocked(showListener);
635633
}
636634
maybeSendUserPresentBroadcast();
637635
}
@@ -1365,7 +1363,7 @@ private void handleReset(Bundle options) {
13651363

13661364
/**
13671365
* Handle message sent by {@link #verifyUnlock}
1368-
* @see #RESET
1366+
* @see #VERIFY_UNLOCK
13691367
*/
13701368
private void handleVerifyUnlock() {
13711369
synchronized (KeyguardViewMediator.this) {

0 commit comments

Comments
 (0)