Merge "Added support for DO_NOT_ASK_CREDENTIALS_ON_BOOT DPM flag" into mnc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
6503765462
@@ -189,7 +189,9 @@ public class ChooseLockGeneric extends SettingsActivity {
|
|||||||
// TODO: why does this take disabled, its always called with a quality higher than
|
// TODO: why does this take disabled, its always called with a quality higher than
|
||||||
// what makes sense with disabled == true
|
// what makes sense with disabled == true
|
||||||
private void maybeEnableEncryption(int quality, boolean disabled) {
|
private void maybeEnableEncryption(int quality, boolean disabled) {
|
||||||
if (Process.myUserHandle().isOwner() && LockPatternUtils.isDeviceEncryptionEnabled()) {
|
DevicePolicyManager dpm = (DevicePolicyManager) getSystemService(DEVICE_POLICY_SERVICE);
|
||||||
|
if (Process.myUserHandle().isOwner() && LockPatternUtils.isDeviceEncryptionEnabled()
|
||||||
|
&& !dpm.getDoNotAskCredentialsOnBoot()) {
|
||||||
mEncryptionRequestQuality = quality;
|
mEncryptionRequestQuality = quality;
|
||||||
mEncryptionRequestDisabled = disabled;
|
mEncryptionRequestDisabled = disabled;
|
||||||
final Context context = getActivity();
|
final Context context = getActivity();
|
||||||
|
@@ -39,6 +39,8 @@ import com.android.internal.logging.MetricsLogger;
|
|||||||
|
|
||||||
public class CryptKeeperSettings extends InstrumentedFragment {
|
public class CryptKeeperSettings extends InstrumentedFragment {
|
||||||
private static final String TAG = "CryptKeeper";
|
private static final String TAG = "CryptKeeper";
|
||||||
|
private static final String TYPE = "type";
|
||||||
|
private static final String PASSWORD = "password";
|
||||||
|
|
||||||
private static final int KEYGUARD_REQUEST = 55;
|
private static final int KEYGUARD_REQUEST = 55;
|
||||||
|
|
||||||
@@ -194,8 +196,20 @@ public class CryptKeeperSettings extends InstrumentedFragment {
|
|||||||
Preference preference = new Preference(getActivity());
|
Preference preference = new Preference(getActivity());
|
||||||
preference.setFragment(CryptKeeperConfirm.class.getName());
|
preference.setFragment(CryptKeeperConfirm.class.getName());
|
||||||
preference.setTitle(R.string.crypt_keeper_confirm_title);
|
preference.setTitle(R.string.crypt_keeper_confirm_title);
|
||||||
preference.getExtras().putInt("type", type);
|
addEncryptionInfoToPreference(preference, type, password);
|
||||||
preference.getExtras().putString("password", password);
|
|
||||||
((SettingsActivity) getActivity()).onPreferenceStartFragment(null, preference);
|
((SettingsActivity) getActivity()).onPreferenceStartFragment(null, preference);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addEncryptionInfoToPreference(Preference preference, int type, String password) {
|
||||||
|
Activity activity = getActivity();
|
||||||
|
DevicePolicyManager dpm = (DevicePolicyManager)
|
||||||
|
activity.getSystemService(Context.DEVICE_POLICY_SERVICE);
|
||||||
|
if (dpm.getDoNotAskCredentialsOnBoot()) {
|
||||||
|
preference.getExtras().putInt(TYPE, StorageManager.CRYPT_TYPE_DEFAULT);
|
||||||
|
preference.getExtras().putString(PASSWORD, "");
|
||||||
|
} else {
|
||||||
|
preference.getExtras().putInt(TYPE, type);
|
||||||
|
preference.getExtras().putString(PASSWORD, password);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user