public class FingerprintManager {
ctor public FingerprintManager(android.content.Context);
method public void enroll(long);
+ method public boolean enrolledAndEnabled();
method public void remove(int);
method public void startListening(android.service.fingerprint.FingerprintManagerReceiver);
method public void stopListening();
- field protected static final boolean DEBUG = true;
field public static final int FINGERPRINT_ERROR = -1; // 0xffffffff
field public static final int FINGERPRINT_ERROR_BAD_CAPTURE = 2; // 0x2
field public static final int FINGERPRINT_ERROR_HW_UNAVAILABLE = 1; // 0x1
import android.app.ActivityManagerNative;
import android.content.ComponentName;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.ServiceConnection;
import android.os.IBinder;
import android.os.RemoteException;
import android.os.UserHandle;
+import android.provider.Settings;
import android.util.Log;
/**
public class FingerprintManager {
private static final String TAG = "FingerprintManager";
- protected static final boolean DEBUG = true;
+ private static final boolean DEBUG = true;
private static final String FINGERPRINT_SERVICE_PACKAGE = "com.android.service.fingerprint";
private static final String FINGERPRINT_SERVICE_CLASS =
"com.android.service.fingerprint.FingerprintService";
private IFingerprintService mService;
private FingerprintManagerReceiver mClientReceiver;
+ private Context mContext;
private Handler mHandler = new Handler() {
public void handleMessage(android.os.Message msg) {
};
public FingerprintManager(Context context) {
+ mContext = context;
// Connect to service...
Intent intent = new Intent();
intent.setClassName(FINGERPRINT_SERVICE_PACKAGE, FINGERPRINT_SERVICE_CLASS);
};
/**
+ * Determine whether the user has at least one fingerprint enrolled and enabled.
+ *
+ * @return true if at least one is enrolled and enabled
+ */
+ public boolean enrolledAndEnabled() {
+ ContentResolver res = mContext.getContentResolver();
+ return Settings.Secure.getInt(res, "fingerprint_enabled", 0) != 0
+ && FingerprintUtils.getFingerprintIdsForUser(res, getCurrentUserId()).length > 0;
+ }
+
+ /**
* Start the enrollment process. Timeout dictates how long to wait for the user to
* enroll a fingerprint.
*