Credentials should be shown but can't be modified.
Change-Id: I1a22a0ffb244d6cec3c64b2224fa5e9639bf4673
This commit is contained in:
@@ -85,7 +85,7 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
private static final String KEY_SIM_LOCK = "sim_lock";
|
private static final String KEY_SIM_LOCK = "sim_lock";
|
||||||
private static final String KEY_SHOW_PASSWORD = "show_password";
|
private static final String KEY_SHOW_PASSWORD = "show_password";
|
||||||
private static final String KEY_CREDENTIAL_STORAGE_TYPE = "credential_storage_type";
|
private static final String KEY_CREDENTIAL_STORAGE_TYPE = "credential_storage_type";
|
||||||
private static final String KEY_RESET_CREDENTIALS = "reset_credentials";
|
private static final String KEY_RESET_CREDENTIALS = "credentials_reset";
|
||||||
private static final String KEY_CREDENTIALS_INSTALL = "credentials_install";
|
private static final String KEY_CREDENTIALS_INSTALL = "credentials_install";
|
||||||
private static final String KEY_TOGGLE_INSTALL_APPLICATIONS = "toggle_install_applications";
|
private static final String KEY_TOGGLE_INSTALL_APPLICATIONS = "toggle_install_applications";
|
||||||
private static final String KEY_TOGGLE_VERIFY_APPLICATIONS = "toggle_verify_applications";
|
private static final String KEY_TOGGLE_VERIFY_APPLICATIONS = "toggle_verify_applications";
|
||||||
@@ -267,10 +267,12 @@ public class SecuritySettings extends SettingsPreferenceFragment
|
|||||||
mKeyStore.isHardwareBacked() ? R.string.credential_storage_type_hardware
|
mKeyStore.isHardwareBacked() ? R.string.credential_storage_type_hardware
|
||||||
: R.string.credential_storage_type_software;
|
: R.string.credential_storage_type_software;
|
||||||
credentialStorageType.setSummary(storageSummaryRes);
|
credentialStorageType.setSummary(storageSummaryRes);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
removePreference(KEY_CREDENTIALS_MANAGER);
|
PreferenceGroup credentialsManager = (PreferenceGroup)
|
||||||
removePreference(KEY_CREDENTIALS_INSTALL);
|
root.findPreference(KEY_CREDENTIALS_MANAGER);
|
||||||
|
credentialsManager.removePreference(root.findPreference(KEY_RESET_CREDENTIALS));
|
||||||
|
credentialsManager.removePreference(root.findPreference(KEY_CREDENTIALS_INSTALL));
|
||||||
|
credentialsManager.removePreference(root.findPreference(KEY_CREDENTIAL_STORAGE_TYPE));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Application install
|
// Application install
|
||||||
|
@@ -66,12 +66,6 @@ public class TrustedCredentialsSettings extends Fragment {
|
|||||||
|
|
||||||
private static final String USER_ACTION = "com.android.settings.TRUSTED_CREDENTIALS_USER";
|
private static final String USER_ACTION = "com.android.settings.TRUSTED_CREDENTIALS_USER";
|
||||||
|
|
||||||
private static final int REQUEST_PIN_CHALLENGE = 12309;
|
|
||||||
// If the restriction PIN is entered correctly.
|
|
||||||
private boolean mChallengeSucceeded;
|
|
||||||
private boolean mChallengeRequested;
|
|
||||||
|
|
||||||
|
|
||||||
private enum Tab {
|
private enum Tab {
|
||||||
SYSTEM("system",
|
SYSTEM("system",
|
||||||
R.string.trusted_credentials_system_tab,
|
R.string.trusted_credentials_system_tab,
|
||||||
@@ -171,10 +165,6 @@ public class TrustedCredentialsSettings extends Fragment {
|
|||||||
|
|
||||||
@Override public View onCreateView(
|
@Override public View onCreateView(
|
||||||
LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
|
LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
|
||||||
if (mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_CREDENTIALS)) {
|
|
||||||
return inflater.inflate(R.layout.credentials_disallowed_preference_screen,
|
|
||||||
parent, false);
|
|
||||||
}
|
|
||||||
mTabHost = (TabHost) inflater.inflate(R.layout.trusted_credentials, parent, false);
|
mTabHost = (TabHost) inflater.inflate(R.layout.trusted_credentials, parent, false);
|
||||||
mTabHost.setup();
|
mTabHost.setup();
|
||||||
addTab(Tab.SYSTEM);
|
addTab(Tab.SYSTEM);
|
||||||
@@ -413,21 +403,17 @@ public class TrustedCredentialsSettings extends Fragment {
|
|||||||
});
|
});
|
||||||
final Dialog certDialog = builder.create();
|
final Dialog certDialog = builder.create();
|
||||||
|
|
||||||
View view = views.get(0);
|
ViewGroup body = (ViewGroup) container.findViewById(com.android.internal.R.id.body);
|
||||||
ViewGroup body = (ViewGroup) view.findViewById(com.android.internal.R.id.body);
|
|
||||||
LayoutInflater inflater = LayoutInflater.from(getActivity());
|
LayoutInflater inflater = LayoutInflater.from(getActivity());
|
||||||
Button removeButton = (Button) inflater.inflate(R.layout.trusted_credential_details,
|
Button removeButton = (Button) inflater.inflate(R.layout.trusted_credential_details,
|
||||||
body,
|
body,
|
||||||
false);
|
false);
|
||||||
|
if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_CREDENTIALS)) {
|
||||||
body.addView(removeButton);
|
body.addView(removeButton);
|
||||||
|
}
|
||||||
removeButton.setText(certHolder.mTab.getButtonLabel(certHolder));
|
removeButton.setText(certHolder.mTab.getButtonLabel(certHolder));
|
||||||
removeButton.setOnClickListener(new View.OnClickListener() {
|
removeButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override public void onClick(View v) {
|
@Override public void onClick(View v) {
|
||||||
if (mUserManager.hasRestrictionsChallenge() && !mChallengeSucceeded) {
|
|
||||||
ensurePin();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||||
builder.setMessage(certHolder.mTab.getButtonConfirmation(certHolder));
|
builder.setMessage(certHolder.mTab.getButtonConfirmation(certHolder));
|
||||||
builder.setPositiveButton(
|
builder.setPositiveButton(
|
||||||
@@ -473,35 +459,6 @@ public class TrustedCredentialsSettings extends Fragment {
|
|||||||
titles.add(sslCert.getIssuedTo().getCName());
|
titles.add(sslCert.getIssuedTo().getCName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onActivityResult(int requestCode, int resultCode, Intent data) {
|
|
||||||
if (requestCode == REQUEST_PIN_CHALLENGE) {
|
|
||||||
mChallengeRequested = false;
|
|
||||||
if (resultCode == Activity.RESULT_OK) {
|
|
||||||
mChallengeSucceeded = true;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
super.onActivityResult(requestCode, resultCode, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ensurePin() {
|
|
||||||
if (!mChallengeSucceeded) {
|
|
||||||
final UserManager um = UserManager.get(getActivity());
|
|
||||||
if (!mChallengeRequested) {
|
|
||||||
if (um.hasRestrictionsChallenge()) {
|
|
||||||
Intent requestPin =
|
|
||||||
new Intent(Intent.ACTION_RESTRICTIONS_CHALLENGE);
|
|
||||||
startActivityForResult(requestPin, REQUEST_PIN_CHALLENGE);
|
|
||||||
mChallengeRequested = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
mChallengeSucceeded = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private class AliasOperation extends AsyncTask<Void, Void, Boolean> {
|
private class AliasOperation extends AsyncTask<Void, Void, Boolean> {
|
||||||
private final CertHolder mCertHolder;
|
private final CertHolder mCertHolder;
|
||||||
private AliasOperation(CertHolder certHolder) {
|
private AliasOperation(CertHolder certHolder) {
|
||||||
|
Reference in New Issue
Block a user