diff options
16 files changed, 414 insertions, 1861 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/BundleNotificationInfoTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/BundleNotificationInfoTest.java deleted file mode 100644 index 66277e2d13a6..000000000000 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/BundleNotificationInfoTest.java +++ /dev/null @@ -1,308 +0,0 @@ -/* - * Copyright (C) 2024 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. - */ - -package com.android.systemui.statusbar.notification.row; - -import static android.app.Notification.EXTRA_BUILDER_APPLICATION_INFO; -import static android.app.NotificationManager.IMPORTANCE_LOW; -import static android.print.PrintManager.PRINT_SPOOLER_PACKAGE_NAME; -import static android.service.notification.NotificationAssistantService.ACTION_NOTIFICATION_ASSISTANT_FEEDBACK_SETTINGS; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; - -import static org.mockito.Mockito.any; -import static org.mockito.Mockito.anyBoolean; -import static org.mockito.Mockito.anyInt; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import android.app.INotificationManager; -import android.app.Notification; -import android.app.NotificationChannel; -import android.content.ComponentName; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.content.pm.ApplicationInfo; -import android.content.pm.PackageInfo; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.os.UserHandle; -import android.platform.test.annotations.EnableFlags; -import android.service.notification.NotificationAssistantService; -import android.service.notification.StatusBarNotification; -import android.telecom.TelecomManager; -import android.testing.TestableLooper; -import android.view.LayoutInflater; -import android.view.View; - -import androidx.test.ext.junit.runners.AndroidJUnit4; -import androidx.test.filters.SmallTest; - -import com.android.internal.logging.MetricsLogger; -import com.android.internal.logging.testing.UiEventLoggerFake; -import com.android.systemui.Dependency; -import com.android.systemui.SysuiTestCase; -import com.android.systemui.res.R; -import com.android.systemui.statusbar.notification.AssistantFeedbackController; -import com.android.systemui.statusbar.notification.collection.NotificationEntry; -import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder; - -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.junit.MockitoJUnit; -import org.mockito.junit.MockitoRule; - -import java.util.ArrayList; -import java.util.List; -import java.util.concurrent.CountDownLatch; - -@SmallTest -@RunWith(AndroidJUnit4.class) -@TestableLooper.RunWithLooper -public class BundleNotificationInfoTest extends SysuiTestCase { - private static final String TEST_PACKAGE_NAME = "test_package"; - private static final String TEST_SYSTEM_PACKAGE_NAME = PRINT_SPOOLER_PACKAGE_NAME; - private static final int TEST_UID = 1; - private static final String TEST_CHANNEL = "test_channel"; - private static final String TEST_CHANNEL_NAME = "TEST CHANNEL NAME"; - - private TestableLooper mTestableLooper; - private BundleNotificationInfo mInfo; - private NotificationChannel mNotificationChannel; - private StatusBarNotification mSbn; - private NotificationEntry mEntry; - private UiEventLoggerFake mUiEventLogger = new UiEventLoggerFake(); - - @Rule - public MockitoRule mockito = MockitoJUnit.rule(); - @Mock - private MetricsLogger mMetricsLogger; - @Mock - private INotificationManager mMockINotificationManager; - @Mock - private PackageManager mMockPackageManager; - @Mock - private OnUserInteractionCallback mOnUserInteractionCallback; - @Mock - private ChannelEditorDialogController mChannelEditorDialogController; - @Mock - private AssistantFeedbackController mAssistantFeedbackController; - @Mock - private TelecomManager mTelecomManager; - - @Before - public void setUp() throws Exception { - mTestableLooper = TestableLooper.get(this); - - mContext.addMockSystemService(TelecomManager.class, mTelecomManager); - - mDependency.injectTestDependency(Dependency.BG_LOOPER, mTestableLooper.getLooper()); - // Inflate the layout - final LayoutInflater layoutInflater = LayoutInflater.from(mContext); - mInfo = (BundleNotificationInfo) layoutInflater.inflate(R.layout.bundle_notification_info, - null); - mInfo.setGutsParent(mock(NotificationGuts.class)); - // Our view is never attached to a window so the View#post methods in - // BundleNotificationInfo never get called. Setting this will skip the post and do the - // action immediately. - mInfo.mSkipPost = true; - - // PackageManager must return a packageInfo and applicationInfo. - final PackageInfo packageInfo = new PackageInfo(); - packageInfo.packageName = TEST_PACKAGE_NAME; - when(mMockPackageManager.getPackageInfo(eq(TEST_PACKAGE_NAME), anyInt())) - .thenReturn(packageInfo); - final ApplicationInfo applicationInfo = new ApplicationInfo(); - applicationInfo.uid = TEST_UID; // non-zero - final PackageInfo systemPackageInfo = new PackageInfo(); - systemPackageInfo.packageName = TEST_SYSTEM_PACKAGE_NAME; - when(mMockPackageManager.getPackageInfo(eq(TEST_SYSTEM_PACKAGE_NAME), anyInt())) - .thenReturn(systemPackageInfo); - when(mMockPackageManager.getPackageInfo(eq("android"), anyInt())) - .thenReturn(packageInfo); - - // Package has one channel by default. - when(mMockINotificationManager.getNumNotificationChannelsForPackage( - eq(TEST_PACKAGE_NAME), eq(TEST_UID), anyBoolean())).thenReturn(1); - - // Some test channels. - mNotificationChannel = new NotificationChannel( - TEST_CHANNEL, TEST_CHANNEL_NAME, IMPORTANCE_LOW); - Notification notification = new Notification(); - notification.extras.putParcelable(EXTRA_BUILDER_APPLICATION_INFO, applicationInfo); - mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, TEST_UID, 0, - notification, UserHandle.getUserHandleForUid(TEST_UID), null, 0); - mEntry = new NotificationEntryBuilder().setSbn(mSbn).build(); - when(mAssistantFeedbackController.isFeedbackEnabled()).thenReturn(false); - when(mAssistantFeedbackController.getInlineDescriptionResource(any())) - .thenReturn(R.string.notification_channel_summary_automatic); - } - - @Test - @EnableFlags(android.app.Flags.FLAG_NOTIFICATION_CLASSIFICATION_UI) - public void testBindNotification_setsOnClickListenerForFeedback() throws Exception { - // When Notification Assistant is available, - when(mMockINotificationManager.getAllowedNotificationAssistant()).thenReturn( - new ComponentName("assistantPkg", "assistantCls")); - - // ...and Package manager has an intent that matches. - ArrayList<ResolveInfo> resolveInfos = new ArrayList<>(); - ResolveInfo info = new ResolveInfo(); - info.activityInfo = new ActivityInfo(); - info.activityInfo.packageName = "assistantPkg"; - info.activityInfo.name = "assistantCls"; - resolveInfos.add(info); - when(mMockPackageManager.queryIntentActivities(any(), anyInt())).thenReturn(resolveInfos); - - // And we attempt to bind the notification to the Info object - final CountDownLatch latch = new CountDownLatch(1); - mInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - (View v, Intent intent) -> { - // Assert that the intent action and package match. - assertEquals(intent.getAction(), - ACTION_NOTIFICATION_ASSISTANT_FEEDBACK_SETTINGS); - assertEquals(intent.getPackage(), "assistantPkg"); - latch.countDown(); - }, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); - // and the feedback button is clicked, - final View feedbackButton = mInfo.findViewById(R.id.notification_guts_bundle_feedback); - feedbackButton.performClick(); - - // then of the intents queried for is the feedback intent, - ArgumentCaptor<Intent> captor = ArgumentCaptor.forClass(Intent.class); - verify(mMockPackageManager, atLeastOnce()).queryIntentActivities(captor.capture(), - anyInt()); - List<Intent> capturedIntents = captor.getAllValues(); - Intent feedbackIntent = null; - for (int i = 0; i < capturedIntents.size(); i++) { - final Intent capturedIntent = capturedIntents.get(i); - if (capturedIntent.getAction() == ACTION_NOTIFICATION_ASSISTANT_FEEDBACK_SETTINGS - && capturedIntent.getPackage().equals("assistantPkg")) { - feedbackIntent = capturedIntent; - } - } - assertNotNull("feedbackIntent should be not null", feedbackIntent); - assertEquals(mSbn.getKey(), - feedbackIntent.getExtra(NotificationAssistantService.EXTRA_NOTIFICATION_KEY)); - - // and verify that listener was triggered. - assertEquals(0, latch.getCount()); - assertEquals(View.VISIBLE, feedbackButton.getVisibility()); - } - - @Test - @EnableFlags(android.app.Flags.FLAG_NOTIFICATION_CLASSIFICATION_UI) - public void testBindNotification_hidesFeedbackButtonWhenNoNAS() throws Exception { - // When the Notification Assistant is not available - when(mMockINotificationManager.getAllowedNotificationAssistant()).thenReturn(null); - final CountDownLatch latch = new CountDownLatch(1); - - mInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - (View v, Intent intent) -> { - // Assert that the intent action and package match. - assertEquals(intent.getAction(), - ACTION_NOTIFICATION_ASSISTANT_FEEDBACK_SETTINGS); - assertEquals(intent.getPackage(), "assistantPkg"); - latch.countDown(); - }, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); - - final View feedbackButton = mInfo.findViewById(R.id.notification_guts_bundle_feedback); - feedbackButton.performClick(); - // Listener was not triggered - assertEquals(1, latch.getCount()); - assertEquals(View.GONE, feedbackButton.getVisibility()); - } - - @Test - @EnableFlags(android.app.Flags.FLAG_NOTIFICATION_CLASSIFICATION_UI) - public void testBindNotification_hidesFeedbackButtonWhenNoIntent() throws Exception { - // When the Notification Assistant is available, - when(mMockINotificationManager.getAllowedNotificationAssistant()).thenReturn( - new ComponentName("assistantPkg", "assistantCls")); - - // But the intent activity is null - when(mMockPackageManager.queryIntentActivities(any(), anyInt())).thenReturn(null); - - final CountDownLatch latch = new CountDownLatch(1); - mInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - (View v, Intent intent) -> { - // Assert that the intent action and package match. - assertEquals(intent.getAction(), - ACTION_NOTIFICATION_ASSISTANT_FEEDBACK_SETTINGS); - assertEquals(intent.getPackage(), "assistantPkg"); - latch.countDown(); - }, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); - - final View feedbackButton = mInfo.findViewById(R.id.notification_guts_bundle_feedback); - feedbackButton.performClick(); - // Listener was not triggered - assertEquals(1, latch.getCount()); - assertEquals(View.GONE, feedbackButton.getVisibility()); - } -} diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.kt index 28b2ee8dde06..11673a0e73b2 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerTest.kt @@ -522,6 +522,7 @@ class NotificationGutsManagerTest(flags: FlagsParameterization) : SysuiTestCase( eq(entry), any<NotificationInfo.OnSettingsClickListener>(), any<NotificationInfo.OnAppSettingsClickListener>(), + any<NotificationInfo.OnFeedbackClickListener>(), any<UiEventLogger>(), /* isDeviceProvisioned = */ eq(false), /* isNonblockable = */ eq(false), @@ -559,6 +560,7 @@ class NotificationGutsManagerTest(flags: FlagsParameterization) : SysuiTestCase( eq(entry), any<NotificationInfo.OnSettingsClickListener>(), any<NotificationInfo.OnAppSettingsClickListener>(), + any<NotificationInfo.OnFeedbackClickListener>(), any<UiEventLogger>(), /* isDeviceProvisioned = */ eq(true), /* isNonblockable = */ eq(false), @@ -594,44 +596,7 @@ class NotificationGutsManagerTest(flags: FlagsParameterization) : SysuiTestCase( eq(entry), any<NotificationInfo.OnSettingsClickListener>(), any<NotificationInfo.OnAppSettingsClickListener>(), - any<UiEventLogger>(), - /* isDeviceProvisioned = */ eq(false), - /* isNonblockable = */ eq(false), - /* wasShownHighPriority = */ eq(false), - eq(assistantFeedbackController), - eq(metricsLogger), - any<View.OnClickListener>(), - ) - } - - @Test - @Throws(Exception::class) - fun testInitializeBundleNotificationInfoView() { - val infoView: BundleNotificationInfo = mock() - val row = spy(helper.createRow()) - val entry = row.entry - - // Modify the notification entry to have a channel that is in SYSTEM_RESERVED_IDS - val channel = NotificationChannel(NotificationChannel.NEWS_ID, "name", 2) - NotificationEntryHelper.modifyRanking(entry).setChannel(channel).build() - - whenever(row.isNonblockable).thenReturn(false) - val statusBarNotification = entry.sbn - // Can we change this to a call to bindGuts instead? We have the row, - // we need a MenuItem that we can put the infoView into. - gutsManager.initializeBundleNotificationInfo(row, infoView) - - verify(infoView) - .bindNotification( - any<PackageManager>(), - any<INotificationManager>(), - eq(onUserInteractionCallback), - eq(channelEditorDialogController), - eq(statusBarNotification.packageName), - any<NotificationChannel>(), - eq(entry), - any<NotificationInfo.OnSettingsClickListener>(), - any<NotificationInfo.OnAppSettingsClickListener>(), + any<NotificationInfo.OnFeedbackClickListener>(), any<UiEventLogger>(), /* isDeviceProvisioned = */ eq(false), /* isNonblockable = */ eq(false), diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java index fdba7ba34855..a64339e20f7c 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/NotificationInfoTest.java @@ -17,6 +17,7 @@ package com.android.systemui.statusbar.notification.row; import static android.app.Notification.EXTRA_BUILDER_APPLICATION_INFO; +import static android.app.NotificationChannel.SOCIAL_MEDIA_ID; import static android.app.NotificationChannel.USER_LOCKED_IMPORTANCE; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_LOW; @@ -41,18 +42,26 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import android.app.Flags; import android.app.INotificationManager; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationChannelGroup; import android.app.PendingIntent; import android.app.Person; +import android.content.ComponentName; +import android.content.Intent; +import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.graphics.drawable.Drawable; import android.os.RemoteException; import android.os.UserHandle; +import android.platform.test.annotations.DisableFlags; +import android.platform.test.annotations.EnableFlags; +import android.platform.test.flag.junit.SetFlagsRule; import android.service.notification.StatusBarNotification; import android.telecom.TelecomManager; import android.testing.TestableLooper; @@ -69,6 +78,7 @@ import com.android.internal.logging.testing.UiEventLoggerFake; import com.android.systemui.Dependency; import com.android.systemui.SysuiTestCase; import com.android.systemui.res.R; +import com.android.systemui.statusbar.RankingBuilder; import com.android.systemui.statusbar.notification.AssistantFeedbackController; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder; @@ -82,6 +92,8 @@ import org.mockito.Mock; import org.mockito.junit.MockitoJUnit; import org.mockito.junit.MockitoRule; +import java.util.List; +import java.util.Optional; import java.util.concurrent.CountDownLatch; @SmallTest @@ -98,6 +110,7 @@ public class NotificationInfoTest extends SysuiTestCase { private NotificationInfo mNotificationInfo; private NotificationChannel mNotificationChannel; private NotificationChannel mDefaultNotificationChannel; + private NotificationChannel mClassifiedNotificationChannel; private StatusBarNotification mSbn; private NotificationEntry mEntry; private UiEventLoggerFake mUiEventLogger = new UiEventLoggerFake(); @@ -119,6 +132,9 @@ public class NotificationInfoTest extends SysuiTestCase { @Mock private TelecomManager mTelecomManager; + @Rule + public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); + @Before public void setUp() throws Exception { mTestableLooper = TestableLooper.get(this); @@ -149,6 +165,14 @@ public class NotificationInfoTest extends SysuiTestCase { when(mMockPackageManager.getPackageInfo(eq("android"), anyInt())) .thenReturn(packageInfo); + ComponentName assistant = new ComponentName("package", "service"); + when(mMockINotificationManager.getAllowedNotificationAssistant()).thenReturn(assistant); + ResolveInfo ri = new ResolveInfo(); + ri.activityInfo = new ActivityInfo(); + ri.activityInfo.packageName = assistant.getPackageName(); + ri.activityInfo.name = "activity"; + when(mMockPackageManager.queryIntentActivities(any(), anyInt())).thenReturn(List.of(ri)); + // Package has one channel by default. when(mMockINotificationManager.getNumNotificationChannelsForPackage( eq(TEST_PACKAGE_NAME), eq(TEST_UID), anyBoolean())).thenReturn(1); @@ -159,6 +183,9 @@ public class NotificationInfoTest extends SysuiTestCase { mDefaultNotificationChannel = new NotificationChannel( NotificationChannel.DEFAULT_CHANNEL_ID, TEST_CHANNEL_NAME, IMPORTANCE_LOW); + mClassifiedNotificationChannel = + new NotificationChannel(SOCIAL_MEDIA_ID, "social", IMPORTANCE_LOW); + Notification notification = new Notification(); notification.extras.putParcelable(EXTRA_BUILDER_APPLICATION_INFO, applicationInfo); mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, TEST_UID, 0, @@ -168,10 +195,8 @@ public class NotificationInfoTest extends SysuiTestCase { when(mAssistantFeedbackController.getInlineDescriptionResource(any())) .thenReturn(R.string.notification_channel_summary_automatic); } - - @Test - public void testBindNotification_SetsTextApplicationName() throws Exception { - when(mMockPackageManager.getApplicationLabel(any())).thenReturn("App Name"); + + private void doStandardBind() throws Exception { mNotificationInfo.bindNotification( mMockPackageManager, mMockINotificationManager, @@ -182,12 +207,19 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, true, mAssistantFeedbackController, mMetricsLogger, null); + } + + @Test + public void testBindNotification_SetsTextApplicationName() throws Exception { + when(mMockPackageManager.getApplicationLabel(any())).thenReturn("App Name"); + doStandardBind(); final TextView textView = mNotificationInfo.findViewById(R.id.pkg_name); assertTrue(textView.getText().toString().contains("App Name")); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); @@ -198,44 +230,14 @@ public class NotificationInfoTest extends SysuiTestCase { final Drawable iconDrawable = mock(Drawable.class); when(mMockPackageManager.getApplicationIcon(any(ApplicationInfo.class))) .thenReturn(iconDrawable); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, null); + doStandardBind(); final ImageView iconView = mNotificationInfo.findViewById(R.id.pkg_icon); assertEquals(iconDrawable, iconView.getDrawable()); } @Test public void testBindNotification_noDelegate() throws Exception { - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, null); + doStandardBind(); final TextView nameView = mNotificationInfo.findViewById(R.id.delegate_name); assertEquals(GONE, nameView.getVisibility()); } @@ -261,6 +263,7 @@ public class NotificationInfoTest extends SysuiTestCase { entry, null, null, + null, mUiEventLogger, true, false, @@ -274,22 +277,7 @@ public class NotificationInfoTest extends SysuiTestCase { @Test public void testBindNotification_GroupNameHiddenIfNoGroup() throws Exception { - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, null); + doStandardBind(); final TextView groupNameView = mNotificationInfo.findViewById(R.id.group_name); assertEquals(GONE, groupNameView.getVisibility()); } @@ -302,22 +290,7 @@ public class NotificationInfoTest extends SysuiTestCase { when(mMockINotificationManager.getNotificationChannelGroupForPackage( eq("test_group_id"), eq(TEST_PACKAGE_NAME), eq(TEST_UID))) .thenReturn(notificationChannelGroup); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, null); + doStandardBind(); final TextView groupNameView = mNotificationInfo.findViewById(R.id.group_name); assertEquals(View.VISIBLE, groupNameView.getVisibility()); assertEquals("Test Group Name", groupNameView.getText()); @@ -325,22 +298,7 @@ public class NotificationInfoTest extends SysuiTestCase { @Test public void testBindNotification_SetsTextChannelName() throws Exception { - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, null); + doStandardBind(); final TextView textView = mNotificationInfo.findViewById(R.id.channel_name); assertEquals(TEST_CHANNEL_NAME, textView.getText()); } @@ -357,6 +315,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -383,6 +342,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -406,13 +366,13 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, true, true, mAssistantFeedbackController, - mMetricsLogger, - null); + mMetricsLogger, null); final TextView textView = mNotificationInfo.findViewById(R.id.channel_name); assertEquals(VISIBLE, textView.getVisibility()); } @@ -433,6 +393,7 @@ public class NotificationInfoTest extends SysuiTestCase { latch.countDown(); }, null, + null, mUiEventLogger, true, false, @@ -449,23 +410,7 @@ public class NotificationInfoTest extends SysuiTestCase { @Test public void testBindNotification_SettingsButtonInvisibleWhenNoClickListener() throws Exception { - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); final View settingsButton = mNotificationInfo.findViewById(R.id.info); assertTrue(settingsButton.getVisibility() != View.VISIBLE); } @@ -485,6 +430,7 @@ public class NotificationInfoTest extends SysuiTestCase { assertEquals(mNotificationChannel, c); }, null, + null, mUiEventLogger, false, false, @@ -498,23 +444,7 @@ public class NotificationInfoTest extends SysuiTestCase { @Test public void testBindNotification_SettingsButtonReappearsAfterSecondBind() throws Exception { - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); mNotificationInfo.bindNotification( mMockPackageManager, mMockINotificationManager, @@ -525,6 +455,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, (View v, NotificationChannel c, int appUid) -> { }, null, + null, mUiEventLogger, true, false, @@ -548,13 +479,13 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, true, true, mAssistantFeedbackController, - mMetricsLogger, - null); + mMetricsLogger, null); final TextView view = mNotificationInfo.findViewById(R.id.non_configurable_text); assertEquals(View.VISIBLE, view.getVisibility()); assertEquals(mContext.getString(R.string.notification_unblockable_desc), @@ -582,23 +513,7 @@ public class NotificationInfoTest extends SysuiTestCase { mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, TEST_UID, 0, nb.build(), UserHandle.getUserHandleForUid(TEST_UID), null, 0); mEntry.setSbn(mSbn); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); final TextView view = mNotificationInfo.findViewById(R.id.non_configurable_call_text); assertEquals(View.VISIBLE, view.getVisibility()); assertEquals(mContext.getString(R.string.notification_unblockable_call_desc), @@ -613,9 +528,6 @@ public class NotificationInfoTest extends SysuiTestCase { public void testBindNotification_whenCurrentlyInCall_notCall() throws Exception { when(mMockINotificationManager.isInCall(anyString(), anyInt())).thenReturn(true); - Person person = new Person.Builder() - .setName("caller") - .build(); Notification.Builder nb = new Notification.Builder( mContext, mNotificationChannel.getId()) .setContentTitle("foo") @@ -626,23 +538,7 @@ public class NotificationInfoTest extends SysuiTestCase { mSbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME, 0, null, TEST_UID, 0, nb.build(), UserHandle.getUserHandleForUid(TEST_UID), null, 0); mEntry.setSbn(mSbn); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); assertEquals(GONE, mNotificationInfo.findViewById(R.id.non_configurable_call_text).getVisibility()); assertEquals(VISIBLE, @@ -654,46 +550,14 @@ public class NotificationInfoTest extends SysuiTestCase { @Test public void testBindNotification_automaticIsVisible() throws Exception { when(mAssistantFeedbackController.isFeedbackEnabled()).thenReturn(true); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.automatic).getVisibility()); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.automatic_summary).getVisibility()); } @Test public void testBindNotification_automaticIsGone() throws Exception { - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); assertEquals(GONE, mNotificationInfo.findViewById(R.id.automatic).getVisibility()); assertEquals(GONE, mNotificationInfo.findViewById(R.id.automatic_summary).getVisibility()); } @@ -702,45 +566,13 @@ public class NotificationInfoTest extends SysuiTestCase { public void testBindNotification_automaticIsSelected() throws Exception { when(mAssistantFeedbackController.isFeedbackEnabled()).thenReturn(true); mNotificationChannel.unlockFields(USER_LOCKED_IMPORTANCE); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); assertTrue(mNotificationInfo.findViewById(R.id.automatic).isSelected()); } @Test public void testBindNotification_alertIsSelected() throws Exception { - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); assertTrue(mNotificationInfo.findViewById(R.id.alert).isSelected()); } @@ -756,6 +588,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -768,23 +601,7 @@ public class NotificationInfoTest extends SysuiTestCase { @Test public void testBindNotification_DoesNotUpdateNotificationChannel() throws Exception { - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); mTestableLooper.processAllMessages(); verify(mMockINotificationManager, never()).updateNotificationChannelForPackage( anyString(), eq(TEST_UID), any()); @@ -792,23 +609,7 @@ public class NotificationInfoTest extends SysuiTestCase { @Test public void testBindNotification_LogsOpen() throws Exception { - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); assertEquals(1, mUiEventLogger.numLogs()); assertEquals(NotificationControlsEvent.NOTIFICATION_CONTROLS_OPEN.getId(), mUiEventLogger.eventId(0)); @@ -827,6 +628,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -845,23 +647,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testDoesNotUpdateNotificationChannelAfterImportanceChangedSilenced() throws Exception { mNotificationChannel.setImportance(IMPORTANCE_DEFAULT); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); mNotificationInfo.findViewById(R.id.silence).performClick(); mTestableLooper.processAllMessages(); @@ -873,23 +659,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testDoesNotUpdateNotificationChannelAfterImportanceChangedAutomatic() throws Exception { mNotificationChannel.setImportance(IMPORTANCE_DEFAULT); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); mNotificationInfo.findViewById(R.id.automatic).performClick(); mTestableLooper.processAllMessages(); @@ -902,23 +672,7 @@ public class NotificationInfoTest extends SysuiTestCase { throws Exception { when(mAssistantFeedbackController.isFeedbackEnabled()).thenReturn(true); mNotificationChannel.unlockFields(USER_LOCKED_IMPORTANCE); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); mNotificationInfo.handleCloseControls(true, false); mTestableLooper.processAllMessages(); @@ -930,23 +684,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testHandleCloseControls_DoesNotUpdateNotificationChannelIfUnchanged() throws Exception { int originalImportance = mNotificationChannel.getImportance(); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); mNotificationInfo.handleCloseControls(true, false); mTestableLooper.processAllMessages(); @@ -966,23 +704,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testHandleCloseControls_DoesNotUpdateNotificationChannelIfUnspecified() throws Exception { mNotificationChannel.setImportance(IMPORTANCE_UNSPECIFIED); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); mNotificationInfo.handleCloseControls(true, false); @@ -995,23 +717,7 @@ public class NotificationInfoTest extends SysuiTestCase { @Test public void testSilenceCallsUpdateNotificationChannel() throws Exception { mNotificationChannel.setImportance(IMPORTANCE_DEFAULT); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); mNotificationInfo.findViewById(R.id.silence).performClick(); mNotificationInfo.findViewById(R.id.done).performClick(); @@ -1047,6 +753,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -1075,23 +782,7 @@ public class NotificationInfoTest extends SysuiTestCase { when(mAssistantFeedbackController.isFeedbackEnabled()).thenReturn(true); mNotificationChannel.setImportance(IMPORTANCE_DEFAULT); mNotificationChannel.lockFields(USER_LOCKED_IMPORTANCE); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); mNotificationInfo.findViewById(R.id.automatic).performClick(); mNotificationInfo.findViewById(R.id.done).performClick(); @@ -1108,23 +799,7 @@ public class NotificationInfoTest extends SysuiTestCase { public void testSilenceCallsUpdateNotificationChannel_channelImportanceUnspecified() throws Exception { mNotificationChannel.setImportance(IMPORTANCE_UNSPECIFIED); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); mNotificationInfo.findViewById(R.id.silence).performClick(); mNotificationInfo.findViewById(R.id.done).performClick(); @@ -1155,6 +830,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -1194,6 +870,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -1226,6 +903,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -1255,23 +933,7 @@ public class NotificationInfoTest extends SysuiTestCase { @Test public void testAdjustImportanceTemporarilyAllowsReordering() throws Exception { mNotificationChannel.setImportance(IMPORTANCE_DEFAULT); - mNotificationInfo.bindNotification( - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - null, - null, - mUiEventLogger, - true, - false, - true, - mAssistantFeedbackController, - mMetricsLogger, - null); + doStandardBind(); mNotificationInfo.findViewById(R.id.silence).performClick(); mNotificationInfo.findViewById(R.id.done).performClick(); @@ -1295,6 +957,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -1327,6 +990,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -1363,6 +1027,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -1397,6 +1062,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -1431,6 +1097,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -1458,6 +1125,7 @@ public class NotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, @@ -1468,4 +1136,54 @@ public class NotificationInfoTest extends SysuiTestCase { assertFalse(mNotificationInfo.willBeRemoved()); } + + + @Test + @DisableFlags(Flags.FLAG_NOTIFICATION_CLASSIFICATION_UI) + public void testBindNotification_HidesFeedbackLink_flagOff() throws Exception { + doStandardBind(); + assertEquals(GONE, mNotificationInfo.findViewById(R.id.feedback).getVisibility()); + } + + @Test + @EnableFlags(Flags.FLAG_NOTIFICATION_CLASSIFICATION_UI) + public void testBindNotification_SetsFeedbackLink_isReservedChannel() throws RemoteException { + mEntry.setRanking(new RankingBuilder(mEntry.getRanking()) + .setSummarization("something").build()); + final CountDownLatch latch = new CountDownLatch(1); + mNotificationInfo.bindNotification( + mMockPackageManager, + mMockINotificationManager, + mOnUserInteractionCallback, + mChannelEditorDialogController, + TEST_PACKAGE_NAME, + mClassifiedNotificationChannel, + mEntry, + null, + null, + (View v, Intent intent) -> { + latch.countDown(); + }, + mUiEventLogger, + true, + false, + false, + mAssistantFeedbackController, + mMetricsLogger, + null); + + final View feedback = mNotificationInfo.findViewById(R.id.feedback); + assertEquals(VISIBLE, feedback.getVisibility()); + feedback.performClick(); + // Verify that listener was triggered. + assertEquals(0, latch.getCount()); + } + + @Test + @EnableFlags(Flags.FLAG_NOTIFICATION_CLASSIFICATION_UI) + public void testBindNotification_hidesFeedbackLink_notReservedChannel() throws Exception { + doStandardBind(); + + assertEquals(GONE, mNotificationInfo.findViewById(R.id.feedback).getVisibility()); + } } diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfoTest.java b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfoTest.java index b33f93d5b523..acdbd6237733 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfoTest.java +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfoTest.java @@ -138,6 +138,7 @@ public class PromotedNotificationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mUiEventLogger, true, false, diff --git a/packages/SystemUI/res/layout/bundle_notification_info.xml b/packages/SystemUI/res/layout/bundle_notification_info.xml deleted file mode 100644 index 745066a7bdbb..000000000000 --- a/packages/SystemUI/res/layout/bundle_notification_info.xml +++ /dev/null @@ -1,366 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- - Copyright 2024, 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. ---> - -<com.android.systemui.statusbar.notification.row.BundleNotificationInfo - xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:androidprv="http://schemas.android.com/apk/prv/res/android" - android:id="@+id/notification_guts" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:focusable="true" - android:clipChildren="false" - android:clipToPadding="true" - android:orientation="vertical" - android:paddingStart="@dimen/notification_shade_content_margin_horizontal"> - - <!-- Package Info --> - <LinearLayout - android:id="@+id/header" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center_vertical" - android:clipChildren="false" - android:paddingTop="@dimen/notification_guts_header_top_padding" - android:clipToPadding="true"> - <ImageView - android:id="@+id/pkg_icon" - android:layout_width="@dimen/notification_guts_conversation_icon_size" - android:layout_height="@dimen/notification_guts_conversation_icon_size" - android:layout_centerVertical="true" - android:layout_alignParentStart="true" - android:layout_marginEnd="15dp" /> - <LinearLayout - android:id="@+id/names" - android:layout_weight="1" - android:layout_width="0dp" - android:orientation="vertical" - android:layout_height="wrap_content" - android:minHeight="@dimen/notification_guts_conversation_icon_size" - android:layout_centerVertical="true" - android:gravity="center_vertical" - android:layout_alignEnd="@id/pkg_icon" - android:layout_toEndOf="@id/pkg_icon"> - <TextView - android:id="@+id/channel_name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textDirection="locale" - style="@style/TextAppearance.NotificationImportanceChannel"/> - <TextView - android:id="@+id/group_name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:textDirection="locale" - android:ellipsize="end" - style="@style/TextAppearance.NotificationImportanceChannelGroup"/> - <TextView - android:id="@+id/pkg_name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - style="@style/TextAppearance.NotificationImportanceApp" - android:ellipsize="end" - android:textDirection="locale" - android:maxLines="1"/> - <TextView - android:id="@+id/delegate_name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_centerVertical="true" - style="@style/TextAppearance.NotificationImportanceHeader" - android:layout_marginStart="2dp" - android:layout_marginEnd="2dp" - android:ellipsize="end" - android:textDirection="locale" - android:text="@string/notification_delegate_header" - android:maxLines="1" /> - - </LinearLayout> - - <!-- end aligned fields --> - <!-- Optional link to app. Only appears if the channel is not disabled and the app -asked for it --> - <ImageButton - android:id="@+id/app_settings" - android:layout_width="@dimen/notification_importance_toggle_size" - android:layout_height="@dimen/notification_importance_toggle_size" - android:layout_centerVertical="true" - android:visibility="gone" - android:background="@drawable/ripple_drawable" - android:contentDescription="@string/notification_app_settings" - android:src="@drawable/ic_info" - android:layout_toStartOf="@id/info" - android:tint="@androidprv:color/materialColorPrimary"/> - <ImageButton - android:id="@+id/info" - android:layout_width="@dimen/notification_importance_toggle_size" - android:layout_height="@dimen/notification_importance_toggle_size" - android:layout_centerVertical="true" - android:contentDescription="@string/notification_more_settings" - android:background="@drawable/ripple_drawable_20dp" - android:src="@drawable/ic_settings" - android:tint="@androidprv:color/materialColorPrimary" - android:layout_alignParentEnd="true" /> - - </LinearLayout> - - <LinearLayout - android:id="@+id/inline_controls" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingEnd="@dimen/notification_shade_content_margin_horizontal" - android:layout_marginTop="@dimen/notification_guts_option_vertical_padding" - android:clipChildren="false" - android:clipToPadding="false" - android:orientation="vertical"> - - <!-- Non configurable app/channel text. appears instead of @+id/interruptiveness_settings--> - <TextView - android:id="@+id/non_configurable_text" - android:text="@string/notification_unblockable_desc" - android:visibility="gone" - android:layout_width="match_parent" - android:layout_height="wrap_content" - style="@*android:style/TextAppearance.DeviceDefault.Notification" /> - - <!-- Non configurable app/channel text. appears instead of @+id/interruptiveness_settings--> - <TextView - android:id="@+id/non_configurable_call_text" - android:text="@string/notification_unblockable_call_desc" - android:visibility="gone" - android:layout_width="match_parent" - android:layout_height="wrap_content" - style="@*android:style/TextAppearance.DeviceDefault.Notification" /> - - <!-- Non configurable multichannel text. appears instead of @+id/interruptiveness_settings--> - <TextView - android:id="@+id/non_configurable_multichannel_text" - android:text="@string/notification_multichannel_desc" - android:visibility="gone" - android:layout_width="match_parent" - android:layout_height="wrap_content" - style="@*android:style/TextAppearance.DeviceDefault.Notification" /> - - <LinearLayout - android:id="@+id/interruptiveness_settings" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="center" - android:orientation="vertical"> - <com.android.systemui.statusbar.notification.row.ButtonLinearLayout - android:id="@+id/automatic" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="@dimen/notification_importance_button_separation" - android:padding="@dimen/notification_importance_button_padding" - android:clickable="true" - android:focusable="true" - android:background="@drawable/notification_guts_priority_button_bg" - android:orientation="vertical" - android:visibility="gone"> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:gravity="center" - > - <ImageView - android:id="@+id/automatic_icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ic_notifications_automatic" - android:background="@android:color/transparent" - android:tint="@color/notification_guts_priority_contents" - android:clickable="false" - android:focusable="false"/> - <TextView - android:id="@+id/automatic_label" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginStart="@dimen/notification_importance_drawable_padding" - android:layout_weight="1" - android:ellipsize="end" - android:maxLines="1" - android:clickable="false" - android:focusable="false" - android:textAppearance="@style/TextAppearance.NotificationImportanceButton" - android:text="@string/notification_automatic_title"/> - </LinearLayout> - <TextView - android:id="@+id/automatic_summary" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/notification_importance_button_description_top_margin" - android:visibility="gone" - android:text="@string/notification_channel_summary_automatic" - android:clickable="false" - android:focusable="false" - android:ellipsize="end" - android:maxLines="2" - android:textAppearance="@style/TextAppearance.NotificationImportanceDetail"/> - </com.android.systemui.statusbar.notification.row.ButtonLinearLayout> - - <com.android.systemui.statusbar.notification.row.ButtonLinearLayout - android:id="@+id/alert" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:padding="@dimen/notification_importance_button_padding" - android:clickable="true" - android:focusable="true" - android:background="@drawable/notification_guts_priority_button_bg" - android:orientation="vertical"> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:gravity="center" - > - <ImageView - android:id="@+id/alert_icon" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:src="@drawable/ic_notifications_alert" - android:background="@android:color/transparent" - android:tint="@color/notification_guts_priority_contents" - android:clickable="false" - android:focusable="false"/> - <TextView - android:id="@+id/alert_label" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:layout_marginStart="@dimen/notification_importance_drawable_padding" - android:layout_weight="1" - android:ellipsize="end" - android:maxLines="1" - android:clickable="false" - android:focusable="false" - android:textAppearance="@style/TextAppearance.NotificationImportanceButton" - android:text="@string/notification_alert_title"/> - </LinearLayout> - <TextView - android:id="@+id/alert_summary" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/notification_importance_button_description_top_margin" - android:visibility="gone" - android:text="@string/notification_channel_summary_default" - android:clickable="false" - android:focusable="false" - android:ellipsize="end" - android:maxLines="2" - android:textAppearance="@style/TextAppearance.NotificationImportanceDetail"/> - </com.android.systemui.statusbar.notification.row.ButtonLinearLayout> - - <com.android.systemui.statusbar.notification.row.ButtonLinearLayout - android:id="@+id/silence" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/notification_importance_button_separation" - android:padding="@dimen/notification_importance_button_padding" - android:clickable="true" - android:focusable="true" - android:background="@drawable/notification_guts_priority_button_bg" - android:orientation="vertical"> - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:gravity="center" - > - <ImageView - android:id="@+id/silence_icon" - android:src="@drawable/ic_notifications_silence" - android:background="@android:color/transparent" - android:tint="@color/notification_guts_priority_contents" - android:layout_gravity="center" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:clickable="false" - android:focusable="false"/> - <TextView - android:id="@+id/silence_label" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:ellipsize="end" - android:maxLines="1" - android:clickable="false" - android:focusable="false" - android:layout_toEndOf="@id/silence_icon" - android:layout_marginStart="@dimen/notification_importance_drawable_padding" - android:textAppearance="@style/TextAppearance.NotificationImportanceButton" - android:text="@string/notification_silence_title"/> - </LinearLayout> - <TextView - android:id="@+id/silence_summary" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="@dimen/notification_importance_button_description_top_margin" - android:visibility="gone" - android:text="@string/notification_channel_summary_low" - android:clickable="false" - android:focusable="false" - android:ellipsize="end" - android:maxLines="2" - android:textAppearance="@style/TextAppearance.NotificationImportanceDetail"/> - </com.android.systemui.statusbar.notification.row.ButtonLinearLayout> - - </LinearLayout> - - <TextView - android:id="@+id/notification_guts_bundle_feedback" - android:text="@string/notification_guts_bundle_feedback" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:gravity="start|center_vertical" - android:minWidth="@dimen/notification_guts_bundle_feedback_size" - android:minHeight="@dimen/notification_guts_bundle_feedback_size" - android:maxWidth="200dp" - style="@style/TextAppearance.NotificationInfo.Button"/> - - <RelativeLayout - android:id="@+id/bottom_buttons" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="60dp" - android:gravity="center_vertical" - android:paddingStart="4dp" - android:paddingEnd="4dp" - > - <TextView - android:id="@+id/turn_off_notifications" - android:text="@string/inline_turn_off_notifications" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentStart="true" - android:gravity="start|center_vertical" - android:minWidth="@dimen/notification_importance_toggle_size" - android:minHeight="@dimen/notification_importance_toggle_size" - android:maxWidth="200dp" - style="@style/TextAppearance.NotificationInfo.Button"/> - <TextView - android:id="@+id/done" - android:text="@string/inline_ok_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_alignParentEnd="true" - android:gravity="end|center_vertical" - android:minWidth="@dimen/notification_importance_toggle_size" - android:minHeight="@dimen/notification_importance_toggle_size" - android:maxWidth="125dp" - style="@style/TextAppearance.NotificationInfo.Button"/> - </RelativeLayout> - </LinearLayout> -</com.android.systemui.statusbar.notification.row.BundleNotificationInfo> diff --git a/packages/SystemUI/res/layout/notification_conversation_info.xml b/packages/SystemUI/res/layout/notification_conversation_info.xml index cb9d8115d674..9560be0d6969 100644 --- a/packages/SystemUI/res/layout/notification_conversation_info.xml +++ b/packages/SystemUI/res/layout/notification_conversation_info.xml @@ -167,6 +167,17 @@ <!-- end aligned fields --> <ImageButton + android:id="@+id/feedback" + android:layout_width="@dimen/notification_importance_toggle_size" + android:layout_height="@dimen/notification_importance_toggle_size" + android:layout_centerVertical="true" + android:visibility="gone" + android:background="@drawable/ripple_drawable" + android:contentDescription="@string/notification_guts_bundle_feedback" + android:src="@*android:drawable/ic_feedback" + android:layout_alignParentEnd="true" + android:tint="@androidprv:color/materialColorPrimary"/> + <ImageButton android:id="@+id/info" android:layout_width="@dimen/notification_importance_toggle_size" android:layout_height="@dimen/notification_importance_toggle_size" diff --git a/packages/SystemUI/res/layout/notification_info.xml b/packages/SystemUI/res/layout/notification_info.xml index edca7e3a9940..089ceaee6ce3 100644 --- a/packages/SystemUI/res/layout/notification_info.xml +++ b/packages/SystemUI/res/layout/notification_info.xml @@ -91,6 +91,18 @@ </LinearLayout> <!-- end aligned fields --> + <!-- feedback for notificationassistantservice --> + <ImageButton + android:id="@+id/feedback" + android:layout_width="@dimen/notification_importance_toggle_size" + android:layout_height="@dimen/notification_importance_toggle_size" + android:layout_centerVertical="true" + android:visibility="gone" + android:background="@drawable/ripple_drawable" + android:contentDescription="@string/notification_guts_bundle_feedback" + android:src="@*android:drawable/ic_feedback" + android:layout_toStartOf="@id/info" + android:tint="@androidprv:color/materialColorPrimary"/> <!-- Optional link to app. Only appears if the channel is not disabled and the app asked for it --> <ImageButton @@ -102,7 +114,7 @@ asked for it --> android:background="@drawable/ripple_drawable" android:contentDescription="@string/notification_app_settings" android:src="@drawable/ic_info" - android:layout_toStartOf="@id/info" + android:layout_toStartOf="@id/feedback" android:tint="@androidprv:color/materialColorPrimary"/> <ImageButton android:id="@+id/info" diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/BundleNotificationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/BundleNotificationInfo.java deleted file mode 100644 index 9c6e41c482b6..000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/BundleNotificationInfo.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright (C) 2024 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. - */ - -package com.android.systemui.statusbar.notification.row; - -import android.app.INotificationManager; -import android.app.NotificationChannel; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.pm.ActivityInfo; -import android.content.pm.PackageManager; -import android.content.pm.ResolveInfo; -import android.os.RemoteException; -import android.service.notification.NotificationAssistantService; -import android.service.notification.StatusBarNotification; -import android.util.AttributeSet; -import android.view.View; - -import com.android.internal.logging.MetricsLogger; -import com.android.internal.logging.UiEventLogger; -import com.android.systemui.res.R; -import com.android.systemui.statusbar.notification.AssistantFeedbackController; -import com.android.systemui.statusbar.notification.collection.NotificationEntry; - -import java.util.List; - -/** - * The guts of a notification revealed when performing a long press. - */ -public class BundleNotificationInfo extends NotificationInfo { - private static final String TAG = "BundleNotifInfoGuts"; - - public BundleNotificationInfo(Context context, AttributeSet attrs) { - super(context, attrs); - } - - @Override - public void bindNotification( - PackageManager pm, - INotificationManager iNotificationManager, - OnUserInteractionCallback onUserInteractionCallback, - ChannelEditorDialogController channelEditorDialogController, - String pkg, - NotificationChannel notificationChannel, - NotificationEntry entry, - OnSettingsClickListener onSettingsClick, - OnAppSettingsClickListener onAppSettingsClick, - UiEventLogger uiEventLogger, - boolean isDeviceProvisioned, - boolean isNonblockable, - boolean wasShownHighPriority, - AssistantFeedbackController assistantFeedbackController, - MetricsLogger metricsLogger, OnClickListener onCloseClick) throws RemoteException { - super.bindNotification(pm, iNotificationManager, onUserInteractionCallback, - channelEditorDialogController, pkg, notificationChannel, entry, onSettingsClick, - onAppSettingsClick, uiEventLogger, isDeviceProvisioned, isNonblockable, - wasShownHighPriority, assistantFeedbackController, metricsLogger, onCloseClick); - - // Additionally, bind the feedback button. - ComponentName assistant = iNotificationManager.getAllowedNotificationAssistant(); - bindFeedback(entry.getSbn(), pm, assistant, onAppSettingsClick); - } - - protected void bindFeedback(StatusBarNotification sbn, PackageManager pm, - ComponentName assistant, - NotificationInfo.OnAppSettingsClickListener appSettingsClickListener) { - View feedbackButton = findViewById(R.id.notification_guts_bundle_feedback); - // If the assistant component is null, don't show the feedback button and finish. - if (assistant == null) { - feedbackButton.setVisibility(GONE); - return; - } - // Otherwise we extract the assistant package name. - String assistantPkg = assistant.getPackageName(); - - feedbackButton.setOnClickListener(getBundleFeedbackClickListener(sbn, pm, assistantPkg, - appSettingsClickListener)); - feedbackButton.setVisibility(feedbackButton.hasOnClickListeners() ? VISIBLE : GONE); - } - - private OnClickListener getBundleFeedbackClickListener(StatusBarNotification sbn, - PackageManager pm, String assistantPkg, - NotificationInfo.OnAppSettingsClickListener appSettingsClickListener) { - Intent feedbackIntent = getBundleFeedbackIntent(pm, assistantPkg, sbn.getKey()); - if (feedbackIntent != null) { - return ((View view) -> { - appSettingsClickListener.onClick(view, feedbackIntent); - }); - } - return null; - } - - private Intent getBundleFeedbackIntent(PackageManager pm, String packageName, String key) { - Intent intent = new Intent( - NotificationAssistantService.ACTION_NOTIFICATION_ASSISTANT_FEEDBACK_SETTINGS) - .setPackage(packageName); - final List<ResolveInfo> resolveInfos = pm.queryIntentActivities( - intent, - PackageManager.MATCH_DEFAULT_ONLY - ); - if (resolveInfos == null || resolveInfos.size() == 0 || resolveInfos.get(0) == null) { - return null; - } - final ActivityInfo activityInfo = resolveInfos.get(0).activityInfo; - intent.setClassName(activityInfo.packageName, activityInfo.name); - intent.putExtra(NotificationAssistantService.EXTRA_NOTIFICATION_KEY, key); - return intent; - } -} - diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java index a6dde103e6ff..aa7665a5b630 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/ExpandableNotificationRow.java @@ -1497,9 +1497,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView items.add(NotificationMenuRow.createPartialConversationItem(mContext)); items.add(NotificationMenuRow.createInfoItem(mContext)); items.add(NotificationMenuRow.createSnoozeItem(mContext)); - if (android.app.Flags.notificationClassificationUi()) { - items.add(NotificationMenuRow.createBundleItem(mContext)); - } mMenuRow.setMenuItems(items); } if (existed) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java index be9f60d4d5a1..3c7d9ef8e71d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfo.java @@ -70,6 +70,7 @@ import com.android.systemui.dagger.qualifiers.Main; import com.android.systemui.people.widget.PeopleSpaceWidgetManager; import com.android.systemui.res.R; import com.android.systemui.shade.ShadeController; +import com.android.systemui.statusbar.notification.NmSummarizationUiFlag; import com.android.systemui.statusbar.notification.NotificationChannelHelper; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.stack.StackStateAnimator; @@ -118,6 +119,7 @@ public class NotificationConversationInfo extends LinearLayout implements private OnSettingsClickListener mOnSettingsClickListener; private NotificationGuts mGutsContainer; private OnConversationSettingsClickListener mOnConversationSettingsClickListener; + private NotificationInfo.OnFeedbackClickListener mFeedbackClickListener; private UserManager mUm; @@ -202,6 +204,7 @@ public class NotificationConversationInfo extends LinearLayout implements NotificationEntry entry, Notification.BubbleMetadata bubbleMetadata, OnSettingsClickListener onSettingsClick, + NotificationInfo.OnFeedbackClickListener onFeedbackClickListener, ConversationIconFactory conversationIconFactory, Context userContext, boolean isDeviceProvisioned, @@ -234,6 +237,7 @@ public class NotificationConversationInfo extends LinearLayout implements mBgHandler = bgHandler; mShortcutManager = shortcutManager; mShortcutInfo = entry.getRanking().getConversationShortcutInfo(); + mFeedbackClickListener = onFeedbackClickListener; if (mShortcutInfo == null) { throw new IllegalArgumentException("Does not have required information"); } @@ -288,6 +292,8 @@ public class NotificationConversationInfo extends LinearLayout implements settingsButton.setOnClickListener(getSettingsOnClickListener()); settingsButton.setVisibility(settingsButton.hasOnClickListeners() ? VISIBLE : GONE); + bindFeedback(); + updateToggleActions(mSelectedAction == -1 ? getPriority() : mSelectedAction, false); } @@ -299,6 +305,25 @@ public class NotificationConversationInfo extends LinearLayout implements bindDelegate(); } + private void bindFeedback() { + View feedbackButton = findViewById(R.id.feedback); + if (!NmSummarizationUiFlag.isEnabled() + || TextUtils.isEmpty(mEntry.getRanking().getSummarization())) { + feedbackButton.setVisibility(GONE); + } else { + Intent intent = NotificationInfo.getAssistantFeedbackIntent( + mINotificationManager, mPm, mEntry); + if (intent == null) { + feedbackButton.setVisibility(GONE); + } else { + feedbackButton.setVisibility(VISIBLE); + feedbackButton.setOnClickListener((View v) -> { + mFeedbackClickListener.onClick(v, intent); + }); + } + } + } + private OnClickListener getSettingsOnClickListener() { if (mAppUid >= 0 && mOnSettingsClickListener != null && mIsDeviceProvisioned) { final int appUidF = mAppUid; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java index 445cd010cd86..430e5e4f1520 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationGutsManager.java @@ -18,14 +18,22 @@ package com.android.systemui.statusbar.notification.row; import static android.app.AppOpsManager.OP_CAMERA; import static android.app.AppOpsManager.OP_RECORD_AUDIO; import static android.app.AppOpsManager.OP_SYSTEM_ALERT_WINDOW; +import static android.service.notification.Adjustment.KEY_SUMMARIZATION; +import static android.service.notification.Adjustment.KEY_TYPE; +import static android.service.notification.NotificationAssistantService.ACTION_NOTIFICATION_ASSISTANT_FEEDBACK_SETTINGS; +import static android.service.notification.NotificationAssistantService.EXTRA_NOTIFICATION_ADJUSTMENT; +import static android.service.notification.NotificationAssistantService.EXTRA_NOTIFICATION_KEY; import android.annotation.FlaggedApi; import android.app.INotificationManager; import android.app.NotificationChannel; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; +import android.content.pm.ActivityInfo; import android.content.pm.LauncherApps; import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.content.pm.ShortcutManager; import android.net.Uri; import android.os.Bundle; @@ -33,6 +41,7 @@ import android.os.Handler; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; +import android.service.notification.NotificationAssistantService; import android.service.notification.StatusBarNotification; import android.util.ArraySet; import android.util.IconDrawableFactory; @@ -78,6 +87,7 @@ import com.android.systemui.statusbar.policy.DeviceProvisionedController; import com.android.systemui.util.kotlin.JavaAdapter; import com.android.systemui.wmshell.BubblesManager; +import java.util.List; import java.util.Optional; import javax.inject.Inject; @@ -325,9 +335,6 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta (PartialConversationInfo) gutsView); } else if (gutsView instanceof FeedbackInfo) { initializeFeedbackInfo(row, (FeedbackInfo) gutsView); - } else if (android.app.Flags.notificationClassificationUi() - && gutsView instanceof BundleNotificationInfo) { - initializeBundleNotificationInfo(row, (BundleNotificationInfo) gutsView); } return true; } catch (Exception e) { @@ -412,60 +419,10 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta }; } - notificationInfoView.bindNotification( - pmUser, - mNotificationManager, - mOnUserInteractionCallback, - mChannelEditorDialogController, - packageName, - row.getEntry().getChannel(), - row.getEntry(), - onSettingsClick, - onAppSettingsClick, - mUiEventLogger, - mDeviceProvisionedController.isDeviceProvisioned(), - row.getIsNonblockable(), - mHighPriorityProvider.isHighPriority(row.getEntry()), - mAssistantFeedbackController, - mMetricsLogger, - row.getCloseButtonOnClickListener(row)); - } - - /** - * Sets up the {@link BundleNotificationInfo} inside the notification row's guts. - * @param row view to set up the guts for - * @param notificationInfoView view to set up/bind within {@code row} - */ - @VisibleForTesting - @FlaggedApi(android.app.Flags.FLAG_NOTIFICATION_CLASSIFICATION_UI) - void initializeBundleNotificationInfo( - final ExpandableNotificationRow row, - BundleNotificationInfo notificationInfoView) throws Exception { - NotificationGuts guts = row.getGuts(); - StatusBarNotification sbn = row.getEntry().getSbn(); - String packageName = sbn.getPackageName(); - // Settings link is only valid for notifications that specify a non-system user - NotificationInfo.OnSettingsClickListener onSettingsClick = null; - UserHandle userHandle = sbn.getUser(); - PackageManager pmUser = CentralSurfaces.getPackageManagerForUser( - mContext, userHandle.getIdentifier()); - final NotificationInfo.OnAppSettingsClickListener onAppSettingsClick = - (View v, Intent intent) -> { - mMetricsLogger.action(MetricsProto.MetricsEvent.ACTION_APP_NOTE_SETTINGS); - guts.resetFalsingCheck(); - mNotificationActivityStarter.startNotificationGutsIntent(intent, sbn.getUid(), - row); - }; - - if (!userHandle.equals(UserHandle.ALL) - || mLockscreenUserManager.getCurrentUserId() == UserHandle.USER_SYSTEM) { - onSettingsClick = (View v, NotificationChannel channel, int appUid) -> { - mMetricsLogger.action(MetricsProto.MetricsEvent.ACTION_NOTE_INFO); - guts.resetFalsingCheck(); - mOnSettingsClickListener.onSettingsClick(sbn.getKey()); - startAppNotificationSettingsActivity(packageName, appUid, channel, row); - }; - } + NotificationInfo.OnFeedbackClickListener onNasFeedbackClick = (View v, Intent intent) -> { + guts.resetFalsingCheck(); + mNotificationActivityStarter.startNotificationGutsIntent(intent, sbn.getUid(), row); + }; notificationInfoView.bindNotification( pmUser, @@ -477,6 +434,7 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta row.getEntry(), onSettingsClick, onAppSettingsClick, + onNasFeedbackClick, mUiEventLogger, mDeviceProvisionedController.isDeviceProvisioned(), row.getIsNonblockable(), @@ -572,6 +530,11 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta mContext.getResources().getDimensionPixelSize( R.dimen.notification_guts_conversation_icon_size)); + NotificationInfo.OnFeedbackClickListener onNasFeedbackClick = (View v, Intent intent) -> { + guts.resetFalsingCheck(); + mNotificationActivityStarter.startNotificationGutsIntent(intent, sbn.getUid(), row); + }; + notificationInfoView.bindNotification( mShortcutManager, pmUser, @@ -584,6 +547,7 @@ public class NotificationGutsManager implements NotifGutsViewManager, CoreStarta entry, entry.getBubbleMetadata(), onSettingsClick, + onNasFeedbackClick, iconFactoryLoader, mContextTracker.getUserContext(), mDeviceProvisionedController.isDeviceProvisioned(), diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java index 8d26f94ced21..bea14b2c003f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationInfo.java @@ -17,9 +17,12 @@ package com.android.systemui.statusbar.notification.row; import static android.app.Notification.EXTRA_BUILDER_APPLICATION_INFO; +import static android.app.NotificationChannel.SYSTEM_RESERVED_IDS; import static android.app.NotificationManager.IMPORTANCE_DEFAULT; import static android.app.NotificationManager.IMPORTANCE_LOW; import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED; +import static android.service.notification.Adjustment.KEY_SUMMARIZATION; +import static android.service.notification.Adjustment.KEY_TYPE; import static com.android.app.animation.Interpolators.FAST_OUT_SLOW_IN; @@ -27,10 +30,12 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; import android.annotation.IntDef; import android.annotation.Nullable; +import android.app.Flags; import android.app.INotificationManager; import android.app.Notification; import android.app.NotificationChannel; import android.app.NotificationChannelGroup; +import android.content.ComponentName; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; @@ -41,6 +46,7 @@ import android.graphics.drawable.Drawable; import android.metrics.LogMaker; import android.os.Handler; import android.os.RemoteException; +import android.service.notification.NotificationAssistantService; import android.service.notification.StatusBarNotification; import android.text.Html; import android.text.TextUtils; @@ -50,6 +56,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; @@ -63,6 +70,7 @@ import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.systemui.Dependency; import com.android.systemui.res.R; import com.android.systemui.statusbar.notification.AssistantFeedbackController; +import com.android.systemui.statusbar.notification.NmSummarizationUiFlag; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import java.lang.annotation.Retention; @@ -126,6 +134,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G private OnSettingsClickListener mOnSettingsClickListener; private OnAppSettingsClickListener mAppSettingsClickListener; + private OnFeedbackClickListener mFeedbackClickListener; private NotificationGuts mGutsContainer; private Drawable mPkgIcon; private UiEventLogger mUiEventLogger; @@ -187,6 +196,10 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G void onClick(View v, Intent intent); } + public interface OnFeedbackClickListener { + void onClick(View v, Intent intent); + } + public void bindNotification( PackageManager pm, INotificationManager iNotificationManager, @@ -197,6 +210,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G NotificationEntry entry, OnSettingsClickListener onSettingsClick, OnAppSettingsClickListener onAppSettingsClick, + OnFeedbackClickListener onFeedbackClickListener, UiEventLogger uiEventLogger, boolean isDeviceProvisioned, boolean isNonblockable, @@ -214,6 +228,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G mSbn = entry.getSbn(); mPm = pm; mAppSettingsClickListener = onAppSettingsClick; + mFeedbackClickListener = onFeedbackClickListener; mAppName = mPackageName; mOnSettingsClickListener = onSettingsClick; mSingleNotificationChannel = notificationChannel; @@ -318,19 +333,25 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G // Delegate bindDelegate(); - // Set up app settings link (i.e. Customize) - View settingsLinkView = findViewById(R.id.app_settings); - Intent settingsIntent = getAppSettingsIntent(mPm, mPackageName, - mSingleNotificationChannel, - mSbn.getId(), mSbn.getTag()); - if (settingsIntent != null - && !TextUtils.isEmpty(mSbn.getNotification().getSettingsText())) { - settingsLinkView.setVisibility(VISIBLE); - settingsLinkView.setOnClickListener((View view) -> { - mAppSettingsClickListener.onClick(view, settingsIntent); - }); + + if (Flags.notificationClassificationUi() && + SYSTEM_RESERVED_IDS.contains(mSingleNotificationChannel.getId())) { + bindFeedback(); } else { - settingsLinkView.setVisibility(View.GONE); + // Set up app settings link (i.e. Customize) + View settingsLinkView = findViewById(R.id.app_settings); + Intent settingsIntent = getAppSettingsIntent(mPm, mPackageName, + mSingleNotificationChannel, + mSbn.getId(), mSbn.getTag()); + if (settingsIntent != null + && !TextUtils.isEmpty(mSbn.getNotification().getSettingsText())) { + settingsLinkView.setVisibility(VISIBLE); + settingsLinkView.setOnClickListener((View view) -> { + mAppSettingsClickListener.onClick(view, settingsIntent); + }); + } else { + settingsLinkView.setVisibility(View.GONE); + } } // System Settings button. @@ -339,6 +360,51 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G settingsButton.setVisibility(settingsButton.hasOnClickListeners() ? VISIBLE : GONE); } + private void bindFeedback() { + View feedbackButton = findViewById(R.id.feedback); + Intent intent = getAssistantFeedbackIntent(mINotificationManager, mPm, mEntry); + if (!android.app.Flags.notificationClassificationUi() || intent == null) { + feedbackButton.setVisibility(GONE); + } else { + feedbackButton.setVisibility(VISIBLE); + feedbackButton.setOnClickListener((View v) -> { + if (mFeedbackClickListener != null) { + mFeedbackClickListener.onClick(v, intent); + } + }); + } + } + + public static Intent getAssistantFeedbackIntent(INotificationManager inm, PackageManager pm, + NotificationEntry entry) { + try { + ComponentName assistant = inm.getAllowedNotificationAssistant(); + if (assistant == null) { + return null; + } + Intent intent = new Intent( + NotificationAssistantService.ACTION_NOTIFICATION_ASSISTANT_FEEDBACK_SETTINGS) + .setPackage(assistant.getPackageName()); + final List<ResolveInfo> resolveInfos = pm.queryIntentActivities( + intent, + PackageManager.MATCH_DEFAULT_ONLY + ); + if (resolveInfos == null || resolveInfos.size() == 0 || resolveInfos.get(0) == null) { + return null; + } + final ActivityInfo activityInfo = resolveInfos.get(0).activityInfo; + intent.setClassName(activityInfo.packageName, activityInfo.name); + + intent.putExtra(NotificationAssistantService.EXTRA_NOTIFICATION_KEY, entry.getKey()); + intent.putExtra(NotificationAssistantService.EXTRA_NOTIFICATION_ADJUSTMENT, + entry.getRanking().getSummarization() != null ? KEY_SUMMARIZATION : KEY_TYPE); + return intent; + } catch (Exception e) { + Slog.d(TAG, "no assistant?", e); + return null; + } + } + private OnClickListener getSettingsOnClickListener() { if (mAppUid >= 0 && mOnSettingsClickListener != null && mIsDeviceProvisioned) { final int appUidF = mAppUid; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java index d213c78a82c7..b96b224a7d2e 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/NotificationMenuRow.java @@ -263,12 +263,7 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl mFeedbackItem = createFeedbackItem(mContext); NotificationEntry entry = mParent.getEntry(); int personNotifType = mPeopleNotificationIdentifier.getPeopleNotificationType(entry); - if (android.app.Flags.notificationClassificationUi() - && entry.getChannel() != null - && SYSTEM_RESERVED_IDS.contains(entry.getChannel().getId())) { - // Bundled notification; create bundle-specific guts. - mInfoItem = createBundleItem(mContext); - } else if (personNotifType == PeopleNotificationIdentifier.TYPE_PERSON) { + if (personNotifType == PeopleNotificationIdentifier.TYPE_PERSON) { mInfoItem = createPartialConversationItem(mContext); } else if (personNotifType >= PeopleNotificationIdentifier.TYPE_FULL_PERSON) { mInfoItem = createConversationItem(mContext); @@ -698,16 +693,6 @@ public class NotificationMenuRow implements NotificationMenuRowPlugin, View.OnCl R.drawable.ic_settings); } - static NotificationMenuItem createBundleItem(Context context) { - Resources res = context.getResources(); - String infoDescription = res.getString(R.string.notification_menu_gear_description); - BundleNotificationInfo infoContent = - (BundleNotificationInfo) LayoutInflater.from(context).inflate( - R.layout.bundle_notification_info, null, false); - return new NotificationMenuItem(context, infoDescription, infoContent, - R.drawable.ic_settings); - } - static NotificationMenuItem createPartialConversationItem(Context context) { Resources res = context.getResources(); String infoDescription = res.getString(R.string.notification_menu_gear_description); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfo.java b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfo.java index e4a0fa5b534e..93b2a2d41691 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfo.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PromotedNotificationInfo.java @@ -56,6 +56,7 @@ public class PromotedNotificationInfo extends NotificationInfo { NotificationEntry entry, OnSettingsClickListener onSettingsClick, OnAppSettingsClickListener onAppSettingsClick, + OnFeedbackClickListener feedbackClickListener, UiEventLogger uiEventLogger, boolean isDeviceProvisioned, boolean isNonblockable, @@ -64,8 +65,9 @@ public class PromotedNotificationInfo extends NotificationInfo { MetricsLogger metricsLogger, OnClickListener onCloseClick) throws RemoteException { super.bindNotification(pm, iNotificationManager, onUserInteractionCallback, channelEditorDialogController, pkg, notificationChannel, entry, onSettingsClick, - onAppSettingsClick, uiEventLogger, isDeviceProvisioned, isNonblockable, - wasShownHighPriority, assistantFeedbackController, metricsLogger, onCloseClick); + onAppSettingsClick, feedbackClickListener, uiEventLogger, isDeviceProvisioned, + isNonblockable, wasShownHighPriority, assistantFeedbackController, metricsLogger, + onCloseClick); mNotificationManager = iNotificationManager; diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java index be89ab8c5cf8..3061842c386c 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationConversationInfoTest.java @@ -45,6 +45,7 @@ import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; +import android.app.Flags; import android.app.INotificationManager; import android.app.Notification; import android.app.NotificationChannel; @@ -52,11 +53,14 @@ import android.app.NotificationChannelGroup; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Person; +import android.content.ComponentName; import android.content.Intent; +import android.content.pm.ActivityInfo; import android.content.pm.ApplicationInfo; import android.content.pm.LauncherApps; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; import android.content.pm.ShortcutInfo; import android.content.pm.ShortcutManager; import android.graphics.drawable.Drawable; @@ -64,6 +68,9 @@ import android.graphics.drawable.Icon; import android.os.Handler; import android.os.UserHandle; import android.os.UserManager; +import android.platform.test.annotations.DisableFlags; +import android.platform.test.annotations.EnableFlags; +import android.platform.test.flag.junit.SetFlagsRule; import android.service.notification.StatusBarNotification; import android.testing.TestableLooper; import android.view.LayoutInflater; @@ -80,6 +87,7 @@ import com.android.systemui.SysuiTestCase; import com.android.systemui.people.widget.PeopleSpaceWidgetManager; import com.android.systemui.res.R; import com.android.systemui.shade.ShadeController; +import com.android.systemui.statusbar.RankingBuilder; import com.android.systemui.statusbar.SbnBuilder; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.collection.NotificationEntryBuilder; @@ -155,6 +163,8 @@ public class NotificationConversationInfoTest extends SysuiTestCase { @Mock private Notification.BubbleMetadata mBubbleMetadata; private Handler mTestHandler; + @Rule + public final SetFlagsRule mSetFlagsRule = new SetFlagsRule(); @Before public void setUp() throws Exception { @@ -192,6 +202,14 @@ public class NotificationConversationInfoTest extends SysuiTestCase { when(mMockPackageManager.getPackageInfo(eq("android"), anyInt())) .thenReturn(packageInfo); + ComponentName assistant = new ComponentName("package", "service"); + when(mMockINotificationManager.getAllowedNotificationAssistant()).thenReturn(assistant); + ResolveInfo ri = new ResolveInfo(); + ri.activityInfo = new ActivityInfo(); + ri.activityInfo.packageName = assistant.getPackageName(); + ri.activityInfo.name = "activity"; + when(mMockPackageManager.queryIntentActivities(any(), anyInt())).thenReturn(List.of(ri)); + when(mShortcutInfo.getLabel()).thenReturn("Convo name"); List<ShortcutInfo> shortcuts = Arrays.asList(mShortcutInfo); when(mLauncherApps.getShortcuts(any(), any())).thenReturn(shortcuts); @@ -216,8 +234,8 @@ public class NotificationConversationInfoTest extends SysuiTestCase { new Intent(mContext, BubblesTestActivity.class), PendingIntent.FLAG_MUTABLE); mBubbleSbn = new SbnBuilder(mSbn).setBubbleMetadata( - new Notification.BubbleMetadata.Builder(bubbleIntent, - Icon.createWithResource(mContext, R.drawable.android)).build()) + new Notification.BubbleMetadata.Builder(bubbleIntent, + Icon.createWithResource(mContext, R.drawable.android)).build()) .build(); mBubbleEntry = new NotificationEntryBuilder() .setSbn(mBubbleSbn) @@ -237,8 +255,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { when(mPeopleSpaceWidgetManager.requestPinAppWidget(any(), any())).thenReturn(true); } - @Test - public void testBindNotification_SetsShortcutIcon() { + private void doStandardBind() { mNotificationInfo.bindNotification( mShortcutManager, mMockPackageManager, @@ -251,12 +268,18 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mEntry, mBubbleMetadata, null, + null, mIconFactory, mContext, true, mTestHandler, mTestHandler, null, Optional.of(mBubblesManager), mShadeController); + } + + @Test + public void testBindNotification_SetsShortcutIcon() { + doStandardBind(); final ImageView view = mNotificationInfo.findViewById(R.id.conversation_icon); assertEquals(mIconDrawable, view.getDrawable()); } @@ -264,77 +287,43 @@ public class NotificationConversationInfoTest extends SysuiTestCase { @Test public void testBindNotification_SetsTextApplicationName() { when(mMockPackageManager.getApplicationLabel(any())).thenReturn("App Name"); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); final TextView textView = mNotificationInfo.findViewById(R.id.pkg_name); assertTrue(textView.getText().toString().contains("App Name")); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); } -/** - @Test - public void testBindNotification_SetsTextChannelName() { - mNotificationInfo.bindNotification( - -1, - mShortcutManager, - mLauncherApps, - mMockPackageManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - null, - null, - true); - final TextView textView = mNotificationInfo.findViewById(R.id.parent_channel_name); - assertTrue(textView.getText().toString().contains(mNotificationChannel.getName())); - assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); - } -*/ + + /** + * @Test public void testBindNotification_SetsTextChannelName() { + * mNotificationInfo.bindNotification( + * -1, + * mShortcutManager, + * mLauncherApps, + * mMockPackageManager, + * mMockINotificationManager, + * mOnUserInteractionCallback, + * TEST_PACKAGE_NAME, + * mNotificationChannel, + * mEntry, + * mBubbleMetadata, + * null, + * null, + * null, + * true); + * final TextView textView = mNotificationInfo.findViewById(R.id.parent_channel_name); + * assertTrue(textView.getText().toString().contains(mNotificationChannel.getName())); + * assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); + * } + */ @Test public void testBindNotification_SetsTextGroupName() throws Exception { NotificationChannelGroup group = new NotificationChannelGroup("id", "name"); when(mMockINotificationManager.getNotificationChannelGroupForPackage( - anyString(), anyString(), anyInt())).thenReturn(group); + anyString(), anyString(), anyInt())).thenReturn(group); mNotificationChannel.setGroup(group.getId()); mConversationChannel.setGroup(group.getId()); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); final TextView textView = mNotificationInfo.findViewById(R.id.group_name); assertTrue(textView.getText().toString().contains(group.getName())); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); @@ -343,24 +332,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { @Test public void testBindNotification_GroupNameHiddenIfNoGroup() { - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); final TextView textView = mNotificationInfo.findViewById(R.id.group_name); assertEquals(VISIBLE, mNotificationInfo.findViewById(R.id.header).getVisibility()); assertEquals(GONE, textView.getVisibility()); @@ -368,24 +340,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { @Test public void testBindNotification_noDelegate() { - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); final TextView nameView = mNotificationInfo.findViewById(R.id.delegate_name); assertEquals(GONE, nameView.getVisibility()); } @@ -416,6 +371,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { entry, mBubbleMetadata, null, + null, mIconFactory, mContext, true, @@ -428,7 +384,17 @@ public class NotificationConversationInfoTest extends SysuiTestCase { } @Test - public void testBindNotification_SetsOnClickListenerForSettings() { + @DisableFlags({Flags.FLAG_NM_SUMMARIZATION, Flags.FLAG_NM_SUMMARIZATION_UI}) + public void testBindNotification_HidesFeedbackLink_flagOff() { + doStandardBind(); + assertEquals(GONE, mNotificationInfo.findViewById(R.id.feedback).getVisibility()); + } + + @Test + @EnableFlags({Flags.FLAG_NM_SUMMARIZATION, Flags.FLAG_NM_SUMMARIZATION_UI}) + public void testBindNotification_SetsFeedbackLink_ifSummaryInRanking() { + mEntry.setRanking(new RankingBuilder(mEntry.getRanking()) + .setSummarization("something").build()); final CountDownLatch latch = new CountDownLatch(1); mNotificationInfo.bindNotification( mShortcutManager, @@ -441,8 +407,8 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mNotificationChannel, mEntry, mBubbleMetadata, - (View v, NotificationChannel c, int appUid) -> { - assertEquals(mConversationChannel, c); + null, + (View v, Intent intent) -> { latch.countDown(); }, mIconFactory, @@ -452,14 +418,24 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mTestHandler, null, Optional.of(mBubblesManager), mShadeController); - final View settingsButton = mNotificationInfo.findViewById(R.id.info); - settingsButton.performClick(); + final View feedback = mNotificationInfo.findViewById(R.id.feedback); + assertEquals(VISIBLE, feedback.getVisibility()); + feedback.performClick(); // Verify that listener was triggered. assertEquals(0, latch.getCount()); } @Test - public void testBindNotification_SettingsButtonInvisibleWhenNoClickListener() { + @EnableFlags({Flags.FLAG_NM_SUMMARIZATION, Flags.FLAG_NM_SUMMARIZATION_UI}) + public void testBindNotification_hidesFeedbackLink_ifSummaryNotInRanking() { + doStandardBind(); + + assertEquals(GONE, mNotificationInfo.findViewById(R.id.feedback).getVisibility()); + } + + @Test + public void testBindNotification_SetsOnClickListenerForSettings() { + final CountDownLatch latch = new CountDownLatch(1); mNotificationInfo.bindNotification( mShortcutManager, mMockPackageManager, @@ -471,6 +447,10 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mNotificationChannel, mEntry, mBubbleMetadata, + (View v, NotificationChannel c, int appUid) -> { + assertEquals(mConversationChannel, c); + latch.countDown(); + }, null, mIconFactory, mContext, @@ -478,6 +458,16 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mTestHandler, mTestHandler, null, Optional.of(mBubblesManager), mShadeController); + + final View settingsButton = mNotificationInfo.findViewById(R.id.info); + settingsButton.performClick(); + // Verify that listener was triggered. + assertEquals(0, latch.getCount()); + } + + @Test + public void testBindNotification_SettingsButtonInvisibleWhenNoClickListener() { + doStandardBind(); final View settingsButton = mNotificationInfo.findViewById(R.id.info); assertTrue(settingsButton.getVisibility() != View.VISIBLE); } @@ -500,6 +490,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { assertEquals(mNotificationChannel, c); latch.countDown(); }, + null, mIconFactory, mContext, false, @@ -514,24 +505,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { public void testBindNotification_silentSelected_isFave_isSilent() { mConversationChannel.setImportance(IMPORTANCE_LOW); mConversationChannel.setImportantConversation(true); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); View view = mNotificationInfo.findViewById(R.id.silence); assertThat(view.isSelected()).isTrue(); } @@ -543,24 +517,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setImportance(IMPORTANCE_HIGH); mConversationChannel.setImportantConversation(false); mConversationChannel.setAllowBubbles(true); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); View view = mNotificationInfo.findViewById(R.id.default_behavior); assertThat(view.isSelected()).isTrue(); assertThat(((TextView) view.findViewById(R.id.default_summary)).getText()).isEqualTo( @@ -575,24 +532,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setImportance(IMPORTANCE_HIGH); mConversationChannel.setImportantConversation(false); mConversationChannel.setAllowBubbles(true); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); View view = mNotificationInfo.findViewById(R.id.default_behavior); assertThat(view.isSelected()).isTrue(); assertThat(((TextView) view.findViewById(R.id.default_summary)).getText()).isEqualTo( @@ -625,6 +565,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mIconFactory, mContext, true, @@ -654,6 +595,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mEntry, null, null, + null, mIconFactory, mContext, true, @@ -678,24 +620,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setImportance(IMPORTANCE_HIGH); mConversationChannel.setImportantConversation(false); mConversationChannel.setAllowBubbles(true); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); assertThat(((TextView) mNotificationInfo.findViewById(R.id.priority_summary)).getText()) .isEqualTo(mContext.getString( R.string.notification_channel_summary_priority_all)); @@ -707,24 +632,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setImportance(IMPORTANCE_LOW); mConversationChannel.setImportantConversation(false); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); View fave = mNotificationInfo.findViewById(R.id.priority); fave.performClick(); @@ -752,24 +660,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setAllowBubbles(false); mConversationChannel.setImportance(IMPORTANCE_LOW); mConversationChannel.setImportantConversation(false); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); mNotificationInfo.findViewById(R.id.default_behavior).performClick(); mTestableLooper.processAllMessages(); @@ -796,24 +687,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setImportance(IMPORTANCE_DEFAULT); mConversationChannel.setImportantConversation(false); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); View silence = mNotificationInfo.findViewById(R.id.silence); @@ -841,24 +715,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setImportance(IMPORTANCE_LOW); mConversationChannel.setImportantConversation(false); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); View fave = mNotificationInfo.findViewById(R.id.priority); fave.performClick(); @@ -880,24 +737,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setOriginalImportance(IMPORTANCE_HIGH); mConversationChannel.setImportance(9); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); View fave = mNotificationInfo.findViewById(R.id.priority); fave.performClick(); @@ -917,24 +757,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setImportance(IMPORTANCE_HIGH); mConversationChannel.setImportantConversation(true); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); View fave = mNotificationInfo.findViewById(R.id.priority); fave.performClick(); @@ -958,24 +781,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setImportantConversation(false); // WHEN we indicate no selected action - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); // THEN the selected action is -1, so the selected option is "Default" priority assertEquals(mNotificationInfo.getSelectedAction(), -1); @@ -990,24 +796,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { // WHEN we indicate the selected action should be "Favorite" mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_FAVORITE); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); // THEN the selected action is "Favorite", so the selected option is "priority" priority assertEquals(mNotificationInfo.getSelectedAction(), @@ -1020,24 +809,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setAllowBubbles(true); mConversationChannel.setOriginalImportance(IMPORTANCE_HIGH); mConversationChannel.setImportantConversation(true); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); mNotificationInfo.findViewById(R.id.default_behavior).performClick(); mNotificationInfo.findViewById(R.id.done).performClick(); @@ -1058,24 +830,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setAllowBubbles(true); mConversationChannel.setOriginalImportance(IMPORTANCE_HIGH); mConversationChannel.setImportantConversation(false); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); mNotificationInfo.findViewById(R.id.default_behavior).performClick(); mNotificationInfo.findViewById(R.id.done).performClick(); @@ -1095,24 +850,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setImportance(9); mConversationChannel.setOriginalImportance(IMPORTANCE_HIGH); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); mNotificationInfo.findViewById(R.id.default_behavior).performClick(); mNotificationInfo.findViewById(R.id.done).performClick(); @@ -1131,24 +869,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setImportantConversation(true); mConversationChannel.setAllowBubbles(true); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); View silence = mNotificationInfo.findViewById(R.id.silence); silence.performClick(); @@ -1171,24 +892,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setImportantConversation(true); mConversationChannel.setAllowBubbles(true); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); mNotificationInfo.findViewById(R.id.silence).performClick(); mNotificationInfo.handleCloseControls(false, false); @@ -1202,24 +906,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { @Test public void testBindNotification_createsNewChannel() throws Exception { - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); verify(mMockINotificationManager, times(1)).createConversationNotificationChannelForPackage( anyString(), anyInt(), any(), eq(CONVERSATION_ID)); @@ -1228,24 +915,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { @Test public void testBindNotification_doesNotCreateNewChannelIfExists() throws Exception { mNotificationChannel.setConversationId("", CONVERSATION_ID); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); verify(mMockINotificationManager, never()).createConversationNotificationChannelForPackage( anyString(), anyInt(), any(), eq(CONVERSATION_ID)); @@ -1256,24 +926,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { when(mUserManager.isSameProfileGroup(anyInt(), anyInt())).thenReturn(true); //WHEN channel is default importance mNotificationChannel.setImportantConversation(false); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); // WHEN user clicks "priority" mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_FAVORITE); @@ -1290,24 +943,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { when(mUserManager.isSameProfileGroup(anyInt(), anyInt())).thenReturn(false); //WHEN channel is default importance mNotificationChannel.setImportantConversation(false); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); // WHEN user clicks "priority" mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_FAVORITE); @@ -1321,24 +957,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { @Test public void testSelectDefaultDoesNotRequestPinPeopleTile() { - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); // WHEN user clicks "default" mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_DEFAULT); @@ -1356,24 +975,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mConversationChannel.setImportance(IMPORTANCE_HIGH); mConversationChannel.setImportantConversation(true); - mNotificationInfo.bindNotification( - mShortcutManager, - mMockPackageManager, - mUserManager, - mPeopleSpaceWidgetManager, - mMockINotificationManager, - mOnUserInteractionCallback, - TEST_PACKAGE_NAME, - mNotificationChannel, - mEntry, - mBubbleMetadata, - null, - mIconFactory, - mContext, - true, - mTestHandler, - mTestHandler, null, Optional.of(mBubblesManager), - mShadeController); + doStandardBind(); // WHEN user clicks "priority" mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_FAVORITE); diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerWithScenesTest.kt b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerWithScenesTest.kt index 7cc1ac1d3806..1b447525bbf5 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerWithScenesTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/notification/row/NotificationGutsManagerWithScenesTest.kt @@ -436,6 +436,7 @@ class NotificationGutsManagerWithScenesTest : SysuiTestCase() { eq(entry), any<NotificationInfo.OnSettingsClickListener>(), any<NotificationInfo.OnAppSettingsClickListener>(), + any<NotificationInfo.OnFeedbackClickListener>(), any<UiEventLogger>(), eq(true), eq(false), @@ -469,6 +470,7 @@ class NotificationGutsManagerWithScenesTest : SysuiTestCase() { eq(entry), any<NotificationInfo.OnSettingsClickListener>(), any<NotificationInfo.OnAppSettingsClickListener>(), + any<NotificationInfo.OnFeedbackClickListener>(), any<UiEventLogger>(), eq(true), eq(false), @@ -502,6 +504,7 @@ class NotificationGutsManagerWithScenesTest : SysuiTestCase() { eq(entry), any<NotificationInfo.OnSettingsClickListener>(), any<NotificationInfo.OnAppSettingsClickListener>(), + any<NotificationInfo.OnFeedbackClickListener>(), any<UiEventLogger>(), eq(true), eq(false), |