Settings for NFC Unlock

Change-Id: Ifaa2717da6c364daa7af073e42fc8f6a097c14bb
This commit is contained in:
Andres Morales
2013-11-25 17:26:13 -08:00
parent aadd6e516a
commit fd2b629335
24 changed files with 445 additions and 0 deletions

View File

@@ -29,7 +29,9 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.content.pm.UserInfo;
import android.nfc.NfcUnlock;
import android.os.Bundle;
import android.os.SystemProperties;
import android.os.UserHandle;
import android.os.UserManager;
import android.preference.CheckBoxPreference;
@@ -57,6 +59,7 @@ public class SecuritySettings extends RestrictedSettingsFragment
// Lock Settings
private static final String KEY_UNLOCK_SET_OR_CHANGE = "unlock_set_or_change";
private static final String KEY_NFC_UNLOCK_SET_OR_CHANGE = "nfc_unlock_set_or_change";
private static final String KEY_BIOMETRIC_WEAK_IMPROVE_MATCHING =
"biometric_weak_improve_matching";
private static final String KEY_BIOMETRIC_WEAK_LIVELINESS = "biometric_weak_liveliness";
@@ -225,6 +228,17 @@ public class SecuritySettings extends RestrictedSettingsFragment
}
}
// don't display NFC unlock settings if the prop is not enabled
if (!NfcUnlock.getPropertyEnabled()) {
PreferenceGroup securityCategory =
(PreferenceGroup) root.findPreference(KEY_SECURITY_CATEGORY);
if (securityCategory != null) {
securityCategory.removePreference(
root.findPreference(KEY_NFC_UNLOCK_SET_OR_CHANGE));
}
}
// Append the rest of the settings
addPreferencesFromResource(R.xml.security_settings_misc);
@@ -520,6 +534,9 @@ public class SecuritySettings extends RestrictedSettingsFragment
if (KEY_UNLOCK_SET_OR_CHANGE.equals(key)) {
startFragment(this, "com.android.settings.ChooseLockGeneric$ChooseLockGenericFragment",
SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
} else if (KEY_NFC_UNLOCK_SET_OR_CHANGE.equals(key)) {
startFragment(this, "com.android.settings.NfcLockFragment",
SET_OR_CHANGE_LOCK_METHOD_REQUEST, null);
} else if (KEY_BIOMETRIC_WEAK_IMPROVE_MATCHING.equals(key)) {
ChooseLockSettingsHelper helper =
new ChooseLockSettingsHelper(this.getActivity(), this);