summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Miller <jaggies@google.com>2014-07-17 14:46:05 -0700
committerJim Miller <jaggies@google.com>2014-07-18 20:48:34 +0000
commit06e345089a0425c6cd5a5596835113fb229b7d41 (patch)
treedd6dda2525d92824189d99b493b260709c50e148
parent9d59a76dd0e850558e83ef1a48fefd865fac1336 (diff)
downloadframeworks_base-06e345089a0425c6cd5a5596835113fb229b7d41.zip
frameworks_base-06e345089a0425c6cd5a5596835113fb229b7d41.tar.gz
frameworks_base-06e345089a0425c6cd5a5596835113fb229b7d41.tar.bz2
Add DevicePolicyManager flag for fingerprint.
Change-Id: Icb3e4b98d97487179acefabc7a3b747d3d0fa23a
-rw-r--r--api/current.txt1
-rw-r--r--core/java/android/app/admin/DevicePolicyManager.java5
-rw-r--r--packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java13
3 files changed, 19 insertions, 0 deletions
diff --git a/api/current.txt b/api/current.txt
index 6f7f9ee..1eb9615 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -5423,6 +5423,7 @@ package android.app.admin {
field public static int FLAG_PARENT_CAN_ACCESS_MANAGED;
field public static final int KEYGUARD_DISABLE_FEATURES_ALL = 2147483647; // 0x7fffffff
field public static final int KEYGUARD_DISABLE_FEATURES_NONE = 0; // 0x0
+ field public static final int KEYGUARD_DISABLE_FINGERPRINT = 32; // 0x20
field public static final int KEYGUARD_DISABLE_SECURE_CAMERA = 2; // 0x2
field public static final int KEYGUARD_DISABLE_SECURE_NOTIFICATIONS = 4; // 0x4
field public static final int KEYGUARD_DISABLE_TRUST_AGENTS = 16; // 0x10
diff --git a/core/java/android/app/admin/DevicePolicyManager.java b/core/java/android/app/admin/DevicePolicyManager.java
index 71ad0c9..5a8a01a 100644
--- a/core/java/android/app/admin/DevicePolicyManager.java
+++ b/core/java/android/app/admin/DevicePolicyManager.java
@@ -1561,6 +1561,11 @@ public class DevicePolicyManager {
public static final int KEYGUARD_DISABLE_TRUST_AGENTS = 1 << 4;
/**
+ * Disable fingerprint sensor on keyguard secure screens (e.g. PIN/Pattern/Password).
+ */
+ public static final int KEYGUARD_DISABLE_FINGERPRINT = 1 << 5;
+
+ /**
* Disable all current and future keyguard customizations.
*/
public static final int KEYGUARD_DISABLE_FEATURES_ALL = 0x7fffffff;
diff --git a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
index 5e80dfc..a5dbbcb 100644
--- a/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
+++ b/packages/Keyguard/src/com/android/keyguard/KeyguardUpdateMonitor.java
@@ -26,6 +26,7 @@ import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.UserInfo;
import android.database.ContentObserver;
import android.graphics.Bitmap;
@@ -36,6 +37,7 @@ import static android.os.BatteryManager.EXTRA_STATUS;
import static android.os.BatteryManager.EXTRA_PLUGGED;
import static android.os.BatteryManager.EXTRA_LEVEL;
import static android.os.BatteryManager.EXTRA_HEALTH;
+
import android.media.AudioManager;
import android.media.IRemoteControlDisplay;
import android.os.BatteryManager;
@@ -247,6 +249,10 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
Log.e(TAG, "Failed to get current user id: ", e);
return;
}
+ if (isFingerprintDisabled(userId)) {
+ Log.d(TAG, "Fingerprint disabled by DPM for userId: " + userId);
+ return;
+ }
final ContentResolver res = mContext.getContentResolver();
final int ids[] = FingerprintUtils.getFingerprintIdsForUser(res, userId);
for (int i = 0; i < ids.length; i++) {
@@ -286,6 +292,13 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener {
return false;
}
+ private boolean isFingerprintDisabled(int userId) {
+ final DevicePolicyManager dpm =
+ (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
+ return dpm != null && (dpm.getKeyguardDisabledFeatures(null, userId)
+ & DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT) != 0;
+ }
+
public boolean getUserHasTrust(int userId) {
return !isTrustDisabled(userId) && mUserHasTrust.get(userId)
|| mUserFingerprintRecognized.get(userId);