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

Commit b7ed9579 authored by Matt Pietal's avatar Matt Pietal
Browse files

Make sure user tracking stops

There was one case of the user tracking not stopping, which resulted
in the incorrect number of notifications showing. Also simplify the
notification count logic slightly.

Test: atest SharedNotificationContainerViewModelTest
Bug: 296606746
Flag: ACONFIG com.android.systemui.keyguard_shade_migration_nssl DEVELOPMENT
Change-Id: I8a572087ba8c44d80cda192567fa187c4e132464
parent fa492c0d
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -160,8 +160,15 @@ constructor(
    var mUdfpsKeyguardViewControllerLegacy: UdfpsKeyguardViewControllerLegacy? = null

    /** The touch helper responsible for the drag down animation. */
    val touchHelper = DragDownHelper(falsingManager, falsingCollector, this,
            naturalScrollingSettingObserver, context)
    val touchHelper =
        DragDownHelper(
            falsingManager,
            falsingCollector,
            this,
            naturalScrollingSettingObserver,
            shadeRepository,
            context
        )

    private val splitShadeOverScroller: SplitShadeLockScreenOverScroller by lazy {
        splitShadeOverScrollerFactory.create({ qS }, { nsslController })
@@ -756,6 +763,7 @@ class DragDownHelper(
    private val falsingCollector: FalsingCollector,
    private val dragDownCallback: LockscreenShadeTransitionController,
    private val naturalScrollingSettingObserver: NaturalScrollingSettingObserver,
    private val shadeRepository: ShadeRepository,
    context: Context
) : Gefingerpoken {

@@ -808,8 +816,9 @@ class DragDownHelper(
                startingChild = null
                initialTouchY = y
                initialTouchX = x
                isTrackpadReverseScroll = !naturalScrollingSettingObserver.isNaturalScrollingEnabled
                        && isTrackpadScroll(true, event)
                isTrackpadReverseScroll =
                    !naturalScrollingSettingObserver.isNaturalScrollingEnabled &&
                        isTrackpadScroll(true, event)
            }
            MotionEvent.ACTION_MOVE -> {
                val h = (if (isTrackpadReverseScroll) -1 else 1) * (y - initialTouchY)
@@ -875,6 +884,7 @@ class DragDownHelper(
                    }
                    isDraggingDown = false
                    isTrackpadReverseScroll = false
                    shadeRepository.setLegacyLockscreenShadeTracking(false)
                } else {
                    stopDragging()
                    return false
+11 −12
Original line number Diff line number Diff line
@@ -168,15 +168,11 @@ constructor(
        // When to limit notifications: on lockscreen with an unexpanded shade. Also, recalculate
        // when the notification stack has changed internally
        val limitedNotifications =
            combineTransform(
                isOnLockscreen,
            combine(
                position,
                shadeInteractor.shadeExpansion,
                interactor.notificationStackChanged.onStart { emit(Unit) },
            ) { isOnLockscreen, position, shadeExpansion, _ ->
                if (isOnLockscreen && shadeExpansion == 0f) {
                    emit(calculateSpace(position.bottom - position.top))
                }
            ) { position, _ ->
                calculateSpace(position.bottom - position.top)
            }

        // When to show unlimited notifications: When the shade is fully expanded and the user is
@@ -190,11 +186,14 @@ constructor(
                    emit(-1)
                }
            }

        return merge(
                limitedNotifications,
                unlimitedNotifications,
            )
        return isOnLockscreenWithoutShade
            .flatMapLatest { isOnLockscreenWithoutShade ->
                if (isOnLockscreenWithoutShade) {
                    limitedNotifications
                } else {
                    unlimitedNotifications
                }
            }
            .distinctUntilChanged()
    }

+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.systemui.keyguard.domain.interactor.NaturalScrollingSettingOb
import com.android.systemui.plugins.FalsingManager
import com.android.systemui.statusbar.notification.row.ExpandableView
import com.android.systemui.util.mockito.mock
import com.android.systemui.shade.data.repository.FakeShadeRepository
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith
@@ -61,6 +62,7 @@ class DragDownHelperTest : SysuiTestCase() {
                falsingCollector,
                dragDownloadCallback,
                naturalScrollingSettingObserver,
                FakeShadeRepository(),
                mContext,
        ).also {
            it.expandCallback = expandCallback