use of android.os.storage.IStorageManager in project platform_packages_apps_Settings by BlissRoms.
the class CryptKeeper method handleBadAttempt.
private void handleBadAttempt(Integer failedAttempts) {
// Wrong entry. Handle pattern case.
if (mLockPatternView != null) {
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
mLockPatternView.removeCallbacks(mClearPatternRunnable);
mLockPatternView.postDelayed(mClearPatternRunnable, WRONG_PATTERN_CLEAR_TIMEOUT_MS);
}
if ((failedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
mCooldown = true;
// No need to setBackFunctionality(false) - it's already done
// at this point.
cooldown();
} else {
final TextView status = (TextView) findViewById(R.id.status);
int remainingAttempts = MAX_FAILED_ATTEMPTS - failedAttempts;
if (remainingAttempts < COOL_DOWN_ATTEMPTS) {
CharSequence warningTemplate = getText(R.string.crypt_keeper_warn_wipe);
CharSequence warning = TextUtils.expandTemplate(warningTemplate, Integer.toString(remainingAttempts));
status.setText(warning);
} else {
int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
try {
final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType();
} catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e);
}
if (passwordType == StorageManager.CRYPT_TYPE_PIN) {
status.setText(R.string.cryptkeeper_wrong_pin);
} else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
status.setText(R.string.cryptkeeper_wrong_pattern);
} else {
status.setText(R.string.cryptkeeper_wrong_password);
}
}
if (mLockPatternView != null) {
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
mLockPatternView.setEnabled(true);
}
// Reenable the password entry
if (mPasswordEntry != null) {
mPasswordEntry.setEnabled(true);
mPasswordEntry.scheduleShowSoftInput();
setBackFunctionality(true);
}
}
}
use of android.os.storage.IStorageManager in project platform_packages_apps_Settings by BlissRoms.
the class CryptKeeper method setupUi.
/**
* Initializes the UI based on the current state of encryption.
* This is idempotent - calling repeatedly will simply re-initialize the UI.
*/
private void setupUi() {
if (mEncryptionGoneBad || isDebugView(FORCE_VIEW_ERROR)) {
setContentView(R.layout.crypt_keeper_progress);
showFactoryReset(mCorrupt);
return;
}
final String progress = SystemProperties.get("vold.encrypt_progress");
if (!"".equals(progress) || isDebugView(FORCE_VIEW_PROGRESS)) {
setContentView(R.layout.crypt_keeper_progress);
encryptionProgressInit();
} else if (mValidationComplete || isDebugView(FORCE_VIEW_PASSWORD)) {
new AsyncTask<Void, Void, Void>() {
int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
String owner_info;
boolean pattern_visible;
boolean password_visible;
@Override
public Void doInBackground(Void... v) {
try {
final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType();
owner_info = service.getField(StorageManager.OWNER_INFO_KEY);
pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY)));
password_visible = !("0".equals(service.getField(StorageManager.PASSWORD_VISIBLE_KEY)));
} catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e);
}
return null;
}
@Override
public void onPostExecute(java.lang.Void v) {
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, password_visible ? 1 : 0);
if (passwordType == StorageManager.CRYPT_TYPE_PIN) {
setContentView(R.layout.crypt_keeper_pin_entry);
mStatusString = R.string.enter_pin;
} else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
setContentView(R.layout.crypt_keeper_pattern_entry);
setBackFunctionality(false);
mStatusString = R.string.enter_pattern;
} else {
setContentView(R.layout.crypt_keeper_password_entry);
mStatusString = R.string.enter_password;
}
final TextView status = (TextView) findViewById(R.id.status);
status.setText(mStatusString);
final TextView ownerInfo = (TextView) findViewById(R.id.owner_info);
ownerInfo.setText(owner_info);
// Required for marquee'ing to work
ownerInfo.setSelected(true);
passwordEntryInit();
findViewById(android.R.id.content).setSystemUiVisibility(View.STATUS_BAR_DISABLE_BACK);
if (mLockPatternView != null) {
mLockPatternView.setInStealthMode(!pattern_visible);
}
if (mCooldown) {
// in case we are cooling down and coming back from emergency dialler
setBackFunctionality(false);
cooldown();
}
}
}.execute();
} else if (!mValidationRequested) {
// We're supposed to be encrypted, but no validation has been done.
new ValidationTask().execute((Void[]) null);
mValidationRequested = true;
}
}
use of android.os.storage.IStorageManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class CryptKeeper method handleBadAttempt.
private void handleBadAttempt(Integer failedAttempts) {
// Wrong entry. Handle pattern case.
if (mLockPatternView != null) {
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
mLockPatternView.removeCallbacks(mClearPatternRunnable);
mLockPatternView.postDelayed(mClearPatternRunnable, WRONG_PATTERN_CLEAR_TIMEOUT_MS);
}
if ((failedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
mCooldown = true;
// No need to setBackFunctionality(false) - it's already done
// at this point.
cooldown();
} else {
int remainingAttempts = MAX_FAILED_ATTEMPTS - failedAttempts;
if (remainingAttempts < COOL_DOWN_ATTEMPTS) {
CharSequence warningTemplate = getText(R.string.crypt_keeper_warn_wipe);
CharSequence warning = TextUtils.expandTemplate(warningTemplate, Integer.toString(remainingAttempts));
mStatusText.setText(warning);
} else {
int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
try {
final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType();
} catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e);
}
if (passwordType == StorageManager.CRYPT_TYPE_PIN) {
mStatusText.setText(R.string.cryptkeeper_wrong_pin);
} else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
mStatusText.setText(R.string.cryptkeeper_wrong_pattern);
} else {
mStatusText.setText(R.string.cryptkeeper_wrong_password);
}
}
if (mLockPatternView != null) {
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
mLockPatternView.setEnabled(true);
setPatternButtonsEnabled(true);
}
// Reenable the password entry
if (mPasswordEntry != null) {
mPasswordEntry.setEnabled(true);
mPasswordEntry.scheduleShowSoftInput();
setBackFunctionality(true);
}
}
}
use of android.os.storage.IStorageManager in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class CryptKeeper method setupUi.
/**
* Initializes the UI based on the current state of encryption.
* This is idempotent - calling repeatedly will simply re-initialize the UI.
*/
private void setupUi() {
if (mEncryptionGoneBad || isDebugView(FORCE_VIEW_ERROR)) {
setContentView(R.layout.crypt_keeper_progress);
showFactoryReset(mCorrupt);
return;
}
final String progress = VoldProperties.encrypt_progress().orElse("");
if (!"".equals(progress) || isDebugView(FORCE_VIEW_PROGRESS)) {
setContentView(R.layout.crypt_keeper_progress);
encryptionProgressInit();
} else if (mValidationComplete || isDebugView(FORCE_VIEW_PASSWORD)) {
new AsyncTask<Void, Void, Void>() {
int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
String owner_info;
boolean pattern_visible;
boolean password_visible;
@Override
public Void doInBackground(Void... v) {
try {
final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType();
owner_info = service.getField(StorageManager.OWNER_INFO_KEY);
pattern_visible = !("0".equals(service.getField(StorageManager.PATTERN_VISIBLE_KEY)));
password_visible = !("0".equals(service.getField(StorageManager.PASSWORD_VISIBLE_KEY)));
} catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e);
}
return null;
}
@Override
public void onPostExecute(java.lang.Void v) {
Settings.System.putInt(getContentResolver(), Settings.System.TEXT_SHOW_PASSWORD, password_visible ? 1 : 0);
if (passwordType == StorageManager.CRYPT_TYPE_PIN) {
setContentView(R.layout.crypt_keeper_pin_entry);
mStatusString = R.string.enter_pin;
} else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
setContentView(R.layout.crypt_keeper_pattern_entry);
setBackFunctionality(false);
mStatusString = R.string.enter_pattern;
} else {
setContentView(R.layout.crypt_keeper_password_entry);
mStatusString = R.string.enter_password;
}
mStatusText.setText(mStatusString);
final TextView ownerInfo = (TextView) findViewById(R.id.owner_info);
ownerInfo.setText(owner_info);
// Required for marquee'ing to work
ownerInfo.setSelected(true);
passwordEntryInit();
findViewById(android.R.id.content).setSystemUiVisibility(View.STATUS_BAR_DISABLE_BACK);
if (mLockPatternView != null) {
mLockPatternView.setInStealthMode(!pattern_visible);
}
if (mCooldown) {
// in case we are cooling down and coming back from emergency dialler
setBackFunctionality(false);
cooldown();
}
}
}.execute();
} else if (!mValidationRequested) {
// We're supposed to be encrypted, but no validation has been done.
new ValidationTask().execute((Void[]) null);
mValidationRequested = true;
}
}
use of android.os.storage.IStorageManager in project android_packages_apps_Settings by omnirom.
the class CryptKeeper method handleBadAttempt.
private void handleBadAttempt(Integer failedAttempts) {
// Wrong entry. Handle pattern case.
if (mLockPatternView != null) {
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
mLockPatternView.removeCallbacks(mClearPatternRunnable);
mLockPatternView.postDelayed(mClearPatternRunnable, WRONG_PATTERN_CLEAR_TIMEOUT_MS);
}
if ((failedAttempts % COOL_DOWN_ATTEMPTS) == 0) {
mCooldown = true;
// No need to setBackFunctionality(false) - it's already done
// at this point.
cooldown();
} else {
final TextView status = (TextView) findViewById(R.id.status);
int remainingAttempts = MAX_FAILED_ATTEMPTS - failedAttempts;
if (remainingAttempts < COOL_DOWN_ATTEMPTS) {
CharSequence warningTemplate = getText(R.string.crypt_keeper_warn_wipe);
CharSequence warning = TextUtils.expandTemplate(warningTemplate, Integer.toString(remainingAttempts));
status.setText(warning);
} else {
int passwordType = StorageManager.CRYPT_TYPE_PASSWORD;
try {
final IStorageManager service = getStorageManager();
passwordType = service.getPasswordType();
} catch (Exception e) {
Log.e(TAG, "Error calling mount service " + e);
}
if (passwordType == StorageManager.CRYPT_TYPE_PIN) {
status.setText(R.string.cryptkeeper_wrong_pin);
} else if (passwordType == StorageManager.CRYPT_TYPE_PATTERN) {
status.setText(R.string.cryptkeeper_wrong_pattern);
} else {
status.setText(R.string.cryptkeeper_wrong_password);
}
}
if (mLockPatternView != null) {
mLockPatternView.setDisplayMode(DisplayMode.Wrong);
mLockPatternView.setEnabled(true);
}
// Reenable the password entry
if (mPasswordEntry != null) {
mPasswordEntry.setEnabled(true);
mPasswordEntry.scheduleShowSoftInput();
setBackFunctionality(true);
}
}
}
Aggregations