Loading packages/SystemUI/res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -1505,6 +1505,10 @@ <!-- Notification Inline Controls: Shown when a channel's notifications are currently blocked --> <string name="notification_channel_disabled">You won\'t see these notifications anymore</string> <!-- Notification Inline controls: continue receiving notifications prompt, channel level --> <string name="inline_blocking_helper">You usually dismiss these notifications. \nKeep showing them?</string> <!-- Notification Inline controls: continue receiving notifications prompt, channel level --> <string name="inline_keep_showing">Keep showing these notifications?</string> Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationGutsManager.java +5 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ package com.android.systemui.statusbar; import static android.service.notification.NotificationListenerService.Ranking .USER_SENTIMENT_NEGATIVE; import android.app.INotificationManager; import android.app.NotificationChannel; import android.content.Context; Loading Loading @@ -230,7 +233,8 @@ public class NotificationGutsManager implements Dumpable { try { info.bindNotification(pmUser, iNotificationManager, pkg, row.getEntry().channel, channels.size(), sbn, mCheckSaveListener, onSettingsClick, onAppSettingsClick, mNonBlockablePkgs); onAppSettingsClick, mNonBlockablePkgs, row.getEntry().userSentiment == USER_SENTIMENT_NEGATIVE); } catch (RemoteException e) { Log.e(TAG, e.toString()); } Loading packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java +31 −10 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G private OnSettingsClickListener mOnSettingsClickListener; private OnAppSettingsClickListener mAppSettingsClickListener; private NotificationGuts mGutsContainer; private boolean mNegativeUserSentiment; private OnClickListener mOnKeepShowing = v -> { closeControls(v); Loading Loading @@ -122,6 +123,22 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G final OnAppSettingsClickListener onAppSettingsClick, final Set<String> nonBlockablePkgs) throws RemoteException { bindNotification(pm, iNotificationManager, pkg, notificationChannel, numChannels, sbn, checkSaveListener, onSettingsClick, onAppSettingsClick, nonBlockablePkgs, false /* negative sentiment */); } public void bindNotification(final PackageManager pm, final INotificationManager iNotificationManager, final String pkg, final NotificationChannel notificationChannel, final int numChannels, final StatusBarNotification sbn, final CheckSaveListener checkSaveListener, final OnSettingsClickListener onSettingsClick, final OnAppSettingsClickListener onAppSettingsClick, final Set<String> nonBlockablePkgs, boolean negativeUserSentiment) throws RemoteException { mINotificationManager = iNotificationManager; mPkg = pkg; mNumNotificationChannels = numChannels; Loading @@ -133,6 +150,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G mOnSettingsClickListener = onSettingsClick; mSingleNotificationChannel = notificationChannel; mStartingUserImportance = mChosenImportance = mSingleNotificationChannel.getImportance(); mNegativeUserSentiment = negativeUserSentiment; int numTotalChannels = mINotificationManager.getNumNotificationChannelsForPackage( pkg, mAppUid, false /* includeDeleted */); Loading Loading @@ -227,24 +245,27 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G } private void bindPrompt() { final TextView channelName = findViewById(R.id.channel_name); final TextView blockPrompt = findViewById(R.id.block_prompt); bindName(); if (mNonblockable) { if (mIsSingleDefaultChannel || mNumNotificationChannels > 1) { channelName.setVisibility(View.GONE); blockPrompt.setText(R.string.notification_unblockable_desc); } else { channelName.setText(mSingleNotificationChannel.getName()); if (mNegativeUserSentiment) { blockPrompt.setText(R.string.inline_blocking_helper); } else if (mIsSingleDefaultChannel || mNumNotificationChannels > 1) { blockPrompt.setText(R.string.inline_keep_showing_app); } else { blockPrompt.setText(R.string.inline_keep_showing); } } } blockPrompt.setText(R.string.notification_unblockable_desc); } else { private void bindName() { final TextView channelName = findViewById(R.id.channel_name); if (mIsSingleDefaultChannel || mNumNotificationChannels > 1) { channelName.setVisibility(View.GONE); blockPrompt.setText(R.string.inline_keep_showing_app); } else { channelName.setText(mSingleNotificationChannel.getName()); blockPrompt.setText(R.string.inline_keep_showing); } } } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java +10 −0 Original line number Diff line number Diff line Loading @@ -280,6 +280,16 @@ public class NotificationInfoTest extends SysuiTestCase { assertEquals(GONE, blockView.getVisibility()); } @Test public void testbindNotification_BlockingHelper() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, null, true); final TextView view = mNotificationInfo.findViewById(R.id.block_prompt); assertEquals(View.VISIBLE, view.getVisibility()); assertEquals(mContext.getString(R.string.inline_blocking_helper), view.getText()); } @Test public void testbindNotification_UnblockableTextVisibleWhenAppUnblockable() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, Loading Loading
packages/SystemUI/res/values/strings.xml +4 −0 Original line number Diff line number Diff line Loading @@ -1505,6 +1505,10 @@ <!-- Notification Inline Controls: Shown when a channel's notifications are currently blocked --> <string name="notification_channel_disabled">You won\'t see these notifications anymore</string> <!-- Notification Inline controls: continue receiving notifications prompt, channel level --> <string name="inline_blocking_helper">You usually dismiss these notifications. \nKeep showing them?</string> <!-- Notification Inline controls: continue receiving notifications prompt, channel level --> <string name="inline_keep_showing">Keep showing these notifications?</string> Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationGutsManager.java +5 −1 Original line number Diff line number Diff line Loading @@ -15,6 +15,9 @@ */ package com.android.systemui.statusbar; import static android.service.notification.NotificationListenerService.Ranking .USER_SENTIMENT_NEGATIVE; import android.app.INotificationManager; import android.app.NotificationChannel; import android.content.Context; Loading Loading @@ -230,7 +233,8 @@ public class NotificationGutsManager implements Dumpable { try { info.bindNotification(pmUser, iNotificationManager, pkg, row.getEntry().channel, channels.size(), sbn, mCheckSaveListener, onSettingsClick, onAppSettingsClick, mNonBlockablePkgs); onAppSettingsClick, mNonBlockablePkgs, row.getEntry().userSentiment == USER_SENTIMENT_NEGATIVE); } catch (RemoteException e) { Log.e(TAG, e.toString()); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/NotificationInfo.java +31 −10 Original line number Diff line number Diff line Loading @@ -79,6 +79,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G private OnSettingsClickListener mOnSettingsClickListener; private OnAppSettingsClickListener mAppSettingsClickListener; private NotificationGuts mGutsContainer; private boolean mNegativeUserSentiment; private OnClickListener mOnKeepShowing = v -> { closeControls(v); Loading Loading @@ -122,6 +123,22 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G final OnAppSettingsClickListener onAppSettingsClick, final Set<String> nonBlockablePkgs) throws RemoteException { bindNotification(pm, iNotificationManager, pkg, notificationChannel, numChannels, sbn, checkSaveListener, onSettingsClick, onAppSettingsClick, nonBlockablePkgs, false /* negative sentiment */); } public void bindNotification(final PackageManager pm, final INotificationManager iNotificationManager, final String pkg, final NotificationChannel notificationChannel, final int numChannels, final StatusBarNotification sbn, final CheckSaveListener checkSaveListener, final OnSettingsClickListener onSettingsClick, final OnAppSettingsClickListener onAppSettingsClick, final Set<String> nonBlockablePkgs, boolean negativeUserSentiment) throws RemoteException { mINotificationManager = iNotificationManager; mPkg = pkg; mNumNotificationChannels = numChannels; Loading @@ -133,6 +150,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G mOnSettingsClickListener = onSettingsClick; mSingleNotificationChannel = notificationChannel; mStartingUserImportance = mChosenImportance = mSingleNotificationChannel.getImportance(); mNegativeUserSentiment = negativeUserSentiment; int numTotalChannels = mINotificationManager.getNumNotificationChannelsForPackage( pkg, mAppUid, false /* includeDeleted */); Loading Loading @@ -227,24 +245,27 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G } private void bindPrompt() { final TextView channelName = findViewById(R.id.channel_name); final TextView blockPrompt = findViewById(R.id.block_prompt); bindName(); if (mNonblockable) { if (mIsSingleDefaultChannel || mNumNotificationChannels > 1) { channelName.setVisibility(View.GONE); blockPrompt.setText(R.string.notification_unblockable_desc); } else { channelName.setText(mSingleNotificationChannel.getName()); if (mNegativeUserSentiment) { blockPrompt.setText(R.string.inline_blocking_helper); } else if (mIsSingleDefaultChannel || mNumNotificationChannels > 1) { blockPrompt.setText(R.string.inline_keep_showing_app); } else { blockPrompt.setText(R.string.inline_keep_showing); } } } blockPrompt.setText(R.string.notification_unblockable_desc); } else { private void bindName() { final TextView channelName = findViewById(R.id.channel_name); if (mIsSingleDefaultChannel || mNumNotificationChannels > 1) { channelName.setVisibility(View.GONE); blockPrompt.setText(R.string.inline_keep_showing_app); } else { channelName.setText(mSingleNotificationChannel.getName()); blockPrompt.setText(R.string.inline_keep_showing); } } } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/NotificationInfoTest.java +10 −0 Original line number Diff line number Diff line Loading @@ -280,6 +280,16 @@ public class NotificationInfoTest extends SysuiTestCase { assertEquals(GONE, blockView.getVisibility()); } @Test public void testbindNotification_BlockingHelper() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, TEST_PACKAGE_NAME, mNotificationChannel, 1, mSbn, null, null, null, null, true); final TextView view = mNotificationInfo.findViewById(R.id.block_prompt); assertEquals(View.VISIBLE, view.getVisibility()); assertEquals(mContext.getString(R.string.inline_blocking_helper), view.getText()); } @Test public void testbindNotification_UnblockableTextVisibleWhenAppUnblockable() throws Exception { mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager, Loading