Merge "Touch, wake and unlock" into mnc-dev
This commit is contained in:
@@ -285,7 +285,7 @@ LOCAL_SRC_FILES += \
|
|||||||
core/java/com/android/internal/appwidget/IAppWidgetHost.aidl \
|
core/java/com/android/internal/appwidget/IAppWidgetHost.aidl \
|
||||||
core/java/com/android/internal/backup/IBackupTransport.aidl \
|
core/java/com/android/internal/backup/IBackupTransport.aidl \
|
||||||
core/java/com/android/internal/backup/IObbBackupService.aidl \
|
core/java/com/android/internal/backup/IObbBackupService.aidl \
|
||||||
core/java/com/android/internal/policy/IKeyguardShowCallback.aidl \
|
core/java/com/android/internal/policy/IKeyguardDrawnCallback.aidl \
|
||||||
core/java/com/android/internal/policy/IKeyguardExitCallback.aidl \
|
core/java/com/android/internal/policy/IKeyguardExitCallback.aidl \
|
||||||
core/java/com/android/internal/policy/IKeyguardService.aidl \
|
core/java/com/android/internal/policy/IKeyguardService.aidl \
|
||||||
core/java/com/android/internal/policy/IKeyguardStateCallback.aidl \
|
core/java/com/android/internal/policy/IKeyguardStateCallback.aidl \
|
||||||
|
|||||||
@@ -321,6 +321,14 @@ public class FingerprintManager {
|
|||||||
* Called when a fingerprint is valid but not recognized.
|
* Called when a fingerprint is valid but not recognized.
|
||||||
*/
|
*/
|
||||||
public void onAuthenticationFailed() { }
|
public void onAuthenticationFailed() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a fingerprint image has been acquired, but wasn't processed yet.
|
||||||
|
*
|
||||||
|
* @param acquireInfo one of FINGERPRINT_ACQUIRED_* constants
|
||||||
|
* @hide
|
||||||
|
*/
|
||||||
|
public void onAuthenticationAcquired(int acquireInfo) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -737,9 +745,13 @@ public class FingerprintManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendAcquiredResult(long deviceId, int acquireInfo) {
|
private void sendAcquiredResult(long deviceId, int acquireInfo) {
|
||||||
|
if (mAuthenticationCallback != null) {
|
||||||
|
mAuthenticationCallback.onAuthenticationAcquired(acquireInfo);
|
||||||
|
}
|
||||||
final String msg = getAcquiredString(acquireInfo);
|
final String msg = getAcquiredString(acquireInfo);
|
||||||
if (msg == null) return;
|
if (msg == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (mEnrollmentCallback != null) {
|
if (mEnrollmentCallback != null) {
|
||||||
mEnrollmentCallback.onEnrollmentHelp(acquireInfo, msg);
|
mEnrollmentCallback.onEnrollmentHelp(acquireInfo, msg);
|
||||||
} else if (mAuthenticationCallback != null) {
|
} else if (mAuthenticationCallback != null) {
|
||||||
|
|||||||
@@ -15,6 +15,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.internal.policy;
|
package com.android.internal.policy;
|
||||||
|
|
||||||
oneway interface IKeyguardShowCallback {
|
oneway interface IKeyguardDrawnCallback {
|
||||||
void onShown(IBinder windowToken);
|
void onDrawn();
|
||||||
}
|
}
|
||||||
@@ -15,7 +15,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.android.internal.policy;
|
package com.android.internal.policy;
|
||||||
|
|
||||||
import com.android.internal.policy.IKeyguardShowCallback;
|
import com.android.internal.policy.IKeyguardDrawnCallback;
|
||||||
import com.android.internal.policy.IKeyguardStateCallback;
|
import com.android.internal.policy.IKeyguardStateCallback;
|
||||||
import com.android.internal.policy.IKeyguardExitCallback;
|
import com.android.internal.policy.IKeyguardExitCallback;
|
||||||
|
|
||||||
@@ -57,7 +57,13 @@ oneway interface IKeyguardService {
|
|||||||
/**
|
/**
|
||||||
* Called when the device has started waking up.
|
* Called when the device has started waking up.
|
||||||
*/
|
*/
|
||||||
void onStartedWakingUp(IKeyguardShowCallback callback);
|
void onStartedWakingUp();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when the device screen is turning on.
|
||||||
|
*/
|
||||||
|
void onScreenTurningOn(IKeyguardDrawnCallback callback);
|
||||||
|
|
||||||
void setKeyguardEnabled(boolean enabled);
|
void setKeyguardEnabled(boolean enabled);
|
||||||
void onSystemReady();
|
void onSystemReady();
|
||||||
void doKeyguardTimeout(in Bundle options);
|
void doKeyguardTimeout(in Bundle options);
|
||||||
|
|||||||
@@ -27,4 +27,5 @@ public class KeyguardConstants {
|
|||||||
*/
|
*/
|
||||||
public static final boolean DEBUG = false;
|
public static final boolean DEBUG = false;
|
||||||
public static final boolean DEBUG_SIM_STATES = false;
|
public static final boolean DEBUG_SIM_STATES = false;
|
||||||
|
public static final boolean DEBUG_FP_WAKELOCK = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,9 @@ import android.os.CancellationSignal;
|
|||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.IRemoteCallback;
|
import android.os.IRemoteCallback;
|
||||||
import android.os.Message;
|
import android.os.Message;
|
||||||
|
import android.os.PowerManager;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
|
import android.os.SystemClock;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
|
|
||||||
@@ -90,12 +92,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
private static final String TAG = "KeyguardUpdateMonitor";
|
private static final String TAG = "KeyguardUpdateMonitor";
|
||||||
private static final boolean DEBUG = KeyguardConstants.DEBUG;
|
private static final boolean DEBUG = KeyguardConstants.DEBUG;
|
||||||
private static final boolean DEBUG_SIM_STATES = KeyguardConstants.DEBUG_SIM_STATES;
|
private static final boolean DEBUG_SIM_STATES = KeyguardConstants.DEBUG_SIM_STATES;
|
||||||
|
private static final boolean DEBUG_FP_WAKELOCK = KeyguardConstants.DEBUG_FP_WAKELOCK;
|
||||||
private static final int LOW_BATTERY_THRESHOLD = 20;
|
private static final int LOW_BATTERY_THRESHOLD = 20;
|
||||||
|
private static final long FINGERPRINT_WAKELOCK_TIMEOUT_MS = 15 * 1000;
|
||||||
|
|
||||||
private static final String ACTION_FACE_UNLOCK_STARTED
|
private static final String ACTION_FACE_UNLOCK_STARTED
|
||||||
= "com.android.facelock.FACE_UNLOCK_STARTED";
|
= "com.android.facelock.FACE_UNLOCK_STARTED";
|
||||||
private static final String ACTION_FACE_UNLOCK_STOPPED
|
private static final String ACTION_FACE_UNLOCK_STOPPED
|
||||||
= "com.android.facelock.FACE_UNLOCK_STOPPED";
|
= "com.android.facelock.FACE_UNLOCK_STOPPED";
|
||||||
|
private static final String FINGERPRINT_WAKE_LOCK_NAME = "wake-and-unlock wakelock";
|
||||||
|
|
||||||
// Callback messages
|
// Callback messages
|
||||||
private static final int MSG_TIME_UPDATE = 301;
|
private static final int MSG_TIME_UPDATE = 301;
|
||||||
@@ -114,10 +119,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
private static final int MSG_SCREEN_TURNED_ON = 319;
|
private static final int MSG_SCREEN_TURNED_ON = 319;
|
||||||
private static final int MSG_SCREEN_TURNED_OFF = 320;
|
private static final int MSG_SCREEN_TURNED_OFF = 320;
|
||||||
private static final int MSG_KEYGUARD_BOUNCER_CHANGED = 322;
|
private static final int MSG_KEYGUARD_BOUNCER_CHANGED = 322;
|
||||||
private static final int MSG_FINGERPRINT_AUTHENTICATED = 323;
|
|
||||||
private static final int MSG_FINGERPRINT_ERROR = 324;
|
|
||||||
private static final int MSG_FINGERPRINT_HELP = 325;
|
|
||||||
private static final int MSG_FINGERPRINT_AUTH_FAILED = 326;
|
|
||||||
private static final int MSG_FACE_UNLOCK_STATE_CHANGED = 327;
|
private static final int MSG_FACE_UNLOCK_STATE_CHANGED = 327;
|
||||||
private static final int MSG_SIM_SUBSCRIPTION_INFO_CHANGED = 328;
|
private static final int MSG_SIM_SUBSCRIPTION_INFO_CHANGED = 328;
|
||||||
private static final int MSG_AIRPLANE_MODE_CHANGED = 329;
|
private static final int MSG_AIRPLANE_MODE_CHANGED = 329;
|
||||||
@@ -157,6 +158,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
private List<SubscriptionInfo> mSubscriptionInfo;
|
private List<SubscriptionInfo> mSubscriptionInfo;
|
||||||
private boolean mFingerprintDetectionRunning;
|
private boolean mFingerprintDetectionRunning;
|
||||||
private TrustManager mTrustManager;
|
private TrustManager mTrustManager;
|
||||||
|
private PowerManager mPowerManager;
|
||||||
|
|
||||||
private final Handler mHandler = new Handler() {
|
private final Handler mHandler = new Handler() {
|
||||||
@Override
|
@Override
|
||||||
@@ -210,18 +212,6 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
case MSG_SCREEN_TURNED_ON:
|
case MSG_SCREEN_TURNED_ON:
|
||||||
handleScreenTurnedOn();
|
handleScreenTurnedOn();
|
||||||
break;
|
break;
|
||||||
case MSG_FINGERPRINT_AUTHENTICATED:
|
|
||||||
handleFingerprintAuthenticated();
|
|
||||||
break;
|
|
||||||
case MSG_FINGERPRINT_HELP:
|
|
||||||
handleFingerprintHelp(msg.arg1 /* msgId */, (String) msg.obj /* errString */);
|
|
||||||
break;
|
|
||||||
case MSG_FINGERPRINT_ERROR:
|
|
||||||
handleFingerprintError(msg.arg1 /* msgId */, (String) msg.obj /* errString */);
|
|
||||||
break;
|
|
||||||
case MSG_FINGERPRINT_AUTH_FAILED:
|
|
||||||
handleFingerprintAuthFailed();
|
|
||||||
break;
|
|
||||||
case MSG_FACE_UNLOCK_STATE_CHANGED:
|
case MSG_FACE_UNLOCK_STATE_CHANGED:
|
||||||
handleFaceUnlockStateChanged(msg.arg1 != 0, msg.arg2);
|
handleFaceUnlockStateChanged(msg.arg1 != 0, msg.arg2);
|
||||||
break;
|
break;
|
||||||
@@ -253,6 +243,8 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
|
|
||||||
private static int sCurrentUser;
|
private static int sCurrentUser;
|
||||||
|
|
||||||
|
private boolean mWakeAndUnlocking;
|
||||||
|
|
||||||
public synchronized static void setCurrentUser(int currentUser) {
|
public synchronized static void setCurrentUser(int currentUser) {
|
||||||
sCurrentUser = currentUser;
|
sCurrentUser = currentUser;
|
||||||
}
|
}
|
||||||
@@ -353,23 +345,72 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onFingerprintAuthenticated(int userId) {
|
private void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) {
|
||||||
mUserFingerprintAuthenticated.put(userId, true);
|
mUserFingerprintAuthenticated.put(userId, true);
|
||||||
for (int i = 0; i < mCallbacks.size(); i++) {
|
for (int i = 0; i < mCallbacks.size(); i++) {
|
||||||
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
KeyguardUpdateMonitorCallback cb = mCallbacks.get(i).get();
|
||||||
if (cb != null) {
|
if (cb != null) {
|
||||||
cb.onFingerprintAuthenticated(userId);
|
cb.onFingerprintAuthenticated(userId, wakeAndUnlocking);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleFingerprintAuthFailed() {
|
private void handleFingerprintAuthFailed() {
|
||||||
|
releaseFingerprintWakeLock();
|
||||||
stopListeningForFingerprint();
|
stopListeningForFingerprint();
|
||||||
handleFingerprintHelp(-1, mContext.getString(R.string.fingerprint_not_recognized));
|
handleFingerprintHelp(-1, mContext.getString(R.string.fingerprint_not_recognized));
|
||||||
updateFingerprintListeningState();
|
updateFingerprintListeningState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleFingerprintAcquired(int acquireInfo) {
|
||||||
|
if (acquireInfo != FingerprintManager.FINGERPRINT_ACQUIRED_GOOD) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!mScreenOn) {
|
||||||
|
releaseFingerprintWakeLock();
|
||||||
|
mWakeLock = mPowerManager.newWakeLock(
|
||||||
|
PowerManager.PARTIAL_WAKE_LOCK, FINGERPRINT_WAKE_LOCK_NAME);
|
||||||
|
mWakeLock.acquire();
|
||||||
|
mWakeAndUnlocking = true;
|
||||||
|
if (DEBUG_FP_WAKELOCK) {
|
||||||
|
Log.i(TAG, "fingerprint acquired, grabbing fp wakelock");
|
||||||
|
}
|
||||||
|
mHandler.postDelayed(mReleaseFingerprintWakeLockRunnable,
|
||||||
|
FINGERPRINT_WAKELOCK_TIMEOUT_MS);
|
||||||
|
} else {
|
||||||
|
mWakeAndUnlocking = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private final Runnable mReleaseFingerprintWakeLockRunnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (DEBUG_FP_WAKELOCK) {
|
||||||
|
Log.i(TAG, "fp wakelock: TIMEOUT!!");
|
||||||
|
}
|
||||||
|
releaseFingerprintWakeLock();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private void releaseFingerprintWakeLock() {
|
||||||
|
if (mWakeLock != null) {
|
||||||
|
mHandler.removeCallbacks(mReleaseFingerprintWakeLockRunnable);
|
||||||
|
if (DEBUG_FP_WAKELOCK) {
|
||||||
|
Log.i(TAG, "releasing fp wakelock");
|
||||||
|
}
|
||||||
|
mWakeLock.release();
|
||||||
|
mWakeLock = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void handleFingerprintAuthenticated() {
|
private void handleFingerprintAuthenticated() {
|
||||||
|
if (mWakeAndUnlocking) {
|
||||||
|
if (DEBUG_FP_WAKELOCK) {
|
||||||
|
Log.i(TAG, "fp wakelock: Authenticated, waking up...");
|
||||||
|
}
|
||||||
|
mPowerManager.wakeUp(SystemClock.uptimeMillis());
|
||||||
|
}
|
||||||
|
releaseFingerprintWakeLock();
|
||||||
try {
|
try {
|
||||||
final int userId;
|
final int userId;
|
||||||
try {
|
try {
|
||||||
@@ -382,7 +423,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
Log.d(TAG, "Fingerprint disabled by DPM for userId: " + userId);
|
Log.d(TAG, "Fingerprint disabled by DPM for userId: " + userId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
onFingerprintAuthenticated(userId);
|
onFingerprintAuthenticated(userId, mWakeAndUnlocking);
|
||||||
} finally {
|
} finally {
|
||||||
setFingerprintRunningDetectionRunning(false);
|
setFingerprintRunningDetectionRunning(false);
|
||||||
}
|
}
|
||||||
@@ -555,26 +596,32 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticationFailed() {
|
public void onAuthenticationFailed() {
|
||||||
mHandler.obtainMessage(MSG_FINGERPRINT_AUTH_FAILED).sendToTarget();
|
handleFingerprintAuthFailed();
|
||||||
};
|
};
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticationSucceeded(AuthenticationResult result) {
|
public void onAuthenticationSucceeded(AuthenticationResult result) {
|
||||||
mHandler.obtainMessage(MSG_FINGERPRINT_AUTHENTICATED).sendToTarget();
|
handleFingerprintAuthenticated();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
|
public void onAuthenticationHelp(int helpMsgId, CharSequence helpString) {
|
||||||
mHandler.obtainMessage(MSG_FINGERPRINT_HELP, helpMsgId, 0, helpString).sendToTarget();
|
handleFingerprintHelp(helpMsgId, helpString.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAuthenticationError(int errMsgId, CharSequence errString) {
|
public void onAuthenticationError(int errMsgId, CharSequence errString) {
|
||||||
mHandler.obtainMessage(MSG_FINGERPRINT_ERROR, errMsgId, 0, errString).sendToTarget();
|
handleFingerprintError(errMsgId, errString.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAuthenticationAcquired(int acquireInfo) {
|
||||||
|
handleFingerprintAcquired(acquireInfo);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
private CancellationSignal mFingerprintCancelSignal;
|
private CancellationSignal mFingerprintCancelSignal;
|
||||||
private FingerprintManager mFpm;
|
private FingerprintManager mFpm;
|
||||||
|
private PowerManager.WakeLock mWakeLock;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When we receive a
|
* When we receive a
|
||||||
@@ -741,6 +788,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
private KeyguardUpdateMonitor(Context context) {
|
private KeyguardUpdateMonitor(Context context) {
|
||||||
mContext = context;
|
mContext = context;
|
||||||
mSubscriptionManager = SubscriptionManager.from(context);
|
mSubscriptionManager = SubscriptionManager.from(context);
|
||||||
|
mPowerManager = context.getSystemService(PowerManager.class);
|
||||||
mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
|
mDeviceProvisioned = isDeviceProvisionedInSettingsDb();
|
||||||
// Since device can't be un-provisioned, we only need to register a content observer
|
// Since device can't be un-provisioned, we only need to register a content observer
|
||||||
// to update mDeviceProvisioned when we are...
|
// to update mDeviceProvisioned when we are...
|
||||||
@@ -819,7 +867,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldListenForFingerprint() {
|
private boolean shouldListenForFingerprint() {
|
||||||
return mScreenOn && mKeyguardIsVisible && !mSwitchingUser
|
return mKeyguardIsVisible && !mSwitchingUser
|
||||||
&& mTrustManager.hasUserAuthenticatedSinceBoot(ActivityManager.getCurrentUser());
|
&& mTrustManager.hasUserAuthenticatedSinceBoot(ActivityManager.getCurrentUser());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -178,8 +178,10 @@ public class KeyguardUpdateMonitorCallback {
|
|||||||
/**
|
/**
|
||||||
* Called when a fingerprint is recognized.
|
* Called when a fingerprint is recognized.
|
||||||
* @param userId the user id for which the fingerprint was authenticated
|
* @param userId the user id for which the fingerprint was authenticated
|
||||||
|
* @param wakeAndUnlocking whether the authentication woke the device up and thus we'd like to
|
||||||
|
* dismiss the lockscreen before turning on the screen
|
||||||
*/
|
*/
|
||||||
public void onFingerprintAuthenticated(int userId) { }
|
public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) { }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when fingerprint provides help string (e.g. "Try again")
|
* Called when fingerprint provides help string (e.g. "Try again")
|
||||||
|
|||||||
@@ -25,9 +25,9 @@ import android.os.IBinder;
|
|||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
|
import com.android.internal.policy.IKeyguardDrawnCallback;
|
||||||
import com.android.internal.policy.IKeyguardExitCallback;
|
import com.android.internal.policy.IKeyguardExitCallback;
|
||||||
import com.android.internal.policy.IKeyguardService;
|
import com.android.internal.policy.IKeyguardService;
|
||||||
import com.android.internal.policy.IKeyguardShowCallback;
|
|
||||||
import com.android.internal.policy.IKeyguardStateCallback;
|
import com.android.internal.policy.IKeyguardStateCallback;
|
||||||
import com.android.systemui.SystemUIApplication;
|
import com.android.systemui.SystemUIApplication;
|
||||||
|
|
||||||
@@ -120,9 +120,15 @@ public class KeyguardService extends Service {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override // Binder interface
|
@Override // Binder interface
|
||||||
public void onStartedWakingUp(IKeyguardShowCallback callback) {
|
public void onStartedWakingUp() {
|
||||||
checkPermission();
|
checkPermission();
|
||||||
mKeyguardViewMediator.onStartedWakingUp(callback);
|
mKeyguardViewMediator.onStartedWakingUp();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override // Binder interface
|
||||||
|
public void onScreenTurningOn(IKeyguardDrawnCallback callback) {
|
||||||
|
checkPermission();
|
||||||
|
mKeyguardViewMediator.onScreenTurningOn(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override // Binder interface
|
@Override // Binder interface
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ import android.os.PowerManager;
|
|||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
|
import android.os.Trace;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.os.UserManager;
|
import android.os.UserManager;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
@@ -55,8 +56,9 @@ import android.view.WindowManagerGlobal;
|
|||||||
import android.view.WindowManagerPolicy;
|
import android.view.WindowManagerPolicy;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
|
|
||||||
|
import com.android.internal.policy.IKeyguardDrawnCallback;
|
||||||
import com.android.internal.policy.IKeyguardExitCallback;
|
import com.android.internal.policy.IKeyguardExitCallback;
|
||||||
import com.android.internal.policy.IKeyguardShowCallback;
|
|
||||||
import com.android.internal.policy.IKeyguardStateCallback;
|
import com.android.internal.policy.IKeyguardStateCallback;
|
||||||
import com.android.internal.telephony.IccCardConstants;
|
import com.android.internal.telephony.IccCardConstants;
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
@@ -77,7 +79,6 @@ import java.util.List;
|
|||||||
|
|
||||||
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
|
import static android.provider.Settings.System.SCREEN_OFF_TIMEOUT;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mediates requests related to the keyguard. This includes queries about the
|
* Mediates requests related to the keyguard. This includes queries about the
|
||||||
* state of the keyguard, power management events that effect whether the keyguard
|
* state of the keyguard, power management events that effect whether the keyguard
|
||||||
@@ -138,7 +139,7 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
private static final int RESET = 4;
|
private static final int RESET = 4;
|
||||||
private static final int VERIFY_UNLOCK = 5;
|
private static final int VERIFY_UNLOCK = 5;
|
||||||
private static final int NOTIFY_SCREEN_OFF = 6;
|
private static final int NOTIFY_SCREEN_OFF = 6;
|
||||||
private static final int NOTIFY_SCREEN_ON = 7;
|
private static final int NOTIFY_SCREEN_TURNING_ON = 7;
|
||||||
private static final int KEYGUARD_DONE = 9;
|
private static final int KEYGUARD_DONE = 9;
|
||||||
private static final int KEYGUARD_DONE_DRAWING = 10;
|
private static final int KEYGUARD_DONE_DRAWING = 10;
|
||||||
private static final int KEYGUARD_DONE_AUTHENTICATING = 11;
|
private static final int KEYGUARD_DONE_AUTHENTICATING = 11;
|
||||||
@@ -148,6 +149,7 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
private static final int START_KEYGUARD_EXIT_ANIM = 18;
|
private static final int START_KEYGUARD_EXIT_ANIM = 18;
|
||||||
private static final int ON_ACTIVITY_DRAWN = 19;
|
private static final int ON_ACTIVITY_DRAWN = 19;
|
||||||
private static final int KEYGUARD_DONE_PENDING_TIMEOUT = 20;
|
private static final int KEYGUARD_DONE_PENDING_TIMEOUT = 20;
|
||||||
|
private static final int NOTIFY_STARTED_WAKING_UP = 21;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The default amount of time we stay awake (used for all key input)
|
* The default amount of time we stay awake (used for all key input)
|
||||||
@@ -311,11 +313,14 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
private boolean mPendingReset;
|
private boolean mPendingReset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* When starting goign to sleep, we figured out that we need to lock Keyguard and this should be
|
* When starting going to sleep, we figured out that we need to lock Keyguard and this should be
|
||||||
* committed when finished going to sleep.
|
* committed when finished going to sleep.
|
||||||
*/
|
*/
|
||||||
private boolean mPendingLock;
|
private boolean mPendingLock;
|
||||||
|
|
||||||
|
private boolean mWakeAndUnlocking;
|
||||||
|
private IKeyguardDrawnCallback mDrawnCallback;
|
||||||
|
|
||||||
KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() {
|
KeyguardUpdateMonitorCallback mUpdateCallback = new KeyguardUpdateMonitorCallback() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -454,13 +459,18 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFingerprintAuthenticated(int userId) {
|
public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) {
|
||||||
if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
|
if (mStatusBarKeyguardViewManager.isBouncerShowing()) {
|
||||||
mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated();
|
mStatusBarKeyguardViewManager.notifyKeyguardAuthenticated();
|
||||||
|
} else {
|
||||||
|
if (wakeAndUnlocking) {
|
||||||
|
mWakeAndUnlocking = true;
|
||||||
|
keyguardDone(true, true);
|
||||||
} else {
|
} else {
|
||||||
mStatusBarKeyguardViewManager.animateCollapsePanels(
|
mStatusBarKeyguardViewManager.animateCollapsePanels(
|
||||||
FINGERPRINT_COLLAPSE_SPEEDUP_FACTOR);
|
FINGERPRINT_COLLAPSE_SPEEDUP_FACTOR);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
@@ -752,21 +762,23 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
/**
|
/**
|
||||||
* Let's us know when the device is waking up.
|
* Let's us know when the device is waking up.
|
||||||
*/
|
*/
|
||||||
public void onStartedWakingUp(IKeyguardShowCallback callback) {
|
public void onStartedWakingUp() {
|
||||||
|
|
||||||
// TODO: Rename all screen off/on references to interactive/sleeping
|
// TODO: Rename all screen off/on references to interactive/sleeping
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
mDeviceInteractive = true;
|
mDeviceInteractive = true;
|
||||||
cancelDoKeyguardLaterLocked();
|
cancelDoKeyguardLaterLocked();
|
||||||
if (DEBUG) Log.d(TAG, "onStartedWakingUp, seq = " + mDelayedShowingSequence);
|
if (DEBUG) Log.d(TAG, "onStartedWakingUp, seq = " + mDelayedShowingSequence);
|
||||||
if (callback != null) {
|
notifyStartedWakingUp();
|
||||||
notifyScreenOnLocked(callback);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
KeyguardUpdateMonitor.getInstance(mContext).dispatchScreenTurnedOn();
|
KeyguardUpdateMonitor.getInstance(mContext).dispatchScreenTurnedOn();
|
||||||
maybeSendUserPresentBroadcast();
|
maybeSendUserPresentBroadcast();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void onScreenTurningOn(IKeyguardDrawnCallback callback) {
|
||||||
|
notifyScreenOnLocked(callback);
|
||||||
|
}
|
||||||
|
|
||||||
private void maybeSendUserPresentBroadcast() {
|
private void maybeSendUserPresentBroadcast() {
|
||||||
if (mSystemReady && mLockPatternUtils.isLockScreenDisabled(
|
if (mSystemReady && mLockPatternUtils.isLockScreenDisabled(
|
||||||
KeyguardUpdateMonitor.getCurrentUser())) {
|
KeyguardUpdateMonitor.getCurrentUser())) {
|
||||||
@@ -1093,14 +1105,14 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
mHandler.sendEmptyMessage(NOTIFY_SCREEN_OFF);
|
mHandler.sendEmptyMessage(NOTIFY_SCREEN_OFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void notifyStartedWakingUp() {
|
||||||
* Send a message to keyguard telling it the screen just turned on.
|
if (DEBUG) Log.d(TAG, "notifyStartedWakingUp");
|
||||||
* @see #onScreenTurnedOn
|
mHandler.sendEmptyMessage(NOTIFY_STARTED_WAKING_UP);
|
||||||
* @see #handleNotifyScreenOn
|
}
|
||||||
*/
|
|
||||||
private void notifyScreenOnLocked(IKeyguardShowCallback result) {
|
private void notifyScreenOnLocked(IKeyguardDrawnCallback callback) {
|
||||||
if (DEBUG) Log.d(TAG, "notifyScreenOnLocked");
|
if (DEBUG) Log.d(TAG, "notifyScreenOnLocked");
|
||||||
Message msg = mHandler.obtainMessage(NOTIFY_SCREEN_ON, result);
|
Message msg = mHandler.obtainMessage(NOTIFY_SCREEN_TURNING_ON, callback);
|
||||||
mHandler.sendMessage(msg);
|
mHandler.sendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1190,8 +1202,11 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
case NOTIFY_SCREEN_OFF:
|
case NOTIFY_SCREEN_OFF:
|
||||||
handleNotifyScreenOff();
|
handleNotifyScreenOff();
|
||||||
break;
|
break;
|
||||||
case NOTIFY_SCREEN_ON:
|
case NOTIFY_SCREEN_TURNING_ON:
|
||||||
handleNotifyScreenOn((IKeyguardShowCallback) msg.obj);
|
handleNotifyScreenTurningOn((IKeyguardDrawnCallback) msg.obj);
|
||||||
|
break;
|
||||||
|
case NOTIFY_STARTED_WAKING_UP:
|
||||||
|
handleNotifyStartedWakingUp();
|
||||||
break;
|
break;
|
||||||
case KEYGUARD_DONE:
|
case KEYGUARD_DONE:
|
||||||
handleKeyguardDone(msg.arg1 != 0, msg.arg2 != 0);
|
handleKeyguardDone(msg.arg1 != 0, msg.arg2 != 0);
|
||||||
@@ -1354,6 +1369,7 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
setShowingLocked(true);
|
setShowingLocked(true);
|
||||||
mStatusBarKeyguardViewManager.show(options);
|
mStatusBarKeyguardViewManager.show(options);
|
||||||
mHiding = false;
|
mHiding = false;
|
||||||
|
mWakeAndUnlocking = false;
|
||||||
resetKeyguardDonePendingLocked();
|
resetKeyguardDonePendingLocked();
|
||||||
mHideAnimationRun = false;
|
mHideAnimationRun = false;
|
||||||
updateActivityLockScreenState();
|
updateActivityLockScreenState();
|
||||||
@@ -1375,7 +1391,8 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
// manager until it tells us it's safe to do so with
|
// manager until it tells us it's safe to do so with
|
||||||
// startKeyguardExitAnimation.
|
// startKeyguardExitAnimation.
|
||||||
ActivityManagerNative.getDefault().keyguardGoingAway(
|
ActivityManagerNative.getDefault().keyguardGoingAway(
|
||||||
mStatusBarKeyguardViewManager.shouldDisableWindowAnimationsForUnlock(),
|
mStatusBarKeyguardViewManager.shouldDisableWindowAnimationsForUnlock()
|
||||||
|
|| mWakeAndUnlocking,
|
||||||
mStatusBarKeyguardViewManager.isGoingToNotificationShade());
|
mStatusBarKeyguardViewManager.isGoingToNotificationShade());
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Log.e(TAG, "Error while calling WindowManager", e);
|
Log.e(TAG, "Error while calling WindowManager", e);
|
||||||
@@ -1437,6 +1454,9 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
updateActivityLockScreenState();
|
updateActivityLockScreenState();
|
||||||
adjustStatusBarLocked();
|
adjustStatusBarLocked();
|
||||||
sendUserPresentBroadcast();
|
sendUserPresentBroadcast();
|
||||||
|
if (mWakeAndUnlocking && mDrawnCallback != null) {
|
||||||
|
notifyDrawn(mDrawnCallback);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1508,14 +1528,31 @@ public class KeyguardViewMediator extends SystemUI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
private void handleNotifyStartedWakingUp() {
|
||||||
* Handle message sent by {@link #notifyScreenOnLocked}
|
|
||||||
* @see #NOTIFY_SCREEN_ON
|
|
||||||
*/
|
|
||||||
private void handleNotifyScreenOn(IKeyguardShowCallback callback) {
|
|
||||||
synchronized (KeyguardViewMediator.this) {
|
synchronized (KeyguardViewMediator.this) {
|
||||||
if (DEBUG) Log.d(TAG, "handleNotifyScreenOn");
|
if (DEBUG) Log.d(TAG, "handleNotifyWakingUp");
|
||||||
mStatusBarKeyguardViewManager.onScreenTurnedOn(callback);
|
mStatusBarKeyguardViewManager.onScreenTurnedOn();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleNotifyScreenTurningOn(IKeyguardDrawnCallback callback) {
|
||||||
|
synchronized (KeyguardViewMediator.this) {
|
||||||
|
if (DEBUG) Log.d(TAG, "handleNotifyScreenTurningOn");
|
||||||
|
if (callback != null) {
|
||||||
|
if (mWakeAndUnlocking) {
|
||||||
|
mDrawnCallback = callback;
|
||||||
|
} else {
|
||||||
|
notifyDrawn(callback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void notifyDrawn(final IKeyguardDrawnCallback callback) {
|
||||||
|
try {
|
||||||
|
callback.onDrawn();
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.w(TAG, "Exception calling onDrawn():", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -641,7 +641,7 @@ public class KeyguardBottomAreaView extends FrameLayout implements View.OnClickL
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFingerprintAuthenticated(int userId) {
|
public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1730,7 +1730,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private int adjustDisableFlags(int state) {
|
private int adjustDisableFlags(int state) {
|
||||||
if (!mLaunchTransitionFadingAway
|
if (!mLaunchTransitionFadingAway && !mKeyguardFadingAway
|
||||||
&& (mExpandedVisible || mBouncerShowing || mWaitingForKeyguardExit)) {
|
&& (mExpandedVisible || mBouncerShowing || mWaitingForKeyguardExit)) {
|
||||||
state |= StatusBarManager.DISABLE_NOTIFICATION_ICONS;
|
state |= StatusBarManager.DISABLE_NOTIFICATION_ICONS;
|
||||||
state |= StatusBarManager.DISABLE_SYSTEM_INFO;
|
state |= StatusBarManager.DISABLE_SYSTEM_INFO;
|
||||||
@@ -3460,7 +3460,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
|
|||||||
startTime + fadeoutDuration
|
startTime + fadeoutDuration
|
||||||
- StatusBarIconController.DEFAULT_TINT_ANIMATION_DURATION,
|
- StatusBarIconController.DEFAULT_TINT_ANIMATION_DURATION,
|
||||||
StatusBarIconController.DEFAULT_TINT_ANIMATION_DURATION);
|
StatusBarIconController.DEFAULT_TINT_ANIMATION_DURATION);
|
||||||
disable(mDisabledUnmodified1, mDisabledUnmodified2, true /* animate */);
|
disable(mDisabledUnmodified1, mDisabledUnmodified2, fadeoutDuration > 0 /* animate */);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isKeyguardFadingAway() {
|
public boolean isKeyguardFadingAway() {
|
||||||
|
|||||||
@@ -19,15 +19,12 @@ package com.android.systemui.statusbar.phone;
|
|||||||
import android.content.ComponentCallbacks2;
|
import android.content.ComponentCallbacks2;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.util.Slog;
|
|
||||||
import android.view.KeyEvent;
|
import android.view.KeyEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.view.WindowManagerGlobal;
|
import android.view.WindowManagerGlobal;
|
||||||
|
|
||||||
import com.android.internal.policy.IKeyguardShowCallback;
|
|
||||||
import com.android.internal.widget.LockPatternUtils;
|
import com.android.internal.widget.LockPatternUtils;
|
||||||
import com.android.keyguard.KeyguardUpdateMonitor;
|
import com.android.keyguard.KeyguardUpdateMonitor;
|
||||||
import com.android.keyguard.ViewMediatorCallback;
|
import com.android.keyguard.ViewMediatorCallback;
|
||||||
@@ -163,26 +160,10 @@ public class StatusBarKeyguardViewManager {
|
|||||||
mBouncer.onScreenTurnedOff();
|
mBouncer.onScreenTurnedOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onScreenTurnedOn(final IKeyguardShowCallback callback) {
|
public void onScreenTurnedOn() {
|
||||||
mScreenOn = true;
|
mScreenOn = true;
|
||||||
mScreenWillWakeUp = false;
|
mScreenWillWakeUp = false;
|
||||||
mPhoneStatusBar.onScreenTurnedOn();
|
mPhoneStatusBar.onScreenTurnedOn();
|
||||||
if (callback != null) {
|
|
||||||
callbackAfterDraw(callback);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void callbackAfterDraw(final IKeyguardShowCallback callback) {
|
|
||||||
mContainer.post(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
callback.onShown(mContainer.getWindowToken());
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
Slog.w(TAG, "Exception calling onShown():", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void notifyScreenWakeUpRequested() {
|
public void notifyScreenWakeUpRequested() {
|
||||||
@@ -270,6 +251,11 @@ public class StatusBarKeyguardViewManager {
|
|||||||
mPhoneStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration);
|
mPhoneStatusBar.setKeyguardFadingAway(startTime, delay, fadeoutDuration);
|
||||||
boolean staying = mPhoneStatusBar.hideKeyguard();
|
boolean staying = mPhoneStatusBar.hideKeyguard();
|
||||||
if (!staying) {
|
if (!staying) {
|
||||||
|
if (fadeoutDuration == 0) {
|
||||||
|
mPhoneStatusBar.finishKeyguardFadingAway();
|
||||||
|
WindowManagerGlobal.getInstance().trimMemory(
|
||||||
|
ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN);
|
||||||
|
} else {
|
||||||
mStatusBarWindowManager.setKeyguardFadingAway(true);
|
mStatusBarWindowManager.setKeyguardFadingAway(true);
|
||||||
mScrimController.animateKeyguardFadingOut(delay, fadeoutDuration, new Runnable() {
|
mScrimController.animateKeyguardFadingOut(delay, fadeoutDuration, new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
@@ -280,6 +266,7 @@ public class StatusBarKeyguardViewManager {
|
|||||||
ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN);
|
ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mScrimController.animateGoingToFullShade(delay, fadeoutDuration);
|
mScrimController.animateGoingToFullShade(delay, fadeoutDuration);
|
||||||
mPhoneStatusBar.finishKeyguardFadingAway();
|
mPhoneStatusBar.finishKeyguardFadingAway();
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ public class UnlockMethodCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFingerprintAuthenticated(int userId) {
|
public void onFingerprintAuthenticated(int userId, boolean wakeAndUnlocking) {
|
||||||
update(false /* updateAlways */);
|
update(false /* updateAlways */);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
|
|||||||
private static final int MSG_USER_SWITCHING = 10;
|
private static final int MSG_USER_SWITCHING = 10;
|
||||||
private static final int ENROLLMENT_TIMEOUT_MS = 60 * 1000; // 1 minute
|
private static final int ENROLLMENT_TIMEOUT_MS = 60 * 1000; // 1 minute
|
||||||
|
|
||||||
private boolean mIsKeyguard; // true if the authentication client is keyguard
|
|
||||||
private ClientMonitor mAuthClient = null;
|
private ClientMonitor mAuthClient = null;
|
||||||
private ClientMonitor mEnrollClient = null;
|
private ClientMonitor mEnrollClient = null;
|
||||||
private ClientMonitor mRemoveClient = null;
|
private ClientMonitor mRemoveClient = null;
|
||||||
@@ -577,12 +576,6 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
|
|||||||
result |= true; // we have a valid fingerprint
|
result |= true; // we have a valid fingerprint
|
||||||
mLockoutReset.run();
|
mLockoutReset.run();
|
||||||
}
|
}
|
||||||
// For fingerprint devices that support touch-to-wake, this will ensure the device
|
|
||||||
// wakes up and turns the screen on when fingerprint is authenticated.
|
|
||||||
if (mIsKeyguard && authenticated) {
|
|
||||||
mPowerManager.wakeUp(SystemClock.uptimeMillis(),
|
|
||||||
"android.server.fingerprint:AUTH");
|
|
||||||
}
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,7 +720,6 @@ public class FingerprintService extends SystemService implements IBinder.DeathRe
|
|||||||
mHandler.post(new Runnable() {
|
mHandler.post(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
mIsKeyguard = KEYGUARD_PACKAGE.equals(opPackageName);
|
|
||||||
startAuthentication(token, opId, groupId, receiver, flags, restricted);
|
startAuthentication(token, opId, groupId, receiver, flags, restricted);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ import com.android.internal.util.ScreenShapeHelper;
|
|||||||
import com.android.internal.widget.PointerLocationView;
|
import com.android.internal.widget.PointerLocationView;
|
||||||
import com.android.server.LocalServices;
|
import com.android.server.LocalServices;
|
||||||
import com.android.server.policy.keyguard.KeyguardServiceDelegate;
|
import com.android.server.policy.keyguard.KeyguardServiceDelegate;
|
||||||
import com.android.server.policy.keyguard.KeyguardServiceDelegate.ShowListener;
|
import com.android.server.policy.keyguard.KeyguardServiceDelegate.DrawnListener;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
@@ -323,10 +323,10 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
mHandler.sendEmptyMessage(MSG_WINDOW_MANAGER_DRAWN_COMPLETE);
|
mHandler.sendEmptyMessage(MSG_WINDOW_MANAGER_DRAWN_COMPLETE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
final ShowListener mKeyguardDelegateCallback = new ShowListener() {
|
final DrawnListener mKeyguardDrawnCallback = new DrawnListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onShown(IBinder windowToken) {
|
public void onDrawn() {
|
||||||
if (DEBUG_WAKEUP) Slog.d(TAG, "mKeyguardDelegate.ShowListener.onShown.");
|
if (DEBUG_WAKEUP) Slog.d(TAG, "mKeyguardDelegate.ShowListener.onDrawn.");
|
||||||
mHandler.sendEmptyMessage(MSG_KEYGUARD_DRAWN_COMPLETE);
|
mHandler.sendEmptyMessage(MSG_KEYGUARD_DRAWN_COMPLETE);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -5496,11 +5496,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (mKeyguardDelegate != null) {
|
if (mKeyguardDelegate != null) {
|
||||||
mKeyguardDelegate.onStartedWakingUp(mKeyguardDelegateCallback);
|
mKeyguardDelegate.onStartedWakingUp();
|
||||||
// ... eventually calls finishKeyguardDrawn
|
|
||||||
} else {
|
|
||||||
if (DEBUG_WAKEUP) Slog.d(TAG, "null mKeyguardDelegate: setting mKeyguardDrawComplete.");
|
|
||||||
finishKeyguardDrawn();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5539,9 +5535,13 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
if (mKeyguardDelegate != null) {
|
if (mKeyguardDelegate != null) {
|
||||||
mHandler.removeMessages(MSG_KEYGUARD_DRAWN_TIMEOUT);
|
mHandler.removeMessages(MSG_KEYGUARD_DRAWN_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
mWindowManagerDrawComplete = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
finishScreenTurningOn();
|
// ... eventually calls finishWindowsDrawn which will finalize our screen turn on
|
||||||
|
// as well as enabling the orientation change logic/sensor.
|
||||||
|
mWindowManagerInternal.waitForAllWindowsDrawn(mWindowManagerDrawCallback,
|
||||||
|
WAITING_FOR_DRAWN_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called on the DisplayManager's DisplayPowerController thread.
|
// Called on the DisplayManager's DisplayPowerController thread.
|
||||||
@@ -5570,12 +5570,15 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
|||||||
mScreenOnFully = false;
|
mScreenOnFully = false;
|
||||||
mWindowManagerDrawComplete = false;
|
mWindowManagerDrawComplete = false;
|
||||||
mScreenOnListener = screenOnListener;
|
mScreenOnListener = screenOnListener;
|
||||||
}
|
|
||||||
|
|
||||||
mWindowManagerInternal.waitForAllWindowsDrawn(mWindowManagerDrawCallback,
|
if (mKeyguardDelegate != null) {
|
||||||
WAITING_FOR_DRAWN_TIMEOUT);
|
mKeyguardDelegate.onScreenTurningOn(mKeyguardDrawnCallback);
|
||||||
// ... eventually calls finishWindowsDrawn which will finalize our screen turn on
|
} else {
|
||||||
// as well as enabling the orientation change logic/sensor.
|
if (DEBUG_WAKEUP) Slog.d(TAG,
|
||||||
|
"null mKeyguardDelegate: setting mKeyguardDrawComplete.");
|
||||||
|
finishKeyguardDrawn();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finishWindowsDrawn() {
|
private void finishWindowsDrawn() {
|
||||||
|
|||||||
@@ -18,9 +18,9 @@ import android.view.ViewGroup;
|
|||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import android.view.WindowManagerPolicy.OnKeyguardExitResult;
|
import android.view.WindowManagerPolicy.OnKeyguardExitResult;
|
||||||
|
|
||||||
|
import com.android.internal.policy.IKeyguardDrawnCallback;
|
||||||
import com.android.internal.policy.IKeyguardExitCallback;
|
import com.android.internal.policy.IKeyguardExitCallback;
|
||||||
import com.android.internal.policy.IKeyguardService;
|
import com.android.internal.policy.IKeyguardService;
|
||||||
import com.android.internal.policy.IKeyguardShowCallback;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A local class that keeps a cache of keyguard state that can be restored in the event
|
* A local class that keeps a cache of keyguard state that can be restored in the event
|
||||||
@@ -35,7 +35,7 @@ public class KeyguardServiceDelegate {
|
|||||||
private final Context mContext;
|
private final Context mContext;
|
||||||
private final View mScrim; // shown if keyguard crashes
|
private final View mScrim; // shown if keyguard crashes
|
||||||
private final KeyguardState mKeyguardState = new KeyguardState();
|
private final KeyguardState mKeyguardState = new KeyguardState();
|
||||||
private ShowListener mShowListenerWhenConnect;
|
private DrawnListener mDrawnListenerWhenConnect;
|
||||||
|
|
||||||
private static final class KeyguardState {
|
private static final class KeyguardState {
|
||||||
KeyguardState() {
|
KeyguardState() {
|
||||||
@@ -61,23 +61,23 @@ public class KeyguardServiceDelegate {
|
|||||||
public boolean bootCompleted;
|
public boolean bootCompleted;
|
||||||
};
|
};
|
||||||
|
|
||||||
public interface ShowListener {
|
public interface DrawnListener {
|
||||||
public void onShown(IBinder windowToken);
|
void onDrawn();
|
||||||
}
|
}
|
||||||
|
|
||||||
// A delegate class to map a particular invocation with a ShowListener object.
|
// A delegate class to map a particular invocation with a ShowListener object.
|
||||||
private final class KeyguardShowDelegate extends IKeyguardShowCallback.Stub {
|
private final class KeyguardShowDelegate extends IKeyguardDrawnCallback.Stub {
|
||||||
private ShowListener mShowListener;
|
private DrawnListener mDrawnListener;
|
||||||
|
|
||||||
KeyguardShowDelegate(ShowListener showListener) {
|
KeyguardShowDelegate(DrawnListener drawnListener) {
|
||||||
mShowListener = showListener;
|
mDrawnListener = drawnListener;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onShown(IBinder windowToken) throws RemoteException {
|
public void onDrawn() throws RemoteException {
|
||||||
if (DEBUG) Log.v(TAG, "**** SHOWN CALLED ****");
|
if (DEBUG) Log.v(TAG, "**** SHOWN CALLED ****");
|
||||||
if (mShowListener != null) {
|
if (mDrawnListener != null) {
|
||||||
mShowListener.onShown(windowToken);
|
mDrawnListener.onDrawn();
|
||||||
}
|
}
|
||||||
hideScrim();
|
hideScrim();
|
||||||
}
|
}
|
||||||
@@ -141,9 +141,10 @@ public class KeyguardServiceDelegate {
|
|||||||
// If the system is ready, it means keyguard crashed and restarted.
|
// If the system is ready, it means keyguard crashed and restarted.
|
||||||
mKeyguardService.onSystemReady();
|
mKeyguardService.onSystemReady();
|
||||||
// This is used to hide the scrim once keyguard displays.
|
// This is used to hide the scrim once keyguard displays.
|
||||||
mKeyguardService.onStartedWakingUp(new KeyguardShowDelegate(
|
mKeyguardService.onStartedWakingUp();
|
||||||
mShowListenerWhenConnect));
|
mKeyguardService.onScreenTurningOn(
|
||||||
mShowListenerWhenConnect = null;
|
new KeyguardShowDelegate(mDrawnListenerWhenConnect));
|
||||||
|
mDrawnListenerWhenConnect = null;
|
||||||
}
|
}
|
||||||
if (mKeyguardState.bootCompleted) {
|
if (mKeyguardState.bootCompleted) {
|
||||||
mKeyguardService.onBootCompleted();
|
mKeyguardService.onBootCompleted();
|
||||||
@@ -221,16 +222,23 @@ public class KeyguardServiceDelegate {
|
|||||||
mKeyguardState.dreaming = false;
|
mKeyguardState.dreaming = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onStartedWakingUp(final ShowListener showListener) {
|
public void onStartedWakingUp() {
|
||||||
if (mKeyguardService != null) {
|
if (mKeyguardService != null) {
|
||||||
if (DEBUG) Log.v(TAG, "onScreenTurnedOn(showListener = " + showListener + ")");
|
if (DEBUG) Log.v(TAG, "onStartedWakingUp()");
|
||||||
mKeyguardService.onStartedWakingUp(new KeyguardShowDelegate(showListener));
|
mKeyguardService.onStartedWakingUp();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onScreenTurningOn(final DrawnListener drawnListener) {
|
||||||
|
if (mKeyguardService != null) {
|
||||||
|
if (DEBUG) Log.v(TAG, "onScreenTurnedOn(showListener = " + drawnListener + ")");
|
||||||
|
mKeyguardService.onScreenTurningOn(new KeyguardShowDelegate(drawnListener));
|
||||||
} else {
|
} else {
|
||||||
// try again when we establish a connection
|
// try again when we establish a connection
|
||||||
Slog.w(TAG, "onScreenTurnedOn(): no keyguard service!");
|
Slog.w(TAG, "onScreenTurningOn(): no keyguard service!");
|
||||||
// This shouldn't happen, but if it does, show the scrim immediately and
|
// This shouldn't happen, but if it does, show the scrim immediately and
|
||||||
// invoke the listener's callback after the service actually connects.
|
// invoke the listener's callback after the service actually connects.
|
||||||
mShowListenerWhenConnect = showListener;
|
mDrawnListenerWhenConnect = drawnListener;
|
||||||
showScrim();
|
showScrim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,9 +22,9 @@ import android.os.IBinder;
|
|||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.util.Slog;
|
import android.util.Slog;
|
||||||
|
|
||||||
|
import com.android.internal.policy.IKeyguardDrawnCallback;
|
||||||
import com.android.internal.policy.IKeyguardExitCallback;
|
import com.android.internal.policy.IKeyguardExitCallback;
|
||||||
import com.android.internal.policy.IKeyguardService;
|
import com.android.internal.policy.IKeyguardService;
|
||||||
import com.android.internal.policy.IKeyguardShowCallback;
|
|
||||||
import com.android.internal.policy.IKeyguardStateCallback;
|
import com.android.internal.policy.IKeyguardStateCallback;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,9 +124,18 @@ public class KeyguardServiceWrapper implements IKeyguardService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStartedWakingUp(IKeyguardShowCallback callback) {
|
public void onStartedWakingUp() {
|
||||||
try {
|
try {
|
||||||
mService.onStartedWakingUp(callback);
|
mService.onStartedWakingUp();
|
||||||
|
} catch (RemoteException e) {
|
||||||
|
Slog.w(TAG , "Remote Exception", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onScreenTurningOn(IKeyguardDrawnCallback callback) {
|
||||||
|
try {
|
||||||
|
mService.onScreenTurningOn(callback);
|
||||||
} catch (RemoteException e) {
|
} catch (RemoteException e) {
|
||||||
Slog.w(TAG , "Remote Exception", e);
|
Slog.w(TAG , "Remote Exception", e);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user