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

Commit 84571f53 authored by Yining Liu's avatar Yining Liu Committed by Android (Google) Code Review
Browse files

Merge changes from topic "lockscreen-notif-settings-page" into main

* changes:
  Replace the existing notifications on lock screen preferences with new page
  Implement the preference switch for minimalism on ls settings page
  Implement the Hide seen notifications toggle
  Implement the hide silent notifications toggle
  Implement the show sensitive content toggle
  Implement the main switch of notifications on lock screen
  Add the new settings page for lock screen notifs
parents 69a0c61f 85aa7f7c
Loading
Loading
Loading
Loading
+121 −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.
  -->

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="wrap_content">

    <TextView
        android:id="@+id/notif_ls_style_desc"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingVertical="@dimen/settingslib_illustration_padding"
        android:paddingEnd="48dp"
        android:paddingStart="48dp"
        android:layout_gravity="center_horizontal"
        android:gravity="center"
        android:focusable="true"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:textColor="?android:attr/textColorSecondary"/>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginBottom="16dp"
        android:orientation="horizontal">

        <Space
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"/>

        <LinearLayout
            android:id="@+id/button_compact"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <FrameLayout
                android:layout_width="@dimen/contrast_button_total_size"
                android:layout_height="@dimen/contrast_button_total_size"
                android:background="@drawable/accessibility_contrast_button_background">

                <ImageView
                    android:layout_gravity="center"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:contentDescription="@null"
                    android:src="@drawable/ic_contrast_standard"/>
            </FrameLayout>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/contrast_button_text_spacing"
                android:gravity="center_horizontal|top"
                android:ellipsize="end"
                android:singleLine="true"
                android:textSize="@dimen/contrast_button_text_size"
                android:text="@string/lock_screen_notifs_show_compact"
                android:textColor="?androidprv:attr/materialColorOnSurface"/>
        </LinearLayout>

        <Space
            android:layout_width="@dimen/contrast_button_horizontal_spacing"
            android:layout_height="match_parent" />

        <LinearLayout
            android:id="@+id/button_full"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <FrameLayout
                android:layout_width="@dimen/contrast_button_total_size"
                android:layout_height="@dimen/contrast_button_total_size"
                android:background="@drawable/accessibility_contrast_button_background">

                <ImageView
                    android:layout_gravity="center"
                    android:layout_height="wrap_content"
                    android:layout_width="wrap_content"
                    android:contentDescription="@null"
                    android:src="@drawable/ic_contrast_high"/>
            </FrameLayout>

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="@dimen/contrast_button_text_spacing"
                android:gravity="center_horizontal|top"
                android:ellipsize="end"
                android:singleLine="true"
                android:textSize="@dimen/contrast_button_text_size"
                android:text="@string/lock_screen_notifs_show_full_list"
                android:textColor="?androidprv:attr/materialColorOnSurface"/>
        </LinearLayout>

        <Space
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:layout_weight="1"/>
    </LinearLayout>

</LinearLayout>
+24 −0
Original line number Diff line number Diff line
@@ -8789,6 +8789,18 @@
    <!-- Configure notifications: Summary for option of showing only new notifications on the lock screen. [CHAR LIMIT=100] -->
    <string name="unseen_notifs_lock_screen_summary">Automatically remove previously viewed notifications from the lock screen</string>
    <!-- Configure notifications: Value for lockscreen notifications: show all notifications [CHAR LIMIT=60] -->
    <string name="lock_screen_notifs_show_full_list">Full list</string>
    <!-- Configure notifications: Summary for lockscreen notifications: show all notifications [CHAR LIMIT=100] -->
    <string name="lock_screen_notifs_full_list_desc">The current default placement is a full shelf and notification stack.</string>
    <!-- Configure notifications: Value for lockscreen notifications: show compact notifications (minimalism on) [CHAR LIMIT=60] -->
    <string name="lock_screen_notifs_show_compact">Compact</string>
    <!-- Configure notifications: Summary for lockscreen notifications: show compact notifications (minimalism on) [CHAR LIMIT=60] -->
    <string name="lock_screen_notifs_compact_desc">New notifications are collapsed into a shelf on your lockscreen.</string>
    <!-- Configure notifications: Title for determining which notifications appear on the lock screen [CHAR LIMIT=60] -->
    <string name="lock_screen_notifs_title">Notifications on lock screen</string>
