am 241610e9: Add password error hint when adding new cert.

Merge commit '241610e986a8d2823f519762737903779089c253'

* commit '241610e986a8d2823f519762737903779089c253':
  Add password error hint when adding new cert.
This commit is contained in:
Hung-ying Tyan
2009-07-21 07:12:23 -07:00
committed by Android Git Automerger
2 changed files with 16 additions and 12 deletions

View File

@@ -528,16 +528,6 @@ public class SecuritySettings extends PreferenceActivity implements
mAccessCheckBox.setChecked(false);
}
private void addCredential() {
String formatString = mCstorAddCredentialHelper.saveToStorage() < 0
? getString(R.string.cstor_add_error)
: getString(R.string.cstor_is_added);
String message = String.format(formatString,
mCstorAddCredentialHelper.getName());
Toast.makeText(SecuritySettings.this, message, Toast.LENGTH_SHORT)
.show();
}
public void onCancel(DialogInterface dialog) {
if (mCstorAddCredentialHelper != null) {
// release the object here so that it doesn't get triggerred in
@@ -590,7 +580,12 @@ public class SecuritySettings extends PreferenceActivity implements
} else if (!isCstorUnlocked()) {
showDialog(CSTOR_UNLOCK_DIALOG);
} else {
addCredential();
String formatString =
getString(R.string.cstor_is_added);
String message = String.format(formatString,
mCstorAddCredentialHelper.getName());
Toast.makeText(SecuritySettings.this, message,
Toast.LENGTH_SHORT).show();
finish();
}
} else if (mSpecialIntent != null) {
@@ -642,6 +637,15 @@ public class SecuritySettings extends PreferenceActivity implements
mCstorAddCredentialHelper.setPassword(password);
}
if (mCstorAddCredentialHelper.saveToStorage() < 0) {
if (mCstorAddCredentialHelper.isPkcs12Keystore()) {
showError(R.string.cstor_password_error);
} else {
showError(R.string.cstor_storage_error);
}
return false;
}
return true;
}