Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -147,8 +147,8 @@ public class SmartReplyControllerTest extends SysuiTestCase { public void testShowSmartSuggestions_logsToStatusBar() throws RemoteException { final boolean generatedByAsssistant = true; final boolean editBeforeSending = true; mSmartReplyController.smartSuggestionsAdded(mEntry, TEST_CHOICE_COUNT, TEST_ACTION_COUNT, generatedByAsssistant, editBeforeSending); mSmartReplyController.smartSuggestionsAdded(mEntry.getKey(), TEST_CHOICE_COUNT, TEST_ACTION_COUNT, generatedByAsssistant, editBeforeSending); // Check we log the result to the status bar service. verify(mIStatusBarService).onNotificationSmartSuggestionsAdded(mSbn.getKey(), Loading packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapterTest.kt +14 −30 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import org.mockito.kotlin.eq @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper @EnableFlags(NotificationBundleUi.FLAG_NAME) class NotificationEntryAdapterTest : SysuiTestCase() { private val kosmos = testKosmos() Loading @@ -63,7 +64,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { @get:Rule val setFlagsRule = SetFlagsRule() @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getBackingHashCode() { val entry = NotificationEntryBuilder() Loading @@ -74,7 +74,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getParent_adapter() { val ge = GroupEntryBuilder().build() val notification: Notification = Loading @@ -92,7 +91,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isTopLevelEntry_adapter() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() Loading @@ -109,7 +107,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getKey_adapter() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() Loading @@ -125,7 +122,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getRow_adapter() { val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Loading @@ -143,7 +139,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_adapter_groupSummary() { val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Loading @@ -166,7 +161,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_adapter_groupChild() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -190,7 +184,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isClearable_adapter() { val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Loading @@ -208,7 +201,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSummarization_adapter() { val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Loading @@ -228,7 +220,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getIcons_adapter() { val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Loading @@ -246,7 +237,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isColorized() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -261,7 +251,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSbn() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() Loading @@ -273,7 +262,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getRanking() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -288,7 +276,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun endLifetimeExtension() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -306,7 +293,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun onImportanceChanged() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -324,7 +310,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun markForUserTriggeredMovement() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -344,7 +329,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isHighPriority() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -361,7 +345,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isBlockable() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -376,7 +359,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun canDragAndDrop() { val pi = mock(PendingIntent::class.java) Mockito.`when`(pi.isActivity).thenReturn(true) Loading @@ -393,7 +375,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isBubble() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -408,7 +389,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getStyle() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -423,7 +403,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSectionBucket() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -439,7 +418,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isAmbient() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() Loading @@ -455,7 +433,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getPeopleNotificationType() { val entry = kosmos.msgStyleBubbleableFullPerson Loading @@ -465,7 +442,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun canShowFullScreen() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -484,7 +460,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun onDragSuccess() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -500,7 +475,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun onNotificationBubbleIconClicked() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() Loading @@ -514,7 +488,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun onNotificationActionClicked() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -530,7 +503,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getDismissState() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() Loading @@ -544,7 +516,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun onEntryClicked() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -559,4 +530,17 @@ class NotificationEntryAdapterTest : SysuiTestCase() { underTest.onEntryClicked(row) verify(kosmos.mockNotificationActivityStarter).onNotificationClicked(entry, row) } @Test fun getRemoteInputEntryAdapter() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() val entry = NotificationEntryBuilder().setNotification(notification).build() underTest = factory.create(entry) as NotificationEntryAdapter assertThat(underTest.remoteInputEntryAdapter) .isSameInstanceAs(entry.remoteInputEntryAdapter) } } packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/RemoteInputEntryAdapterTest.kt 0 → 100644 +278 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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.collection import android.app.Notification import android.app.PendingIntent import android.app.Person import android.app.RemoteInput import android.content.Intent import android.graphics.drawable.Icon import android.net.Uri import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.SetFlagsRule import android.testing.TestableLooper.RunWithLooper import android.view.ContentInfo import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.res.R import com.android.systemui.statusbar.notification.headsup.HeadsUpManager import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.entryAdapterFactory import com.android.systemui.statusbar.notification.shared.NotificationBundleUi import com.android.systemui.testKosmos import com.android.systemui.wmshell.BubblesTestActivity import com.google.common.truth.Truth.assertThat import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.mockito.kotlin.verify @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper @EnableFlags(NotificationBundleUi.FLAG_NAME) class RemoteInputEntryAdapterTest : SysuiTestCase() { private val kosmos = testKosmos() private val factory: EntryAdapterFactory = kosmos.entryAdapterFactory private lateinit var entry : NotificationEntry private lateinit var underTest: RemoteInputEntryAdapter @get:Rule val setFlagsRule = SetFlagsRule() @Before fun before() { entry = NotificationEntryBuilder() .setNotification(getConversationNotif().build()) .build() underTest = (factory.create(entry) as NotificationEntryAdapter).remoteInputEntryAdapter } /** Creates a [Notification.Builder] that is a conversation. */ private fun getConversationNotif(): Notification.Builder { val timeContent = "content at ${System.currentTimeMillis()}" val intent = Intent(context, BubblesTestActivity::class.java) val pendingIntent = PendingIntent.getActivity( context, 0, intent, PendingIntent.FLAG_MUTABLE ) val person = Person.Builder() .setName("PERSON") .build() val remoteInput = RemoteInput.Builder("reply_key").setLabel("reply").build() val inputIntent = PendingIntent.getActivity( mContext, 0, Intent().setPackage(mContext.packageName), PendingIntent.FLAG_MUTABLE ) val icon = Icon.createWithResource( mContext, R.drawable.ic_android ) val replyAction = Notification.Action.Builder( icon, "Reply", inputIntent ).addRemoteInput(remoteInput) .build() return Notification.Builder(context, "channel") .setSmallIcon(R.drawable.ic_android) .setContentTitle("Test Notification") .setContentText(timeContent) .setContentIntent(pendingIntent) .setActions(replyAction) .setStyle( Notification.MessagingStyle(person) .setConversationTitle("Chat") .addMessage( timeContent, System.currentTimeMillis(), person ) ) } @Test fun getKey() { assertThat(underTest.key).isEqualTo(entry.key) } @Test fun getStyle() { assertThat(underTest.style).isEqualTo(entry.notificationStyle) } @Test fun rowExists() { assertThat(underTest.rowExists).isFalse() entry.row = mock() assertThat(underTest.rowExists).isTrue() } @Test fun getRow() { val row : ExpandableNotificationRow = mock() entry.row = row assertThat(underTest.row).isEqualTo(row) } @Test fun closeRemoteInput() { val row : ExpandableNotificationRow = mock() entry.row = row underTest.closeRemoteInput() verify(row).closeRemoteInput() } @Test fun isRemoteInputAnimatingAway() { assertThat(underTest.remoteInputAnimatingAway).isEqualTo(false) entry.mRemoteEditImeAnimatingAway = true assertThat(underTest.remoteInputAnimatingAway).isEqualTo(true) } @Test fun setRemoteInputAnimatingAway() { assertThat(underTest.remoteInputAnimatingAway).isEqualTo(false) underTest.remoteInputAnimatingAway = true assertThat(entry.mRemoteEditImeAnimatingAway).isEqualTo(true) } @Test fun isRemoteInputImeVisible() { assertThat(underTest.remoteInputImeVisible).isEqualTo(false) entry.mRemoteEditImeVisible = true assertThat(underTest.remoteInputImeVisible).isEqualTo(true) } @Test fun setRemoteInputImeVisible() { assertThat(underTest.remoteInputImeVisible).isEqualTo(false) underTest.remoteInputImeVisible = true assertThat(entry.mRemoteEditImeVisible).isEqualTo(true) } @Test fun getRemoteInputAttachment() { val contentInfo : ContentInfo = mock() entry.remoteInputAttachment = contentInfo assertThat(underTest.remoteInputAttachment).isEqualTo(contentInfo) } @Test fun setRemoteInputAttachment() { val contentInfo : ContentInfo = mock() underTest.remoteInputAttachment = contentInfo assertThat(entry.remoteInputAttachment).isEqualTo(contentInfo) } @Test fun setRemoteInputUri() { val uri : Uri = mock() underTest.remoteInputUri = uri assertThat(entry.remoteInputUri).isEqualTo(uri) } @Test fun setRemoteInputMimeType() { val mimeType = "mime" underTest.remoteInputMimeType = mimeType assertThat(entry.remoteInputMimeType).isEqualTo(mimeType) } @Test fun setRemoteInputText() { val text = "TEXT" underTest.remoteInputText = text assertThat(entry.remoteInputText).isEqualTo(text) } @Test fun getRemoteInputText() { val text = "TEXT" entry.remoteInputText = text assertThat(underTest.remoteInputText).isEqualTo(text) } @Test fun setRemoteInputTextWhenReset() { val text = "TEXT" underTest.remoteInputTextWhenReset = text assertThat(entry.remoteInputTextWhenReset).isEqualTo(text) } @Test fun isSameEntryAs() { assertThat(underTest.isSameEntryAs(entry)).isTrue() val entryCopy = NotificationEntryBuilder() .setNotification(getConversationNotif().build()) .build() assertThat(underTest.isSameEntryAs(entryCopy)).isFalse() } @Test fun notifyHeightChanged() { val row : ExpandableNotificationRow = mock() entry.row = row underTest.notifyHeightChanged(true) verify(row).notifyHeightChanged(true) } fun setRemoteInputActive(headsUpManager: HeadsUpManager, isActive: Boolean) { val headsUpManager : HeadsUpManager = mock() val mockEntry: NotificationEntry = mock() underTest = (factory.create(mockEntry) as NotificationEntryAdapter).remoteInputEntryAdapter underTest.setRemoteInputActive(headsUpManager, true) verify(headsUpManager).setRemoteInputActive(mockEntry, true) } } packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java +113 −28 File changed.Preview size limit exceeded, changes collapsed. Show changes packages/SystemUI/src/com/android/systemui/statusbar/SmartReplyController.java +2 −2 Original line number Diff line number Diff line Loading @@ -98,10 +98,10 @@ public class SmartReplyController implements Dumpable { /** * Smart Replies and Actions have been added to the UI. */ public void smartSuggestionsAdded(final NotificationEntry entry, int replyCount, public void smartSuggestionsAdded(String key, int replyCount, int actionCount, boolean generatedByAssistant, boolean editBeforeSending) { try { mBarService.onNotificationSmartSuggestionsAdded(entry.getSbn().getKey(), replyCount, mBarService.onNotificationSmartSuggestionsAdded(key, replyCount, actionCount, generatedByAssistant, editBeforeSending); } catch (RemoteException e) { // Nothing to do, system going down Loading Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java +2 −2 Original line number Diff line number Diff line Loading @@ -147,8 +147,8 @@ public class SmartReplyControllerTest extends SysuiTestCase { public void testShowSmartSuggestions_logsToStatusBar() throws RemoteException { final boolean generatedByAsssistant = true; final boolean editBeforeSending = true; mSmartReplyController.smartSuggestionsAdded(mEntry, TEST_CHOICE_COUNT, TEST_ACTION_COUNT, generatedByAsssistant, editBeforeSending); mSmartReplyController.smartSuggestionsAdded(mEntry.getKey(), TEST_CHOICE_COUNT, TEST_ACTION_COUNT, generatedByAsssistant, editBeforeSending); // Check we log the result to the status bar service. verify(mIStatusBarService).onNotificationSmartSuggestionsAdded(mSbn.getKey(), Loading
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryAdapterTest.kt +14 −30 Original line number Diff line number Diff line Loading @@ -54,6 +54,7 @@ import org.mockito.kotlin.eq @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper @EnableFlags(NotificationBundleUi.FLAG_NAME) class NotificationEntryAdapterTest : SysuiTestCase() { private val kosmos = testKosmos() Loading @@ -63,7 +64,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { @get:Rule val setFlagsRule = SetFlagsRule() @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getBackingHashCode() { val entry = NotificationEntryBuilder() Loading @@ -74,7 +74,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getParent_adapter() { val ge = GroupEntryBuilder().build() val notification: Notification = Loading @@ -92,7 +91,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isTopLevelEntry_adapter() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() Loading @@ -109,7 +107,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getKey_adapter() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() Loading @@ -125,7 +122,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getRow_adapter() { val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Loading @@ -143,7 +139,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_adapter_groupSummary() { val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Loading @@ -166,7 +161,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isGroupRoot_adapter_groupChild() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -190,7 +184,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isClearable_adapter() { val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Loading @@ -208,7 +201,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSummarization_adapter() { val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Loading @@ -228,7 +220,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getIcons_adapter() { val row = mock(ExpandableNotificationRow::class.java) val notification: Notification = Loading @@ -246,7 +237,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isColorized() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -261,7 +251,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSbn() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() Loading @@ -273,7 +262,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getRanking() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -288,7 +276,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun endLifetimeExtension() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -306,7 +293,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun onImportanceChanged() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -324,7 +310,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun markForUserTriggeredMovement() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -344,7 +329,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isHighPriority() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -361,7 +345,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isBlockable() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -376,7 +359,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun canDragAndDrop() { val pi = mock(PendingIntent::class.java) Mockito.`when`(pi.isActivity).thenReturn(true) Loading @@ -393,7 +375,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isBubble() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -408,7 +389,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getStyle() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -423,7 +403,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getSectionBucket() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -439,7 +418,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun isAmbient() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() Loading @@ -455,7 +433,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getPeopleNotificationType() { val entry = kosmos.msgStyleBubbleableFullPerson Loading @@ -465,7 +442,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun canShowFullScreen() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -484,7 +460,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun onDragSuccess() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -500,7 +475,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun onNotificationBubbleIconClicked() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() Loading @@ -514,7 +488,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun onNotificationActionClicked() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -530,7 +503,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun getDismissState() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() Loading @@ -544,7 +516,6 @@ class NotificationEntryAdapterTest : SysuiTestCase() { } @Test @EnableFlags(NotificationBundleUi.FLAG_NAME) fun onEntryClicked() { val notification: Notification = Notification.Builder(mContext, "") Loading @@ -559,4 +530,17 @@ class NotificationEntryAdapterTest : SysuiTestCase() { underTest.onEntryClicked(row) verify(kosmos.mockNotificationActivityStarter).onNotificationClicked(entry, row) } @Test fun getRemoteInputEntryAdapter() { val notification: Notification = Notification.Builder(mContext, "").setSmallIcon(R.drawable.ic_person).build() val entry = NotificationEntryBuilder().setNotification(notification).build() underTest = factory.create(entry) as NotificationEntryAdapter assertThat(underTest.remoteInputEntryAdapter) .isSameInstanceAs(entry.remoteInputEntryAdapter) } }
packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/collection/RemoteInputEntryAdapterTest.kt 0 → 100644 +278 −0 Original line number Diff line number Diff line /* * Copyright (C) 2025 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.collection import android.app.Notification import android.app.PendingIntent import android.app.Person import android.app.RemoteInput import android.content.Intent import android.graphics.drawable.Icon import android.net.Uri import android.platform.test.annotations.EnableFlags import android.platform.test.flag.junit.SetFlagsRule import android.testing.TestableLooper.RunWithLooper import android.view.ContentInfo import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest import com.android.systemui.SysuiTestCase import com.android.systemui.res.R import com.android.systemui.statusbar.notification.headsup.HeadsUpManager import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.entryAdapterFactory import com.android.systemui.statusbar.notification.shared.NotificationBundleUi import com.android.systemui.testKosmos import com.android.systemui.wmshell.BubblesTestActivity import com.google.common.truth.Truth.assertThat import org.junit.Before import org.junit.Rule import org.junit.Test import org.junit.runner.RunWith import org.mockito.kotlin.mock import org.mockito.kotlin.verify @SmallTest @RunWith(AndroidJUnit4::class) @RunWithLooper @EnableFlags(NotificationBundleUi.FLAG_NAME) class RemoteInputEntryAdapterTest : SysuiTestCase() { private val kosmos = testKosmos() private val factory: EntryAdapterFactory = kosmos.entryAdapterFactory private lateinit var entry : NotificationEntry private lateinit var underTest: RemoteInputEntryAdapter @get:Rule val setFlagsRule = SetFlagsRule() @Before fun before() { entry = NotificationEntryBuilder() .setNotification(getConversationNotif().build()) .build() underTest = (factory.create(entry) as NotificationEntryAdapter).remoteInputEntryAdapter } /** Creates a [Notification.Builder] that is a conversation. */ private fun getConversationNotif(): Notification.Builder { val timeContent = "content at ${System.currentTimeMillis()}" val intent = Intent(context, BubblesTestActivity::class.java) val pendingIntent = PendingIntent.getActivity( context, 0, intent, PendingIntent.FLAG_MUTABLE ) val person = Person.Builder() .setName("PERSON") .build() val remoteInput = RemoteInput.Builder("reply_key").setLabel("reply").build() val inputIntent = PendingIntent.getActivity( mContext, 0, Intent().setPackage(mContext.packageName), PendingIntent.FLAG_MUTABLE ) val icon = Icon.createWithResource( mContext, R.drawable.ic_android ) val replyAction = Notification.Action.Builder( icon, "Reply", inputIntent ).addRemoteInput(remoteInput) .build() return Notification.Builder(context, "channel") .setSmallIcon(R.drawable.ic_android) .setContentTitle("Test Notification") .setContentText(timeContent) .setContentIntent(pendingIntent) .setActions(replyAction) .setStyle( Notification.MessagingStyle(person) .setConversationTitle("Chat") .addMessage( timeContent, System.currentTimeMillis(), person ) ) } @Test fun getKey() { assertThat(underTest.key).isEqualTo(entry.key) } @Test fun getStyle() { assertThat(underTest.style).isEqualTo(entry.notificationStyle) } @Test fun rowExists() { assertThat(underTest.rowExists).isFalse() entry.row = mock() assertThat(underTest.rowExists).isTrue() } @Test fun getRow() { val row : ExpandableNotificationRow = mock() entry.row = row assertThat(underTest.row).isEqualTo(row) } @Test fun closeRemoteInput() { val row : ExpandableNotificationRow = mock() entry.row = row underTest.closeRemoteInput() verify(row).closeRemoteInput() } @Test fun isRemoteInputAnimatingAway() { assertThat(underTest.remoteInputAnimatingAway).isEqualTo(false) entry.mRemoteEditImeAnimatingAway = true assertThat(underTest.remoteInputAnimatingAway).isEqualTo(true) } @Test fun setRemoteInputAnimatingAway() { assertThat(underTest.remoteInputAnimatingAway).isEqualTo(false) underTest.remoteInputAnimatingAway = true assertThat(entry.mRemoteEditImeAnimatingAway).isEqualTo(true) } @Test fun isRemoteInputImeVisible() { assertThat(underTest.remoteInputImeVisible).isEqualTo(false) entry.mRemoteEditImeVisible = true assertThat(underTest.remoteInputImeVisible).isEqualTo(true) } @Test fun setRemoteInputImeVisible() { assertThat(underTest.remoteInputImeVisible).isEqualTo(false) underTest.remoteInputImeVisible = true assertThat(entry.mRemoteEditImeVisible).isEqualTo(true) } @Test fun getRemoteInputAttachment() { val contentInfo : ContentInfo = mock() entry.remoteInputAttachment = contentInfo assertThat(underTest.remoteInputAttachment).isEqualTo(contentInfo) } @Test fun setRemoteInputAttachment() { val contentInfo : ContentInfo = mock() underTest.remoteInputAttachment = contentInfo assertThat(entry.remoteInputAttachment).isEqualTo(contentInfo) } @Test fun setRemoteInputUri() { val uri : Uri = mock() underTest.remoteInputUri = uri assertThat(entry.remoteInputUri).isEqualTo(uri) } @Test fun setRemoteInputMimeType() { val mimeType = "mime" underTest.remoteInputMimeType = mimeType assertThat(entry.remoteInputMimeType).isEqualTo(mimeType) } @Test fun setRemoteInputText() { val text = "TEXT" underTest.remoteInputText = text assertThat(entry.remoteInputText).isEqualTo(text) } @Test fun getRemoteInputText() { val text = "TEXT" entry.remoteInputText = text assertThat(underTest.remoteInputText).isEqualTo(text) } @Test fun setRemoteInputTextWhenReset() { val text = "TEXT" underTest.remoteInputTextWhenReset = text assertThat(entry.remoteInputTextWhenReset).isEqualTo(text) } @Test fun isSameEntryAs() { assertThat(underTest.isSameEntryAs(entry)).isTrue() val entryCopy = NotificationEntryBuilder() .setNotification(getConversationNotif().build()) .build() assertThat(underTest.isSameEntryAs(entryCopy)).isFalse() } @Test fun notifyHeightChanged() { val row : ExpandableNotificationRow = mock() entry.row = row underTest.notifyHeightChanged(true) verify(row).notifyHeightChanged(true) } fun setRemoteInputActive(headsUpManager: HeadsUpManager, isActive: Boolean) { val headsUpManager : HeadsUpManager = mock() val mockEntry: NotificationEntry = mock() underTest = (factory.create(mockEntry) as NotificationEntryAdapter).remoteInputEntryAdapter underTest.setRemoteInputActive(headsUpManager, true) verify(headsUpManager).setRemoteInputActive(mockEntry, true) } }
packages/SystemUI/src/com/android/systemui/statusbar/RemoteInputController.java +113 −28 File changed.Preview size limit exceeded, changes collapsed. Show changes
packages/SystemUI/src/com/android/systemui/statusbar/SmartReplyController.java +2 −2 Original line number Diff line number Diff line Loading @@ -98,10 +98,10 @@ public class SmartReplyController implements Dumpable { /** * Smart Replies and Actions have been added to the UI. */ public void smartSuggestionsAdded(final NotificationEntry entry, int replyCount, public void smartSuggestionsAdded(String key, int replyCount, int actionCount, boolean generatedByAssistant, boolean editBeforeSending) { try { mBarService.onNotificationSmartSuggestionsAdded(entry.getSbn().getKey(), replyCount, mBarService.onNotificationSmartSuggestionsAdded(key, replyCount, actionCount, generatedByAssistant, editBeforeSending); } catch (RemoteException e) { // Nothing to do, system going down Loading