Snap for 6523363 from 5cae0b8042 to mainline-release

Change-Id: Ia9f8e149cc300bcf5abcfb7524008a4d272120e6
This commit is contained in:
android-build-team Robot
2020-05-24 07:08:50 +00:00
15 changed files with 136 additions and 48 deletions

View File

@@ -61,7 +61,7 @@
android:clickable="false"
android:focusable="false"
android:ellipsize="end"
android:maxLines="2"
android:maxLines="3"
android:layout_below="@id/priority_icon"
android:textAppearance="@style/TextAppearance.NotificationImportanceDetail"
android:visibility="gone" />
@@ -143,7 +143,7 @@
<TextView
android:id="@+id/silence_summary"
android:paddingTop="@dimen/notification_importance_button_padding"
android:text="@string/notification_channel_summary_low"
android:text="@string/notification_conversation_summary_low"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="false"

View File

@@ -136,12 +136,12 @@
android:layout_width="wrap_content"
android:text="@string/notification_history_snooze"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textAppearance="@style/TextAppearance.HomepageCardTitle"
android:paddingBottom="16dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notification_list"
android:elevation="3dp"
android:elevation="1dp"
android:background="@drawable/rounded_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -161,11 +161,11 @@
android:layout_width="wrap_content"
android:text="@string/notification_history_dismiss"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textAppearance="@style/TextAppearance.HomepageCardTitle"
android:paddingBottom="16dp" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/notification_list"
android:elevation="3dp"
android:elevation="1dp"
android:background="@drawable/rounded_bg"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -183,19 +183,18 @@
android:layout_width="wrap_content"
android:text="@string/notification_history_today"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textAppearance="@style/TextAppearance.HomepageCardTitle"
android:paddingBottom="16dp" />
<LinearLayout
android:id="@+id/apps"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:elevation="3dp"
android:elevation="1dp"
android:orientation="vertical"
android:background="@drawable/rounded_bg">
<!-- app based recycler views added here -->
</LinearLayout>
</LinearLayout>
</LinearLayout>
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -78,6 +78,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipChildren="true"
android:clipToPadding="true"
android:importantForAccessibility="yes"
android:scrollbars="none"/>

View File

@@ -17,12 +17,13 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="48dp"
android:paddingBottom="6dp"
android:paddingTop="6dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:orientation="vertical"
android:background="?android:attr/selectableItemBackground">
android:background="?android:attr/colorBackgroundFloating"
android:foreground="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
@@ -38,7 +39,7 @@
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title"
android:textAppearance="@style/TextAppearance.NotificationHistory.Title"
android:layout_toStartOf="@id/alerted_icon"
android:textAlignment="viewStart"/>
@@ -64,7 +65,7 @@
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"
android:textAppearance="@style/TextAppearance.NotificationHistory.AppName"
android:textAlignment="viewEnd"
/>
</LinearLayout>
@@ -77,7 +78,7 @@
android:ellipsize="end"
android:singleLine="true"
android:paddingTop="3dp"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"
android:textAppearance="@style/TextAppearance.NotificationHistory.Text"
android:textAlignment="viewStart" />
</LinearLayout>

View File

@@ -16,18 +16,17 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="6dp"
android:minHeight="48dp"
android:orientation="vertical"
android:background="?android:attr/selectableItemBackground"
>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="?android:attr/selectableItemBackground">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
android:orientation="vertical"
>
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
@@ -56,10 +55,9 @@
android:ellipsize="end"
android:singleLine="true"
android:textColor="?android:attr/textColorPrimary"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textAppearance="@style/TextAppearance.NotificationHistory.AppName"
android:marqueeRepeatLimit = "marquee_forever"
android:scrollHorizontally = "true"
android:textStyle="bold"
android:textAlignment="viewStart" />
<ImageView
@@ -98,7 +96,7 @@
android:layout_centerVertical="true"
android:ellipsize="end"
android:singleLine="true"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"
android:textAppearance="@style/TextAppearance.NotificationHistory.AppName"
android:textAlignment="viewEnd"
/>
</LinearLayout>
@@ -107,7 +105,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginStart="30dp"
android:layout_marginBottom="6dp"
>
@@ -118,7 +115,7 @@
android:layout_gravity="left|center_vertical"
android:ellipsize="end"
android:singleLine="true"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification.Title"
android:textAppearance="@style/TextAppearance.NotificationHistory.Title"
android:textAlignment="viewStart"
/>
@@ -129,7 +126,7 @@
android:layout_gravity="left|center_vertical"
android:ellipsize="end"
android:singleLine="true"
android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Notification"
android:textAppearance="@style/TextAppearance.NotificationHistory.Text"
android:textAlignment="viewStart"
/>
@@ -140,6 +137,5 @@
android:id="@+id/divider"
android:layout_width="match_parent"
android:layout_height="0.5dp"
android:layout_marginTop="17dp"
android:background="@color/material_grey_300" />
</LinearLayout>

