From ab8c9d79f44e5aa3c749e06457c860564691c70f Mon Sep 17 00:00:00 2001 From: Max Spencer Date: Tue, 17 Jan 2023 17:34:25 +0000 Subject: [PATCH] No screen lock notification Settings already sends a SafetySourceIssue to Safety Center when the user has not set a screen lock. This CL specifies the corresponding notification for Safety Center to post for that issue. Also specified the actionability of this issue as manual (although this is the default so no functional change here, just for clarity). Fix: 265799125 Bug: 260574754 Test: Manually Change-Id: I9d579cdb8061d247e89031a5bc360f8fd5848277 --- res/values/strings.xml | 4 ++++ .../safetycenter/LockScreenSafetySource.java | 12 +++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index f12824780df..a3fad231f0a 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -1044,6 +1044,10 @@ For added security, set a PIN, pattern, or password for this device. Set screen lock + + Device has no screen lock + + For added security, set a PIN, pattern, or password for this device. diff --git a/src/com/android/settings/safetycenter/LockScreenSafetySource.java b/src/com/android/settings/safetycenter/LockScreenSafetySource.java index bdc0a0918a6..ed3ebc004f5 100644 --- a/src/com/android/settings/safetycenter/LockScreenSafetySource.java +++ b/src/com/android/settings/safetycenter/LockScreenSafetySource.java @@ -138,6 +138,12 @@ public final class LockScreenSafetySource { SET_SCREEN_LOCK_ACTION_ID, context.getString(R.string.no_screen_lock_issue_action_label), pendingIntent).build(); + // Custom notification deliberately has zero actions + final SafetySourceIssue.Notification customNotification = + new SafetySourceIssue.Notification.Builder( + context.getString(R.string.no_screen_lock_issue_notification_title), + context.getString(R.string.no_screen_lock_issue_notification_text)) + .build(); return new SafetySourceIssue.Builder( NO_SCREEN_LOCK_ISSUE_ID, context.getString(R.string.no_screen_lock_issue_title), @@ -145,6 +151,10 @@ public final class LockScreenSafetySource { SafetySourceData.SEVERITY_LEVEL_RECOMMENDATION, NO_SCREEN_LOCK_ISSUE_TYPE_ID) .setIssueCategory(SafetySourceIssue.ISSUE_CATEGORY_DEVICE) - .addAction(action).build(); + .addAction(action) + .setIssueActionability(SafetySourceIssue.ISSUE_ACTIONABILITY_MANUAL) + .setCustomNotification(customNotification) + .setNotificationBehavior(SafetySourceIssue.NOTIFICATION_BEHAVIOR_DELAYED) + .build(); } }