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

Commit 4a84e58d authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Add display and notif vis effects to new modes ui

Test: atest com.android.settings.notification.modes
Flag: android.app.modes_ui
Fixes: 337087926
Fixes: 308820151
Change-Id: Id9cd9cc4b2d521713a2ba1d4581eb818ad0e5eee
parent 3f2bcf97
Loading
Loading
Loading
Loading
+52 −4
Original line number Diff line number Diff line
@@ -7948,8 +7948,55 @@
    <!--  Do not disturb: Subtitle for the Visual signals option to toggle on/off visual signals/alerts when the screen is on/when screen is off. [CHAR LIMIT=30] -->
    <string name="zen_mode_visual_signals_settings_subtitle">Allow visual signals</string>
    <!-- Do not disturb: mode page section title [CHAR LIMIT=80] -->
    <string name="mode_interruption_filter_title">Notifications that can reach you</string>
    <!-- Do not disturb: mode page section title [CHAR LIMIT=80] -->
    <string name="mode_device_effects_title">Additional actions</string>
    <!-- Do not disturb: display settings title [CHAR LIMIT=80] -->
    <string name="mode_display_settings_title">Display settings</string>
    <!-- Do not disturb: display options section header [CHAR LIMIT=80] -->
    <string name="mode_display_options_section">Display options</string>
    <!-- Do not disturb: device effect option, title or first in list [CHAR LIMIT=80] -->
    <string name="mode_grayscale_title">Grayscale</string>
    <!-- Do not disturb: device effect option, not first in list [CHAR LIMIT=80] -->
    <string name="mode_grayscale_title_secondary_list">grayscale</string>
    <!-- Do not disturb: device effect summary [CHAR LIMIT=NONE] -->
    <string name="mode_grayscale_summary">Change the screen to black and white</string>
    <!-- Do not disturb: device effect option, title or first in list [CHAR LIMIT=80] -->
    <string name="mode_aod_title">Keep the screen dark</string>
    <!-- Do not disturb: device effect option, not first in list [CHAR LIMIT=80] -->
    <string name="mode_aod_title_secondary_list">keep the screen dark</string>
    <!-- Do not disturb: device effect summary [CHAR LIMIT=NONE] -->
    <string name="mode_aod_summary">Disable always on display</string>
    <!-- Do not disturb: device effect option , title or first in list[CHAR LIMIT=80] -->
    <string name="mode_wallpaper_title">Dim the wallpaper</string>
    <!-- Do not disturb: device effect option, not first in list [CHAR LIMIT=80] -->
    <string name="mode_wallpaper_title_secondary_list">dim the wallpaper</string>
    <!-- Do not disturb: device effect summary [CHAR LIMIT=NONE] -->
    <string name="mode_wallpaper_summary">Filter the brightness of the wallpaper</string>
    <!-- Do not disturb: device effect option, title or first in list [CHAR LIMIT=80] -->
    <string name="mode_dark_theme_title">Enable dark theme</string>
    <!-- Do not disturb: device effect option, not first in list [CHAR LIMIT=80] -->
    <string name="mode_dark_theme_title_secondary_list">enable dark theme</string>
    <!-- Do not disturb: device effect summary [CHAR LIMIT=NONE] -->
    <string name="mode_dark_theme_summary">Switch the OS and apps to prefer light text on a dark
        background, which may be easier on the eyes and confers significant battery savings on some devices</string>
    <!-- [CHAR LIMIT=NONE] Zen mode settings: Summary for sound interruption settings -->
    <string name="mode_display_settings_summary">
        {count, plural, offset:2
        =0    {No display changes}
        =1    {{effect_1}}
        =2    {{effect_1} and {effect_2}}
        =3    {{effect_1}, {effect_2}, and {effect_3}}
        other {{effect_1}, {effect_2}, and # more}
        }
    </string>
    <!-- Do not disturb: restrict notifications settings title [CHAR LIMIT=80] -->
    <string name="zen_mode_restrict_notifications_title">Display options for hidden notifications</string>
    <string name="zen_mode_restrict_notifications_title">Display options for filtered
        notifications</string>
    <!-- Do not disturb: Hide notifications screen category title [CHAR LIMIT=100] -->
    <string name="zen_mode_restrict_notifications_category">When Do Not Disturb is on</string>
    <!-- Do not disturb: Mute notifications option [CHAR LIMIT=60] -->
@@ -7971,11 +8018,12 @@
    <!-- Do not disturb: restrict notifications page, menu option [CHAR LIMIT=60] -->
    <string name="zen_mode_restrict_notifications_disable_custom">Remove custom setting</string>
    <!-- Do not disturb: restrict notifications page, menu option [CHAR LIMIT=60] -->
    <string name="zen_mode_restrict_notifications_summary_muted">No sound from notifications</string>
    <string name="zen_mode_restrict_notifications_summary_muted">Notifications shown</string>
    <!-- Do not disturb: restrict notifications page, menu option [CHAR LIMIT=60] -->
    <string name="zen_mode_restrict_notifications_summary_custom">Partially hidden</string>
    <string name="zen_mode_restrict_notifications_summary_custom">Notifications partially
        hidden</string>
    <!-- Do not disturb: restrict notifications page, menu option [CHAR LIMIT=100] -->
    <string name="zen_mode_restrict_notifications_summary_hidden">No visuals or sound from notifications</string>
    <string name="zen_mode_restrict_notifications_summary_hidden">Notifications hidden</string>
    <!-- Do not disturb: what to block title [CHAR LIMIT = 60] -->
    <string name="zen_mode_what_to_block_title">Custom restrictions</string>
+45 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2024 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:title="@string/mode_display_settings_title">

    <PreferenceCategory
        android:key="display_options"
        android:title="@string/mode_display_options_section">
        <Preference
                android:key="notification_visibility"
                android:title="@string/zen_mode_restrict_notifications_title" />
        <SwitchPreferenceCompat
                android:key="effect_greyscale"
                android:title="@string/mode_grayscale_title"
                android:summary="@string/mode_grayscale_summary"/>
        <SwitchPreferenceCompat
                android:key="effect_aod"
                android:title="@string/mode_aod_title"
                android:summary="@string/mode_aod_summary"/>
        <SwitchPreferenceCompat
                android:key="effect_wallpaper"
                android:title="@string/mode_wallpaper_title"
                android:summary="@string/mode_wallpaper_summary"/>
        <SwitchPreferenceCompat
                android:key="effect_dark_theme"
                android:title="@string/mode_dark_theme_title"
                android:summary="@string/mode_dark_theme_summary"/>
    </PreferenceCategory>
</PreferenceScreen>
+59 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
     Copyright (C) 2024 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:key="zen_mode_block_settings_page"
    android:title="@string/zen_mode_restrict_notifications_title">

   <PreferenceCategory
       android:title="@string/zen_mode_block_effects_screen_off"
       android:key="zen_mode_block_screen_off">

       <com.android.settings.widget.DisabledCheckBoxPreference
           android:key="zen_effect_intent"
           android:title="@string/zen_mode_block_effect_intent" />

       <com.android.settings.widget.DisabledCheckBoxPreference
           android:key="zen_effect_light"
           android:title="@string/zen_mode_block_effect_light" />

       <com.android.settings.widget.DisabledCheckBoxPreference
           android:key="zen_effect_ambient"
           android:title="@string/zen_mode_block_effect_ambient" />

   </PreferenceCategory>
    <PreferenceCategory
        android:title="@string/zen_mode_block_effects_screen_on"
        android:key="zen_mode_block_screen_on">
       <com.android.settings.widget.DisabledCheckBoxPreference
           android:key="zen_effect_badge"
           android:title="@string/zen_mode_block_effect_badge" />

        <com.android.settings.widget.DisabledCheckBoxPreference
            android:key="zen_effect_status"
            android:title="@string/zen_mode_block_effect_status" />

        <com.android.settings.widget.DisabledCheckBoxPreference
            android:key="zen_effect_peek"
            android:title="@string/zen_mode_block_effect_peek" />

       <com.android.settings.widget.DisabledCheckBoxPreference
           android:key="zen_effect_list"
           android:title="@string/zen_mode_block_effect_list" />
   </PreferenceCategory>
</PreferenceScreen>
+17 −6
Original line number Diff line number Diff line
@@ -22,6 +22,9 @@
            android:key="header"
            android:layout="@layout/settings_entity_header" />

    <PreferenceCategory
            android:title="@string/mode_interruption_filter_title"
            android:key="modes_filters">
        <Preference
                android:key="zen_mode_people"
                android:title="@string/zen_category_people"/>
@@ -29,5 +32,13 @@
        <Preference
                android:key="zen_other_settings"
                android:title="@string/zen_category_exceptions" />
    </PreferenceCategory>

    <PreferenceCategory
            android:title="@string/mode_device_effects_title"
            android:key="modes_additional_actions">
        <Preference
                android:key="mode_display_settings"
                android:title="@string/mode_display_settings_title" />
    </PreferenceCategory>
</PreferenceScreen>
 No newline at end of file
+9 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ class ZenMode {
                    .build();

    private final String mId;
    private final AutomaticZenRule mRule;
    private AutomaticZenRule mRule;
    private final boolean mIsActive;
    private final boolean mIsManualDnd;

@@ -190,6 +190,14 @@ class ZenMode {
        }
    }

    /**
     * Use sparingly. If you're updating a policy field, use
     * {@link #setPolicy(android.service.notification.ZenPolicy)} instead.
     */
    public void setAzr(@NonNull AutomaticZenRule newRule) {
        mRule = newRule;
    }

    /**
     * Updates the {@link ZenPolicy} of the associated {@link AutomaticZenRule} based on the
     * supplied policy. In some cases this involves conversions, so that the following call
Loading