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

Commit 76ef09ef authored by Ibrahim Yilmaz's avatar Ibrahim Yilmaz Committed by Automerger Merge Worker
Browse files

Merge "Fix isExpanded behavior for sensitive notifications" into udc-qpr-dev...

Merge "Fix isExpanded behavior for sensitive notifications" into udc-qpr-dev am: 448e6a95 am: 1461a23a

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23623116



Change-Id: If03f3c6c6cc35fc06c9adb542a1d7079ea910c4b
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 01f7a42e 1461a23a
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -2673,7 +2673,12 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    }

    public boolean isExpanded(boolean allowOnKeyguard) {
        return (!mOnKeyguard || allowOnKeyguard)
        if (DEBUG) {
            if (!mShowingPublicInitialized && !allowOnKeyguard) {
                Log.d(TAG, "mShowingPublic is not initialized.");
            }
        }
        return !mShowingPublic && (!mOnKeyguard || allowOnKeyguard)
                && (!hasUserChangedExpansion() && (isSystemExpanded() || isSystemChildExpanded())
                || isUserExpanded());
    }
@@ -3620,6 +3625,8 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            pw.print(", mOnUserInteractionCallback null: " + (mOnUserInteractionCallback == null));
            pw.print(", removed: " + isRemoved());
            pw.print(", expandAnimationRunning: " + mExpandAnimationRunning);
            pw.print(", mShowingPublic: " + mShowingPublic);
            pw.print(", mShowingPublicInitialized: " + mShowingPublicInitialized);
            NotificationContentView showingLayout = getShowingLayout();
            pw.print(", privateShowing: " + (showingLayout == mPrivateLayout));
            pw.println();
+30 −0
Original line number Diff line number Diff line
@@ -733,6 +733,36 @@ public class ExpandableNotificationRowTest extends SysuiTestCase {
        verify(lowPriVectorDrawable, times(1)).start();
    }

    @Test
    public void isExpanded_hideSensitive_sensitiveNotExpanded()
            throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setUserExpanded(true);
        row.setOnKeyguard(false);
        row.setSensitive(/* sensitive= */true, /* hideSensitive= */false);
        row.setHideSensitive(/* hideSensitive= */true, /* animated= */false,
                /* delay= */0L, /* duration= */0L);

        // THEN
        assertThat(row.isExpanded()).isFalse();
    }

    @Test
    public void isExpanded_hideSensitive_nonSensitiveExpanded()
            throws Exception {
        // GIVEN
        final ExpandableNotificationRow row = mNotificationTestHelper.createRow();
        row.setUserExpanded(true);
        row.setOnKeyguard(false);
        row.setSensitive(/* sensitive= */true, /* hideSensitive= */false);
        row.setHideSensitive(/* hideSensitive= */false, /* animated= */false,
                /* delay= */0L, /* duration= */0L);

        // THEN
        assertThat(row.isExpanded()).isTrue();
    }

    private void setDrawableIconsInImageView(CachingIconView icon, Drawable iconDrawable,
            Drawable rightIconDrawable) {
        ImageView iconView = mock(ImageView.class);