From b1478ce882cb88ebc85c90bec18a8abf8b61c47f Mon Sep 17 00:00:00 2001 From: Angela Wang Date: Mon, 20 Feb 2023 08:15:49 +0000 Subject: Applies feature flag on Flash Notifications Renames the feature flag and avoids starting flash notifications when the feature is off. Bug: 237628564 Test: manual test Change-Id: If3cb246f3bbe9a2b212bbac5bcb4f492f72d40a6 --- core/java/android/util/FeatureFlagUtils.java | 6 +++--- .../android/server/accessibility/FlashNotificationsController.java | 7 +++++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/core/java/android/util/FeatureFlagUtils.java b/core/java/android/util/FeatureFlagUtils.java index a746dc6c15f0..2ae882c81b50 100644 --- a/core/java/android/util/FeatureFlagUtils.java +++ b/core/java/android/util/FeatureFlagUtils.java @@ -164,10 +164,10 @@ public class FeatureFlagUtils { */ public static final String SETTINGS_AUDIO_ROUTING = "settings_audio_routing"; - /** Flag to enable/disable flash alerts + /** Flag to enable/disable flash notifications * @hide */ - public static final String SETTINGS_FLASH_ALERTS = "settings_flash_alerts"; + public static final String SETTINGS_FLASH_NOTIFICATIONS = "settings_flash_notifications"; /** * Flag to disable/enable showing udfps enroll view in settings. If it's disabled, udfps enroll @@ -232,7 +232,7 @@ public class FeatureFlagUtils { DEFAULT_FLAGS.put(SETTINGS_ACCESSIBILITY_HEARING_AID_PAGE, "false"); DEFAULT_FLAGS.put(SETTINGS_PREFER_ACCESSIBILITY_MENU_IN_SYSTEM, "false"); DEFAULT_FLAGS.put(SETTINGS_AUDIO_ROUTING, "false"); - DEFAULT_FLAGS.put(SETTINGS_FLASH_ALERTS, "false"); + DEFAULT_FLAGS.put(SETTINGS_FLASH_NOTIFICATIONS, "true"); DEFAULT_FLAGS.put(SETTINGS_SHOW_UDFPS_ENROLL_IN_SETTINGS, "true"); DEFAULT_FLAGS.put(SETTINGS_ENABLE_LOCKSCREEN_TRANSFER_API, "false"); DEFAULT_FLAGS.put(SETTINGS_REMOTE_DEVICE_CREDENTIAL_VALIDATION, "false"); diff --git a/services/accessibility/java/com/android/server/accessibility/FlashNotificationsController.java b/services/accessibility/java/com/android/server/accessibility/FlashNotificationsController.java index 86b5a12f3c47..a94ab34bc8b3 100644 --- a/services/accessibility/java/com/android/server/accessibility/FlashNotificationsController.java +++ b/services/accessibility/java/com/android/server/accessibility/FlashNotificationsController.java @@ -53,6 +53,7 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.provider.Settings; +import android.util.FeatureFlagUtils; import android.util.Log; import android.view.Display; import android.view.View; @@ -342,10 +343,12 @@ class FlashNotificationsController { private void requestStartFlashNotification(FlashNotification flashNotification) { if (DEBUG) Log.d(LOG_TAG, "requestStartFlashNotification"); - mIsCameraFlashNotificationEnabled = Settings.System.getIntForUser( + boolean isFeatureOn = FeatureFlagUtils.isEnabled(mContext, + FeatureFlagUtils.SETTINGS_FLASH_NOTIFICATIONS); + mIsCameraFlashNotificationEnabled = isFeatureOn && Settings.System.getIntForUser( mContext.getContentResolver(), SETTING_KEY_CAMERA_FLASH_NOTIFICATION, 0, UserHandle.USER_CURRENT) != 0; - mIsScreenFlashNotificationEnabled = Settings.System.getIntForUser( + mIsScreenFlashNotificationEnabled = isFeatureOn && Settings.System.getIntForUser( mContext.getContentResolver(), SETTING_KEY_SCREEN_FLASH_NOTIFICATION, 0, UserHandle.USER_CURRENT) != 0; -- cgit v1.2.3-59-g8ed1b