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

Commit aa0f8a40 authored by Richard MacGregor's avatar Richard MacGregor Committed by Android (Google) Code Review
Browse files

Merge "Hide notification expander arrow while screenshare" into main

parents 8454fc6b 5f68bf2e
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -119,6 +119,9 @@ class SensitiveContentCoordinatorImpl @Inject constructor(
            val needsRedaction = lockscreenUserManager.needsRedaction(entry)
            val isSensitive = userPublic && needsRedaction
            entry.setSensitive(isSensitive || shouldProtectNotification, deviceSensitive)
            if (screenshareNotificationHiding()) {
                entry.row?.setPublicExpanderVisible(!shouldProtectNotification)
            }
        }
    }
}
+10 −2
Original line number Diff line number Diff line
@@ -218,6 +218,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
    private boolean mShowingPublic;
    private boolean mSensitive;
    private boolean mSensitiveHiddenInGeneral;
    private boolean mShowPublicExpander = true;
    private boolean mShowingPublicInitialized;
    private boolean mHideSensitiveForIntrinsicHeight;
    private float mHeaderVisibleAmount = DEFAULT_HEADER_VISIBLE_AMOUNT;
@@ -599,8 +600,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            mNotificationParent.updateChildrenAppearance();
        }
        onAttachedChildrenCountChanged();
        // The public layouts expand button is always visible
        mPublicLayout.updateExpandButtons(true);
        mPublicLayout.updateExpandButtons(mShowPublicExpander);
        updateLimits();
        updateShelfIconColor();
        if (mUpdateSelfBackgroundOnUpdate) {
@@ -2837,6 +2837,14 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
    }

    /** Sets whether this notification row should show the notification expander or not */
    public void setPublicExpanderVisible(boolean showPublicExpander) {
        if (mShowPublicExpander != showPublicExpander) {
            mShowPublicExpander = showPublicExpander;
            mPublicLayout.updateExpandButtons(mShowPublicExpander);
        }
    }

    @Override
    public void setHideSensitiveForIntrinsicHeight(boolean hideSensitive) {
        mHideSensitiveForIntrinsicHeight = hideSensitive;
+21 −1
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ import com.android.systemui.statusbar.notification.collection.coordinator.dagger
import com.android.systemui.statusbar.notification.collection.listbuilder.OnBeforeRenderListListener
import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.Invalidator
import com.android.systemui.statusbar.notification.collection.listbuilder.pluggable.Pluggable
import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow
import com.android.systemui.statusbar.policy.KeyguardStateController
import com.android.systemui.statusbar.policy.SensitiveNotificationProtectionController
import com.android.systemui.user.domain.interactor.SelectedUserInteractor
@@ -130,6 +131,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(false, true)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(true)
    }

    @Test
@@ -156,6 +158,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(true, false)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(false)
    }

    @Test
@@ -196,6 +199,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(false, true)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(true)
    }

    @Test
@@ -222,6 +226,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(true, false)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(false)
    }

    @Test
@@ -262,6 +267,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(false, true)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(true)
    }

    @Test
@@ -288,6 +294,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(true, false)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(false)
    }

    @Test
@@ -329,6 +336,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(false, true)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(true)
    }

    @Test
@@ -356,6 +364,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(true, true)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(false)
    }

    @Test
@@ -396,6 +405,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(true, true)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(true)
    }

    @Test
@@ -422,6 +432,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(true, true)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(false)
    }

    @Test
@@ -462,6 +473,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(false, true)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(true)
    }

    @Test
@@ -489,6 +501,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(true, true)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(false)
    }

    @Test
@@ -531,6 +544,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(true, true)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(true)
    }

    @Test
@@ -559,6 +573,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!).setSensitive(true, true)
        verify(entry.representativeEntry!!.row!!).setPublicExpanderVisible(false)
    }

    @Test
@@ -584,6 +599,7 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
        onBeforeRenderListListener.onBeforeRenderList(listOf(entry))

        verify(entry.representativeEntry!!, never()).setSensitive(any(), any())
        verify(entry.representativeEntry!!.row!!, never()).setPublicExpanderVisible(any())
    }

    private fun fakeNotification(notifUserId: Int, needsRedaction: Boolean): ListEntry {
@@ -591,7 +607,11 @@ class SensitiveContentCoordinatorTest : SysuiTestCase() {
            mock<UserHandle>().apply { whenever(identifier).thenReturn(notifUserId) }
        val mockSbn: StatusBarNotification =
            mock<StatusBarNotification>().apply { whenever(user).thenReturn(mockUserHandle) }
        val mockEntry = mock<NotificationEntry>().apply { whenever(sbn).thenReturn(mockSbn) }
        val mockRow: ExpandableNotificationRow = mock<ExpandableNotificationRow>()
        val mockEntry = mock<NotificationEntry>().apply {
            whenever(sbn).thenReturn(mockSbn)
            whenever(row).thenReturn(mockRow)
        }
        whenever(lockscreenUserManager.needsRedaction(mockEntry)).thenReturn(needsRedaction)
        whenever(mockEntry.rowExists()).thenReturn(true)
        return object : ListEntry("key", 0) {