@@ -8851,6 +8863,18 @@
    <!-- Security > Choose PIN/PW/Pattern > Notification redaction interstitial: Message asking the user how they want their profile notifications to appear when the device is locked [CHAR LIMIT=NONE] -->
    <string name="lock_screen_notifications_interstitial_message_profile">When your device is locked, how do you want profile notifications to show?</string>
    <!-- Notification Settings > Notifications on lock screen > Title for hiding seen notifications toggle. [CHAR LIMIT=30] -->
    <string name="lock_screen_notification_hide_seen_title">Hide seen notifications</string>
    <!-- Notification Settings > Notifications on lock screen > Summary for hiding seen notifications toggle. [CHAR LIMIT=30] -->
    <string name="lock_screen_notification_hide_seen_summary">Seen notifications are removed from the lock screen.</string>
    <!-- Notification Settings > Notifications on lock screen > Title for hiding silent notifications toggle. [CHAR LIMIT=30] -->
    <string name="lock_screen_notification_hide_silent_title">Hide silent notifications</string>
    <!-- Notification Settings > Notifications on lock screen > Summary for hiding seen notifications toggle. [CHAR LIMIT=30] -->
    <string name="lock_screen_notification_hide_silent_summary">Silent notifications and conversations are removed from the lock screen.</string>
    <!-- Security > Choose PIN/PW/Pattern > Notification redaction interstitial: Title for the screen asking the user how they want their profile notifications to appear when the device is locked [CHAR LIMIT=30] -->
    <string name="lock_screen_notifications_interstitial_title_profile">Profile notifications</string>
+22 −14
Original line number Diff line number Diff line
@@ -92,23 +92,31 @@
            android:singleLineTitle="false"
            android:summary="@string/summary_placeholder" />

        <Preference
            android:key="lock_screen_notifications_page"
            android:order="14"
            android:persistent="false"
            android:title="@string/lock_screen_notifs_title"
            android:fragment="com.android.settings.notification.LockScreenNotificationsPreferencePageFragment"
            settings:controller="com.android.settings.notification.LockScreenNotificationsPreferencePageController" />

        <com.android.settingslib.RestrictedSwitchPreference
            android:key="lock_screen_redact"
            android:order="14"
            android:order="15"
            android:title="@string/lock_screen_notifs_redact"
            android:summary="@string/lock_screen_notifs_redact_summary"
            settings:controller="com.android.settings.notification.RedactNotificationPreferenceController" />

        <com.android.settingslib.RestrictedSwitchPreference
            android:key="lock_screen_work_redact"
            android:order="15"
            android:order="16"
            android:title="@string/lock_screen_notifs_redact_work"
            android:summary="@string/lock_screen_notifs_redact_work_summary"
            settings:controller="com.android.settings.notification.RedactNotificationPreferenceController" />

        <SwitchPreferenceCompat
            android:key="notification_lockscreen_bypass"
            android:order="16"
            android:order="17"
            android:title="@string/lockscreen_bypass_title"
            android:summary="@string/lockscreen_bypass_summary"
            settings:searchable="false"
@@ -129,14 +137,14 @@
        <Preference
            android:fragment="com.android.settings.notification.PoliteNotificationsPreferenceFragment"
            android:key="polite_notifications_preference"
            android:order="17"
            android:order="18"
            android:persistent="false"
            android:title="@string/notification_polite_title"
            settings:controller="com.android.settings.notification.PoliteNotificationsPreferenceController" />

        <com.android.settingslib.RestrictedPreference
            android:key="zen_mode_notifications"
            android:order="18"
            android:order="19"
            android:title="@string/zen_mode_settings_title"
            settings:useAdminDisabledSummary="true"
            android:fragment="com.android.settings.notification.zen.ZenModeSettings"
@@ -145,7 +153,7 @@

        <SwitchPreferenceCompat
            android:key="lock_screen_notif_minimalism"
            android:order="19"
            android:order="20"
            android:title="@string/lock_screen_notif_minimalism"
            android:summary="@string/lock_screen_notif_minimalism_summary"
            settings:controller="com.android.settings.notification.LockscreenNotificationMinimalismPreferenceController"
@@ -153,7 +161,7 @@

        <SwitchPreferenceCompat
            android:key="lock_screen_show_only_unseen_notifs"
            android:order="20"
            android:order="21"
            android:title="@string/unseen_notifs_lock_screen"
            android:summary="@string/unseen_notifs_lock_screen_summary"
            settings:controller="com.android.settings.notification.ShowOnlyUnseenNotificationsOnLockscreenPreferenceController"
@@ -162,7 +170,7 @@
        <Preference
            android:fragment="com.android.settings.accessibility.FlashNotificationsPreferenceFragment"
            android:key="flash_notifications_preference"
            android:order="21"
            android:order="22"
            android:persistent="false"
            android:title="@string/flash_notifications_title"
            settings:searchable="false"
