Show different strings when PO/DO user approves a cert

1. This is confusing for restricted users who don't have any options other
than 'Trust'.
2. show dialog title of "Check certificate" instead of "Trust or remove certificate"

The change only applies to ProfileOwner and DeviceOwner case

Fix: 28875819
Change-Id: I3f7dc8f3dcac75b4d99814cbc9af67433676a8c7
This commit is contained in:
Victor Chang
2016-05-31 22:07:20 +01:00
parent 8eaa3de931
commit 71d1fed0e7
2 changed files with 12 additions and 6 deletions

View File

@@ -34,6 +34,7 @@ import android.widget.Spinner;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.TrustedCredentialsSettings.CertHolder;
import com.android.settingslib.RestrictedLockUtils;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
@@ -221,10 +222,11 @@ class TrustedCredentialsDialogBuilder extends AlertDialog.Builder {
&& isUserSecure(certHolder.getUserId())
&& !mDpm.isCaCertApproved(certHolder.getAlias(), certHolder.getUserId());
// The ok button is optional. User can still dismiss the dialog by other means.
// Display it only when trust button is not displayed, because we want users to
// either remove or trust a CA cert when the cert is installed by DPC app.
CharSequence displayText = mActivity.getText(mNeedsApproval
final boolean isProfileOrDeviceOwner = RestrictedLockUtils.getProfileOrDeviceOwner(
mActivity, certHolder.getUserId()) != null;
// Show trust button only when it requires consumer user (non-PO/DO) to approve
CharSequence displayText = mActivity.getText(!isProfileOrDeviceOwner && mNeedsApproval
? R.string.trusted_credentials_trust_label
: android.R.string.ok);
mPositiveButton = updateButton(DialogInterface.BUTTON_POSITIVE, displayText);