Merge "Minor language changes for enrollment flow." into sc-dev
diff --git a/res/drawable/button_border_selected.xml b/res/drawable/button_border_selected.xml
index 29acbce..5d2388a 100644
--- a/res/drawable/button_border_selected.xml
+++ b/res/drawable/button_border_selected.xml
@@ -15,9 +15,10 @@
limitations under the License.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
android:shape="rectangle">
<solid
- android:color="@color/notification_importance_selection_bg" />
+ android:color="?androidprv:attr/colorSurface" />
<stroke
android:width="2dp"
android:color="?android:attr/colorAccent"/>
diff --git a/res/drawable/empty_icon.xml b/res/drawable/empty_icon.xml
index db55af5..8e5fd20 100644
--- a/res/drawable/empty_icon.xml
+++ b/res/drawable/empty_icon.xml
@@ -16,6 +16,6 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
- <size android:width="32dip" android:height="32dip" />
+ <size android:width="24dp" android:height="24dp" />
<solid android:color="@android:color/transparent" />
</shape>
diff --git a/res/drawable/ic_demote_conversation.xml b/res/drawable/ic_demote_conversation.xml
index ef25bad..056ff58 100644
--- a/res/drawable/ic_demote_conversation.xml
+++ b/res/drawable/ic_demote_conversation.xml
@@ -17,8 +17,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
diff --git a/res/drawable/ic_notification_dot.xml b/res/drawable/ic_notification_dot.xml
new file mode 100644
index 0000000..25fec48
--- /dev/null
+++ b/res/drawable/ic_notification_dot.xml
@@ -0,0 +1,25 @@
+<!--
+ Copyright (C) 2021 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M22,6.98V16c0,1.1 -0.9,2 -2,2H6l-4,4V4c0,-1.1 0.9,-2 2,-2h10.1C14.04,2.32 14,2.66 14,3s0.04,0.68 0.1,1H4v12h16V7.9C20.74,7.75 21.42,7.42 22,6.98zM16,3c0,1.66 1.34,3 3,3s3,-1.34 3,-3s-1.34,-3 -3,-3S16,1.34 16,3z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_notification_min.xml b/res/drawable/ic_notification_min.xml
new file mode 100644
index 0000000..90101dd
--- /dev/null
+++ b/res/drawable/ic_notification_min.xml
@@ -0,0 +1,25 @@
+<!--
+ Copyright (C) 2021 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M6,19h12v2H6v-2z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_notification_peek.xml b/res/drawable/ic_notification_peek.xml
new file mode 100644
index 0000000..51d6948
--- /dev/null
+++ b/res/drawable/ic_notification_peek.xml
@@ -0,0 +1,25 @@
+<!--
+ Copyright (C) 2021 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M17,1L7,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2L19,3c0,-1.1 -0.9,-2 -2,-2zM17,21L7,21v-1h10v1zM17,18L7,18L7,6h10v12zM17,4L7,4L7,3h10v1zM8,7h8v2L8,9z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_notification_vis_override.xml b/res/drawable/ic_notification_vis_override.xml
new file mode 100644
index 0000000..067128e
--- /dev/null
+++ b/res/drawable/ic_notification_vis_override.xml
@@ -0,0 +1,25 @@
+<!--
+ Copyright (C) 2021 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.
+-->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24.0"
+ android:viewportHeight="24.0"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M17,1.01L7,1c-1.1,0 -2,0.9 -2,2v18c0,1.1 0.9,2 2,2h10c1.1,0 2,-0.9 2,-2L19,3c0,-1.1 -0.9,-1.99 -2,-1.99zM17,21L7,21v-1h10v1zM17,18L7,18L7,6h10v12zM7,4L7,3h10v1L7,4zM14.25,10.5v-0.66c0,-1.13 -1.03,-2.09 -2.25,-2.09s-2.25,0.96 -2.25,2.09v0.66L9,10.5L9,16h6v-5.5h-0.75zM12.75,10.5h-1.5v-0.66c0,-0.29 0.38,-0.59 0.75,-0.59s0.75,0.3 0.75,0.59v0.66z"/>
+</vector>
\ No newline at end of file
diff --git a/res/drawable/ic_volume_ringer_vibrate.xml b/res/drawable/ic_volume_ringer_vibrate.xml
index 4663b75..cd50414 100644
--- a/res/drawable/ic_volume_ringer_vibrate.xml
+++ b/res/drawable/ic_volume_ringer_vibrate.xml
@@ -17,8 +17,8 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
- android:viewportWidth="24.0"
- android:viewportHeight="24.0"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FFFFFF"
diff --git a/res/layout/notif_importance_preference.xml b/res/layout/notif_importance_preference.xml
index 6e4786e..b2a02d1 100644
--- a/res/layout/notif_importance_preference.xml
+++ b/res/layout/notif_importance_preference.xml
@@ -22,7 +22,7 @@
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginStart="24dp"
- android:layout_marginEnd="24dp"
+ android:layout_marginEnd="16dp"
android:paddingTop="@dimen/notification_importance_toggle_marginTop"
android:paddingBottom="@dimen/notification_importance_toggle_marginTop"
android:orientation="vertical">
diff --git a/res/layout/notif_priority_conversation_preference.xml b/res/layout/notif_priority_conversation_preference.xml
index c93abf2..4601c00 100644
--- a/res/layout/notif_priority_conversation_preference.xml
+++ b/res/layout/notif_priority_conversation_preference.xml
@@ -21,7 +21,10 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
- android:padding="@dimen/notification_importance_toggle_marginTop"
+ android:layout_marginStart="24dp"
+ android:layout_marginEnd="16dp"
+ android:paddingTop="@dimen/notification_importance_toggle_marginTop"
+ android:paddingBottom="@dimen/notification_importance_toggle_marginTop"
android:orientation="vertical">
<com.android.settings.notification.NotificationButtonRelativeLayout
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 8357f89..ef0a051 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -8794,11 +8794,14 @@
<string name="recent_notifications_see_all_title">See all from last 7 days</string>
<!-- notification header for general notification settings [CHAR LIMIT=80]-->
- <string name="general_notification_header">General</string>
+ <string name="general_notification_header">Manage</string>
<!-- notification preference for app specific notification settings [CHAR LIMIT=80]-->
<string name="app_notification_field">App settings</string>
+ <!-- notification preference summary for app specific notification settings [CHAR LIMIT=120]-->
+ <string name="app_notification_field_summary">Control notifications from individual apps</string>
+
<!-- Configure Notifications: Advanced section header [CHAR LIMIT=30] -->
<string name="advanced_section_header">General</string>
@@ -9248,7 +9251,7 @@
<!-- Sound & notification > Advanced section: Title for managing notification listeners option. [CHAR LIMIT=60] -->
<string name="manage_notification_access_title">Device & app notifications</string>
- <string name="manage_notification_access_summary">Control which notifications show on your apps and devices</string>
+ <string name="manage_notification_access_summary">Control which apps and devices can read notifications</string>
<!-- Notification Access section: Indicates that the work profile admin doesn't allow this
notification listener to access work profile notifications [CHAR LIMIT=100] -->
diff --git a/res/xml/app_notification_settings.xml b/res/xml/app_notification_settings.xml
index 5270b09..5b744fb 100644
--- a/res/xml/app_notification_settings.xml
+++ b/res/xml/app_notification_settings.xml
@@ -58,7 +58,16 @@
android:key="channels"
android:layout="@layout/empty_view"
settings:allowDividerAbove="true"
- settings:allowDividerBelow="false" />
+ settings:allowDividerBelow="true" />
+
+ <!-- Show badge -->
+ <com.android.settingslib.RestrictedSwitchPreference
+ android:key="badge"
+ android:title="@string/notification_badge_title"
+ settings:useAdditionalSummary="true"
+ android:order="1001"
+ settings:allowDividerAbove="true"
+ settings:restrictedSwitchSummary="@string/enabled_by_admin" />
<!-- Importance toggle -->
<com.android.settingslib.RestrictedSwitchPreference
@@ -75,26 +84,14 @@
<com.android.settingslib.RestrictedSwitchPreference
android:key="bypass_dnd"
android:title="@string/app_notification_override_dnd_title"
- android:summary="@string/app_notification_override_dnd_summary"
- settings:useAdditionalSummary="true"/>
+ android:summary="@string/app_notification_override_dnd_summary"/>
- <PreferenceCategory
- android:key="app_advanced"
- android:order="1000">
- <!-- Show badge -->
- <com.android.settingslib.RestrictedSwitchPreference
- android:key="badge"
- android:title="@string/notification_badge_title"
- settings:useAdditionalSummary="true"
- android:order="1001"
- settings:restrictedSwitchSummary="@string/enabled_by_admin" />
<Preference
android:key="app_link"
android:order="1003"
+ android:icon="@drawable/ic_settings_24dp"
android:title="@string/app_settings_link" />
- </PreferenceCategory>
-
<com.android.settingslib.widget.FooterPreference
android:key="desc"
android:order="5000" />
diff --git a/res/xml/channel_notification_settings.xml b/res/xml/channel_notification_settings.xml
index 97dcc26..a3895e3 100644
--- a/res/xml/channel_notification_settings.xml
+++ b/res/xml/channel_notification_settings.xml
@@ -34,26 +34,26 @@
android:key="allow_sound"
android:order="3"
android:title="@string/allow_interruption"
+ android:icon="@drawable/empty_icon"
android:summary="@string/allow_interruption_summary" />
<!-- Importance -->
<com.android.settings.notification.app.ImportancePreference
android:key="importance"
android:order="4"
- android:title="@string/notification_importance_title"
- settings:allowDividerBelow="true"/>
+ android:title="@string/notification_importance_title" />
<com.android.settingslib.RestrictedSwitchPreference
android:key="min_importance"
android:order="5"
- settings:allowDividerAbove="true"
+ android:icon="@drawable/ic_notification_min"
android:title="@string/notification_importance_min_title"
android:summary="@string/notification_channel_summary_min"/>
<com.android.settingslib.RestrictedSwitchPreference
android:key="high_importance"
android:order="6"
- settings:allowDividerAbove="true"
+ android:icon="@drawable/ic_notification_peek"
android:title="@string/notification_importance_high_title"
android:summary="@string/notification_channel_summary_high"/>
@@ -62,14 +62,14 @@
android:order="7"
android:icon="@drawable/ic_promote_conversation"
android:title="@string/promote_conversation_title"
- android:summary="@string/promote_conversation_summary"
- settings:allowDividerAbove="true"/>
+ android:summary="@string/promote_conversation_summary" />
<!-- Default ringtone -->
<com.android.settings.notification.app.NotificationSoundPreference
android:key="ringtone"
android:title="@string/notification_channel_sound_title"
android:dialogTitle="@string/notification_channel_sound_title"
+ android:icon="@drawable/ic_notifications"
android:order="11"
android:showSilent="true"
android:showDefault="true"/>
@@ -78,49 +78,47 @@
<com.android.settingslib.RestrictedSwitchPreference
android:key="vibrate"
android:order="12"
- android:title="@string/notification_vibrate_title"
- settings:useAdditionalSummary="true" />
+ android:icon="@drawable/ic_volume_ringer_vibrate"
+ android:title="@string/notification_vibrate_title" />
<!-- Visibility Override -->
<com.android.settings.RestrictedListPreference
android:key="visibility_override"
android:order="13"
+ android:icon="@drawable/ic_notification_vis_override"
android:title="@string/app_notification_visibility_override_title"/>
<!-- Lights -->
<com.android.settingslib.RestrictedSwitchPreference
android:key="lights"
android:order="14"
- android:title="@string/notification_show_lights_title"
- settings:useAdditionalSummary="true"/>
+ android:icon="@drawable/ic_lightbulb_outline_24"
+ android:title="@string/notification_show_lights_title" />
<!-- Show badge -->
<com.android.settingslib.RestrictedSwitchPreference
android:key="badge"
android:order="15"
android:title="@string/notification_channel_badge_title"
- settings:useAdditionalSummary="true"
+ android:icon="@drawable/ic_notification_dot"
settings:restrictedSwitchSummary="@string/enabled_by_admin"/>
<!-- Bypass DND -->
<com.android.settingslib.RestrictedSwitchPreference
android:key="bypass_dnd"
android:order="17"
+ android:icon="@drawable/ic_do_not_disturb_on_24dp"
android:title="@string/app_notification_override_dnd_title"
- android:summary="@string/app_notification_override_dnd_summary"
- settings:useAdditionalSummary="true"/>
+ android:summary="@string/app_notification_override_dnd_summary" />
<Preference
android:key="app_link"
android:order="18"
android:title="@string/app_settings_link"
+ android:icon="@drawable/ic_settings_24dp"
settings:allowDividerAbove="true"/>
<com.android.settingslib.widget.FooterPreference
- android:key="desc"
- android:order="100"/>
-
- <com.android.settingslib.widget.FooterPreference
android:key="block_desc"
android:order="110"
settings:allowDividerAbove="false"/>
diff --git a/res/xml/configure_notification_settings.xml b/res/xml/configure_notification_settings.xml
index cce790b..4e58e66 100644
--- a/res/xml/configure_notification_settings.xml
+++ b/res/xml/configure_notification_settings.xml
@@ -26,6 +26,7 @@
android:key="all_notifications"
android:order="10"
android:title="@string/app_notification_field"
+ android:summary="@string/app_notification_field_summary"
android:fragment="com.android.settings.applications.manageapplications.ManageApplications"
settings:searchable="false">
<extra
@@ -42,13 +43,6 @@
android:targetPackage="com.android.settings"
android:targetClass="com.android.settings.notification.history.NotificationHistoryActivity" />
</Preference>
- <Preference
- android:key="notification_access"
- android:order="12"
- android:title="@string/manage_notification_access_title"
- android:summary="@string/manage_notification_access_summary"
- android:fragment="com.android.settings.notification.NotificationAccessSettings"
- settings:controller="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessController" />
</PreferenceCategory>
<PreferenceCategory
@@ -75,6 +69,13 @@
<PreferenceCategory
android:key="configure_notifications_lock"
android:title="@string/lock_screen_notifications_title">
+ <Preference
+ android:key="notification_access"
+ android:order="12"
+ android:title="@string/manage_notification_access_title"
+ android:summary="@string/manage_notification_access_summary"
+ android:fragment="com.android.settings.notification.NotificationAccessSettings"
+ settings:controller="com.android.settings.applications.specialaccess.notificationaccess.NotificationAccessController" />
<!-- When device is locked -->
<com.android.settings.RestrictedListPreference
android:key="lock_screen_notifications"
diff --git a/res/xml/conversation_notification_settings.xml b/res/xml/conversation_notification_settings.xml
index 7e475be..af82140 100644
--- a/res/xml/conversation_notification_settings.xml
+++ b/res/xml/conversation_notification_settings.xml
@@ -32,41 +32,23 @@
settings:allowDividerAbove="true"
settings:allowDividerBelow="true"/>
- <PreferenceCategory
- android:key="bubbles"
- android:title="@string/notification_bubbles_title">
-
- <!-- bubbles -->
- <com.android.settingslib.RestrictedSwitchPreference
- android:key="bubble_pref"
- android:title="@string/bubbles_conversation_toggle_title"
- android:summary="@string/bubbles_conversation_toggle_summary"
- android:icon="@drawable/ic_create_bubble"
- settings:restrictedSwitchSummary="@string/enabled_by_admin" />
-
- <Preference
- android:key="notification_bubbles"
- android:title="@string/bubbles_conversation_app_link"
- />
- </PreferenceCategory>
-
- <!-- demote -->
- <Preference
- android:key="demote"
- android:icon="@drawable/ic_demote_conversation"
- android:title="@string/demote_conversation_title"
- android:summary="@string/demote_conversation_summary"
- settings:allowDividerAbove="true"/>
+ <!-- bubbles -->
+ <com.android.settingslib.RestrictedSwitchPreference
+ android:key="bubble_pref"
+ android:title="@string/bubbles_conversation_toggle_title"
+ android:summary="@string/bubbles_conversation_toggle_summary"
+ android:icon="@drawable/ic_create_bubble"
+ settings:restrictedSwitchSummary="@string/enabled_by_admin" />
<com.android.settingslib.widget.FooterPreference
android:key="block_desc"
settings:allowDividerAbove="false"/>
-
<!-- peeking -->
<com.android.settingslib.RestrictedSwitchPreference
android:key="high_importance"
android:title="@string/notification_importance_high_title"
+ android:icon="@drawable/ic_notification_peek"
android:summary="@string/notification_channel_summary_high"/>
<!-- ringtone -->
@@ -81,27 +63,34 @@
<!-- Visibility Override -->
<com.android.settings.RestrictedListPreference
android:key="visibility_override"
- android:icon="@drawable/ic_lock_closed"
+ android:icon="@drawable/ic_notification_vis_override"
android:title="@string/app_notification_visibility_override_title"/>
<!-- Show badge -->
<com.android.settingslib.RestrictedSwitchPreference
android:key="badge"
android:title="@string/notification_channel_badge_title"
- settings:useAdditionalSummary="true"
+ android:icon="@drawable/ic_notification_dot"
settings:restrictedSwitchSummary="@string/enabled_by_admin"/>
<!-- Lights -->
<com.android.settingslib.RestrictedSwitchPreference
android:key="lights"
- android:title="@string/notification_show_lights_title"
- settings:useAdditionalSummary="true"/>
+ android:icon="@drawable/ic_lightbulb_outline_24"
+ android:title="@string/notification_show_lights_title"/>
<!-- Vibration -->
<com.android.settingslib.RestrictedSwitchPreference
android:key="vibrate"
android:icon="@drawable/ic_volume_ringer_vibrate"
- android:title="@string/notification_vibrate_title"
- settings:useAdditionalSummary="true" />
+ android:title="@string/notification_vibrate_title" />
+
+ <!-- demote -->
+ <Preference
+ android:key="demote"
+ android:icon="@drawable/ic_demote_conversation"
+ android:title="@string/demote_conversation_title"
+ android:summary="@string/demote_conversation_summary"
+ settings:allowDividerAbove="true"/>
</PreferenceScreen>
diff --git a/src/com/android/settings/notification/app/AppNotificationSettings.java b/src/com/android/settings/notification/app/AppNotificationSettings.java
index d7694d7..ebcd261 100644
--- a/src/com/android/settings/notification/app/AppNotificationSettings.java
+++ b/src/com/android/settings/notification/app/AppNotificationSettings.java
@@ -25,9 +25,11 @@
import androidx.preference.Preference;
import androidx.preference.PreferenceGroup;
import androidx.preference.PreferenceScreen;
+import androidx.recyclerview.widget.RecyclerView;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
+import com.android.settings.Utils;
import com.android.settingslib.core.AbstractPreferenceController;
import java.util.ArrayList;
@@ -38,35 +40,11 @@
private static final String TAG = "AppNotificationSettings";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
- private static String KEY_ADVANCED_CATEGORY = "app_advanced";
- private static String KEY_BADGE = "badge";
- private static String KEY_APP_LINK = "app_link";
- private static String[] LEGACY_NON_ADVANCED_KEYS = {KEY_BADGE, KEY_APP_LINK};
-
@Override
public int getMetricsCategory() {
return SettingsEnums.NOTIFICATION_APP_NOTIFICATION;
}
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- final PreferenceScreen screen = getPreferenceScreen();
- if (mShowLegacyChannelConfig && screen != null) {
- // if showing legacy settings, pull advanced settings out of the advanced category
- PreferenceGroup advanced = (PreferenceGroup) findPreference(KEY_ADVANCED_CATEGORY);
- removePreference(KEY_ADVANCED_CATEGORY);
- if (advanced != null) {
- for (String key : LEGACY_NON_ADVANCED_KEYS) {
- Preference pref = advanced.findPreference(key);
- advanced.removePreference(pref);
- if (pref != null) {
- screen.addPreference(pref);
- }
- }
- }
- }
- }
@Override
public void onResume() {
@@ -78,6 +56,8 @@
return;
}
+ getActivity().setTitle(mAppRow.label);
+
for (NotificationPreferenceController controller : mControllers) {
controller.onResume(mAppRow, mChannel, mChannelGroup, null, null, mSuspendedAppsAdmin,
null);
diff --git a/src/com/android/settings/notification/app/ChannelListPreferenceController.java b/src/com/android/settings/notification/app/ChannelListPreferenceController.java
index b1109ec..12c15c2 100644
--- a/src/com/android/settings/notification/app/ChannelListPreferenceController.java
+++ b/src/com/android/settings/notification/app/ChannelListPreferenceController.java
@@ -322,7 +322,7 @@
if (channel.getImportance() > IMPORTANCE_LOW) {
channelPref.setIcon(getAlertingIcon());
} else {
- channelPref.setIcon(null);
+ channelPref.setIcon(R.drawable.empty_icon);
}
channelPref.setIconSize(PrimarySwitchPreference.ICON_SIZE_SMALL);
channelPref.setTitle(channel.getName());
@@ -350,7 +350,7 @@
channel.setImportance(importance);
channel.lockFields(NotificationChannel.USER_LOCKED_IMPORTANCE);
PrimarySwitchPreference channelPref1 = (PrimarySwitchPreference) preference;
- channelPref1.setIcon(null);
+ channelPref1.setIcon(R.drawable.empty_icon);
if (channel.getImportance() > IMPORTANCE_LOW) {
channelPref1.setIcon(getAlertingIcon());
}
diff --git a/src/com/android/settings/notification/app/ChannelNotificationSettings.java b/src/com/android/settings/notification/app/ChannelNotificationSettings.java
index 296863c..a7aba52 100644
--- a/src/com/android/settings/notification/app/ChannelNotificationSettings.java
+++ b/src/com/android/settings/notification/app/ChannelNotificationSettings.java
@@ -66,8 +66,9 @@
return;
}
- if (mChannel != null && !TextUtils.isEmpty(mChannel.getConversationId())
- && !mChannel.isDemoted()) {
+ getActivity().setTitle(mChannel.getName());
+
+ if (!TextUtils.isEmpty(mChannel.getConversationId()) && !mChannel.isDemoted()) {
Intent intent = new SubSettingLauncher(mContext)
.setDestination(ConversationNotificationSettings.class.getName())
.setArguments(getArguments())
@@ -128,7 +129,6 @@
mDependentFieldListener, mBackend));
mControllers.add(new VibrationPreferenceController(context, mBackend));
mControllers.add(new AppLinkPreferenceController(context));
- mControllers.add(new DescriptionPreferenceController(context));
mControllers.add(new VisibilityPreferenceController(context, new LockPatternUtils(context),
mBackend));
mControllers.add(new LightsPreferenceController(context, mBackend));
diff --git a/src/com/android/settings/notification/app/ConversationNotificationSettings.java b/src/com/android/settings/notification/app/ConversationNotificationSettings.java
index d712c84..d659c54 100644
--- a/src/com/android/settings/notification/app/ConversationNotificationSettings.java
+++ b/src/com/android/settings/notification/app/ConversationNotificationSettings.java
@@ -41,11 +41,13 @@
@Override
public void onResume() {
super.onResume();
- if (mUid < 0 || TextUtils.isEmpty(mPkg) || mPkgInfo == null || mChannel == null) {
+ if (mUid < 0 || TextUtils.isEmpty(mPkg) || mPkgInfo == null || mChannel == null
+ || mConversationInfo == null) {
Log.w(TAG, "Missing package or uid or packageinfo or channel");
finish();
return;
}
+ getActivity().setTitle(mConversationInfo.getLabel());
for (NotificationPreferenceController controller : mControllers) {
controller.onResume(mAppRow, mChannel, mChannelGroup, mConversationDrawable,
diff --git a/src/com/android/settings/notification/app/HeaderPreferenceController.java b/src/com/android/settings/notification/app/HeaderPreferenceController.java
index 974ac79..7379d55 100644
--- a/src/com/android/settings/notification/app/HeaderPreferenceController.java
+++ b/src/com/android/settings/notification/app/HeaderPreferenceController.java
@@ -84,6 +84,7 @@
pref = mHeaderController.setIcon(mAppRow.icon)
.setLabel(getLabel())
.setSummary(getSummary())
+ .setSecondSummary(getSecondSummary())
.setPackageName(mAppRow.pkg)
.setUid(mAppRow.uid)
.setButtonActions(EntityHeaderController.ActionType.ACTION_NOTIF_PREFERENCE,
@@ -96,25 +97,11 @@
}
}
- @Override
- public CharSequence getSummary() {
+ public CharSequence getLabel() {
if (mChannel != null && !isDefaultChannel()) {
- if (mChannelGroup != null
- && !TextUtils.isEmpty(mChannelGroup.getName())) {
- final SpannableStringBuilder summary = new SpannableStringBuilder();
- BidiFormatter bidi = BidiFormatter.getInstance();
- summary.append(bidi.unicodeWrap(mAppRow.label.toString()));
- summary.append(bidi.unicodeWrap(mContext.getText(
- R.string.notification_header_divider_symbol_with_spaces)));
- summary.append(bidi.unicodeWrap(mChannelGroup.getName().toString()));
- return summary.toString();
- } else {
- return mAppRow.label.toString();
- }
- } else if (mChannelGroup != null) {
- return mAppRow.label.toString();
+ return mChannel.getName();
} else {
- return "";
+ return mAppRow.label;
}
}
@@ -123,11 +110,26 @@
mStarted = true;
}
- @VisibleForTesting
- CharSequence getLabel() {
- return (mChannel != null && !isDefaultChannel()) ? mChannel.getName()
- : mChannelGroup != null
- ? mChannelGroup.getName()
- : mAppRow.label;
+ @Override
+ public CharSequence getSummary() {
+ if (mChannel != null) {
+ if (mChannelGroup != null
+ && !TextUtils.isEmpty(mChannelGroup.getName())) {
+ final SpannableStringBuilder summary = new SpannableStringBuilder();
+ BidiFormatter bidi = BidiFormatter.getInstance();
+ summary.append(bidi.unicodeWrap(mAppRow.label));
+ summary.append(bidi.unicodeWrap(mContext.getText(
+ R.string.notification_header_divider_symbol_with_spaces)));
+ summary.append(bidi.unicodeWrap(mChannelGroup.getName().toString()));
+ return summary.toString();
+ } else {
+ return mAppRow.label.toString();
+ }
+ }
+ return "";
+ }
+
+ public CharSequence getSecondSummary() {
+ return mChannel == null ? null : mChannel.getDescription();
}
}
diff --git a/tests/robotests/src/com/android/settings/notification/app/HeaderPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/notification/app/HeaderPreferenceControllerTest.java
index 9f90a16..e0a221a 100644
--- a/tests/robotests/src/com/android/settings/notification/app/HeaderPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/notification/app/HeaderPreferenceControllerTest.java
@@ -118,7 +118,7 @@
NotificationChannelGroup group = new NotificationChannelGroup("id", "name");
mController.onResume(appRow, null, group, null, null, null, null);
- assertEquals(group.getName(), mController.getLabel());
+ assertEquals(appRow.label, mController.getLabel());
NotificationChannel channel = new NotificationChannel("cid", "cname", IMPORTANCE_NONE);
mController.onResume(appRow, channel, group, null, null, null, null);
@@ -155,4 +155,24 @@
mController.onResume(appRow, defaultChannel, null, null, null, null, null);
assertEquals("", mController.getSummary());
}
+
+ @Test
+ public void testGetSecondSummary() {
+ NotificationBackend.AppRow appRow = new NotificationBackend.AppRow();
+ appRow.label = "bananas";
+ mController.onResume(appRow, null, null, null, null, null, null);
+ assertEquals("", mController.getSecondSummary());
+
+ NotificationChannelGroup group = new NotificationChannelGroup("id", "name");
+ mController.onResume(appRow, null, group, null, null, null, null);
+ assertEquals("", mController.getSecondSummary());
+
+ NotificationChannel channel = new NotificationChannel("cid", "cname", IMPORTANCE_NONE);
+ mController.onResume(appRow, channel, group, null, null, null, null);
+ assertEquals("", mController.getSecondSummary());
+
+ channel.setDescription("description");
+ mController.onResume(appRow, channel, group, null, null, null, null);
+ assertEquals("description", mController.getSecondSummary());
+ }
}