diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index db5b07a35da18..788a20c3745ff 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -296,7 +296,8 @@ public final class Settings {
* monitoring of encrypted network traffic.
*
* In some cases, a matching Activity may not exist, so ensure you
- * safeguard against this.
+ * safeguard against this. Add {@link #EXTRA_NUMBER_OF_CERTIFICATES} extra to indicate the
+ * number of certificates.
*
* Input: Nothing.
*
@@ -1369,6 +1370,16 @@ public final class Settings {
public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES =
"android.settings.extra.do_not_disturb_mode_minutes";
+ /**
+ * Activity Extra: Number of certificates
+ *
+ * This can be passed as an extra field to the {@link #ACTION_MONITORING_CERT_INFO}
+ * intent to indicate the number of certificates
+ * @hide
+ */
+ public static final String EXTRA_NUMBER_OF_CERTIFICATES =
+ "android.settings.extra.number_of_certificates";
+
private static final String JID_RESOURCE_PREFIX = "android";
public static final String AUTHORITY = "settings";
diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml
index dd60778adc87a..fa799c985f52d 100644
--- a/core/res/res/values/strings.xml
+++ b/core/res/res/values/strings.xml
@@ -349,18 +349,18 @@
- Network may be monitored
-
+
+ - Certificate authority installed
+ - Certificate authorities installed
+
+
By an unknown third party
-
+
By your work profile administrator
-
+
By %s
diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml
index 98661cfa32a20..e37f8d567c936 100644
--- a/core/res/res/values/symbols.xml
+++ b/core/res/res/values/symbols.xml
@@ -1095,7 +1095,6 @@
-
@@ -1115,6 +1114,7 @@
+
diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
index d2296331bce0c..72e8bd3e871a7 100644
--- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
+++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java
@@ -211,7 +211,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
private static final String ACTION_EXPIRED_PASSWORD_NOTIFICATION
= "com.android.server.ACTION_EXPIRED_PASSWORD_NOTIFICATION";
- private static final int MONITORING_CERT_NOTIFICATION_ID = R.string.ssl_ca_cert_warning;
+ private static final int MONITORING_CERT_NOTIFICATION_ID = R.plurals.ssl_ca_cert_warning;
private static final int PROFILE_WIPED_NOTIFICATION_ID = 1001;
private static final String ATTR_PERMISSION_PROVIDER = "permission-provider";
@@ -2696,23 +2696,25 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
// Build and show a warning notification
int smallIconId;
String contentText;
- // TODO Why does it use the DO name? The cert APIs are all for PO. b/25772443
- final String ownerName = getDeviceOwnerName();
- if (isManagedProfile(userHandle.getIdentifier())) {
- contentText = mContext.getString(R.string.ssl_ca_cert_noti_by_administrator);
+ if (getProfileOwner(userHandle.getIdentifier()) != null) {
+ contentText = mContext.getString(R.string.ssl_ca_cert_noti_managed,
+ getProfileOwnerName(userHandle.getIdentifier()));
smallIconId = R.drawable.stat_sys_certificate_info;
- } else if (ownerName != null) {
- contentText = mContext.getString(R.string.ssl_ca_cert_noti_managed, ownerName);
+ } else if (getDeviceOwnerUserId() == userHandle.getIdentifier()) {
+ contentText = mContext.getString(R.string.ssl_ca_cert_noti_managed,
+ getDeviceOwnerName());
smallIconId = R.drawable.stat_sys_certificate_info;
} else {
contentText = mContext.getString(R.string.ssl_ca_cert_noti_by_unknown);
smallIconId = android.R.drawable.stat_sys_warning;
}
+ final int numberOfCertificates = pendingCertificates.size();
Intent dialogIntent = new Intent(Settings.ACTION_MONITORING_CERT_INFO);
dialogIntent.setFlags(
Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
dialogIntent.setPackage("com.android.settings");
+ dialogIntent.putExtra(Settings.EXTRA_NUMBER_OF_CERTIFICATES, numberOfCertificates);
PendingIntent notifyIntent = PendingIntent.getActivityAsUser(mContext, 0,
dialogIntent, PendingIntent.FLAG_UPDATE_CURRENT, null, userHandle);
@@ -2726,7 +2728,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub {
}
final Notification noti = new Notification.Builder(userContext)
.setSmallIcon(smallIconId)
- .setContentTitle(mContext.getString(R.string.ssl_ca_cert_warning))
+ .setContentTitle(mContext.getResources().getQuantityText(
+ R.plurals.ssl_ca_cert_warning, numberOfCertificates))
.setContentText(contentText)
.setContentIntent(notifyIntent)
.setPriority(Notification.PRIORITY_HIGH)