Skip to content

Commit 78f2d56

Browse files
committed
Don't update PO-specific notifications if not one
Can cause a crash if BOOT_COMPLETED is received before provisioning. Bug: 26811719 Change-Id: I5edef01529b83c7a223d1d7fb788e8979da78c8e
1 parent 2bc7482 commit 78f2d56

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

app/src/main/java/com/afwsamples/testdpc/DeviceAdminReceiver.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,13 @@ public void onPasswordChanged(Context context, Intent intent) {
276276
private static void updatePasswordQualityNotification(Context context) {
277277
DevicePolicyManager devicePolicyManager = (DevicePolicyManager) context.getSystemService(
278278
Context.DEVICE_POLICY_SERVICE);
279+
280+
if (!devicePolicyManager.isProfileOwnerApp(context.getPackageName())
281+
&& !devicePolicyManager.isDeviceOwnerApp(context.getPackageName())) {
282+
// Only try to update the notification if we are a profile or device owner.
283+
return;
284+
}
285+
279286
NotificationManager nm = (NotificationManager)
280287
context.getSystemService(Context.NOTIFICATION_SERVICE);
281288

0 commit comments

Comments
 (0)