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

Commit d57ced4d authored by Rohan Shah's avatar Rohan Shah Committed by android-build-merger
Browse files

Merge "[Notif] Disable "Customize" for blocking helper" into pi-dev

am: 13276e7e

Change-Id: I3fd89e7245077edf12670dbb398b49186e065b78
parents 718c0608 13276e7e
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -308,15 +308,15 @@ public class NotificationInfo extends LinearLayout implements NotificationGuts.G
            minimize.setVisibility(GONE);
        }

        // Set up app settings link
        // Set up app settings link (i.e. Customize)
        TextView settingsLinkView = findViewById(R.id.app_settings);
        Intent settingsIntent = getAppSettingsIntent(mPm, mPkg, mSingleNotificationChannel,
                mSbn.getId(), mSbn.getTag());
        if (settingsIntent != null
        if (!mIsForBlockingHelper
                && settingsIntent != null
                && !TextUtils.isEmpty(mSbn.getNotification().getSettingsText())) {
            settingsLinkView.setVisibility(VISIBLE);
            settingsLinkView.setText(mContext.getString(R.string.notification_app_settings,
                    mSbn.getNotification().getSettingsText()));
            settingsLinkView.setText(mContext.getString(R.string.notification_app_settings));
            settingsLinkView.setOnClickListener((View view) -> {
                mAppSettingsClickListener.onClick(view, settingsIntent);
            });
+23 −0
Original line number Diff line number Diff line
@@ -696,6 +696,29 @@ public class NotificationInfoTest extends SysuiTestCase {
        assertEquals(GONE, settingsLink.getVisibility());
    }

    @Test
    public void testBindHeader_noSettingsLinkWhenIsForBlockingHelper() throws Exception {
        final String settingsText = "work chats";
        final ResolveInfo ri = new ResolveInfo();
        ri.activityInfo = new ActivityInfo();
        ri.activityInfo.packageName = TEST_PACKAGE_NAME;
        ri.activityInfo.name = "something";
        List<ResolveInfo> ris = new ArrayList<>();
        ris.add(ri);
        when(mMockPackageManager.queryIntentActivities(any(), anyInt())).thenReturn(ris);
        mNotificationChannel.setImportance(IMPORTANCE_LOW);
        Notification n = new Notification.Builder(mContext, mNotificationChannel.getId())
                .setSettingsText(settingsText).build();
        StatusBarNotification sbn = new StatusBarNotification(TEST_PACKAGE_NAME, TEST_PACKAGE_NAME,
                0, null, 0, 0, n, UserHandle.CURRENT, null, 0);

        mNotificationInfo.bindNotification(mMockPackageManager, mMockINotificationManager,
                TEST_PACKAGE_NAME, mNotificationChannel, 1, sbn, null, null, null, false, true,
                true);
        final TextView settingsLink = mNotificationInfo.findViewById(R.id.app_settings);
        assertEquals(GONE, settingsLink.getVisibility());
    }


    @Test
    public void testWillBeRemovedReturnsFalseBeforeBind() throws Exception {