View File

@@ -8301,17 +8301,17 @@
<!-- Configure notifications: Title for determining which notifications appear on the lock screen [CHAR LIMIT=60] -->
<string name="lock_screen_notifs_title">Notifications on lockscreen</string>
<string name="lock_screen_notifs_title">Notifications on lock screen</string>
<!-- Configure notifications: Value for lockscreen notifications: all notifications shown
regardless of noisiness [CHAR LIMIT=60] -->
<string name="lock_screen_notifs_show_all">Show alerting and silent notifications</string>
<string name="lock_screen_notifs_show_all">Show conversations, default, and silent</string>
<!-- Configure notifications: Value for lockscreen notifications: show alerting notifications [CHAR LIMIT=60] -->
<string name="lock_screen_notifs_show_alerting">Show alerting notifications only</string>
<string name="lock_screen_notifs_show_alerting">Hide silent conversations and notifications</string>
<!-- Configure notifications: Value for lockscreen notifications: don't show notifications [CHAR LIMIT=60] -->
<string name="lock_screen_notifs_show_none">Don\u2019t show notifications</string>
<string name="lock_screen_notifs_show_none">Don\u2019t show any notifications</string>
<!-- Configure notifications: Title for redacting sensitive content on lockscreen [CHAR LIMIT=60] -->
<string name="lock_screen_notifs_redact">Sensitive notifications</string>
@@ -8395,7 +8395,7 @@
<string name="conversation_section_switch_title">Conversation section</string>
<!-- [CHAR LIMIT=100] Summary for switch that says whether this app can appear in the conversation notification section-->
<string name="conversation_section_switch_summary">Allow <xliff:g id="app">%1$s</xliff:g> to appear in the conversation section</string>
<string name="conversation_section_switch_summary">Allow app to use conversation section</string>
<!-- [CHAR LIMIT=NONE] Conversation preference summary, the parent channel this conversation was spawned from (separator) the parent channel group (e.g. an account name)-->
<string name="notification_conversation_summary" translatable="false">"<xliff:g id="parent_category_name">%1$s</xliff:g><xliff:g id="parent_category_group_name">%2$s</xliff:g>"</string>
@@ -8434,7 +8434,7 @@
<string name="important_conversations_summary">Show at top of conversation section</string>
<!-- [CHAR LIMIT=100] preference category title -->
<string name="other_conversations">Modified conversations</string>
<string name="other_conversations">Other conversations</string>
<!-- summary for other conversations list -->
<string name="other_conversations_summary">Conversations you\u2019ve made changes to</string>
@@ -8494,7 +8494,7 @@
<string name="notification_silence_title">Silent</string>
<!-- [CHAR LIMIT=100] Notification Importance title -->
<string name="notification_alert_title">Alerting</string>
<string name="notification_alert_title">Default</string>
<!-- [CHAR LIMIT=40] Notification importance title. This setting controls how notifications in older apps may alert the user (eg, sound, visual, vibrate). -->
<string name="allow_interruption">Allow interruptions</string>
@@ -8506,9 +8506,9 @@
<string name="notification_priority_title">Priority</string>
<!-- [CHAR LIMIT=150] Notification Importance title: important conversation level summary -->
<string name="notification_channel_summary_priority">Shows at top of conversation section and appears as a bubble</string>
<string name="notification_channel_summary_priority">Shows at top of conversation section, appears as floating bubble, displays profile picture on lock screen</string>
<string name="convo_not_supported_summary"><xliff:g id="app_name" example="Android Services">%1$s</xliff:g> does not support conversation-specific settings.</string>
<string name="convo_not_supported_summary"><xliff:g id="app_name" example="Android Services">%1$s</xliff:g> doesn\u2019t support most conversation features. You cant set a conversation as priority, and conversations wont appear as floating bubbles.</string>
<!-- Channel summaries for the app notification page -->
@@ -8516,10 +8516,13 @@
<string name="notification_channel_summary_min">In the pull-down shade, collapse notifications to one line</string>
<!-- [CHAR LIMIT=150] Notification Importance title: low importance level summary -->
<string name="notification_channel_summary_low">Helps you focus without sound or vibration</string>
<string name="notification_channel_summary_low">No sound or vibration</string>
<!-- [CHAR LIMIT=150] Notification Importance title: low importance level summary -->
<string name="notification_conversation_summary_low">No sound or vibration and appears lower in conversation section</string>
<!-- [CHAR LIMIT=150] Notification Importance title: normal importance level summary -->
<string name="notification_channel_summary_default">Gets your attention with sound or vibration</string>
<string name="notification_channel_summary_default">May ring or vibrate based on phone settings</string>
<!-- [CHAR LIMIT=150] Notification Importance title: high importance level summary -->
<string name="notification_channel_summary_high">When device is unlocked, show notifications as a banner across the top of the screen</string>
@@ -8850,7 +8853,7 @@
<string name="notification_channel_sound_title">Sound</string>
<!-- [CHAR LIMIT=180] Notification conversation: important -->
<string name="notification_conversation_important">Important</string>
<string name="notification_conversation_important">Priority</string>
<!-- [CHAR LIMIT=180] Notification conversation: add to home screen -->
<string name="notification_conversation_add_to_home">Add to home</string>

