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

Commit 1d53e631 authored by Julia Reynolds's avatar Julia Reynolds Committed by Android (Google) Code Review
Browse files

Merge "Hide noti info icon is device isn't provisioned"

parents 8cc28a30 35765d89
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -280,6 +280,7 @@ public class NotificationGutsManager implements Dumpable {
                    mCheckSaveListener,
                    onSettingsClick,
                    onAppSettingsClick,
                    mPresenter.isDeviceProvisioned(),
                    row.getIsNonblockable(),
                    isForBlockingHelper,
                    row.getEntry().userSentiment == USER_SENTIMENT_NEGATIVE);
+7 −3
Original line number Diff line number Diff line
@@ -81,6 +81,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
    private StatusBarNotification mSbn;
    private AnimatorSet mExpandAnimation;
    private boolean mIsForeground;
    private boolean mIsDeviceProvisioned;

    private CheckSaveListener mCheckSaveListener;
    private OnSettingsClickListener mOnSettingsClickListener;
@@ -143,12 +144,13 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
            final CheckSaveListener checkSaveListener,
            final OnSettingsClickListener onSettingsClick,
            final OnAppSettingsClickListener onAppSettingsClick,
            boolean isDeviceProvisioned,
            boolean isNonblockable)
            throws RemoteException {
        bindNotification(pm, iNotificationManager, pkg, notificationChannel,
                numUniqueChannelsInRow, sbn, checkSaveListener, onSettingsClick,
                onAppSettingsClick, isNonblockable, false /* isBlockingHelper */,
                false /* isUserSentimentNegative */);
                onAppSettingsClick, isDeviceProvisioned, isNonblockable,
                false /* isBlockingHelper */, false /* isUserSentimentNegative */);
    }

    public void bindNotification(
@@ -161,6 +163,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
            CheckSaveListener checkSaveListener,
            OnSettingsClickListener onSettingsClick,
            OnAppSettingsClickListener onAppSettingsClick,
            boolean isDeviceProvisioned,
            boolean isNonblockable,
            boolean isForBlockingHelper,
            boolean isUserSentimentNegative)
@@ -183,6 +186,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
                (mSbn.getNotification().flags & Notification.FLAG_FOREGROUND_SERVICE) != 0;
        mIsForBlockingHelper = isForBlockingHelper;
        mAppUid = mSbn.getUid();
        mIsDeviceProvisioned = isDeviceProvisioned;

        int numTotalChannels = mINotificationManager.getNumNotificationChannelsForPackage(
                pkg, mAppUid, false /* includeDeleted */);
@@ -246,7 +250,7 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G

        // Settings button.
        final View settingsButton = findViewById(R.id.info);
        if (mAppUid >= 0 && mOnSettingsClickListener != null) {
        if (mAppUid >= 0 && mOnSettingsClickListener != null && mIsDeviceProvisioned) {
            settingsButton.setVisibility(View.VISIBLE);
            final int appUidF = mAppUid;
            settingsButton.setOnClickListener(
+30 −0
Original line number Diff line number Diff line
@@ -286,6 +286,7 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
                any(NotificationInfo.OnSettingsClickListener.class),
                any(NotificationInfo.OnAppSettingsClickListener.class),
                eq(false),
                eq(false),
                eq(true) /* isForBlockingHelper */,
                eq(true) /* isUserSentimentNegative */);
    }
@@ -312,6 +313,35 @@ public class NotificationGutsManagerTest extends SysuiTestCase {
                any(NotificationInfo.OnSettingsClickListener.class),
                any(NotificationInfo.OnAppSettingsClickListener.class),
                eq(false),
                eq(false),
                eq(false) /* isForBlockingHelper */,
                eq(true) /* isUserSentimentNegative */);
    }

    @Test
    public void testInitializeNotificationInfoView_PassesAlongProvisionedState() throws Exception {
        NotificationInfo notificationInfoView = mock(NotificationInfo.class);
        ExpandableNotificationRow row = spy(mHelper.createRow());
        row.setBlockingHelperShowing(false);
        row.getEntry().userSentiment = USER_SENTIMENT_NEGATIVE;
        when(row.getIsNonblockable()).thenReturn(false);
        StatusBarNotification statusBarNotification = row.getStatusBarNotification();
        when(mPresenter.isDeviceProvisioned()).thenReturn(true);

        mGutsManager.initializeNotificationInfo(row, notificationInfoView);

        verify(notificationInfoView).bindNotification(
                any(PackageManager.class),
                any(INotificationManager.class),
                eq(statusBarNotification.getPackageName()),
                any(NotificationChannel.class),
                anyInt(),
                eq(statusBarNotification),
                any(NotificationInfo.CheckSaveListener.class),
                any(NotificationInfo.OnSettingsClickListener.class),
                any(NotificationInfo.OnAppSettingsClickListener.class),
                eq(true),
                eq(false),
                eq(false) /* isForBlockingHelper */,
                eq(true) /* isUserSentimentNegative */);
    }
+69 −51

File changed.

Preview size limit exceeded, changes collapsed.