Fix text in notification settings for apps that do not send notifications

Added a new string to show for apps apps that target T, but do not declare the POST_NOTIFICATIONS permission in notification settings.

Bug: 229108007
Test: `croot` `make -j64 RunSettingsRoboTests ROBOTEST_FILTER="com.android.settings.notification.app.NotificationsOffPreferenceControllerTest"` and manual: open Settings-Notifications-App Settings, check the text for apps that does not post notifications with toggle disabled. Text should be: "This app does not send notifications" when system language is English.
Change-Id: I9822b6f983e00c5982522099e339d86fae45aefe
This commit is contained in:
Yining Liu
2022-10-25 20:22:12 +00:00
parent f5a9766041
commit e899b4c96c
4 changed files with 30 additions and 0 deletions

View File

@@ -126,6 +126,7 @@ public class NotificationBackend {
if (app.requestedPermissions == null || Arrays.stream(app.requestedPermissions)
.noneMatch(p -> p.equals(android.Manifest.permission.POST_NOTIFICATIONS))) {
row.lockedImportance = true;
row.permissionStateLocked = true;
}
}
}
@@ -684,6 +685,9 @@ public class NotificationBackend {
public boolean systemApp;
public boolean lockedImportance;
public boolean showBadge;
// For apps target T but have not but has not requested the permission
// we cannot change the permission state
public boolean permissionStateLocked;
public int bubblePreference = NotificationManager.BUBBLE_PREFERENCE_NONE;
public int userId;
public int blockedChannelCount;