@@ -170,7 +178,7 @@

        <com.android.settingslib.RestrictedPreference
            android:key="app_and_notif_cell_broadcast_settings"
            android:order="22"
            android:order="23"
            android:title="@string/cell_broadcast_settings"
            settings:useAdminDisabledSummary="true">
            <intent
@@ -181,33 +189,33 @@

        <SwitchPreferenceCompat
             android:key="silent_icons"
             android:order="23"
             android:order="24"
             android:title="@string/silent_notifications_status_bar"
             settings:controller="com.android.settings.notification.SilentStatusBarPreferenceController"/>

        <SwitchPreferenceCompat
            android:key="show_snooze_options"
            android:order="24"
            android:order="25"
            android:title="@string/snooze_options_title"
            settings:controller="com.android.settings.notification.SnoozeNotificationPreferenceController" />

        <!-- Notification badging -->
        <SwitchPreferenceCompat
            android:key="notification_badging"
            android:order="25"
            android:order="26"
            android:title="@string/notification_badging_title"
            settings:controller="com.android.settings.notification.BadgingNotificationPreferenceController"/>

        <!-- Pulse notification light, on devices that support it -->
        <SwitchPreferenceCompat
            android:key="notification_pulse"
            android:order="26"
            android:order="27"
            android:title="@string/notification_pulse_title"
            settings:controller="com.android.settings.notification.PulseNotificationPreferenceController"/>

        <SwitchPreferenceCompat
            android:key="notification_assistant"
            android:order="27"
            android:order="28"
            android:title="@string/notification_assistant_title"
            android:summary="@string/notification_assistant_summary"
            settings:controller="com.android.settings.notification.NotificationAssistantPreferenceController"/>
+69 −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/lock_screen_notifs_title"
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <com.android.settingslib.widget.MainSwitchPreference
        android:key="lock_screen_notification_global_pref"
        android:title="@string/switch_on_text"
        settings:controller="com.android.settings.notification.LockScreenNotificationsGlobalPreferenceController"/>

<!--    TODO: replace res with actual illustrations when we have -->
    <com.android.settingslib.widget.IllustrationPreference
        android:key="compact_illustration"
        settings:searchable="false"
        android:selectable="false"
        settings:dynamicColor="true"/>

    <com.android.settingslib.widget.IllustrationPreference
        android:key="full_list_illustration"
        settings:searchable="false"
        android:selectable="false"
        settings:dynamicColor="true"/>

    <com.android.settingslib.widget.LayoutPreference
        android:key="ls_minimalism"
        android:selectable="false"
        android:layout="@layout/notification_ls_minimalism_selector"
        settings:controller="com.android.settings.notification.lockscreen.MinimalismPreferenceController" />

    <com.android.settingslib.RestrictedSwitchPreference
        android:key="lock_screen_notification_show_sensitive_toggle"
        android:title="@string/lock_screen_notifications_summary_hide"
        settings:controller="com.android.settings.notification.LockScreenNotificationShowSensitiveToggleController" />

    <com.android.settingslib.RestrictedSwitchPreference
        android:key="work_profile_show_sensitive_notif_toggle"
        android:title="@string/lock_screen_notifications_summary_hide_profile"
        settings:controller="com.android.settings.notification.LockScreenNotificationShowSensitiveToggleController" />

    <SwitchPreferenceCompat
        android:key="lock_screen_notification_hide_seen_toggle"
        android:title="@string/lock_screen_notification_hide_seen_title"
        android:summary="@string/lock_screen_notification_hide_seen_summary"
        settings:controller="com.android.settings.notification.LockScreenNotificationHideSeenToggleController" />

    <SwitchPreferenceCompat
        android:key="lock_screen_notification_hide_silent_toggle"
        android:title="@string/lock_screen_notification_hide_silent_title"
        android:summary="@string/lock_screen_notification_hide_silent_summary"
        settings:controller="com.android.settings.notification.LockScreenNotificationHideSilentToggleController" />

</PreferenceScreen>
+6 −0
Original line number Diff line number Diff line
@@ -83,6 +83,12 @@
            android:summary="@string/summary_placeholder"
            settings:searchable="false"/>

        <Preference
            android:key="more_security_lock_screen_notifications_page"
            android:title="@string/lock_screen_notifs_title"
            android:fragment="com.android.settings.notification.LockScreenNotificationsPreferencePageFragment"
            settings:controller="com.android.settings.notification.LockScreenNotificationsPreferencePageController" />

        <!-- Show media on lock screen -->
        <SwitchPreferenceCompat
            android:key="privacy_media_controls_lockscreen"
Loading