Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5380846b authored by Angela Wang's avatar Angela Wang
Browse files

Adds system settings related to flash notifications in settings provider

There are 2 types of flash notifications:
1. Camera flash notification
2. Screen flash notification

Adds 2 internal system settings keys for enabling these 2 kinds of flash notifications. An extra setting is introduced for configuring the color of screen flash notification.

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: I772e8493e41ab6d45187f1feac7482c9784fcce5
parent 96d94102
Loading
Loading
Loading
Loading
+33 −0
Original line number Diff line number Diff line
@@ -5670,6 +5670,36 @@ public final class Settings {
         */
        public static final String LOCALE_PREFERENCES = "locale_preferences";
        /**
         * Setting to enable camera flash notification feature.
         * <ul>
         *     <li> 0 = Off
         *     <li> 1 = On
         * </ul>
         * @hide
         */
        public static final String CAMERA_FLASH_NOTIFICATION = "camera_flash_notification";
        /**
         * Setting to enable screen flash notification feature.
         * <ul>
         *     <li> 0 = Off
         *     <li> 1 = On
         * </ul>
         *  @hide
         */
        public static final String SCREEN_FLASH_NOTIFICATION = "screen_flash_notification";
        /**
         * Integer property that specifes the color for screen flash notification as a
         * packed 32-bit color.
         *
         * @see android.graphics.Color#argb
         * @hide
         */
        public static final String SCREEN_FLASH_NOTIFICATION_COLOR =
                "screen_flash_notification_color_global";
        /**
         * IMPORTANT: If you add a new public settings you also have to add it to
         * PUBLIC_SETTINGS below. If the new setting is hidden you have to add
@@ -5803,6 +5833,9 @@ public final class Settings {
            PRIVATE_SETTINGS.add(TOUCHPAD_NATURAL_SCROLLING);
            PRIVATE_SETTINGS.add(TOUCHPAD_TAP_TO_CLICK);
            PRIVATE_SETTINGS.add(TOUCHPAD_RIGHT_CLICK_ZONE);
            PRIVATE_SETTINGS.add(CAMERA_FLASH_NOTIFICATION);
            PRIVATE_SETTINGS.add(SCREEN_FLASH_NOTIFICATION);
            PRIVATE_SETTINGS.add(SCREEN_FLASH_NOTIFICATION_COLOR);
        }
        /**
+3 −0
Original line number Diff line number Diff line
@@ -115,6 +115,9 @@ message SystemSettingsProto {
        optional SettingProto sound_cache = 2;
        optional SettingProto light_pulse = 3 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto vibration_intensity = 4 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto camera_flash_notification = 5 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto screen_flash_notification = 6 [ (android.privacy).dest = DEST_AUTOMATIC ];
        optional SettingProto screen_flash_notification_color_global = 7 [ (android.privacy).dest = DEST_AUTOMATIC ];
    }
    optional Notification notification = 17;

+3 −0
Original line number Diff line number Diff line
@@ -97,5 +97,8 @@ public class SystemSettings {
        Settings.System.TOUCHPAD_NATURAL_SCROLLING,
        Settings.System.TOUCHPAD_TAP_TO_CLICK,
        Settings.System.TOUCHPAD_RIGHT_CLICK_ZONE,
        Settings.System.CAMERA_FLASH_NOTIFICATION,
        Settings.System.SCREEN_FLASH_NOTIFICATION,
        Settings.System.SCREEN_FLASH_NOTIFICATION_COLOR,
    };
}
+4 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.provider.settings.validators;

import static android.provider.settings.validators.SettingsValidators.ANY_INTEGER_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.ANY_STRING_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.BOOLEAN_VALIDATOR;
import static android.provider.settings.validators.SettingsValidators.COMPONENT_NAME_VALIDATOR;
@@ -215,5 +216,8 @@ public class SystemSettingsValidators {
        VALIDATORS.put(System.UNREAD_NOTIFICATION_DOT_INDICATOR, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.AUTO_LAUNCH_MEDIA_CONTROLS, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.LOCALE_PREFERENCES, ANY_STRING_VALIDATOR);
        VALIDATORS.put(System.CAMERA_FLASH_NOTIFICATION, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.SCREEN_FLASH_NOTIFICATION, BOOLEAN_VALIDATOR);
        VALIDATORS.put(System.SCREEN_FLASH_NOTIFICATION_COLOR, ANY_INTEGER_VALIDATOR);
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -2832,6 +2832,15 @@ class SettingsProtoDumpUtil {
        dumpSetting(s, p,
                Settings.System.NOTIFICATION_VIBRATION_INTENSITY,
                SystemSettingsProto.Notification.VIBRATION_INTENSITY);
        dumpSetting(s, p,
                Settings.System.CAMERA_FLASH_NOTIFICATION,
                SystemSettingsProto.Notification.CAMERA_FLASH_NOTIFICATION);
        dumpSetting(s, p,
                Settings.System.SCREEN_FLASH_NOTIFICATION,
                SystemSettingsProto.Notification.SCREEN_FLASH_NOTIFICATION);
        dumpSetting(s, p,
                Settings.System.SCREEN_FLASH_NOTIFICATION_COLOR,
                SystemSettingsProto.Notification.SCREEN_FLASH_NOTIFICATION_COLOR_GLOBAL);
        // Settings.System.NOTIFICATIONS_USE_RING_VOLUME intentionally excluded since it's deprecated.
        p.end(notificationToken);