Loading src/com/android/settings/notification/app/AppChannelsBypassingDndPreferenceController.java +11 −6 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.app.settings.SettingsEnums; import android.content.Context; import android.os.AsyncTask; import android.os.Bundle; import android.os.UserHandle; import android.provider.Settings; import androidx.core.text.BidiFormatter; Loading Loading @@ -183,12 +184,16 @@ public class AppChannelsBypassingDndPreferenceController extends NotificationPre channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, mAppRow.pkg); channelArgs.putString(Settings.EXTRA_CHANNEL_ID, channel.getId()); channelArgs.putBoolean(ARG_FROM_SETTINGS, true); channelPreference.setIntent(new SubSettingLauncher(mContext) channelPreference.setOnPreferenceClickListener(preference -> { new SubSettingLauncher(mContext) .setDestination(ChannelNotificationSettings.class.getName()) .setArguments(channelArgs) .setUserHandle(UserHandle.of(mAppRow.userId)) .setTitleRes(com.android.settings.R.string.notification_channel_title) .setSourceMetricsCategory(SettingsEnums.DND_APPS_BYPASSING) .toIntent()); .launch(); return true; }); mPreferenceCategory.addPreference(channelPreference); } mAllNotificationsToggle.setChecked(areAllChannelsBypassing()); Loading src/com/android/settings/notification/app/ConversationListPreferenceController.java +9 −4 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ShortcutInfo; import android.os.Bundle; import android.os.UserHandle; import android.provider.Settings; import android.service.notification.ConversationChannelWrapper; import android.text.TextUtils; Loading Loading @@ -97,7 +98,10 @@ public abstract class ConversationListPreferenceController extends AbstractPrefe conversation.getPkg(), conversation.getUid(), conversation.getNotificationChannel().isImportantConversation())); pref.setKey(conversation.getNotificationChannel().getId()); pref.setIntent(getIntent(conversation, pref.getTitle())); pref.setOnPreferenceClickListener(preference -> { getSubSettingLauncher(conversation, pref.getTitle()).launch(); return true; }); return pref; } Loading @@ -116,7 +120,8 @@ public abstract class ConversationListPreferenceController extends AbstractPrefe : conversation.getNotificationChannel().getName(); } Intent getIntent(ConversationChannelWrapper conversation, CharSequence title) { SubSettingLauncher getSubSettingLauncher(ConversationChannelWrapper conversation, CharSequence title) { Bundle channelArgs = new Bundle(); channelArgs.putInt(AppInfoBase.ARG_PACKAGE_UID, conversation.getUid()); channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, conversation.getPkg()); Loading @@ -129,9 +134,9 @@ public abstract class ConversationListPreferenceController extends AbstractPrefe .setDestination(ChannelNotificationSettings.class.getName()) .setArguments(channelArgs) .setExtras(channelArgs) .setUserHandle(UserHandle.getUserHandleForUid(conversation.getUid())) .setTitleText(title) .setSourceMetricsCategory(SettingsEnums.NOTIFICATION_CONVERSATION_LIST_SETTINGS) .toIntent(); .setSourceMetricsCategory(SettingsEnums.NOTIFICATION_CONVERSATION_LIST_SETTINGS); } protected Comparator<ConversationChannelWrapper> mConversationComparator = Loading src/com/android/settings/notification/zen/ZenModeAllBypassingAppsPreferenceController.java +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.app.Application; import android.app.settings.SettingsEnums; import android.content.Context; import android.os.Bundle; import android.os.UserHandle; import androidx.annotation.VisibleForTesting; import androidx.core.text.BidiFormatter; Loading Loading @@ -137,6 +138,7 @@ public class ZenModeAllBypassingAppsPreferenceController extends AbstractPrefere new SubSettingLauncher(mContext) .setDestination(AppChannelsBypassingDndSettings.class.getName()) .setArguments(args) .setUserHandle(UserHandle.getUserHandleForUid(app.info.uid)) .setResultListener(mHostFragment, 0) .setSourceMetricsCategory( SettingsEnums.NOTIFICATION_ZEN_MODE_OVERRIDING_APP) Loading tests/robotests/src/com/android/settings/notification/app/ConversationListPreferenceControllerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -191,7 +191,7 @@ public class ConversationListPreferenceControllerTest { } @Test public void testGetIntent() { public void testGetSubSettingLauncher() { ConversationChannelWrapper ccw = new ConversationChannelWrapper(); NotificationChannel channel = new NotificationChannel("a", "child", 2); channel.setConversationId("parent", "convo id"); Loading @@ -199,7 +199,7 @@ public class ConversationListPreferenceControllerTest { ccw.setPkg("pkg"); ccw.setUid(1); ccw.setParentChannelLabel("parent label"); Intent intent = mController.getIntent(ccw, "title"); Intent intent = mController.getSubSettingLauncher(ccw, "title").toIntent(); Bundle extras = intent.getExtras(); assertThat(extras.getString(AppInfoBase.ARG_PACKAGE_NAME)).isEqualTo(ccw.getPkg()); Loading Loading
src/com/android/settings/notification/app/AppChannelsBypassingDndPreferenceController.java +11 −6 Original line number Diff line number Diff line Loading @@ -24,6 +24,7 @@ import android.app.settings.SettingsEnums; import android.content.Context; import android.os.AsyncTask; import android.os.Bundle; import android.os.UserHandle; import android.provider.Settings; import androidx.core.text.BidiFormatter; Loading Loading @@ -183,12 +184,16 @@ public class AppChannelsBypassingDndPreferenceController extends NotificationPre channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, mAppRow.pkg); channelArgs.putString(Settings.EXTRA_CHANNEL_ID, channel.getId()); channelArgs.putBoolean(ARG_FROM_SETTINGS, true); channelPreference.setIntent(new SubSettingLauncher(mContext) channelPreference.setOnPreferenceClickListener(preference -> { new SubSettingLauncher(mContext) .setDestination(ChannelNotificationSettings.class.getName()) .setArguments(channelArgs) .setUserHandle(UserHandle.of(mAppRow.userId)) .setTitleRes(com.android.settings.R.string.notification_channel_title) .setSourceMetricsCategory(SettingsEnums.DND_APPS_BYPASSING) .toIntent()); .launch(); return true; }); mPreferenceCategory.addPreference(channelPreference); } mAllNotificationsToggle.setChecked(areAllChannelsBypassing()); Loading
src/com/android/settings/notification/app/ConversationListPreferenceController.java +9 −4 Original line number Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.content.Context; import android.content.Intent; import android.content.pm.ShortcutInfo; import android.os.Bundle; import android.os.UserHandle; import android.provider.Settings; import android.service.notification.ConversationChannelWrapper; import android.text.TextUtils; Loading Loading @@ -97,7 +98,10 @@ public abstract class ConversationListPreferenceController extends AbstractPrefe conversation.getPkg(), conversation.getUid(), conversation.getNotificationChannel().isImportantConversation())); pref.setKey(conversation.getNotificationChannel().getId()); pref.setIntent(getIntent(conversation, pref.getTitle())); pref.setOnPreferenceClickListener(preference -> { getSubSettingLauncher(conversation, pref.getTitle()).launch(); return true; }); return pref; } Loading @@ -116,7 +120,8 @@ public abstract class ConversationListPreferenceController extends AbstractPrefe : conversation.getNotificationChannel().getName(); } Intent getIntent(ConversationChannelWrapper conversation, CharSequence title) { SubSettingLauncher getSubSettingLauncher(ConversationChannelWrapper conversation, CharSequence title) { Bundle channelArgs = new Bundle(); channelArgs.putInt(AppInfoBase.ARG_PACKAGE_UID, conversation.getUid()); channelArgs.putString(AppInfoBase.ARG_PACKAGE_NAME, conversation.getPkg()); Loading @@ -129,9 +134,9 @@ public abstract class ConversationListPreferenceController extends AbstractPrefe .setDestination(ChannelNotificationSettings.class.getName()) .setArguments(channelArgs) .setExtras(channelArgs) .setUserHandle(UserHandle.getUserHandleForUid(conversation.getUid())) .setTitleText(title) .setSourceMetricsCategory(SettingsEnums.NOTIFICATION_CONVERSATION_LIST_SETTINGS) .toIntent(); .setSourceMetricsCategory(SettingsEnums.NOTIFICATION_CONVERSATION_LIST_SETTINGS); } protected Comparator<ConversationChannelWrapper> mConversationComparator = Loading
src/com/android/settings/notification/zen/ZenModeAllBypassingAppsPreferenceController.java +2 −0 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import android.app.Application; import android.app.settings.SettingsEnums; import android.content.Context; import android.os.Bundle; import android.os.UserHandle; import androidx.annotation.VisibleForTesting; import androidx.core.text.BidiFormatter; Loading Loading @@ -137,6 +138,7 @@ public class ZenModeAllBypassingAppsPreferenceController extends AbstractPrefere new SubSettingLauncher(mContext) .setDestination(AppChannelsBypassingDndSettings.class.getName()) .setArguments(args) .setUserHandle(UserHandle.getUserHandleForUid(app.info.uid)) .setResultListener(mHostFragment, 0) .setSourceMetricsCategory( SettingsEnums.NOTIFICATION_ZEN_MODE_OVERRIDING_APP) Loading
tests/robotests/src/com/android/settings/notification/app/ConversationListPreferenceControllerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -191,7 +191,7 @@ public class ConversationListPreferenceControllerTest { } @Test public void testGetIntent() { public void testGetSubSettingLauncher() { ConversationChannelWrapper ccw = new ConversationChannelWrapper(); NotificationChannel channel = new NotificationChannel("a", "child", 2); channel.setConversationId("parent", "convo id"); Loading @@ -199,7 +199,7 @@ public class ConversationListPreferenceControllerTest { ccw.setPkg("pkg"); ccw.setUid(1); ccw.setParentChannelLabel("parent label"); Intent intent = mController.getIntent(ccw, "title"); Intent intent = mController.getSubSettingLauncher(ccw, "title").toIntent(); Bundle extras = intent.getExtras(); assertThat(extras.getString(AppInfoBase.ARG_PACKAGE_NAME)).isEqualTo(ccw.getPkg()); Loading