Merge "Update conversation inline controls text am: 8d25709048" into rvc-dev-plus-aosp am: 523cc2012c
Change-Id: Ief4b67d7bb08e21b49cec5bd8bb1ad54b65cf3ce
This commit is contained in:
@@ -1829,15 +1829,15 @@
|
||||
<!-- [CHAR LIMIT=150] Notification Importance title: normal importance level summary -->
|
||||
<string name="notification_channel_summary_default">Gets your attention with sound or vibration.</string>
|
||||
|
||||
<!-- [CHAR LIMIT=150] Conversation Notification Importance title: normal conversation level, with bubbling summary -->
|
||||
<string name="notification_channel_summary_default_with_bubbles">Gets your attention with sound or vibration. Conversations from <xliff:g id="app_name" example="YouTube">%1$s</xliff:g> bubble by default.</string>
|
||||
|
||||
<!-- [CHAR LIMIT=150] Notification Importance title: bubble level summary -->
|
||||
<string name="notification_channel_summary_bubble">Keeps your attention with a floating shortcut to this content.</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>
|
||||
|
||||
<!--[CHAR LIMIT=150] Conversation inline controls footer shown when all conversations from the app are allowed to show as bubbles -->
|
||||
<string name="notification_conversation_channel_all_bubble">All conversations from <xliff:g id="app_name" example="YouTube">%1$s</xliff:g> bubble by default. Manage in <xliff:g id="app_name" example="Settings">%2$s</xliff:g>.</string>
|
||||
|
||||
<!--[CHAR LIMIT=30] Linkable text to Settings app -->
|
||||
<string name="notification_conversation_channel_settings">Settings</string>
|
||||
|
||||
|
||||
@@ -564,7 +564,7 @@
|
||||
<style name="TextAppearance.NotificationImportanceButton">
|
||||
<item name="android:textSize">@dimen/notification_importance_button_text</item>
|
||||
<item name="android:fontFamily">@*android:string/config_headlineFontFamilyMedium</item>
|
||||
<item name="android:textColor">?android:attr/colorAccent</item>
|
||||
<item name="android:textColor">@color/notification_guts_priority_contents</item>
|
||||
<item name="android:gravity">center</item>
|
||||
</style>
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package com.android.systemui.statusbar.notification.row;
|
||||
|
||||
import static android.app.Notification.EXTRA_IS_GROUP_CONVERSATION;
|
||||
import static android.app.NotificationManager.BUBBLE_PREFERENCE_ALL;
|
||||
import static android.app.NotificationManager.BUBBLE_PREFERENCE_NONE;
|
||||
import static android.app.NotificationManager.BUBBLE_PREFERENCE_SELECTED;
|
||||
import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
|
||||
@@ -33,6 +34,7 @@ import android.app.INotificationManager;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationChannelGroup;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
@@ -51,6 +53,7 @@ import android.transition.TransitionManager;
|
||||
import android.transition.TransitionSet;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.util.Slog;
|
||||
import android.view.View;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.widget.ImageView;
|
||||
@@ -91,6 +94,7 @@ public class NotificationConversationInfo extends LinearLayout implements
|
||||
private String mConversationId;
|
||||
private StatusBarNotification mSbn;
|
||||
private boolean mIsDeviceProvisioned;
|
||||
private int mAppBubble;
|
||||
|
||||
private TextView mPriorityDescriptionView;
|
||||
private TextView mDefaultDescriptionView;
|
||||
@@ -206,6 +210,13 @@ public class NotificationConversationInfo extends LinearLayout implements
|
||||
mNotificationChannel = NotificationChannelHelper.createConversationChannelIfNeeded(
|
||||
getContext(), mINotificationManager, entry, mNotificationChannel);
|
||||
|
||||
try {
|
||||
mAppBubble = mINotificationManager.getBubblePreferenceForPackage(mPackageName, mAppUid);
|
||||
} catch (RemoteException e) {
|
||||
Slog.e(TAG, "can't reach OS", e);
|
||||
mAppBubble = BUBBLE_PREFERENCE_SELECTED;
|
||||
}
|
||||
|
||||
bindHeader();
|
||||
bindActions();
|
||||
|
||||
@@ -227,6 +238,11 @@ public class NotificationConversationInfo extends LinearLayout implements
|
||||
snooze.setOnClickListener(mOnSnoozeClick);
|
||||
*/
|
||||
|
||||
if (mAppBubble == BUBBLE_PREFERENCE_ALL) {
|
||||
((TextView) findViewById(R.id.default_summary)).setText(getResources().getString(
|
||||
R.string.notification_channel_summary_default_with_bubbles, mAppName));
|
||||
}
|
||||
|
||||
findViewById(R.id.priority).setOnClickListener(mOnFavoriteClick);
|
||||
findViewById(R.id.default_behavior).setOnClickListener(mOnDefaultClick);
|
||||
findViewById(R.id.silence).setOnClickListener(mOnMuteClick);
|
||||
@@ -264,7 +280,6 @@ public class NotificationConversationInfo extends LinearLayout implements
|
||||
// bindName();
|
||||
bindPackage();
|
||||
bindIcon(mNotificationChannel.isImportantConversation());
|
||||
|
||||
}
|
||||
|
||||
private void bindIcon(boolean important) {
|
||||
@@ -560,10 +575,7 @@ public class NotificationConversationInfo extends LinearLayout implements
|
||||
!mChannelToUpdate.isImportantConversation());
|
||||
if (mChannelToUpdate.isImportantConversation()) {
|
||||
mChannelToUpdate.setAllowBubbles(true);
|
||||
int currentPref =
|
||||
mINotificationManager.getBubblePreferenceForPackage(
|
||||
mAppPkg, mAppUid);
|
||||
if (currentPref == BUBBLE_PREFERENCE_NONE) {
|
||||
if (mAppBubble == BUBBLE_PREFERENCE_NONE) {
|
||||
mINotificationManager.setBubblesAllowed(mAppPkg, mAppUid,
|
||||
BUBBLE_PREFERENCE_SELECTED);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@
|
||||
package com.android.systemui.statusbar.notification.row;
|
||||
|
||||
import static android.app.Notification.FLAG_BUBBLE;
|
||||
import static android.app.NotificationManager.BUBBLE_PREFERENCE_ALL;
|
||||
import static android.app.NotificationManager.BUBBLE_PREFERENCE_SELECTED;
|
||||
import static android.app.NotificationManager.IMPORTANCE_DEFAULT;
|
||||
import static android.app.NotificationManager.IMPORTANCE_HIGH;
|
||||
import static android.app.NotificationManager.IMPORTANCE_LOW;
|
||||
@@ -458,7 +460,9 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBindNotification_defaultSelected_notFave_notSilent() {
|
||||
public void testBindNotification_defaultSelected_notFave_notSilent() throws Exception {
|
||||
when(mMockINotificationManager.getBubblePreferenceForPackage(anyString(), anyInt()))
|
||||
.thenReturn(BUBBLE_PREFERENCE_SELECTED);
|
||||
mConversationChannel.setImportance(IMPORTANCE_HIGH);
|
||||
mConversationChannel.setImportantConversation(false);
|
||||
mConversationChannel.setAllowBubbles(true);
|
||||
@@ -476,6 +480,35 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
|
||||
true);
|
||||
View view = mNotificationInfo.findViewById(R.id.default_behavior);
|
||||
assertThat(view.isSelected()).isTrue();
|
||||
assertThat(((TextView) view.findViewById(R.id.default_summary)).getText()).isEqualTo(
|
||||
mContext.getString(R.string.notification_channel_summary_default));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBindNotification_default_allCanBubble() throws Exception {
|
||||
when(mMockINotificationManager.getBubblePreferenceForPackage(anyString(), anyInt()))
|
||||
.thenReturn(BUBBLE_PREFERENCE_ALL);
|
||||
when(mMockPackageManager.getApplicationLabel(any())).thenReturn("App Name");
|
||||
mConversationChannel.setImportance(IMPORTANCE_HIGH);
|
||||
mConversationChannel.setImportantConversation(false);
|
||||
mConversationChannel.setAllowBubbles(true);
|
||||
mNotificationInfo.bindNotification(
|
||||
mShortcutManager,
|
||||
mMockPackageManager,
|
||||
mMockINotificationManager,
|
||||
mVisualStabilityManager,
|
||||
TEST_PACKAGE_NAME,
|
||||
mNotificationChannel,
|
||||
mEntry,
|
||||
null,
|
||||
null,
|
||||
mIconFactory,
|
||||
true);
|
||||
View view = mNotificationInfo.findViewById(R.id.default_behavior);
|
||||
assertThat(view.isSelected()).isTrue();
|
||||
assertThat(((TextView) view.findViewById(R.id.default_summary)).getText()).isEqualTo(
|
||||
mContext.getString(R.string.notification_channel_summary_default_with_bubbles,
|
||||
"App Name"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user