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

Commit 90522156 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Notification settings updates"

parents bc65e6eb 9ce68a20
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -2689,8 +2689,6 @@
            <intent-filter android:priority="150">
                <action android:name="com.android.settings.action.SETTINGS" />
            </intent-filter>
            <meta-data android:name="com.android.settings.category"
                       android:value="com.android.settings.category.ia.notifications" />
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                android:value="com.android.settings.applications.NotificationApps" />
        </activity>
+1 −1
Original line number Diff line number Diff line
@@ -53,7 +53,7 @@
        settings:useAdditionalSummary="true" />

    <!-- Visibility Override -->
    <com.android.settings.notification.RestrictedDropDownPreference
    <com.android.settings.RestrictedListPreference
        android:key="visibility_override"
        android:title="@string/app_notification_visibility_override_title"/>

+35 −31
Original line number Diff line number Diff line
@@ -15,39 +15,27 @@
-->

<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
                  xmlns:settings="http://schemas.android.com/apk/res-auto"
                  android:title="@string/configure_notification_settings"
                  android:key="configure_notification_settings">

    <PreferenceCategory
        android:key="recent_notifications_category"
        android:title="@string/recent_notifications"
        android:order="-200">
        <!-- Placeholder for a list of recent apps -->

        <!-- See all apps button -->
        <Preference
            android:title="@string/notifications_title"
            android:key="all_notifications"
            android:order="20">
            <intent
                android:action="android.intent.action.MAIN"
                android:targetPackage="com.android.settings"
                android:targetClass="com.android.settings.Settings$NotificationAppListActivity">
            </intent>
        </Preference>
    </PreferenceCategory>
    <!-- When device is locked -->
    <com.android.settings.RestrictedListPreference
        android:key="lock_screen_notifications"
        android:title="@string/lock_screen_notifications_title"
        android:summary="@string/summary_placeholder"/>

    <!-- Empty category to draw divider -->
    <PreferenceCategory
        android:key="all_notifications_divider"
        android:order="-190"/>
        android:key="lock_screen_notifications_profile_header"
        android:title="@string/profile_section_header">

    <!-- When device is locked -->
    <com.android.settings.notification.RestrictedDropDownPreference
        android:key="lock_screen_notifications"
        <com.android.settings.RestrictedListPreference
            android:key="lock_screen_notifications_profile"
            android:title="@string/lock_screen_notifications_title"
            android:summary="@string/summary_placeholder"/>

    </PreferenceCategory>

    <!-- Notification badging -->
    <SwitchPreference
        android:key="notification_badging"
@@ -71,14 +59,30 @@
        android:title="@string/fingerprint_swipe_for_notifications_title"
        android:fragment="com.android.settings.gestures.SwipeToNotificationSettings" />

    <!-- Empty category to draw divider -->
    <PreferenceCategory
        android:key="lock_screen_notifications_profile_header"
        android:title="@string/profile_section_header">
        android:key="all_notifications_divider"
        android:order="20"/>

        <com.android.settings.notification.RestrictedDropDownPreference
            android:key="lock_screen_notifications_profile"
            android:title="@string/lock_screen_notifications_title"
            android:summary="@string/summary_placeholder"/>
    <PreferenceCategory
        android:key="recent_notifications_category"
        android:title="@string/recent_notifications"
        settings:allowDividerAbove="false"
        android:order="21">
        <!-- Placeholder for a list of recent apps -->

        <!-- See all apps button -->
        <Preference
            android:title="@string/notifications_title"
            android:key="all_notifications"
            android:order="22">
            <intent
                android:action="android.intent.action.MAIN"
                android:targetPackage="com.android.settings"
                android:targetClass="com.android.settings.Settings$NotificationAppListActivity">
            </intent>
        </Preference>
    </PreferenceCategory>


</PreferenceScreen>
+2 −2
Original line number Diff line number Diff line
@@ -19,7 +19,7 @@
    android:key="security_lockscreen_settings_screen"
    android:title="@string/lockscreen_settings_title">

    <com.android.settings.notification.RestrictedDropDownPreference
    <com.android.settings.RestrictedListPreference
        android:key="security_setting_lock_screen_notif"
        android:title="@string/lock_screen_notifications_title"
        android:summary="@string/summary_placeholder" />
