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

Commit dee733bc authored by András Kurucz's avatar András Kurucz
Browse files

[flexiglass] Use DeviceEntryInteractor#canSwipeToEnter in SensitiveContentCoordinator

Bug: 379825109
Test: lock the device -> check if notifications are ENR#mIsSensitive
Flag: com.android.systemui.scene_container

Change-Id: I8d1e2670836b32072ac3edd97bd2140e8890f7d4
parent 8772f2f5
Loading
Loading
Loading
Loading
+618 −489

File changed.

Preview size limit exceeded, changes collapsed.

+20 −3
Original line number Diff line number Diff line
@@ -14,10 +14,13 @@
 * limitations under the License.
 */

@file:OptIn(ExperimentalCoroutinesApi::class)

package com.android.systemui.statusbar.notification.collection.coordinator

import android.app.Notification
import android.os.UserHandle
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.server.notification.Flags.screenshareNotificationHiding
import com.android.systemui.dagger.qualifiers.Application
@@ -44,9 +47,9 @@ import dagger.Binds
import dagger.Module
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.mapNotNull
import com.android.app.tracing.coroutines.launchTraced as launch

@Module(includes = [PrivateSensitiveContentCoordinatorModule::class])
interface SensitiveContentCoordinatorModule
@@ -80,6 +83,7 @@ constructor(
    DynamicPrivacyController.Listener,
    OnBeforeRenderListListener {
    private var inTransitionFromLockedToGone = false
    private var canSwipeToEnter = false

    private val onSensitiveStateChanged = Runnable() { invalidateList("onSensitiveStateChanged") }

@@ -98,7 +102,9 @@ constructor(
        }

    override fun attach(pipeline: NotifPipeline) {
        if (!SceneContainerFlag.isEnabled) {
            dynamicPrivacyController.addListener(this)
        }
        if (screenshareNotificationHiding()) {
            sensitiveNotificationProtectionController.registerSensitiveStateListener(
                onSensitiveStateChanged
@@ -128,6 +134,15 @@ constructor(
                        invalidateList("inTransitionFromLockedToGoneChanged")
                    }
            }
            scope.launch {
                deviceEntryInteractor.canSwipeToEnter.collect {
                    val canSwipeToEnter = it ?: false
                    if (this@SensitiveContentCoordinatorImpl.canSwipeToEnter != canSwipeToEnter) {
                        this@SensitiveContentCoordinatorImpl.canSwipeToEnter = canSwipeToEnter
                        invalidateList("canSwipeToEnterChanged")
                    }
                }
            }
        }
    }

@@ -168,7 +183,9 @@ constructor(
            (devicePublic &&
                !lockscreenUserManager.userAllowsPrivateNotificationsInPublic(currentUserId)) ||
                isSensitiveContentProtectionActive
        val dynamicallyUnlocked = dynamicPrivacyController.isDynamicallyUnlocked
        val dynamicallyUnlocked =
            if (SceneContainerFlag.isEnabled) canSwipeToEnter
            else dynamicPrivacyController.isDynamicallyUnlocked
        for (entry in extractAllRepresentativeEntries(entries).filter { it.rowExists() }) {
            val notifUserId = entry.sbn.user.identifier
            val userLockscreen =
+1 −1
Original line number Diff line number Diff line
@@ -42,6 +42,6 @@ var Kosmos.sensitiveContentCoordinator: SensitiveContentCoordinator by
            sensitiveNotificationProtectionController,
            deviceEntryInteractor,
            sceneInteractor,
            testScope,
            testScope.backgroundScope,
        )
    }