diff options
-rw-r--r-- | flags/flags.aconfig | 9 | ||||
-rw-r--r-- | service/java/com/android/safetycenter/SafetyCenterFlags.java | 17 |
2 files changed, 20 insertions, 6 deletions
diff --git a/flags/flags.aconfig b/flags/flags.aconfig index 03969d737..98c64507d 100644 --- a/flags/flags.aconfig +++ b/flags/flags.aconfig @@ -72,3 +72,12 @@ flag { bug: "354234946" is_fixed_read_only: true } + +flag { + name: "odad_notifications_supported" + is_exported: true + namespace: "permissions" + description: "This flag is used to enable Safety Center notifications support for ODAD" + bug: "356910008" + is_fixed_read_only: true +} diff --git a/service/java/com/android/safetycenter/SafetyCenterFlags.java b/service/java/com/android/safetycenter/SafetyCenterFlags.java index e51d3a1cf..758744191 100644 --- a/service/java/com/android/safetycenter/SafetyCenterFlags.java +++ b/service/java/com/android/safetycenter/SafetyCenterFlags.java @@ -28,6 +28,7 @@ import android.util.Log; import androidx.annotation.Nullable; import com.android.modules.utils.build.SdkLevel; +import com.android.permission.flags.Flags; import com.android.safetycenter.resources.SafetyCenterResourcesApk; import java.io.PrintWriter; @@ -123,6 +124,8 @@ 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> sAllowedNotificationSources = + new ArraySet<>(new String[] {"GoogleAppProtectionService"}); private static final ArraySet<String> sAllowedNotificationSourcesUPlus = new ArraySet<>(new String[] {"GoogleBackupAndRestore"}); @@ -251,15 +254,17 @@ public final class SafetyCenterFlags { */ public static ArraySet<String> getNotificationsAllowedSourceIds() { ArraySet<String> sources = getNotificationsAllowedSourceIdsFlag(); + // 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 + if (Flags.odadNotificationsSupported()) { + sources.addAll(sAllowedNotificationSources); + } 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; } |