View File

@@ -334,6 +334,24 @@
<item name="android:padding">8dp</item>
</style>
<style name="TextAppearance.NotificationHistory">
<item name="android:textSize">14sp</item>
</style>
<style name="TextAppearance.NotificationHistory.AppName">
<item name="android:fontFamily">@*android:string/config_bodyFontFamily</item>
<item name="android:textSize">12sp</item>
</style>
<style name="TextAppearance.NotificationHistory.Title">
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
</style>
<style name="TextAppearance.NotificationHistory.Text">
<item name="android:fontFamily">@*android:string/config_headlineFontFamily</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="TextAppearance.ContextualCardDismissalText"
parent="@*android:style/TextAppearance.DeviceDefault.Body1">
<item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>

View File

@@ -23,6 +23,7 @@ import android.service.notification.ConversationChannelWrapper;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import com.android.settings.R;
import com.android.settings.notification.NotificationBackend;
import java.util.Collections;
@@ -49,6 +50,14 @@ public class AllConversationsPreferenceController extends ConversationListPrefer
return true;
}
@Override
Preference getSummaryPreference() {
Preference pref = new Preference(mContext);
pref.setOrder(1);
pref.setSummary(R.string.other_conversations_summary);
return pref;
}
@Override
boolean matchesFilter(ConversationChannelWrapper conversation) {
return !conversation.getNotificationChannel().isImportantConversation();

View File

@@ -73,24 +73,33 @@ public abstract class ConversationListPreferenceController extends AbstractPrefe
containerGroup.setVisible(false);
} else {
containerGroup.setVisible(true);
Preference summaryPref = getSummaryPreference();
if (summaryPref != null) {
containerGroup.addPreference(summaryPref);
}
}
}
abstract Preference getSummaryPreference();
abstract boolean matchesFilter(ConversationChannelWrapper conversation);
protected void populateConversations(List<ConversationChannelWrapper> conversations,
PreferenceGroup containerGroup) {
int order = 100;
for (ConversationChannelWrapper conversation : conversations) {
if (conversation.getNotificationChannel().isDemoted()
|| !matchesFilter(conversation)) {
continue;
}
containerGroup.addPreference(createConversationPref(conversation));
containerGroup.addPreference(createConversationPref(conversation, order++));
}
}
protected Preference createConversationPref(final ConversationChannelWrapper conversation) {
protected Preference createConversationPref(final ConversationChannelWrapper conversation,
int order) {
Preference pref = new Preference(mContext);
pref.setOrder(order);
pref.setTitle(getTitle(conversation));
pref.setSummary(getSummary(conversation));

View File

@@ -59,8 +59,7 @@ public class InvalidConversationPreferenceController extends NotificationPrefere
pref.setDisabledByAdmin(mAdmin);
pref.setEnabled(!pref.isDisabledByAdmin());
pref.setChecked(!mBackend.hasUserDemotedInvalidMsgApp(mAppRow.pkg, mAppRow.uid));
preference.setSummary(mContext.getString(
R.string.conversation_section_switch_summary, mAppRow.label));
preference.setSummary(mContext.getString(R.string.conversation_section_switch_summary));
}
@Override

View File

@@ -50,6 +50,11 @@ public class NoConversationsPreferenceController extends ConversationListPrefere
return true;
}
@Override
Preference getSummaryPreference() {
return null;
}
@Override
boolean matchesFilter(ConversationChannelWrapper conversation) {
return false;

View File

@@ -23,6 +23,7 @@ import android.service.notification.ConversationChannelWrapper;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import com.android.settings.R;
import com.android.settings.notification.NotificationBackend;
import java.util.Collections;
@@ -49,6 +50,14 @@ public class PriorityConversationsPreferenceController extends
return true;
}
@Override
Preference getSummaryPreference() {
Preference pref = new Preference(mContext);
pref.setOrder(1);
pref.setSummary(R.string.important_conversations_summary_bubbles);
return pref;
}
@Override
boolean matchesFilter(ConversationChannelWrapper conversation) {
return conversation.getNotificationChannel().isImportantConversation();

View File

@@ -20,6 +20,7 @@ import static android.provider.Settings.Secure.NOTIFICATION_HISTORY_ENABLED;
import static androidx.core.view.accessibility.AccessibilityEventCompat.TYPE_VIEW_ACCESSIBILITY_FOCUSED;
import android.app.ActionBar;
import android.app.Activity;
import android.app.ActivityManager;
import android.app.INotificationManager;
@@ -27,6 +28,8 @@ import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.res.TypedArray;
import android.graphics.Outline;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
@@ -37,9 +40,11 @@ import android.service.notification.NotificationListenerService;
import android.service.notification.StatusBarNotification;
import android.util.Log;
import android.util.Slog;
import android.util.TypedValue;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewOutlineProvider;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.TextView;
@@ -82,6 +87,23 @@ public class NotificationHistoryActivity extends Activity {
findViewById(R.id.today_list).setVisibility(
notifications.isEmpty() ? View.GONE : View.VISIBLE);
mCountdownLatch.countDown();
mTodayView.setClipToOutline(true);
mTodayView.setOutlineProvider(new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
final TypedArray ta = NotificationHistoryActivity.this.obtainStyledAttributes(
new int[]{android.R.attr.dialogCornerRadius});
final float dialogCornerRadius = ta.getDimension(0, 0);
ta.recycle();
TypedValue v = new TypedValue();
NotificationHistoryActivity.this.getTheme().resolveAttribute(
com.android.internal.R.attr.listDivider, v, true);
int bottomPadding = NotificationHistoryActivity.this.getDrawable(v.resourceId)
.getIntrinsicHeight();
outline.setRoundRect(0, 0, view.getWidth(), (view.getHeight() - bottomPadding),
dialogCornerRadius);
}
});
// for each package, new header and recycler view
for (NotificationHistoryPackage nhp : notifications) {
View viewForPackage = LayoutInflater.from(this)
@@ -138,6 +160,13 @@ public class NotificationHistoryActivity extends Activity {
mHistoryOn = findViewById(R.id.history_on);
mHistoryEmpty = findViewById(R.id.history_on_empty);
mSwitchBar = findViewById(R.id.switch_bar);
ActionBar actionBar = getActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
actionBar.setHomeButtonEnabled(true);
actionBar.setDisplayShowTitleEnabled(true);
}
}
@Override
@@ -200,6 +229,12 @@ public class NotificationHistoryActivity extends Activity {
super.onDestroy();
}
@Override
public boolean onNavigateUp() {
finish();
return true;
}
private void bindSwitch() {
if (mSwitchBar != null) {
mSwitchBar.setSwitchBarText(R.string.notification_history_toggle,

View File

@@ -2,10 +2,7 @@ package com.android.settings.notification.history;
import android.annotation.Nullable;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import androidx.recyclerview.widget.DividerItemDecoration;
import androidx.recyclerview.widget.ItemTouchHelper;
@@ -26,7 +23,8 @@ public class NotificationHistoryRecyclerView extends RecyclerView {
this(context, attrs, 0);
}
public NotificationHistoryRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
public NotificationHistoryRecyclerView(Context context, @Nullable AttributeSet attrs,
int defStyle) {
super(context, attrs, defStyle);
setLayoutManager(new LinearLayoutManager(getContext()));

View File

@@ -34,6 +34,7 @@ import android.os.Bundle;
import android.provider.Settings;
import android.service.notification.ConversationChannelWrapper;
import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
@@ -225,5 +226,10 @@ public class ConversationListPreferenceControllerTest {
public String getPreferenceKey() {
return "test";
}
@Override
Preference getSummaryPreference() {
return null;
}
}
}