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

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

Add filtering to notification channel settings

Allow apps that are launching this page to specify targeted subsets of
settings that should be shown.

Test: settings notification robotests
Bug: 177246841
Change-Id: Ib491c43f1861a9775e3b25f39134cdbe105a7ff8
parent d7af6821
Loading
Loading
Loading
Loading
+0 −6
Original line number Diff line number Diff line
@@ -65,11 +65,6 @@
        android:summary="@string/promote_conversation_summary"
        settings:allowDividerAbove="true"/>

    <PreferenceCategory
        android:key="channel_advanced"
        android:order="50"
        settings:initialExpandedChildrenCount="0">

        <!-- Default ringtone -->
        <com.android.settings.notification.app.NotificationSoundPreference
            android:key="ringtone"
@@ -120,7 +115,6 @@
            android:order="18"
            android:title="@string/app_settings_link"
            settings:allowDividerAbove="true"/>
    </PreferenceCategory>

    <com.android.settings.notification.app.NotificationFooterPreference
        android:key="desc"
+4 −3
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import android.view.View;
import android.widget.ImageView;

import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceViewHolder;

import com.android.settings.R;
@@ -67,8 +66,10 @@ public class AppBubbleListPreferenceController extends AppConversationListPrefer
            @Nullable NotificationChannel channel, @Nullable NotificationChannelGroup group,
            Drawable conversationDrawable,
            ShortcutInfo conversationInfo,
            RestrictedLockUtils.EnforcedAdmin admin) {
        super.onResume(appRow, channel, group, conversationDrawable, conversationInfo, admin);
            RestrictedLockUtils.EnforcedAdmin admin,
            List<String> preferenceFilter) {
        super.onResume(appRow, channel, group, conversationDrawable, conversationInfo, admin,
                preferenceFilter);
        // In case something changed in the foreground (e.g. via bubble button on notification)
        loadConversationsAndPopulate();
    }
+6 −0
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package com.android.settings.notification.app;

import android.app.NotificationChannel;
import android.content.Context;
import android.util.Slog;

@@ -47,6 +48,11 @@ public class AddToHomeScreenPreferenceController extends NotificationPreferenceC
        return mConversationInfo != null;
    }

    @Override
    boolean isIncludedInFilter() {
        return mPreferenceFilter.contains(NotificationChannel.EDIT_LAUNCHER);
    }

    @Override
    public boolean handlePreferenceTreeClick(Preference preference) {
        if (KEY.equals(preference.getKey())) {
+5 −0
Original line number Diff line number Diff line
@@ -58,6 +58,11 @@ public class AllowSoundPreferenceController extends NotificationPreferenceContro

    }

    @Override
    boolean isIncludedInFilter() {
        return mPreferenceFilter.contains(NotificationChannel.EDIT_SOUND);
    }

    @Override
    public void updateState(Preference preference) {
        if (mChannel != null) {
+1 −1
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ public class AppBubbleNotificationSettings extends NotificationSettings implemen
        }

        for (NotificationPreferenceController controller : mControllers) {
            controller.onResume(mAppRow, null, null, null, null, mSuspendedAppsAdmin);
            controller.onResume(mAppRow, null, null, null, null, mSuspendedAppsAdmin, null);
            controller.displayPreference(getPreferenceScreen());
        }
        updatePreferenceStates();
Loading