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
This commit is contained in:
Angela Wang
2023-02-20 08:15:49 +00:00
parent f3710c72ae
commit b1478ce882
2 changed files with 8 additions and 5 deletions

View File

@@ -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");

View File

@@ -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;