@@ -42,7 +42,7 @@
        android:key="security_setting_lock_screen_notif_work_header"
        android:title="@string/profile_section_header">

        <com.android.settings.notification.RestrictedDropDownPreference
        <com.android.settings.RestrictedListPreference
            android:key="security_setting_lock_screen_notif_work"
            android:title="@string/lock_screen_notifications_title"
            android:summary="@string/summary_placeholder" />
+42 −42
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import android.util.Log;

import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.RestrictedListPreference;
import com.android.settings.Utils;
import com.android.settings.core.PreferenceControllerMixin;
import com.android.settings.overlay.FeatureFactory;
@@ -55,8 +56,8 @@ public class LockScreenNotificationPreferenceController extends AbstractPreferen
    private final String mWorkSettingCategoryKey;
    private final String mWorkSettingKey;

    private RestrictedDropDownPreference mLockscreen;
    private RestrictedDropDownPreference mLockscreenProfile;
    private RestrictedListPreference mLockscreen;
    private RestrictedListPreference mLockscreenProfile;

    private final int mProfileChallengeUserId;
    private final boolean mSecure;
@@ -92,13 +93,13 @@ public class LockScreenNotificationPreferenceController extends AbstractPreferen
    public void displayPreference(PreferenceScreen screen) {
        super.displayPreference(screen);
        mLockscreen =
                (RestrictedDropDownPreference) screen.findPreference(mSettingKey);
                (RestrictedListPreference) screen.findPreference(mSettingKey);
        if (mLockscreen == null) {
            Log.i(TAG, "Preference not found: " + mSettingKey);
            return;
        }
        if (mProfileChallengeUserId != UserHandle.USER_NULL) {
            mLockscreenProfile = (RestrictedDropDownPreference) screen.findPreference(
            mLockscreenProfile = (RestrictedListPreference) screen.findPreference(
                    mWorkSettingKey);
        } else {
            setVisible(screen, mWorkSettingKey, false /* visible */);
@@ -180,11 +181,6 @@ public class LockScreenNotificationPreferenceController extends AbstractPreferen
        entries.add(mContext.getString(R.string.lock_screen_notifications_summary_disable_profile));
        values.add(Integer.toString(R.string.lock_screen_notifications_summary_disable_profile));

        mLockscreenProfile.setOnPreClickListener(
                (Preference p) -> Utils.startQuietModeDialogIfNecessary(mContext,
                        UserManager.get(mContext), mProfileChallengeUserId)
        );

        mLockscreenProfile.setEntries(entries.toArray(new CharSequence[entries.size()]));
        mLockscreenProfile.setEntryValues(values.toArray(new CharSequence[values.size()]));
        updateLockscreenNotificationsForProfile();
@@ -224,6 +220,10 @@ public class LockScreenNotificationPreferenceController extends AbstractPreferen
    public boolean onPreferenceChange(Preference preference, Object newValue) {
        final String key = preference.getKey();
        if (TextUtils.equals(mWorkSettingKey, key)) {
            if (Utils.startQuietModeDialogIfNecessary(mContext, UserManager.get(mContext),
                    mProfileChallengeUserId)) {
                return false;
            }
            final int val = Integer.parseInt((String) newValue);
            if (val == mLockscreenSelectedValueProfile) {
                return false;
@@ -264,8 +264,8 @@ public class LockScreenNotificationPreferenceController extends AbstractPreferen
                RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(
                        mContext, keyguardNotificationFeatures, UserHandle.myUserId());
        if (admin != null && mLockscreen != null) {
            RestrictedDropDownPreference.RestrictedItem item =
                    new RestrictedDropDownPreference.RestrictedItem(entry, entryValue, admin);
            RestrictedListPreference.RestrictedItem item =
                    new RestrictedListPreference.RestrictedItem(entry, entryValue, admin);
            mLockscreen.addRestrictedItem(item);
        }
        if (mProfileChallengeUserId != UserHandle.USER_NULL) {
@@ -273,8 +273,8 @@ public class LockScreenNotificationPreferenceController extends AbstractPreferen
                    RestrictedLockUtils.checkIfKeyguardFeaturesDisabled(
                            mContext, keyguardNotificationFeatures, mProfileChallengeUserId);
            if (profileAdmin != null && mLockscreenProfile != null) {
                RestrictedDropDownPreference.RestrictedItem item =
                        new RestrictedDropDownPreference.RestrictedItem(
                RestrictedListPreference.RestrictedItem item =
                        new RestrictedListPreference.RestrictedItem(
                                entry, entryValue, profileAdmin);
                mLockscreenProfile.addRestrictedItem(item);
            }
Loading