diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleProvider.java b/packages/SystemUI/src/com/android/systemui/people/PeopleProvider.java index 59329d1b091f8..41957bc915617 100644 --- a/packages/SystemUI/src/com/android/systemui/people/PeopleProvider.java +++ b/packages/SystemUI/src/com/android/systemui/people/PeopleProvider.java @@ -93,7 +93,7 @@ public class PeopleProvider extends ContentProvider { : Dependency.get(NotificationEntryManager.class); RemoteViews view = PeopleSpaceUtils.getPreview(getContext(), mPeopleManager, mLauncherApps, - mNotificationEntryManager, shortcutId, userHandle, packageName); + mNotificationEntryManager, shortcutId, userHandle, packageName, extras); if (view == null) { if (DEBUG) Log.d(TAG, "No preview available for shortcutId: " + shortcutId); return null; diff --git a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java index a160379813708..c0a16e11df681 100644 --- a/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java +++ b/packages/SystemUI/src/com/android/systemui/people/PeopleSpaceUtils.java @@ -529,7 +529,7 @@ public class PeopleSpaceUtils { */ public static RemoteViews getPreview(Context context, IPeopleManager peopleManager, LauncherApps launcherApps, NotificationEntryManager notificationEntryManager, - String shortcutId, UserHandle userHandle, String packageName) { + String shortcutId, UserHandle userHandle, String packageName, Bundle options) { peopleManager = (peopleManager != null) ? peopleManager : IPeopleManager.Stub.asInterface( ServiceManager.getService(Context.PEOPLE_SERVICE)); launcherApps = (launcherApps != null) ? launcherApps @@ -556,8 +556,7 @@ public class PeopleSpaceUtils { context, tile, notificationEntryManager); if (DEBUG) Log.i(TAG, "Returning tile preview for shortcutId: " + shortcutId); - Bundle bundle = new Bundle(); - return new PeopleTileViewHelper(context, augmentedTile, 0, bundle).getViews(); + return new PeopleTileViewHelper(context, augmentedTile, 0, options).getViews(); } /** Returns the userId associated with a {@link PeopleSpaceTile} */ diff --git a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java index 6cb7c315737ee..fb0dcc2bc50a9 100644 --- a/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java +++ b/packages/SystemUI/src/com/android/systemui/people/widget/PeopleSpaceWidgetManager.java @@ -777,12 +777,12 @@ public class PeopleSpaceWidgetManager { * Builds a request to pin a People Tile app widget, with a preview and storing necessary * information as the callback. */ - public boolean requestPinAppWidget(ShortcutInfo shortcutInfo) { + public boolean requestPinAppWidget(ShortcutInfo shortcutInfo, Bundle options) { if (DEBUG) Log.d(TAG, "Requesting pin widget, shortcutId: " + shortcutInfo.getId()); RemoteViews widgetPreview = PeopleSpaceUtils.getPreview(mContext, mIPeopleManager, mLauncherApps, mNotificationEntryManager, shortcutInfo.getId(), - shortcutInfo.getUserHandle(), shortcutInfo.getPackage()); + shortcutInfo.getUserHandle(), shortcutInfo.getPackage(), options); if (widgetPreview == null) { Log.w(TAG, "Skipping pinning widget: no tile for shortcutId: " + shortcutInfo.getId()); return false; 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 fa6f23d389840..3434f67fa2713 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 @@ -44,6 +44,7 @@ import android.content.pm.ShortcutInfo; import android.content.pm.ShortcutManager; import android.content.res.TypedArray; import android.graphics.drawable.Drawable; +import android.os.Bundle; import android.os.Handler; import android.os.RemoteException; import android.os.UserHandle; @@ -181,7 +182,7 @@ public class NotificationConversationInfo extends LinearLayout implements showPriorityOnboarding(); } else if (mSelectedAction == ACTION_FAVORITE && getPriority() != mSelectedAction) { mShadeController.animateCollapsePanels(); - mPeopleSpaceWidgetManager.requestPinAppWidget(mShortcutInfo); + mPeopleSpaceWidgetManager.requestPinAppWidget(mShortcutInfo, new Bundle()); } mGutsContainer.closeControls(v, true); }; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PriorityOnboardingDialogController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PriorityOnboardingDialogController.kt index 9bbe616dc39d5..270721ffa4b88 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PriorityOnboardingDialogController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/row/PriorityOnboardingDialogController.kt @@ -28,6 +28,7 @@ import android.graphics.PixelFormat import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Drawable import android.graphics.drawable.GradientDrawable +import android.os.Bundle import android.text.SpannableStringBuilder import android.text.style.BulletSpan import android.view.Gravity @@ -86,7 +87,7 @@ class PriorityOnboardingDialogController @Inject constructor( Prefs.putBoolean(context, Prefs.Key.HAS_SEEN_PRIORITY_ONBOARDING_IN_S, true) dialog.dismiss() shadeController.animateCollapsePanels() - peopleSpaceWidgetManager.requestPinAppWidget(shortcutInfo) + peopleSpaceWidgetManager.requestPinAppWidget(shortcutInfo, Bundle()) } private fun settings() { diff --git a/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java b/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java index e9be8d8dad3c9..1ab5d341ab903 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/people/widget/PeopleSpaceWidgetManagerTest.java @@ -1143,7 +1143,7 @@ public class PeopleSpaceWidgetManagerTest extends SysuiTestCase { when(mAppWidgetManager.requestPinAppWidget(any(), any(), any())).thenReturn(true); ShortcutInfo info = new ShortcutInfo.Builder(mMockContext, SHORTCUT_ID).build(); - boolean valid = mManager.requestPinAppWidget(info); + boolean valid = mManager.requestPinAppWidget(info, new Bundle()); assertThat(valid).isTrue(); verify(mAppWidgetManager, times(1)).requestPinAppWidget( @@ -1157,7 +1157,7 @@ public class PeopleSpaceWidgetManagerTest extends SysuiTestCase { when(mIPeopleManager.getConversation(PACKAGE_NAME, 0, SHORTCUT_ID)).thenReturn(null); ShortcutInfo info = new ShortcutInfo.Builder(mMockContext, SHORTCUT_ID).build(); - boolean valid = mManager.requestPinAppWidget(info); + boolean valid = mManager.requestPinAppWidget(info, new Bundle()); assertThat(valid).isFalse(); verify(mAppWidgetManager, never()).requestPinAppWidget(any(), any(), any()); 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 12e341a5f135b..5d29f520e8a90 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 @@ -31,7 +31,6 @@ import static junit.framework.Assert.assertEquals; import static junit.framework.Assert.assertFalse; import static junit.framework.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.anyBoolean; import static org.mockito.Mockito.any; import static org.mockito.Mockito.anyInt; import static org.mockito.Mockito.anyString; @@ -239,7 +238,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { when(mBuilder.build()).thenReturn(mock(PriorityOnboardingDialogController.class)); - when(mPeopleSpaceWidgetManager.requestPinAppWidget(any())).thenReturn(true); + when(mPeopleSpaceWidgetManager.requestPinAppWidget(any(), any())).thenReturn(true); } @Test @@ -1289,7 +1288,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mNotificationInfo.findViewById(R.id.done).performClick(); // THEN the user is presented with the People Tile pinning request - verify(mPeopleSpaceWidgetManager, times(1)).requestPinAppWidget(any()); + verify(mPeopleSpaceWidgetManager, times(1)).requestPinAppWidget(any(), any()); } @Test @@ -1325,7 +1324,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mNotificationInfo.findViewById(R.id.done).performClick(); // THEN the user is not presented with the People Tile pinning request - verify(mPeopleSpaceWidgetManager, never()).requestPinAppWidget(mShortcutInfo); + verify(mPeopleSpaceWidgetManager, never()).requestPinAppWidget(eq(mShortcutInfo), any()); } @Test @@ -1364,6 +1363,6 @@ public class NotificationConversationInfoTest extends SysuiTestCase { mNotificationInfo.findViewById(R.id.done).performClick(); // THEN the user is not presented with the People Tile pinning request - verify(mPeopleSpaceWidgetManager, never()).requestPinAppWidget(mShortcutInfo); + verify(mPeopleSpaceWidgetManager, never()).requestPinAppWidget(eq(mShortcutInfo), any()); } }