Merge ""CA cert installed" notification should take PO into account" into nyc-dev am: 60c7635
am: 676250e
* commit '676250e35b9345b90a9690d36c077d319c3d9da9':
"CA cert installed" notification should take PO into account
Change-Id: I982449c67976c755d38b1253688f1b7e5d8ea47e
This commit is contained in:
@@ -1295,6 +1295,7 @@
|
|||||||
<activity android:name="MonitoringCertInfoActivity"
|
<activity android:name="MonitoringCertInfoActivity"
|
||||||
android:label="@string/ssl_ca_cert_dialog_title"
|
android:label="@string/ssl_ca_cert_dialog_title"
|
||||||
android:theme="@style/Transparent"
|
android:theme="@style/Transparent"
|
||||||
|
android:excludeFromRecents="true"
|
||||||
android:taskAffinity="">
|
android:taskAffinity="">
|
||||||
<intent-filter android:priority="1">
|
<intent-filter android:priority="1">
|
||||||
<action android:name="com.android.settings.MONITORING_CERT_INFO" />
|
<action android:name="com.android.settings.MONITORING_CERT_INFO" />
|
||||||
|
@@ -5273,13 +5273,22 @@
|
|||||||
<!-- Button to close the SSL CA cert warning dialog box, meaning the user is done reading. [CHAR LIMIT=NONE] -->
|
<!-- Button to close the SSL CA cert warning dialog box, meaning the user is done reading. [CHAR LIMIT=NONE] -->
|
||||||
<string name="done_button">Done</string>
|
<string name="done_button">Done</string>
|
||||||
<!-- Title of Dialog warning users of SSL monitoring. [CHAR LIMIT=NONE] -->
|
<!-- Title of Dialog warning users of SSL monitoring. [CHAR LIMIT=NONE] -->
|
||||||
<string name="ssl_ca_cert_dialog_title">Network monitoring</string>
|
<plurals name="ssl_ca_cert_dialog_title">
|
||||||
|
<item quantity="one">Trust or remove certificate</item>
|
||||||
|
<item quantity="other">Trust or remove certificates</item>
|
||||||
|
</plurals>
|
||||||
<!-- Text of message to show to users whose administrator has installed a SSL CA Cert. [CHAR LIMIT=NONE] -->
|
<!-- 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:\n<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>
|
<plurals name="ssl_ca_cert_info_message">
|
||||||
|
<item quantity="one"><xliff:g id="managing_domain">%s</xliff:g> has installed a certificate authority for your work profile, which may allow them to monitor work network activity, including emails, apps, and secure websites. You can choose to either trust or remove this certificate.\n\nFor more information about this certificate, contact your admin.</item>
|
||||||
|
<item quantity="other"><xliff:g id="managing_domain">%s</xliff:g> has installed certificate authorities for your work profile, which may allow them to monitor work network activity, including emails, apps, and secure websites. You can choose to either trust or remove these certificates.\n\nFor more information about these certificates, contact your admin.</item>
|
||||||
|
</plurals>
|
||||||
<!-- Text of warning to show to users that have a SSL CA Cert installed. [CHAR LIMIT=NONE] -->
|
<!-- 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 activity, including emails, apps, and secure websites.\n\nA trusted credential installed on your device is making this possible.</string>
|
<string name="ssl_ca_cert_warning_message">A third party is capable of monitoring your network activity, 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]-->
|
<!-- 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>
|
<plurals name="ssl_ca_cert_settings_button">
|
||||||
|
<item quantity="one">Check certificate</item>
|
||||||
|
<item quantity="other">Check certificates</item>
|
||||||
|
</plurals>
|
||||||
|
|
||||||
<!-- User settings -->
|
<!-- User settings -->
|
||||||
<skip/>
|
<skip/>
|
||||||
|
@@ -18,81 +18,65 @@ package com.android.settings;
|
|||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
|
||||||
import android.app.admin.DevicePolicyManager;
|
import android.app.admin.DevicePolicyManager;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.DialogInterface.OnClickListener;
|
import android.content.DialogInterface.OnClickListener;
|
||||||
|
import android.content.DialogInterface.OnDismissListener;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.view.WindowManager;
|
import android.provider.Settings;
|
||||||
import android.view.WindowManagerGlobal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activity that shows a dialog explaining that a CA cert is allowing someone to monitor network
|
* Activity that shows a dialog explaining that a CA cert is allowing someone to monitor network
|
||||||
* traffic.
|
* traffic. This activity should be launched for the user into which the CA cert is installed.
|
||||||
*/
|
*/
|
||||||
public class MonitoringCertInfoActivity extends Activity implements OnClickListener {
|
public class MonitoringCertInfoActivity extends Activity implements OnClickListener,
|
||||||
|
OnDismissListener {
|
||||||
private boolean hasDeviceOwner = false;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedStates) {
|
protected void onCreate(Bundle savedStates) {
|
||||||
super.onCreate(savedStates);
|
super.onCreate(savedStates);
|
||||||
|
|
||||||
DevicePolicyManager dpm =
|
DevicePolicyManager dpm = getSystemService(DevicePolicyManager.class);
|
||||||
(DevicePolicyManager) getSystemService(Context.DEVICE_POLICY_SERVICE);
|
final int numberOfCertificates = getIntent().getIntExtra(
|
||||||
|
Settings.EXTRA_NUMBER_OF_CERTIFICATES, 1);
|
||||||
|
|
||||||
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
|
||||||
builder.setTitle(R.string.ssl_ca_cert_dialog_title);
|
builder.setTitle(getResources().getQuantityText(R.plurals.ssl_ca_cert_dialog_title,
|
||||||
|
numberOfCertificates));
|
||||||
builder.setCancelable(true);
|
builder.setCancelable(true);
|
||||||
// TODO See b/25772443
|
builder.setPositiveButton(getResources().getQuantityText(
|
||||||
hasDeviceOwner = dpm.getDeviceOwnerComponentOnCallingUser() != null;
|
R.plurals.ssl_ca_cert_settings_button, numberOfCertificates) , this);
|
||||||
int buttonLabel;
|
builder.setNeutralButton(R.string.cancel, null);
|
||||||
if (hasDeviceOwner) {
|
builder.setOnDismissListener(this);
|
||||||
// Institutional case. Show informational message.
|
|
||||||
String message = this.getResources().getString(R.string.ssl_ca_cert_info_message,
|
if (dpm.getProfileOwner() != null) {
|
||||||
dpm.getDeviceOwnerNameOnAnyUser());
|
builder.setMessage(getResources().getQuantityString(R.plurals.ssl_ca_cert_info_message,
|
||||||
builder.setMessage(message);
|
numberOfCertificates, dpm.getProfileOwnerName()));
|
||||||
buttonLabel = R.string.done_button;
|
} else if (dpm.getDeviceOwnerComponentOnCallingUser() != null) {
|
||||||
} else {
|
builder.setMessage(getResources().getQuantityString(R.plurals.ssl_ca_cert_info_message,
|
||||||
|
numberOfCertificates, dpm.getDeviceOwnerNameOnAnyUser()));
|
||||||
|
} else {
|
||||||
// Consumer case. Show scary warning.
|
// Consumer case. Show scary warning.
|
||||||
builder.setIcon(android.R.drawable.stat_notify_error);
|
builder.setIcon(android.R.drawable.stat_notify_error);
|
||||||
builder.setMessage(R.string.ssl_ca_cert_warning_message);
|
builder.setMessage(R.string.ssl_ca_cert_warning_message);
|
||||||
buttonLabel = R.string.ssl_ca_cert_settings_button;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
builder.setPositiveButton(buttonLabel, this);
|
builder.show();
|
||||||
|
|
||||||
final Dialog dialog = builder.create();
|
|
||||||
dialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
|
|
||||||
try {
|
|
||||||
WindowManagerGlobal.getWindowManagerService().dismissKeyguard();
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
}
|
|
||||||
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
|
|
||||||
@Override public void onCancel(DialogInterface dialog) {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dialog.show();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if (hasDeviceOwner) {
|
Intent intent = new Intent(android.provider.Settings.ACTION_TRUSTED_CREDENTIALS_USER);
|
||||||
finish();
|
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
||||||
} else {
|
intent.putExtra(TrustedCredentialsSettings.ARG_SHOW_NEW_FOR_USER, UserHandle.myUserId());
|
||||||
Intent intent =
|
startActivity(intent);
|
||||||
new Intent(android.provider.Settings.ACTION_TRUSTED_CREDENTIALS_USER);
|
finish();
|
||||||
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
}
|
||||||
intent.putExtra(TrustedCredentialsSettings.ARG_SHOW_NEW_FOR_USER,
|
|
||||||
UserHandle.myUserId());
|
@Override
|
||||||
startActivity(intent);
|
public void onDismiss(DialogInterface dialogInterface) {
|
||||||
finish();
|
finish();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user