Loading core/java/com/android/internal/statusbar/IStatusBarService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ interface IStatusBarService void onNotificationDirectReplied(String key); void onNotificationSmartSuggestionsAdded(String key, int smartReplyCount, int smartActionCount, boolean generatedByAsssistant); void onNotificationSmartReplySent(in String key, in int replyIndex, in CharSequence reply, boolean generatedByAssistant); void onNotificationSmartReplySent(in String key, in int replyIndex, in CharSequence reply, boolean generatedByAssistant, in int notificationLocation); void onNotificationSettingsViewed(String key); void setSystemUiVisibility(int displayId, int vis, int mask, String cause); Loading packages/SystemUI/src/com/android/systemui/statusbar/SmartReplyController.java +3 −2 Original line number Diff line number Diff line Loading @@ -56,12 +56,13 @@ public class SmartReplyController { * Notifies StatusBarService a smart reply is sent. */ public void smartReplySent(NotificationEntry entry, int replyIndex, CharSequence reply, boolean generatedByAssistant) { boolean generatedByAssistant, int notificationLocation) { mCallback.onSmartReplySent(entry, reply); mSendingKeys.add(entry.key); try { mBarService.onNotificationSmartReplySent( entry.notification.getKey(), replyIndex, reply, generatedByAssistant); entry.notification.getKey(), replyIndex, reply, generatedByAssistant, notificationLocation); } catch (RemoteException e) { // Nothing to do, system going down } Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java +4 −2 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.SmartReplyController; import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.logging.NotificationLogger; import com.android.systemui.statusbar.phone.KeyguardDismissUtil; import java.text.BreakIterator; Loading Loading @@ -258,8 +259,9 @@ public class SmartReplyView extends ViewGroup { return false; } smartReplyController.smartReplySent( entry, replyIndex, b.getText(), smartReplies.fromAssistant); smartReplyController.smartReplySent(entry, replyIndex, b.getText(), smartReplies.fromAssistant, NotificationLogger.getNotificationLocation(entry).toMetricsEventEnum()); Bundle results = new Bundle(); results.putString(smartReplies.remoteInput.getResultKey(), choice.toString()); Intent intent = new Intent().addFlags(Intent.FLAG_RECEIVER_FOREGROUND); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java +13 −7 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.support.test.filters.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; Loading Loading @@ -97,7 +98,8 @@ public class SmartReplyControllerTest extends SysuiTestCase { @Test public void testSendSmartReply_updatesRemoteInput() { mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false); mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false, MetricsEvent.LOCATION_UNKNOWN); // Sending smart reply should make calls to NotificationEntryManager // to update the notification with reply and spinner. Loading @@ -107,21 +109,23 @@ public class SmartReplyControllerTest extends SysuiTestCase { @Test public void testSendSmartReply_logsToStatusBar() throws RemoteException { mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false); mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false, MetricsEvent.LOCATION_UNKNOWN); // Check we log the result to the status bar service. verify(mIStatusBarService).onNotificationSmartReplySent(mSbn.getKey(), TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false); TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false, MetricsEvent.LOCATION_UNKNOWN); } @Test public void testSendSmartReply_logsToStatusBar_generatedByAssistant() throws RemoteException { mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, true); mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, true, MetricsEvent.LOCATION_UNKNOWN); // Check we log the result to the status bar service. verify(mIStatusBarService).onNotificationSmartReplySent(mSbn.getKey(), TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, true); TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, true, MetricsEvent.LOCATION_UNKNOWN); } @Test Loading @@ -137,14 +141,16 @@ public class SmartReplyControllerTest extends SysuiTestCase { @Test public void testSendSmartReply_reportsSending() { mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false); mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false, MetricsEvent.LOCATION_UNKNOWN); assertTrue(mSmartReplyController.isSendingSmartReply(mSbn.getKey())); } @Test public void testSendingSmartReply_afterRemove_shouldReturnFalse() { mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false); mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false, MetricsEvent.LOCATION_UNKNOWN); mSmartReplyController.stopSending(mEntry); assertFalse(mSmartReplyController.isSendingSmartReply(mSbn.getKey())); Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java +3 −2 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.LinearLayout; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.ActivityStarter; Loading Loading @@ -190,7 +191,7 @@ public class SmartReplyViewTest extends SysuiTestCase { setSmartReplies(TEST_CHOICES); mView.getChildAt(2).performClick(); verify(mLogger).smartReplySent(mEntry, 2, TEST_CHOICES[2], false /* generatedByAsssitant */); false /* generatedByAsssitant */, MetricsEvent.LOCATION_UNKNOWN); } @Test Loading @@ -198,7 +199,7 @@ public class SmartReplyViewTest extends SysuiTestCase { setSmartReplies(TEST_CHOICES, true); mView.getChildAt(2).performClick(); verify(mLogger).smartReplySent(mEntry, 2, TEST_CHOICES[2], true /* generatedByAsssitant */); true /* generatedByAsssitant */, MetricsEvent.LOCATION_UNKNOWN); } @Test Loading Loading
core/java/com/android/internal/statusbar/IStatusBarService.aidl +1 −1 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ interface IStatusBarService void onNotificationDirectReplied(String key); void onNotificationSmartSuggestionsAdded(String key, int smartReplyCount, int smartActionCount, boolean generatedByAsssistant); void onNotificationSmartReplySent(in String key, in int replyIndex, in CharSequence reply, boolean generatedByAssistant); void onNotificationSmartReplySent(in String key, in int replyIndex, in CharSequence reply, boolean generatedByAssistant, in int notificationLocation); void onNotificationSettingsViewed(String key); void setSystemUiVisibility(int displayId, int vis, int mask, String cause); Loading
packages/SystemUI/src/com/android/systemui/statusbar/SmartReplyController.java +3 −2 Original line number Diff line number Diff line Loading @@ -56,12 +56,13 @@ public class SmartReplyController { * Notifies StatusBarService a smart reply is sent. */ public void smartReplySent(NotificationEntry entry, int replyIndex, CharSequence reply, boolean generatedByAssistant) { boolean generatedByAssistant, int notificationLocation) { mCallback.onSmartReplySent(entry, reply); mSendingKeys.add(entry.key); try { mBarService.onNotificationSmartReplySent( entry.notification.getKey(), replyIndex, reply, generatedByAssistant); entry.notification.getKey(), replyIndex, reply, generatedByAssistant, notificationLocation); } catch (RemoteException e) { // Nothing to do, system going down } Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/SmartReplyView.java +4 −2 Original line number Diff line number Diff line Loading @@ -38,6 +38,7 @@ import com.android.systemui.statusbar.NotificationRemoteInputManager; import com.android.systemui.statusbar.SmartReplyController; import com.android.systemui.statusbar.notification.NotificationUtils; import com.android.systemui.statusbar.notification.collection.NotificationEntry; import com.android.systemui.statusbar.notification.logging.NotificationLogger; import com.android.systemui.statusbar.phone.KeyguardDismissUtil; import java.text.BreakIterator; Loading Loading @@ -258,8 +259,9 @@ public class SmartReplyView extends ViewGroup { return false; } smartReplyController.smartReplySent( entry, replyIndex, b.getText(), smartReplies.fromAssistant); smartReplyController.smartReplySent(entry, replyIndex, b.getText(), smartReplies.fromAssistant, NotificationLogger.getNotificationLocation(entry).toMetricsEventEnum()); Bundle results = new Bundle(); results.putString(smartReplies.remoteInput.getResultKey(), choice.toString()); Intent intent = new Intent().addFlags(Intent.FLAG_RECEIVER_FOREGROUND); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/SmartReplyControllerTest.java +13 −7 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ import android.support.test.filters.SmallTest; import android.testing.AndroidTestingRunner; import android.testing.TestableLooper; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.internal.statusbar.IStatusBarService; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; Loading Loading @@ -97,7 +98,8 @@ public class SmartReplyControllerTest extends SysuiTestCase { @Test public void testSendSmartReply_updatesRemoteInput() { mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false); mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false, MetricsEvent.LOCATION_UNKNOWN); // Sending smart reply should make calls to NotificationEntryManager // to update the notification with reply and spinner. Loading @@ -107,21 +109,23 @@ public class SmartReplyControllerTest extends SysuiTestCase { @Test public void testSendSmartReply_logsToStatusBar() throws RemoteException { mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false); mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false, MetricsEvent.LOCATION_UNKNOWN); // Check we log the result to the status bar service. verify(mIStatusBarService).onNotificationSmartReplySent(mSbn.getKey(), TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false); TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false, MetricsEvent.LOCATION_UNKNOWN); } @Test public void testSendSmartReply_logsToStatusBar_generatedByAssistant() throws RemoteException { mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, true); mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, true, MetricsEvent.LOCATION_UNKNOWN); // Check we log the result to the status bar service. verify(mIStatusBarService).onNotificationSmartReplySent(mSbn.getKey(), TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, true); TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, true, MetricsEvent.LOCATION_UNKNOWN); } @Test Loading @@ -137,14 +141,16 @@ public class SmartReplyControllerTest extends SysuiTestCase { @Test public void testSendSmartReply_reportsSending() { mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false); mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false, MetricsEvent.LOCATION_UNKNOWN); assertTrue(mSmartReplyController.isSendingSmartReply(mSbn.getKey())); } @Test public void testSendingSmartReply_afterRemove_shouldReturnFalse() { mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false); mSmartReplyController.smartReplySent(mEntry, TEST_CHOICE_INDEX, TEST_CHOICE_TEXT, false, MetricsEvent.LOCATION_UNKNOWN); mSmartReplyController.stopSending(mEntry); assertFalse(mSmartReplyController.isSendingSmartReply(mSbn.getKey())); Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/policy/SmartReplyViewTest.java +3 −2 Original line number Diff line number Diff line Loading @@ -45,6 +45,7 @@ import android.view.ViewGroup; import android.widget.Button; import android.widget.LinearLayout; import com.android.internal.logging.nano.MetricsProto.MetricsEvent; import com.android.systemui.R; import com.android.systemui.SysuiTestCase; import com.android.systemui.plugins.ActivityStarter; Loading Loading @@ -190,7 +191,7 @@ public class SmartReplyViewTest extends SysuiTestCase { setSmartReplies(TEST_CHOICES); mView.getChildAt(2).performClick(); verify(mLogger).smartReplySent(mEntry, 2, TEST_CHOICES[2], false /* generatedByAsssitant */); false /* generatedByAsssitant */, MetricsEvent.LOCATION_UNKNOWN); } @Test Loading @@ -198,7 +199,7 @@ public class SmartReplyViewTest extends SysuiTestCase { setSmartReplies(TEST_CHOICES, true); mView.getChildAt(2).performClick(); verify(mLogger).smartReplySent(mEntry, 2, TEST_CHOICES[2], true /* generatedByAsssitant */); true /* generatedByAsssitant */, MetricsEvent.LOCATION_UNKNOWN); } @Test Loading