Updates to use flash notification settings keys in settings provider
Previously we hard-coded the settings key in FlashNotificationUtils. Change to use internal system settings key for retrieving flash notification settings from the database. Bug: 266775683 Test: make RunSettingsRoboTests ROBOTEST_FILTER=CameraFlashNotificationPreferenceControllerTest Test: make RunSettingsRoboTests ROBOTEST_FILTER=ScreenFlashNotificationPreferenceControllerTest Test: make RunSettingsRoboTests ROBOTEST_FILTER=FlashNotificationsPreviewPreferenceControllerTest Test: make RunSettingsRoboTests ROBOTEST_FILTER=FlashNotificationsUtilTest Change-Id: I1e7a0c4ed58505cfb3c06e43af866744fa1b2d41
This commit is contained in:
@@ -16,8 +16,6 @@
|
||||
|
||||
package com.android.settings.accessibility;
|
||||
|
||||
import static com.android.settings.accessibility.AccessibilityUtil.State.OFF;
|
||||
|
||||
import android.content.Context;
|
||||
import android.hardware.camera2.CameraAccessException;
|
||||
import android.hardware.camera2.CameraCharacteristics;
|
||||
@@ -43,19 +41,10 @@ class FlashNotificationsUtil {
|
||||
static final String EXTRA_FLASH_NOTIFICATION_PREVIEW_TYPE =
|
||||
"com.android.internal.intent.extra.FLASH_NOTIFICATION_PREVIEW_TYPE";
|
||||
|
||||
static final String SETTING_KEY_CAMERA_FLASH_NOTIFICATION =
|
||||
"camera_flash_notification";
|
||||
static final String SETTING_KEY_SCREEN_FLASH_NOTIFICATION =
|
||||
"screen_flash_notification";
|
||||
static final String SETTING_KEY_SCREEN_FLASH_NOTIFICATION_COLOR =
|
||||
"screen_flash_notification_color_global";
|
||||
|
||||
static final int TYPE_SHORT_PREVIEW = 0;
|
||||
static final int TYPE_LONG_PREVIEW = 1;
|
||||
|
||||
static final int DEFAULT_SCREEN_FLASH_COLOR =
|
||||
ScreenFlashNotificationColor.YELLOW.mColorInt;
|
||||
|
||||
static final int DEFAULT_SCREEN_FLASH_COLOR = ScreenFlashNotificationColor.YELLOW.mColorInt;
|
||||
|
||||
@Retention(RetentionPolicy.SOURCE)
|
||||
@IntDef({
|
||||
@@ -128,9 +117,9 @@ class FlashNotificationsUtil {
|
||||
|
||||
final boolean isTorchAvailable = FlashNotificationsUtil.isTorchAvailable(context);
|
||||
final boolean isCameraFlashEnabled = Settings.System.getInt(context.getContentResolver(),
|
||||
SETTING_KEY_CAMERA_FLASH_NOTIFICATION, State.OFF) != State.OFF;
|
||||
Settings.System.CAMERA_FLASH_NOTIFICATION, State.OFF) != State.OFF;
|
||||
final boolean isScreenFlashEnabled = Settings.System.getInt(context.getContentResolver(),
|
||||
SETTING_KEY_SCREEN_FLASH_NOTIFICATION, State.OFF) != State.OFF;
|
||||
Settings.System.SCREEN_FLASH_NOTIFICATION, State.OFF) != State.OFF;
|
||||
|
||||
return ((isTorchAvailable && isCameraFlashEnabled) ? State.CAMERA : State.OFF)
|
||||
| (isScreenFlashEnabled ? State.SCREEN : State.OFF);
|
||||
|
||||
Reference in New Issue
Block a user