From 91b581fdca12f73a3ef180e3d493f9f1a68ba33f Mon Sep 17 00:00:00 2001 From: Elliot Sisteron Date: Wed, 14 Aug 2024 15:50:53 +0000 Subject: Add ODAD to safety center notifications allowed hack. We can't roll this change out remotely (as per existing comment), so rolling this out in code instead. Bug: 356910008 Test: atest CtsSafetyCenterTestCases Relnote: N/A Flag: com.android.permission.flags.odad_notifications_supported Change-Id: I3d4dff60bf0adf40c3a157a557a5ea917be4454c LOW_COVERAGE_REASON=b/356910008 --- .../com/android/safetycenter/SafetyCenterFlags.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'service/java') 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 sAllowedNotificationSources = + new ArraySet<>(new String[] {"GoogleAppProtectionService"}); private static final ArraySet sAllowedNotificationSourcesUPlus = new ArraySet<>(new String[] {"GoogleBackupAndRestore"}); @@ -251,15 +254,17 @@ public final class SafetyCenterFlags { */ public static ArraySet getNotificationsAllowedSourceIds() { ArraySet 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; } -- cgit v1.2.3-59-g8ed1b