Several fixes to new EncryptionInterstitial dialog.

The code now observes whether accessibility is turned on when
deciding the default state.

Additionally, it fixes a bug where the user can back out of
EncryptionInterstitial and leave the setting in a bad state.
We now propagate the state until the place where it ultimately
gets stored.

Also fixes problem where Encryption was ignoring the state
where the device was already encrypted.

Fixes bug 17881324

Change-Id: Iec09e4464832a506bb2a78bb14a38b3531971fa0
This commit is contained in:
Jim Miller
2014-10-16 19:49:07 -07:00
parent 4f903c3e65
commit 0698a21631
6 changed files with 92 additions and 42 deletions

View File

@@ -25,6 +25,7 @@ import android.app.Activity;
import android.app.Fragment;
import android.app.admin.DevicePolicyManager;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.inputmethodservice.KeyboardView;
import android.os.Bundle;
@@ -64,6 +65,19 @@ public class ChooseLockPassword extends SettingsActivity {
return modIntent;
}
public static Intent createIntent(Context context, int quality, final boolean isFallback,
int minLength, final int maxLength, boolean requirePasswordToDecrypt,
boolean confirmCredentials) {
Intent intent = new Intent().setClass(context, ChooseLockPassword.class);
intent.putExtra(LockPatternUtils.PASSWORD_TYPE_KEY, quality);
intent.putExtra(PASSWORD_MIN_KEY, minLength);
intent.putExtra(PASSWORD_MAX_KEY, maxLength);
intent.putExtra(ChooseLockGeneric.CONFIRM_CREDENTIALS, confirmCredentials);
intent.putExtra(LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, isFallback);
intent.putExtra(EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, requirePasswordToDecrypt);
return intent;
}
@Override
protected boolean isValidFragment(String fragmentName) {
if (ChooseLockPasswordFragment.class.getName().equals(fragmentName)) return true;
@@ -412,6 +426,9 @@ public class ChooseLockPassword extends SettingsActivity {
final boolean isFallback = getActivity().getIntent().getBooleanExtra(
LockPatternUtils.LOCKSCREEN_BIOMETRIC_WEAK_FALLBACK, false);
mLockPatternUtils.clearLock(isFallback);
final boolean required = getActivity().getIntent().getBooleanExtra(
EncryptionInterstitial.EXTRA_REQUIRE_PASSWORD, true);
mLockPatternUtils.setCredentialRequiredToDecrypt(required);
mLockPatternUtils.saveLockPassword(pin, mRequestedQuality, isFallback);
getActivity().setResult(RESULT_FINISHED);
getActivity().finish();