summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Elliot Sisteron <elliotsisteron@google.com> 2024-08-14 15:50:53 +0000
committer Elliot Sisteron <elliotsisteron@google.com> 2024-08-14 18:40:39 +0000
commit91b581fdca12f73a3ef180e3d493f9f1a68ba33f (patch)
tree14b44b74ac173853fb32e39aafa4da1d68c1434e
parent102da7f8f5fda0ef927221cc832b28527cf03591 (diff)
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
-rw-r--r--flags/flags.aconfig9
-rw-r--r--service/java/com/android/safetycenter/SafetyCenterFlags.java17
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;
}