am 04217efb: Merge "Fix 5514230: preventing null window token from occurring" into ics-mr0
* commit '04217efb8eaebdbd846671a2f743fa3e960b5dde': Fix 5514230: preventing null window token from occurring
This commit is contained in:
@@ -360,8 +360,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
mHasOverlay = true;
|
mHasOverlay = true;
|
||||||
|
|
||||||
// Continue showing FaceLock area until dialer comes up or call is resumed
|
// Continue showing FaceLock area until dialer comes up or call is resumed
|
||||||
if (mLockPatternUtils.usingBiometricWeak() &&
|
if (usingFaceLock() && mFaceLockServiceRunning) {
|
||||||
mLockPatternUtils.isBiometricWeakInstalled() && mFaceLockServiceRunning) {
|
|
||||||
showFaceLockAreaWithTimeout(FACELOCK_VIEW_AREA_EMERGENCY_DIALER_TIMEOUT);
|
showFaceLockAreaWithTimeout(FACELOCK_VIEW_AREA_EMERGENCY_DIALER_TIMEOUT);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -582,8 +581,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
bindToFaceLock();
|
bindToFaceLock();
|
||||||
// Show FaceLock area, but only for a little bit so lockpattern will become visible if
|
// Show FaceLock area, but only for a little bit so lockpattern will become visible if
|
||||||
// FaceLock fails to start or crashes
|
// FaceLock fails to start or crashes
|
||||||
if (mLockPatternUtils.usingBiometricWeak() &&
|
if (usingFaceLock()) {
|
||||||
mLockPatternUtils.isBiometricWeakInstalled()) {
|
|
||||||
showFaceLockAreaWithTimeout(FACELOCK_VIEW_AREA_SERVICE_TIMEOUT);
|
showFaceLockAreaWithTimeout(FACELOCK_VIEW_AREA_SERVICE_TIMEOUT);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -653,11 +651,10 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
((KeyguardScreen) mUnlockScreen).onResume();
|
((KeyguardScreen) mUnlockScreen).onResume();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mLockPatternUtils.usingBiometricWeak() &&
|
if (usingFaceLock() && !mHasOverlay) {
|
||||||
mLockPatternUtils.isBiometricWeakInstalled() && !mHasOverlay) {
|
|
||||||
// Note that show() gets called before the screen turns off to set it up for next time
|
// Note that show() gets called before the screen turns off to set it up for next time
|
||||||
// it is turned on. We don't want to set a timeout on the FaceLock area here because it
|
// it is turned on. We don't want to set a timeout on the FaceLock area here because it
|
||||||
// may be gone by the time the screen is turned on again. We set the timout when the
|
// may be gone by the time the screen is turned on again. We set the timeout when the
|
||||||
// screen turns on instead.
|
// screen turns on instead.
|
||||||
showFaceLockArea();
|
showFaceLockArea();
|
||||||
} else {
|
} else {
|
||||||
@@ -854,7 +851,9 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
if (mode == Mode.UnlockScreen) {
|
if (mode == Mode.UnlockScreen) {
|
||||||
final UnlockMode unlockMode = getUnlockMode();
|
final UnlockMode unlockMode = getUnlockMode();
|
||||||
if (force || mUnlockScreen == null || unlockMode != mUnlockScreenMode) {
|
if (force || mUnlockScreen == null || unlockMode != mUnlockScreenMode) {
|
||||||
|
boolean restartFaceLock = stopFaceLockIfRunning();
|
||||||
recreateUnlockScreen(unlockMode);
|
recreateUnlockScreen(unlockMode);
|
||||||
|
if (restartFaceLock) activateFaceLockIfAble();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1147,28 +1146,33 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
|
|
||||||
// Everything below pertains to FaceLock - might want to separate this out
|
// Everything below pertains to FaceLock - might want to separate this out
|
||||||
|
|
||||||
// Take care of FaceLock area when layout is created
|
// Indicates whether FaceLock is in use
|
||||||
|
private boolean usingFaceLock() {
|
||||||
|
return (mLockPatternUtils.usingBiometricWeak() &&
|
||||||
|
mLockPatternUtils.isBiometricWeakInstalled());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Takes care of FaceLock area when layout is created
|
||||||
private void initializeFaceLockAreaView(View view) {
|
private void initializeFaceLockAreaView(View view) {
|
||||||
if (mLockPatternUtils.usingBiometricWeak() &&
|
if (usingFaceLock()) {
|
||||||
mLockPatternUtils.isBiometricWeakInstalled()) {
|
|
||||||
mFaceLockAreaView = view.findViewById(R.id.faceLockAreaView);
|
mFaceLockAreaView = view.findViewById(R.id.faceLockAreaView);
|
||||||
if (mFaceLockAreaView == null) {
|
if (mFaceLockAreaView == null) {
|
||||||
Log.e(TAG, "Layout does not have faceLockAreaView and FaceLock is enabled");
|
Log.e(TAG, "Layout does not have faceLockAreaView and FaceLock is enabled");
|
||||||
} else {
|
|
||||||
if (mBoundToFaceLockService) {
|
|
||||||
// If we are creating a layout when we are already bound to FaceLock, then we
|
|
||||||
// are undergoing an orientation change. Stop FaceLock and restart it in the
|
|
||||||
// new location.
|
|
||||||
if (DEBUG) Log.d(TAG, "Restarting FL - creating view while already bound");
|
|
||||||
stopAndUnbindFromFaceLock();
|
|
||||||
activateFaceLockIfAble();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mFaceLockAreaView = null; // Set to null if not using FaceLock
|
mFaceLockAreaView = null; // Set to null if not using FaceLock
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stops FaceLock if it is running and reports back whether it was running or not
|
||||||
|
private boolean stopFaceLockIfRunning() {
|
||||||
|
if (usingFaceLock() && mBoundToFaceLockService) {
|
||||||
|
stopAndUnbindFromFaceLock();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Handles covering or exposing FaceLock area on the client side when FaceLock starts or stops
|
// Handles covering or exposing FaceLock area on the client side when FaceLock starts or stops
|
||||||
// This needs to be done in a handler because the call could be coming from a callback from the
|
// This needs to be done in a handler because the call could be coming from a callback from the
|
||||||
// FaceLock service that is in a thread that can't modify the UI
|
// FaceLock service that is in a thread that can't modify the UI
|
||||||
@@ -1221,8 +1225,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
// Binds to FaceLock service. This call does not tell it to start, but it causes the service
|
// Binds to FaceLock service. This call does not tell it to start, but it causes the service
|
||||||
// to call the onServiceConnected callback, which then starts FaceLock.
|
// to call the onServiceConnected callback, which then starts FaceLock.
|
||||||
public void bindToFaceLock() {
|
public void bindToFaceLock() {
|
||||||
if (mLockPatternUtils.usingBiometricWeak() &&
|
if (usingFaceLock()) {
|
||||||
mLockPatternUtils.isBiometricWeakInstalled()) {
|
|
||||||
if (!mBoundToFaceLockService) {
|
if (!mBoundToFaceLockService) {
|
||||||
if (DEBUG) Log.d(TAG, "before bind to FaceLock service");
|
if (DEBUG) Log.d(TAG, "before bind to FaceLock service");
|
||||||
mContext.bindService(new Intent(IFaceLockInterface.class.getName()),
|
mContext.bindService(new Intent(IFaceLockInterface.class.getName()),
|
||||||
@@ -1238,8 +1241,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
|
|
||||||
// Tells FaceLock to stop and then unbinds from the FaceLock service
|
// Tells FaceLock to stop and then unbinds from the FaceLock service
|
||||||
public void stopAndUnbindFromFaceLock() {
|
public void stopAndUnbindFromFaceLock() {
|
||||||
if (mLockPatternUtils.usingBiometricWeak() &&
|
if (usingFaceLock()) {
|
||||||
mLockPatternUtils.isBiometricWeakInstalled()) {
|
|
||||||
stopFaceLock();
|
stopFaceLock();
|
||||||
|
|
||||||
if (mBoundToFaceLockService) {
|
if (mBoundToFaceLockService) {
|
||||||
@@ -1300,8 +1302,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
// Tells the FaceLock service to start displaying its UI and perform recognition
|
// Tells the FaceLock service to start displaying its UI and perform recognition
|
||||||
public void startFaceLock(IBinder windowToken, int x, int y, int h, int w)
|
public void startFaceLock(IBinder windowToken, int x, int y, int h, int w)
|
||||||
{
|
{
|
||||||
if (mLockPatternUtils.usingBiometricWeak() &&
|
if (usingFaceLock()) {
|
||||||
mLockPatternUtils.isBiometricWeakInstalled()) {
|
|
||||||
synchronized (mFaceLockServiceRunningLock) {
|
synchronized (mFaceLockServiceRunningLock) {
|
||||||
if (!mFaceLockServiceRunning) {
|
if (!mFaceLockServiceRunning) {
|
||||||
if (DEBUG) Log.d(TAG, "Starting FaceLock");
|
if (DEBUG) Log.d(TAG, "Starting FaceLock");
|
||||||
@@ -1322,8 +1323,7 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler
|
|||||||
// Tells the FaceLock service to stop displaying its UI and stop recognition
|
// Tells the FaceLock service to stop displaying its UI and stop recognition
|
||||||
public void stopFaceLock()
|
public void stopFaceLock()
|
||||||
{
|
{
|
||||||
if (mLockPatternUtils.usingBiometricWeak() &&
|
if (usingFaceLock()) {
|
||||||
mLockPatternUtils.isBiometricWeakInstalled()) {
|
|
||||||
// Note that attempting to stop FaceLock when it's not running is not an issue.
|
// Note that attempting to stop FaceLock when it's not running is not an issue.
|
||||||
// FaceLock can return, which stops it and then we try to stop it when the
|
// FaceLock can return, which stops it and then we try to stop it when the
|
||||||
// screen is turned off. That's why we check.
|
// screen is turned off. That's why we check.
|
||||||
|
|||||||
Reference in New Issue
Block a user