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

Commit 6f4d7283 authored by András Kurucz's avatar András Kurucz Committed by Android (Google) Code Review
Browse files

Merge changes Id6f3daf0,I8d1e2670 into main

* changes:
  [flexiglass] Refresh NSSL sensitivity, when the Lockscreen public mode changes
  [flexiglass] Use DeviceEntryInteractor#canSwipeToEnter in SensitiveContentCoordinator
parents 82eaa543 cee74782
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 =
+3 −2
Original line number Diff line number Diff line
@@ -429,9 +429,10 @@ public class NotificationStackScrollLayoutController implements Dumpable {
    };

    /**
     * Recalculate sensitiveness without animation; called when waking up while keyguard occluded.
     * Recalculate sensitiveness without animation; called when waking up while keyguard occluded,
     * or whenever we update the Lockscreen public mode.
     */
    public void updateSensitivenessForOccludedWakeup() {
    public void updateSensitivenessWithoutAnimation() {
        updateSensitivenessWithAnimation(false);
    }

+4 −1
Original line number Diff line number Diff line
@@ -2234,6 +2234,9 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {

            // If the state didn't change, we may still need to update public mode
            mLockscreenUserManager.updatePublicMode();
            if (SceneContainerFlag.isEnabled()) {
                mStackScrollerController.updateSensitivenessWithoutAnimation();
            }
        }
        if (mStatusBarStateController.leaveOpenOnKeyguardHide()) {
            if (!mStatusBarStateController.isKeyguardRequested()) {
@@ -2681,7 +2684,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
                // So if AOD is off or unsupported we need to trigger these updates at screen on
                // when the keyguard is occluded.
                mLockscreenUserManager.updatePublicMode();
                mStackScrollerController.updateSensitivenessForOccludedWakeup();
                mStackScrollerController.updateSensitivenessWithoutAnimation();
            }
            if (mLaunchCameraWhenFinishedWaking) {
                startLaunchTransitionTimeout();
+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,
        )
    }