Skip to content

Commit ea8441e

Browse files
author
Brian Colonna
committed
Changes to biometric sensor interface in lockscreen
This cleans up the biometric sensor interface - the interface between lockscreen and Face Unlock. Not only does it document the interface, but it also makes two noteworthy changes to the interface: 1) Instead of calling mBiometricUnlock.start() with a parameter to tell it whether to suppress itself, lockscreen makes all of the decisions about whether the biometric unlock should be started or not and only calls start() if it should be started. Passing a parmeter to tell a function to not start itself was strange, but it was a necessary intermediate step in the process of fixing this interface. 2) Instead of calling mBiometricUnlock.initializeView() with a top view that the biometric unlock should attach to, lockscreen now provides the biometric unlock with the actual view it is allowed to work in. This keeps lockscreen in control of where the biometric sensor is allowed to display. A few things were also cleaned up within the Face Unlock implementation of the biometric interface: 1) Changes needed to match the requirements of the improved biometric sensor interface, including moving the functions into an order that makes more sense. 2) The bind() function was only being called from start(), which has turned into only a couple of lines of code, so the bind() code has been just put inline into the start() function, which mirrors the stop() function which has the unbind() code in it. 3) The showArea() function was really just one line of code with a check. It was being called from two places. The showArea() code is now just written inline in those two places, which makes the code much easier to follow. 4) Renamed occurrences of FaceLock to Face Unlock. Change-Id: Ie95ce21dcc77170381af9ce320f2675dfe249741
1 parent 66556c7 commit ea8441e

File tree

5 files changed

+242
-161
lines changed

5 files changed

+242
-161
lines changed

policy/src/com/android/internal/policy/impl/BiometricSensorUnlock.java

Lines changed: 48 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -19,33 +19,63 @@
1919
import android.view.View;
2020

2121
interface BiometricSensorUnlock {
22-
// Returns 'true' if the biometric sensor has started its unlock procedure but has not yet
23-
// accepted or rejected the user.
22+
/**
23+
* Initializes the view provided for the biometric unlock UI to work within. The provided area
24+
* completely covers the backup unlock mechanism. The view is then displayed in the same manner
25+
* as if {@link BiometricSensorUnlock#show(long)} was called with a timeout of 0.
26+
* @param biometricUnlockView View provided for the biometric unlock UI.
27+
*/
28+
public void initializeView(View biometricUnlockView);
29+
30+
/**
31+
* Indicates whether the biometric unlock is running. Before
32+
* {@link BiometricSensorUnlock#start} is called, isRunning() returns false. After a successful
33+
* call to {@link BiometricSensorUnlock#start}, isRunning() returns true until the biometric
34+
* unlock completes, {@link BiometricSensorUnlock#stop} has been called, or an error has
35+
* forced the biometric unlock to stop.
36+
* @return whether the biometric unlock is currently running.
37+
*/
2438
public boolean isRunning();
2539

26-
// Show the interface, but don't start the unlock procedure. The interface should disappear
27-
// after the specified timeout. If the timeout is 0, the interface shows until another event,
28-
// such as calling hide(), causes it to disappear.
29-
// Called on the UI Thread
40+
/**
41+
* Covers the backup unlock mechanism by showing the contents of the view initialized in
42+
* {@link BiometricSensorUnlock#initializeView(View)}. The view should disappear after the
43+
* specified timeout. If the timeout is 0, the interface shows until another event, such as
44+
* calling {@link BiometricSensorUnlock#hide()}, causes it to disappear. Called on the UI
45+
* thread.
46+
* @param timeoutMilliseconds Amount of time in milliseconds to display the view before
47+
* disappearing. A value of 0 means the view should remain visible.
48+
*/
3049
public void show(long timeoutMilliseconds);
3150

32-
// Hide the interface, if any, exposing the lockscreen.
51+
/**
52+
* Uncovers the backup unlock mechanism by hiding the contents of the view initialized in
53+
* {@link BiometricSensorUnlock#initializeView(View)}.
54+
*/
3355
public void hide();
3456

35-
// Stop the unlock procedure if running. Returns 'true' if it was in fact running.
36-
public boolean stop();
37-
38-
// Start the unlock procedure. Returns ‘false’ if it can’t be started or if the backup should
39-
// be used.
40-
// Called on the UI thread.
41-
public boolean start(boolean suppressBiometricUnlock);
57+
/**
58+
* Binds to the biometric unlock service and starts the unlock procedure. Called on the UI
59+
* thread.
60+
* @return false if it can't be started or the backup should be used.
61+
*/
62+
public boolean start();
4263

43-
// Provide a view to work within.
44-
public void initializeAreaView(View topView);
64+
/**
65+
* Stops the biometric unlock procedure and unbinds from the service.
66+
* @return whether the biometric unlock was running when called.
67+
*/
68+
public boolean stop();
4569

46-
// Clean up any resources used by the biometric unlock.
70+
/**
71+
* Cleans up any resources used by the biometric unlock.
72+
*/
4773
public void cleanUp();
4874

49-
// Returns the Device Policy Manager quality (e.g. PASSWORD_QUALITY_BIOMETRIC_WEAK).
75+
/**
76+
* Gets the Device Policy Manager quality of the biometric unlock sensor
77+
* (e.g., PASSWORD_QUALITY_BIOMETRIC_WEAK).
78+
* @return biometric unlock sensor quality, as defined by Device Policy Manager.
79+
*/
5080
public int getQuality();
5181
}

0 commit comments

Comments
 (0)