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

Commit c400ce3c authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Move channel listing into a pref controller

And a hidden preference category. This makes
hiding/showing the list a lot cleaner and also allows more
of the code to be tested.

Also delete some unused code that no longer complied after
this refactor.

Fixes: 133443871
Test: atest
Change-Id: I4a5fe0e075019bae2df44a0a9dcec26a40ee6d12
(cherry picked from commit a295d71c)
parent 957463ca
Loading
Loading
Loading
Loading
+0 −7
Original line number Diff line number Diff line
@@ -2594,13 +2594,6 @@
                android:value="com.android.settings.notification.AppNotificationSettings" />
        </activity>

        <!-- Show channel group-level notification settings (group passed in as extras) -->
        <activity android:name="Settings$ChannelGroupNotificationSettingsActivity"
                  android:exported="true">
            <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
                       android:value="com.android.settings.notification.ChannelGroupNotificationSettings" />
        </activity>

        <!-- Show channel-level notification settings (channel passed in as extras) -->
        <activity android:name="Settings$ChannelNotificationSettingsActivity"
                  android:label="@string/notification_channel_title"
+20 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2019 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"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:visibility="gone"/>
+5 −0
Original line number Diff line number Diff line
@@ -30,6 +30,11 @@
        android:key="block_desc" />

    <!-- Channels/Channel groups added here -->
    <PreferenceCategory
        android:key="channels"
        android:layout="@layout/empty_view"
        settings:allowDividerAbove="false"
        settings:allowDividerBelow="false" />

    <!-- Importance toggle -->
    <com.android.settingslib.RestrictedSwitchPreference
+0 −2
Original line number Diff line number Diff line
@@ -106,7 +106,6 @@ import com.android.settings.nfc.AndroidBeam;
import com.android.settings.nfc.PaymentSettings;
import com.android.settings.notification.AppBubbleNotificationSettings;
import com.android.settings.notification.AppNotificationSettings;
import com.android.settings.notification.ChannelGroupNotificationSettings;
import com.android.settings.notification.ChannelNotificationSettings;
import com.android.settings.notification.ConfigureNotificationSettings;
import com.android.settings.notification.NotificationAccessSettings;
@@ -238,7 +237,6 @@ public class SettingsGateway {
            AppNotificationSettings.class.getName(),
            NotificationAssistantPicker.class.getName(),
            ChannelNotificationSettings.class.getName(),
            ChannelGroupNotificationSettings.class.getName(),
            ApnSettings.class.getName(),
            ApnEditor.class.getName(),
            WifiCallingSettings.class.getName(),
+2 −3
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import static android.app.NotificationManager.IMPORTANCE_LOW;
import static android.app.NotificationManager.IMPORTANCE_NONE;
import static android.app.slice.Slice.EXTRA_TOGGLE_STATE;

import static com.android.settings.notification.NotificationSettingsBase.ARG_FROM_SETTINGS;
import static com.android.settings.notification.ChannelListPreferenceController.ARG_FROM_SETTINGS;

import android.app.Application;
import android.app.NotificationChannel;
@@ -110,7 +110,7 @@ public class NotificationChannelSlice implements CustomSliceable {
     *
     * Note:
     * When the sent count of notification channels is the same, follow the sorting mechanism from
     * {@link com.android.settings.notification.NotificationSettingsBase#mChannelComparator}.
     * {@link com.android.settings.notification.ChannelListPreferenceController}.
     * Since slice view only shows displayable notification channels, so those deleted ones are
     * excluded from the comparison here.
     */
@@ -257,7 +257,6 @@ public class NotificationChannelSlice implements CustomSliceable {
        channelArgs.putInt(AppInfoBase.ARG_PACKAGE_UID, mUid);
        channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, mPackageName);
        channelArgs.putString(Settings.EXTRA_CHANNEL_ID, channel.getId());
        channelArgs.putBoolean(ARG_FROM_SETTINGS, true);

        final Intent channelIntent = new SubSettingLauncher(mContext)
                .setDestination(ChannelNotificationSettings.class.getName())
Loading