OSDN Git Service

Respect admin disallow fingerprint in ConfirmDeviceCredentials
authorClara Bayarri <clarabayarri@google.com>
Thu, 18 Feb 2016 15:52:49 +0000 (15:52 +0000)
committerClara Bayarri <clarabayarri@google.com>
Tue, 23 Feb 2016 23:52:53 +0000 (15:52 -0800)
Bug: 26891832
Change-Id: I4c6377fb79fa31e6059149220c854c47ad53eda7

src/com/android/settings/ConfirmDeviceCredentialBaseFragment.java

index ad1d2eb..090d4be 100644 (file)
@@ -83,6 +83,7 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFr
         // Only take this argument into account if it belongs to the current profile.
         Intent intent = getActivity().getIntent();
         mEffectiveUserId = Utils.getUserIdFromBundle(getActivity(), intent.getExtras());
+        mAllowFpAuthentication = mAllowFpAuthentication && !isFingerprintDisabledByAdmin();
         mLockPatternUtils = new LockPatternUtils(getActivity());
     }
 
@@ -113,6 +114,13 @@ public abstract class ConfirmDeviceCredentialBaseFragment extends InstrumentedFr
         }
     }
 
+    private boolean isFingerprintDisabledByAdmin() {
+        DevicePolicyManager dpm = (DevicePolicyManager) getActivity().getSystemService(
+                Context.DEVICE_POLICY_SERVICE);
+        final int disabledFeatures = dpm.getKeyguardDisabledFeatures(null, mEffectiveUserId);
+        return (disabledFeatures & DevicePolicyManager.KEYGUARD_DISABLE_FINGERPRINT) != 0;
+    }
+
     @Override
     public void onResume() {
         super.onResume();