From 12753ded44813a77a4cad5114d34345bec7b21ef Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Mon, 23 May 2016 17:37:01 +0100 Subject: [PATCH] Fix Certificate authority installed notification is gone when turning off and on the work mode. cause: Work mode is turned on before entering USER_STOPPED state. Thus, BOOT_COMPLETED broadcast is not sent, but the notification has been dismissed. use USER_STARTED + USER_UNLOCKED because both are foreground. Bug: 28864104 Change-Id: I4796b61586e194d8367b9e52a9c56f858cbcbe7d --- .../server/devicepolicy/DevicePolicyManagerService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java index a5eb0b217d1f9..c1913decde16b 100644 --- a/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java +++ b/services/devicepolicy/java/com/android/server/devicepolicy/DevicePolicyManagerService.java @@ -484,7 +484,8 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { } }); } - if (Intent.ACTION_BOOT_COMPLETED.equals(action) + if (Intent.ACTION_USER_UNLOCKED.equals(action) + || Intent.ACTION_USER_STARTED.equals(action) || KeyChain.ACTION_STORAGE_CHANGED.equals(action)) { int userId = intent.getIntExtra(Intent.EXTRA_USER_HANDLE, UserHandle.USER_ALL); new MonitoringCertNotificationTask().execute(userId); @@ -1582,6 +1583,7 @@ public class DevicePolicyManagerService extends IDevicePolicyManager.Stub { filter.addAction(Intent.ACTION_USER_ADDED); filter.addAction(Intent.ACTION_USER_REMOVED); filter.addAction(Intent.ACTION_USER_STARTED); + filter.addAction(Intent.ACTION_USER_UNLOCKED); filter.addAction(KeyChain.ACTION_STORAGE_CHANGED); filter.setPriority(IntentFilter.SYSTEM_HIGH_PRIORITY); mContext.registerReceiverAsUser(mReceiver, UserHandle.ALL, filter, null, mHandler);