CA cert monitoring: add notifications and actions for dialog

In DevicePolicyManagementService, on boot and when certs are installed,
post notification to tell the user that their traffic may be
monitored.
Have QuickSettings use the MonitoringCertInfoActivity instead
of building the dialog itself.

Bug: 10633199

Change-Id: Ie4b97295a9fc25867c87872feccdb17f4bea071d
This commit is contained in:
Maggie Benthall
2013-09-05 15:30:26 -04:00
parent cdd82540f2
commit 0469f41010
11 changed files with 132 additions and 55 deletions

View File

@ -500,16 +500,5 @@
<!-- Shows up when there is a user SSL CA Cert installed on the
device. Indicates to the user that SSL traffic can be intercepted. [CHAR LIMIT=NONE] -->
<string name="ssl_ca_cert_warning">Network may be monitored</string>
<!-- Button to close the SSL CA cert warning dialog box. [CHAR LIMIT=NONE] -->
<string name="done_button">Done</string>
<!-- Title of Dialog warning users of SSL monitoring. [CHAR LIMIT=NONE] -->
<string name="ssl_ca_cert_dialog_title">Network Monitoring</string>
<!-- Text of message to show to users whose administrator has installed a SSL CA Cert.
[CHAR LIMIT=NONE] -->
<string name="ssl_ca_cert_info_message">This device is managed by: <xliff:g id="managing_domain">%s</xliff:g>.\n\nYour administrator is capable of monitoring your network activity, including emails, apps, and secure websites.\n\nFor more information,contact your administrator.</string>
<!-- Text of warning to show to users that have a SSL CA Cert installed. [CHAR LIMIT=NONE] -->
<string name="ssl_ca_cert_warning_message">A third party is capable of monitoring your network\nactivity, including emails, apps, and secure websites.\n\nA trusted credential installed on your device is making this possible.</string>
<!-- Label on button that will take the user to the Trusted Credentials settings page.
[CHAR LIMIT=NONE]-->
<string name="ssl_ca_cert_settings_button">Check trusted credentials</string>
</resources>

View File

@ -192,7 +192,7 @@ class QuickSettings {
mQueryCertTask = new AsyncTask<Void, Void, Pair<Boolean, Boolean>>() {
@Override
protected Pair<Boolean, Boolean> doInBackground(Void... params) {
boolean hasCert = mDevicePolicyManager.hasAnyCaCertsInstalled();
boolean hasCert = DevicePolicyManager.hasAnyCaCertsInstalled();
boolean isManaged = mDevicePolicyManager.getDeviceOwner() != null;
return Pair.create(hasCert, isManaged);
@ -756,7 +756,7 @@ class QuickSettings {
@Override
public void onClick(View v) {
collapsePanels();
showSslCaCertWarningDialog();
startSettingsActivity(Settings.ACTION_MONITORING_CERT_INFO);
}
});
@ -824,45 +824,6 @@ class QuickSettings {
dialog.show();
}
private void showSslCaCertWarningDialog() {
final AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
builder.setTitle(R.string.ssl_ca_cert_dialog_title);
builder.setCancelable(true);
final boolean hasDeviceOwner = mDevicePolicyManager.getDeviceOwner() != null;
int buttonLabel;
if (hasDeviceOwner) {
// Institutional case. Show informational message.
String message = mContext.getResources().getString(R.string.ssl_ca_cert_info_message,
mDevicePolicyManager.getDeviceOwnerName());
builder.setMessage(message);
buttonLabel = R.string.done_button;
} else {
// Consumer case. Show scary warning.
builder.setMessage(R.string.ssl_ca_cert_warning_message);
buttonLabel = R.string.ssl_ca_cert_settings_button;
}
builder.setPositiveButton(buttonLabel, new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// do something.
if (hasDeviceOwner) {
// Close
} else {
startSettingsActivity("com.android.settings.TRUSTED_CREDENTIALS_USER");
}
}
});
final Dialog dialog = builder.create();
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
try {
WindowManagerGlobal.getWindowManagerService().dismissKeyguard();
} catch (RemoteException e) {
}
dialog.show();
}
private void updateWifiDisplayStatus() {
mWifiDisplayStatus = mDisplayManager.getWifiDisplayStatus();
applyWifiDisplayStatus();