Merge "[DO NOT MERGE] Keyguard - Treat messsages to lock with priority" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
508167f720
@@ -16,7 +16,7 @@
|
|||||||
package com.android.internal.policy;
|
package com.android.internal.policy;
|
||||||
|
|
||||||
interface IKeyguardStateCallback {
|
interface IKeyguardStateCallback {
|
||||||
void onShowingStateChanged(boolean showing);
|
void onShowingStateChanged(boolean showing, int userId);
|
||||||
void onSimSecureStateChanged(boolean simSecure);
|
void onSimSecureStateChanged(boolean simSecure);
|
||||||
void onInputRestrictedStateChanged(boolean inputRestricted);
|
void onInputRestrictedStateChanged(boolean inputRestricted);
|
||||||
void onTrustedChanged(boolean trusted);
|
void onTrustedChanged(boolean trusted);
|
||||||
|
|||||||
@@ -1310,7 +1310,9 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
|
|||||||
public void doKeyguardTimeout(Bundle options) {
|
public void doKeyguardTimeout(Bundle options) {
|
||||||
mHandler.removeMessages(KEYGUARD_TIMEOUT);
|
mHandler.removeMessages(KEYGUARD_TIMEOUT);
|
||||||
Message msg = mHandler.obtainMessage(KEYGUARD_TIMEOUT, options);
|
Message msg = mHandler.obtainMessage(KEYGUARD_TIMEOUT, options);
|
||||||
mHandler.sendMessage(msg);
|
// Treat these messages with priority - A call to timeout means the device should lock
|
||||||
|
// as soon as possible and not wait for other messages on the thread to process first.
|
||||||
|
mHandler.sendMessageAtFrontOfQueue(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -1497,12 +1499,15 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
|
|||||||
* @see #handleShow
|
* @see #handleShow
|
||||||
*/
|
*/
|
||||||
private void showLocked(Bundle options) {
|
private void showLocked(Bundle options) {
|
||||||
Trace.beginSection("KeyguardViewMediator#showLocked aqcuiring mShowKeyguardWakeLock");
|
Trace.beginSection("KeyguardViewMediator#showLocked acquiring mShowKeyguardWakeLock");
|
||||||
if (DEBUG) Log.d(TAG, "showLocked");
|
if (DEBUG) Log.d(TAG, "showLocked");
|
||||||
// ensure we stay awake until we are finished displaying the keyguard
|
// ensure we stay awake until we are finished displaying the keyguard
|
||||||
mShowKeyguardWakeLock.acquire();
|
mShowKeyguardWakeLock.acquire();
|
||||||
Message msg = mHandler.obtainMessage(SHOW, options);
|
Message msg = mHandler.obtainMessage(SHOW, options);
|
||||||
mHandler.sendMessage(msg);
|
// Treat these messages with priority - This call can originate from #doKeyguardTimeout,
|
||||||
|
// meaning the device should lock as soon as possible and not wait for other messages on
|
||||||
|
// the thread to process first.
|
||||||
|
mHandler.sendMessageAtFrontOfQueue(msg);
|
||||||
Trace.endSection();
|
Trace.endSection();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1664,6 +1669,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
|
|||||||
case KEYGUARD_TIMEOUT:
|
case KEYGUARD_TIMEOUT:
|
||||||
synchronized (KeyguardViewMediator.this) {
|
synchronized (KeyguardViewMediator.this) {
|
||||||
doKeyguardLocked((Bundle) msg.obj);
|
doKeyguardLocked((Bundle) msg.obj);
|
||||||
|
notifyDefaultDisplayCallbacks(mShowing);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DISMISS:
|
case DISMISS:
|
||||||
@@ -2293,7 +2299,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
|
|||||||
for (int i = size - 1; i >= 0; i--) {
|
for (int i = size - 1; i >= 0; i--) {
|
||||||
IKeyguardStateCallback callback = mKeyguardStateCallbacks.get(i);
|
IKeyguardStateCallback callback = mKeyguardStateCallbacks.get(i);
|
||||||
try {
|
try {
|
||||||
callback.onShowingStateChanged(showing);
|
callback.onShowingStateChanged(showing, KeyguardUpdateMonitor.getCurrentUser());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.w(TAG, "Failed to call onShowingStateChanged", e);
|
Slog.w(TAG, "Failed to call onShowingStateChanged", e);
|
||||||
if (e instanceof DeadObjectException) {
|
if (e instanceof DeadObjectException) {
|
||||||
@@ -2342,7 +2348,7 @@ public class KeyguardViewMediator extends SystemUI implements Dumpable {
|
|||||||
mKeyguardStateCallbacks.add(callback);
|
mKeyguardStateCallbacks.add(callback);
|
||||||
try {
|
try {
|
||||||
callback.onSimSecureStateChanged(mUpdateMonitor.isSimPinSecure());
|
callback.onSimSecureStateChanged(mUpdateMonitor.isSimPinSecure());
|
||||||
callback.onShowingStateChanged(mShowing);
|
callback.onShowingStateChanged(mShowing, KeyguardUpdateMonitor.getCurrentUser());
|
||||||
callback.onInputRestrictedStateChanged(mInputRestricted);
|
callback.onInputRestrictedStateChanged(mInputRestricted);
|
||||||
callback.onTrustedChanged(mUpdateMonitor.getUserHasTrust(
|
callback.onTrustedChanged(mUpdateMonitor.getUserHasTrust(
|
||||||
KeyguardUpdateMonitor.getCurrentUser()));
|
KeyguardUpdateMonitor.getCurrentUser()));
|
||||||
|
|||||||
@@ -192,6 +192,12 @@ public class KeyguardServiceWrapper implements IKeyguardService {
|
|||||||
|
|
||||||
@Override // Binder interface
|
@Override // Binder interface
|
||||||
public void doKeyguardTimeout(Bundle options) {
|
public void doKeyguardTimeout(Bundle options) {
|
||||||
|
int userId = mKeyguardStateMonitor.getCurrentUser();
|
||||||
|
if (mKeyguardStateMonitor.isSecure(userId)) {
|
||||||
|
// Preemptively inform the cache that the keyguard will soon be showing, as calls to
|
||||||
|
// doKeyguardTimeout are a signal to lock the device as soon as possible.
|
||||||
|
mKeyguardStateMonitor.onShowingStateChanged(true, userId);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
mService.doKeyguardTimeout(options);
|
mService.doKeyguardTimeout(options);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
|
|||||||
@@ -83,8 +83,14 @@ public class KeyguardStateMonitor extends IKeyguardStateCallback.Stub {
|
|||||||
return mHasLockscreenWallpaper;
|
return mHasLockscreenWallpaper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getCurrentUser() {
|
||||||
|
return mCurrentUserId;
|
||||||
|
}
|
||||||
|
|
||||||
@Override // Binder interface
|
@Override // Binder interface
|
||||||
public void onShowingStateChanged(boolean showing) {
|
public void onShowingStateChanged(boolean showing, int userId) {
|
||||||
|
if (userId != mCurrentUserId) return;
|
||||||
|
|
||||||
mIsShowing = showing;
|
mIsShowing = showing;
|
||||||
|
|
||||||
mCallback.onShowingChanged();
|
mCallback.onShowingChanged();
|
||||||
|
|||||||
Reference in New Issue
Block a user