From 8560a7c2a1681276ccf8cb04dfd02bfea6251af4 Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Mon, 9 May 2016 16:05:32 +0100 Subject: [PATCH] Fix ConfirmCredential is not presented before trusting cert installed by PO/DO - TrustedCredential is responsible to show ConfirmCredential - Show the MonitoringCerInfoActivity in personal side instead to avoid showing work challenge - put user id into extra Bug: 28619980 Change-Id: Iedbc0b721ef56675f3c9eb6f1d12daf1222ad080 --- .../server/devicepolicy/DevicePolicyManagerService.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index 56e2001872e12..6eabb4ab6525d 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -2696,10 +2696,12 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { // Build and show a warning notification int smallIconId; String contentText; + int parentUserId = userHandle.getIdentifier(); 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; + parentUserId = getProfileParentId(userHandle.getIdentifier()); } else if (getDeviceOwnerUserId() == userHandle.getIdentifier()) { contentText = mContext.getString(R.string.ssl_ca_cert_noti_managed, getDeviceOwnerName()); @@ -2711,12 +2713,13 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { 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.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); dialogIntent.setPackage("com.android.settings"); dialogIntent.putExtra(Settings.EXTRA_NUMBER_OF_CERTIFICATES, numberOfCertificates); + dialogIntent.putExtra(Intent.EXTRA_USER_ID, userHandle.getIdentifier()); PendingIntent notifyIntent = PendingIntent.getActivityAsUser(mContext, 0, - dialogIntent, PendingIntent.FLAG_UPDATE_CURRENT, null, userHandle); + dialogIntent, PendingIntent.FLAG_UPDATE_CURRENT, null, + new UserHandle(parentUserId)); final Context userContext; try {