Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e96d323e authored by Julia Reynolds's avatar Julia Reynolds Committed by Automerger Merge Worker
Browse files

Merge "Disable priority conversation widget for secondary users" into udc-qpr-dev am: 8aef12b5

parents 80d2bb03 8aef12b5
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -48,6 +48,7 @@ import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.os.RemoteException;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManager;
import android.service.notification.StatusBarNotification;
import android.service.notification.StatusBarNotification;
import android.text.TextUtils;
import android.text.TextUtils;
import android.transition.ChangeBounds;
import android.transition.ChangeBounds;
@@ -118,6 +119,8 @@ public class NotificationConversationInfo extends LinearLayout implements
    private NotificationGuts mGutsContainer;
    private NotificationGuts mGutsContainer;
    private OnConversationSettingsClickListener mOnConversationSettingsClickListener;
    private OnConversationSettingsClickListener mOnConversationSettingsClickListener;


    private UserManager mUm;

    @VisibleForTesting
    @VisibleForTesting
    boolean mSkipPost = false;
    boolean mSkipPost = false;
    private int mActualHeight;
    private int mActualHeight;
@@ -155,8 +158,10 @@ public class NotificationConversationInfo extends LinearLayout implements
        // People Tile add request.
        // People Tile add request.
        if (mSelectedAction == ACTION_FAVORITE && getPriority() != mSelectedAction) {
        if (mSelectedAction == ACTION_FAVORITE && getPriority() != mSelectedAction) {
            mShadeController.animateCollapseShade();
            mShadeController.animateCollapseShade();
            if (mUm.isSameProfileGroup(UserHandle.USER_SYSTEM, mSbn.getNormalizedUserId())) {
                mPeopleSpaceWidgetManager.requestPinAppWidget(mShortcutInfo, new Bundle());
                mPeopleSpaceWidgetManager.requestPinAppWidget(mShortcutInfo, new Bundle());
            }
            }
        }
        mGutsContainer.closeControls(v, /* save= */ true);
        mGutsContainer.closeControls(v, /* save= */ true);
    };
    };


