diff options
author | Zoltan Szatmary-Ban <szatmz@google.com> | 2015-01-05 16:41:35 +0000 |
---|---|---|
committer | Zoltan Szatmary-Ban <szatmz@google.com> | 2015-01-05 16:49:53 +0000 |
commit | fb1bdf0ffc06e872533230ccfe7de4fc0e706eea (patch) | |
tree | 3606454357b0971acda6f91e433a3eca243df7b8 /src/com/android/settings/TrustedCredentialsSettings.java | |
parent | 7e669a0ae5d9590c69aa59806fbce8b53052b46f (diff) | |
download | packages_apps_Settings-fb1bdf0ffc06e872533230ccfe7de4fc0e706eea.tar.gz packages_apps_Settings-fb1bdf0ffc06e872533230ccfe7de4fc0e706eea.tar.bz2 packages_apps_Settings-fb1bdf0ffc06e872533230ccfe7de4fc0e706eea.zip |
Check DISALLOW_CONFIG_CREDENTIALS on Settings > Trusted Credentials
Remove the enable/disable button in certificate setting dialog if restriction
has been put on the respective profile. Also catch security exception just in
case.
Bug: 18899182
Change-Id: Ia247ab264c1b2d08b58456519bf471ba8c727745
Diffstat (limited to 'src/com/android/settings/TrustedCredentialsSettings.java')
-rw-r--r-- | src/com/android/settings/TrustedCredentialsSettings.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/com/android/settings/TrustedCredentialsSettings.java b/src/com/android/settings/TrustedCredentialsSettings.java index 31ce975d7..e2b49d6f4 100644 --- a/src/com/android/settings/TrustedCredentialsSettings.java +++ b/src/com/android/settings/TrustedCredentialsSettings.java @@ -620,6 +620,9 @@ public class TrustedCredentialsSettings extends Fragment { holder.mSubjectSecondaryView.setText(certHolder.mSubjectSecondary); if (mTab.mSwitch) { holder.mSwitch.setChecked(!certHolder.mDeleted); + holder.mSwitch.setEnabled(!mUserManager.hasUserRestriction( + UserManager.DISALLOW_CONFIG_CREDENTIALS, + new UserHandle(certHolder.mProfileId))); holder.mSwitch.setVisibility(View.VISIBLE); } return convertView; @@ -680,7 +683,8 @@ public class TrustedCredentialsSettings extends Fragment { Button removeButton = (Button) inflater.inflate(R.layout.trusted_credential_details, body, false); - if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_CREDENTIALS)) { + if (!mUserManager.hasUserRestriction(UserManager.DISALLOW_CONFIG_CREDENTIALS, + new UserHandle(certHolder.mProfileId))) { body.addView(removeButton); } removeButton.setText(certHolder.mTab.getButtonLabel(certHolder)); @@ -764,17 +768,11 @@ public class TrustedCredentialsSettings extends Fragment { } else { return service.deleteCaCertificate(mCertHolder.mAlias); } - } catch (CertificateEncodingException e) { + } catch (CertificateEncodingException | SecurityException | IllegalStateException + | RemoteException e) { Log.w(TAG, "Error while toggling alias " + mCertHolder.mAlias, e); return false; - } catch (IllegalStateException e) { - // used by installCaCertificate to report errors - Log.w(TAG, "Error while toggling alias " + mCertHolder.mAlias, e); - return false; - } catch (RemoteException e) { - Log.w(TAG, "Error while toggling alias " + mCertHolder.mAlias, e); - return false; } } |