diff options
author | Jan Tomljanovic <jtomljanovic@google.com> | 2024-01-03 14:52:49 +0000 |
---|---|---|
committer | Jan Tomljanovic <jtomljanovic@google.com> | 2024-01-08 16:45:26 +0000 |
commit | d5d7a022477cdd4cd28cdf9baf96b0e326bd0c4b (patch) | |
tree | ecafa72db9b4be728de62ec4cd31f1178ee9d1fd | |
parent | 61b4ee0555820c54da0ee0548efdf6ccae673a30 (diff) | |
download | Permission-d5d7a022477cdd4cd28cdf9baf96b0e326bd0c4b.tar.gz |
Override notification allowed sources flag.
Test: manual
Bug: 312443616
Relnote: Enables backup notification for U+ devices
Change-Id: Iee5acdb6d05128e5f6ec3fd5cdcec571ea107f9f
-rw-r--r-- | service/java/com/android/safetycenter/SafetyCenterFlags.java | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/service/java/com/android/safetycenter/SafetyCenterFlags.java b/service/java/com/android/safetycenter/SafetyCenterFlags.java index 67c4d25d6..e51d3a1cf 100644 --- a/service/java/com/android/safetycenter/SafetyCenterFlags.java +++ b/service/java/com/android/safetycenter/SafetyCenterFlags.java @@ -123,6 +123,9 @@ public final class SafetyCenterFlags { private static final String RESURFACE_ISSUE_DELAYS_DEFAULT = ""; private static final Duration RESURFACE_ISSUE_DELAYS_DEFAULT_DURATION = Duration.ofDays(180); + private static final ArraySet<String> sAllowedNotificationSourcesUPlus = + new ArraySet<>(new String[] {"GoogleBackupAndRestore"}); + private static volatile String sUntrackedSourcesDefault = "AndroidAccessibility,AndroidBackgroundLocation," + "AndroidNotificationListener,AndroidPermissionAutoRevoke"; @@ -175,7 +178,10 @@ public final class SafetyCenterFlags { fout.println("FLAGS"); printFlag(fout, PROPERTY_SAFETY_CENTER_ENABLED, getSafetyCenterEnabled()); printFlag(fout, PROPERTY_NOTIFICATIONS_ENABLED, getNotificationsEnabled()); - printFlag(fout, PROPERTY_NOTIFICATIONS_ALLOWED_SOURCES, getNotificationsAllowedSourceIds()); + printFlag( + fout, + PROPERTY_NOTIFICATIONS_ALLOWED_SOURCES, + getNotificationsAllowedSourceIdsFlag()); printFlag(fout, PROPERTY_NOTIFICATIONS_MIN_DELAY, getNotificationsMinDelay()); printFlag( fout, @@ -244,6 +250,20 @@ public final class SafetyCenterFlags { * and therefore this is the only way to enable notifications for sources on Android T. */ public static ArraySet<String> getNotificationsAllowedSourceIds() { + ArraySet<String> sources = getNotificationsAllowedSourceIdsFlag(); + if (SdkLevel.isAtLeastU()) { + // This is a hack to update the flag value via mainline update. Reasons why we can't do + // this via: + // remote flag update - these are generally avoided and considered risky + // XML config - it would break GTS tests for OEMs that have a separate config copy + // default flag value - it would also require a remote flag update + sources.addAll(sAllowedNotificationSourcesUPlus); + } + + return sources; + } + + private static ArraySet<String> getNotificationsAllowedSourceIdsFlag() { return getCommaSeparatedStrings(PROPERTY_NOTIFICATIONS_ALLOWED_SOURCES); } |