@@ -188,6 +193,7 @@ public class NotificationConversationInfo extends LinearLayout implements
    public void bindNotification(
    public void bindNotification(
            ShortcutManager shortcutManager,
            ShortcutManager shortcutManager,
            PackageManager pm,
            PackageManager pm,
            UserManager um,
            PeopleSpaceWidgetManager peopleSpaceWidgetManager,
            PeopleSpaceWidgetManager peopleSpaceWidgetManager,
            INotificationManager iNotificationManager,
            INotificationManager iNotificationManager,
            OnUserInteractionCallback onUserInteractionCallback,
            OnUserInteractionCallback onUserInteractionCallback,
@@ -211,6 +217,7 @@ public class NotificationConversationInfo extends LinearLayout implements
        mEntry = entry;
        mEntry = entry;
        mSbn = entry.getSbn();
        mSbn = entry.getSbn();
        mPm = pm;
        mPm = pm;
        mUm = um;
        mAppName = mPackageName;
        mAppName = mPackageName;
        mOnSettingsClickListener = onSettingsClick;
        mOnSettingsClickListener = onSettingsClick;
        mNotificationChannel = notificationChannel;
        mNotificationChannel = notificationChannel;
+7 −0
Original line number Original line Diff line number Diff line
@@ -30,6 +30,7 @@ import android.net.Uri;
import android.os.Bundle;
import android.os.Bundle;
import android.os.Handler;
import android.os.Handler;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManager;
import android.provider.Settings;
import android.provider.Settings;
import android.service.notification.StatusBarNotification;
import android.service.notification.StatusBarNotification;
import android.util.ArraySet;
import android.util.ArraySet;
@@ -112,6 +113,9 @@ public class NotificationGutsManager implements NotifGutsViewManager {
    private Runnable mOpenRunnable;
    private Runnable mOpenRunnable;
    private final INotificationManager mNotificationManager;
    private final INotificationManager mNotificationManager;
    private final PeopleSpaceWidgetManager mPeopleSpaceWidgetManager;
    private final PeopleSpaceWidgetManager mPeopleSpaceWidgetManager;

    private final UserManager mUserManager;

    private final LauncherApps mLauncherApps;
    private final LauncherApps mLauncherApps;
    private final ShortcutManager mShortcutManager;
    private final ShortcutManager mShortcutManager;
    private final UserContextProvider mContextTracker;
    private final UserContextProvider mContextTracker;
@@ -128,6 +132,7 @@ public class NotificationGutsManager implements NotifGutsViewManager {
            AccessibilityManager accessibilityManager,
            AccessibilityManager accessibilityManager,
            HighPriorityProvider highPriorityProvider,
            HighPriorityProvider highPriorityProvider,
            INotificationManager notificationManager,
            INotificationManager notificationManager,
            UserManager userManager,
            PeopleSpaceWidgetManager peopleSpaceWidgetManager,
            PeopleSpaceWidgetManager peopleSpaceWidgetManager,
            LauncherApps launcherApps,
            LauncherApps launcherApps,
            ShortcutManager shortcutManager,
            ShortcutManager shortcutManager,
@@ -150,6 +155,7 @@ public class NotificationGutsManager implements NotifGutsViewManager {
        mAccessibilityManager = accessibilityManager;
        mAccessibilityManager = accessibilityManager;
        mHighPriorityProvider = highPriorityProvider;
        mHighPriorityProvider = highPriorityProvider;
        mNotificationManager = notificationManager;
        mNotificationManager = notificationManager;
        mUserManager = userManager;
        mPeopleSpaceWidgetManager = peopleSpaceWidgetManager;
        mPeopleSpaceWidgetManager = peopleSpaceWidgetManager;
        mLauncherApps = launcherApps;
        mLauncherApps = launcherApps;
        mShortcutManager = shortcutManager;
        mShortcutManager = shortcutManager;
@@ -471,6 +477,7 @@ public class NotificationGutsManager implements NotifGutsViewManager {
        notificationInfoView.bindNotification(
        notificationInfoView.bindNotification(
                mShortcutManager,
                mShortcutManager,
                pmUser,
                pmUser,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mNotificationManager,
                mNotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
+71 −0
Original line number Original line Diff line number Diff line
@@ -62,6 +62,7 @@ import android.graphics.drawable.Drawable;
import android.graphics.drawable.Icon;
import android.graphics.drawable.Icon;
import android.os.Handler;
import android.os.Handler;
import android.os.UserHandle;
import android.os.UserHandle;
import android.os.UserManager;
import android.service.notification.StatusBarNotification;
import android.service.notification.StatusBarNotification;
import android.test.suitebuilder.annotation.SmallTest;
import android.test.suitebuilder.annotation.SmallTest;
import android.testing.AndroidTestingRunner;
import android.testing.AndroidTestingRunner;
@@ -132,6 +133,8 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
    @Mock
    @Mock
    private PackageManager mMockPackageManager;
    private PackageManager mMockPackageManager;
    @Mock
    @Mock
    private UserManager mUserManager;
    @Mock
    private OnUserInteractionCallback mOnUserInteractionCallback;
    private OnUserInteractionCallback mOnUserInteractionCallback;
    @Mock
    @Mock
    private BubblesManager mBubblesManager;
    private BubblesManager mBubblesManager;
@@ -238,6 +241,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -262,6 +266,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -314,6 +319,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -339,6 +345,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -363,6 +370,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -398,6 +406,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -423,6 +432,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -452,6 +462,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -476,6 +487,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -504,6 +516,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -532,6 +545,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -563,6 +577,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -600,6 +615,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -628,6 +644,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -663,6 +680,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -691,6 +709,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -735,6 +754,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -778,6 +798,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -822,6 +843,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -860,6 +882,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -896,6 +919,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -936,6 +960,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -967,6 +992,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -996,6 +1022,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -1033,6 +1060,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -1069,6 +1097,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -1104,6 +1133,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -1143,6 +1173,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -1173,6 +1204,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -1198,6 +1230,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -1219,11 +1252,13 @@ public class NotificationConversationInfoTest extends SysuiTestCase {


    @Test
    @Test
    public void testSelectPriorityRequestsPinPeopleTile() {
    public void testSelectPriorityRequestsPinPeopleTile() {
        when(mUserManager.isSameProfileGroup(anyInt(), anyInt())).thenReturn(true);
        //WHEN channel is default importance
        //WHEN channel is default importance
        mNotificationChannel.setImportantConversation(false);
        mNotificationChannel.setImportantConversation(false);
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -1249,11 +1284,46 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        verify(mPeopleSpaceWidgetManager, times(1)).requestPinAppWidget(any(), any());
        verify(mPeopleSpaceWidgetManager, times(1)).requestPinAppWidget(any(), any());
    }
    }


    @Test
    public void testSelectPriorityRequestsPinPeopleTile_noMultiuser() {
        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);

        // WHEN user clicks "priority"
        mNotificationInfo.setSelectedAction(NotificationConversationInfo.ACTION_FAVORITE);

        // and then done
        mNotificationInfo.findViewById(R.id.done).performClick();

        // No widget prompt; on a secondary user
        verify(mPeopleSpaceWidgetManager, never()).requestPinAppWidget(any(), any());
    }

    @Test
    @Test
    public void testSelectDefaultDoesNotRequestPinPeopleTile() {
    public void testSelectDefaultDoesNotRequestPinPeopleTile() {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
@@ -1288,6 +1358,7 @@ public class NotificationConversationInfoTest extends SysuiTestCase {
        mNotificationInfo.bindNotification(
        mNotificationInfo.bindNotification(
                mShortcutManager,
                mShortcutManager,
                mMockPackageManager,
                mMockPackageManager,
                mUserManager,
                mPeopleSpaceWidgetManager,
                mPeopleSpaceWidgetManager,
                mMockINotificationManager,
                mMockINotificationManager,
                mOnUserInteractionCallback,
                mOnUserInteractionCallback,
+4 −1
Original line number Original line Diff line number Diff line
@@ -52,6 +52,7 @@ import android.content.pm.ShortcutManager;
import android.graphics.Color;
import android.graphics.Color;
import android.os.Binder;
import android.os.Binder;
import android.os.Handler;
import android.os.Handler;
import android.os.UserManager;
import android.provider.Settings;
import android.provider.Settings;
import android.service.notification.StatusBarNotification;
import android.service.notification.StatusBarNotification;
import android.testing.AndroidTestingRunner;
import android.testing.AndroidTestingRunner;
@@ -137,6 +138,8 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
    @Mock private HeadsUpManagerPhone mHeadsUpManagerPhone;
    @Mock private HeadsUpManagerPhone mHeadsUpManagerPhone;
    @Mock private ActivityStarter mActivityStarter;
    @Mock private ActivityStarter mActivityStarter;


    @Mock private UserManager mUserManager;

    @Before
    @Before
    public void setUp() {
    public void setUp() {
        mTestableLooper = TestableLooper.get(this);
        mTestableLooper = TestableLooper.get(this);
@@ -147,7 +150,7 @@ public class NotificationGutsManagerTest extends SysuiTestCase {


        mGutsManager = new NotificationGutsManager(mContext, mHandler, mHandler,
        mGutsManager = new NotificationGutsManager(mContext, mHandler, mHandler,
                mAccessibilityManager,
                mAccessibilityManager,
                mHighPriorityProvider, mINotificationManager,
                mHighPriorityProvider, mINotificationManager, mUserManager,
                mPeopleSpaceWidgetManager, mLauncherApps, mShortcutManager,
                mPeopleSpaceWidgetManager, mLauncherApps, mShortcutManager,
                mChannelEditorDialogController, mContextTracker, mAssistantFeedbackController,
                mChannelEditorDialogController, mContextTracker, mAssistantFeedbackController,
                Optional.of(mBubblesManager), new UiEventLoggerFake(), mOnUserInteractionCallback,
                Optional.of(mBubblesManager), new UiEventLoggerFake(), mOnUserInteractionCallback,