am 363b6052: Merge "changed pokeWakelock() callback to take time in milliseconds" into jb-dev
* commit '363b60527ce82b0f56434e70a8124e4d41e2b1e0': changed pokeWakelock() callback to take time in milliseconds
This commit is contained in:
@@ -23,5 +23,5 @@ oneway interface IFaceLockCallback {
|
|||||||
void cancel();
|
void cancel();
|
||||||
void reportFailedAttempt();
|
void reportFailedAttempt();
|
||||||
void exposeFallback();
|
void exposeFallback();
|
||||||
void pokeWakelock();
|
void pokeWakelock(int millis);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -170,11 +170,6 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
|
|||||||
Log.w(TAG, "Attempt to bind to Face Unlock when already bound");
|
Log.w(TAG, "Attempt to bind to Face Unlock when already bound");
|
||||||
}
|
}
|
||||||
|
|
||||||
// When switching between portrait and landscape view while Face Unlock is running, the
|
|
||||||
// screen will eventually go dark unless we poke the wakelock when Face Unlock is
|
|
||||||
// restarted
|
|
||||||
mKeyguardScreenCallback.pokeWakelock();
|
|
||||||
|
|
||||||
mIsRunning = true;
|
mIsRunning = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -268,7 +263,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
|
|||||||
handleExposeFallback();
|
handleExposeFallback();
|
||||||
break;
|
break;
|
||||||
case MSG_POKE_WAKELOCK:
|
case MSG_POKE_WAKELOCK:
|
||||||
handlePokeWakelock();
|
handlePokeWakelock(msg.arg1);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Log.e(TAG, "Unhandled message");
|
Log.e(TAG, "Unhandled message");
|
||||||
@@ -320,6 +315,11 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
|
|||||||
if (mFaceUnlockView != null) {
|
if (mFaceUnlockView != null) {
|
||||||
IBinder windowToken = mFaceUnlockView.getWindowToken();
|
IBinder windowToken = mFaceUnlockView.getWindowToken();
|
||||||
if (windowToken != null) {
|
if (windowToken != null) {
|
||||||
|
// When switching between portrait and landscape view while Face Unlock is running,
|
||||||
|
// the screen will eventually go dark unless we poke the wakelock when Face Unlock
|
||||||
|
// is restarted.
|
||||||
|
mKeyguardScreenCallback.pokeWakelock();
|
||||||
|
|
||||||
int[] position;
|
int[] position;
|
||||||
position = new int[2];
|
position = new int[2];
|
||||||
mFaceUnlockView.getLocationInWindow(position);
|
mFaceUnlockView.getLocationInWindow(position);
|
||||||
@@ -366,7 +366,7 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Stops the Face Unlock service and exposes the backup lock. Called when the user presses the
|
* Stops the Face Unlock service and exposes the backup lock. Called when the user presses the
|
||||||
* cancel button to skip Face Unlock or no face is detected.
|
* cancel button to skip Face Unlock, no face is detected or there is an error.
|
||||||
*/
|
*/
|
||||||
void handleCancel() {
|
void handleCancel() {
|
||||||
if (DEBUG) Log.d(TAG, "handleCancel()");
|
if (DEBUG) Log.d(TAG, "handleCancel()");
|
||||||
@@ -410,10 +410,10 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pokes the wakelock to keep the screen alive and active.
|
* Pokes the wakelock to keep the screen alive and active for a specific amount of time.
|
||||||
*/
|
*/
|
||||||
void handlePokeWakelock() {
|
void handlePokeWakelock(int millis) {
|
||||||
mKeyguardScreenCallback.pokeWakelock();
|
mKeyguardScreenCallback.pokeWakelock(millis);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -511,7 +511,8 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when the user presses cancel to skip Face Unlock or a face cannot be found.
|
* Called when the user presses cancel to skip Face Unlock, a face cannot be found or
|
||||||
|
* there is an error.
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void cancel() {
|
public void cancel() {
|
||||||
@@ -540,12 +541,14 @@ public class FaceUnlock implements BiometricSensorUnlock, Handler.Callback {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when Face Unlock wants to keep the screen alive and active.
|
* Called when Face Unlock wants to keep the screen alive and active for a specific amount
|
||||||
|
* of time.
|
||||||
*/
|
*/
|
||||||
@Override
|
public void pokeWakelock(int millis) {
|
||||||
public void pokeWakelock() {
|
if (DEBUG) Log.d(TAG, "pokeWakelock() for " + millis + "ms");
|
||||||
if (DEBUG) Log.d(TAG, "pokeWakelock()");
|
Message message = mHandler.obtainMessage(MSG_POKE_WAKELOCK, millis, -1);
|
||||||
mHandler.sendEmptyMessage(MSG_POKE_WAKELOCK);
|
mHandler.sendMessage(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user