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

@@ -2003,12 +2003,12 @@ found in the list of installed applications.</string>
<string name="cstor_password_verification_error">Please enter the password again. The password must have at least 8 characters and must not contain spaces.</string>
<string name="cstor_name_empty_error">Please enter a name.</string>
<string name="cstor_name_char_error">Please enter a name that contains only letters and numbers.</string>
<string name="cstor_storage_error">Unable to save the certificate. Click OK to retry.</string>
<!-- toast message -->
<string name="cstor_is_enabled">Credential storage is enabled.</string>
<!-- toast message -->
<string name="cstor_is_added">%s is added.</string>
<string name="cstor_add_error">Failed to add %s.</string>
<!-- Sound settings screen, setting check box label -->
<string name="emergency_tone_title">Emergency tone</string>

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;
}