summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt24
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetInteractionHandlerTest.kt2
-rw-r--r--packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt7
-rw-r--r--packages/SystemUI/plugin/src/com/android/systemui/plugins/ActivityStarter.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt14
-rw-r--r--packages/SystemUI/src/com/android/systemui/communal/widgets/WidgetInteractionHandler.kt1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt14
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternal.kt1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternalImpl.kt1
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java8
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt6
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImpl.kt26
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java13
14 files changed, 112 insertions, 19 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt
index 0ab09595d6b0..edd875735742 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/CommunalSceneStartableTest.kt
@@ -35,6 +35,8 @@ import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.testScope
import com.android.systemui.statusbar.notificationShadeWindowController
+import com.android.systemui.statusbar.phone.centralSurfaces
+import com.android.systemui.statusbar.phone.centralSurfacesOptional
import com.android.systemui.testKosmos
import com.android.systemui.util.settings.fakeSettings
import com.google.common.truth.Truth.assertThat
@@ -49,6 +51,7 @@ import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import org.junit.runner.RunWith
+import org.mockito.kotlin.whenever
@OptIn(ExperimentalCoroutinesApi::class)
@SmallTest
@@ -74,6 +77,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
applicationScope = applicationCoroutineScope,
bgScope = applicationCoroutineScope,
mainDispatcher = testDispatcher,
+ centralSurfacesOpt = centralSurfacesOptional,
)
.apply { start() }
@@ -127,6 +131,7 @@ class CommunalSceneStartableTest : SysuiTestCase() {
fun occluded_forceBlankScene() =
with(kosmos) {
testScope.runTest {
+ whenever(centralSurfaces.isLaunchingActivityOverLockscreen).thenReturn(false)
val scene by collectLastValue(communalInteractor.desiredScene)
communalInteractor.changeScene(CommunalScenes.Communal)
assertThat(scene).isEqualTo(CommunalScenes.Communal)
@@ -142,6 +147,25 @@ class CommunalSceneStartableTest : SysuiTestCase() {
}
@Test
+ fun occluded_doesNotForceBlankSceneIfLaunchingActivityOverLockscreen() =
+ with(kosmos) {
+ testScope.runTest {
+ whenever(centralSurfaces.isLaunchingActivityOverLockscreen).thenReturn(true)
+ val scene by collectLastValue(communalInteractor.desiredScene)
+ communalInteractor.changeScene(CommunalScenes.Communal)
+ assertThat(scene).isEqualTo(CommunalScenes.Communal)
+
+ updateDocked(true)
+ fakeKeyguardTransitionRepository.sendTransitionSteps(
+ from = KeyguardState.GLANCEABLE_HUB,
+ to = KeyguardState.OCCLUDED,
+ testScope = this
+ )
+ assertThat(scene).isEqualTo(CommunalScenes.Communal)
+ }
+ }
+
+ @Test
fun deviceDocked_doesNotForceCommunalIfTransitioningFromCommunal() =
with(kosmos) {
testScope.runTest {
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetInteractionHandlerTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetInteractionHandlerTest.kt
index b4f87c47a0b0..420b11c4bde3 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetInteractionHandlerTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/communal/widgets/WidgetInteractionHandlerTest.kt
@@ -72,6 +72,7 @@ class WidgetInteractionHandlerTest : SysuiTestCase() {
verify(activityStarter)
.startPendingIntentMaybeDismissingKeyguard(
eq(testIntent),
+ eq(false),
isNull(),
notNull(),
refEq(fillInIntent),
@@ -91,6 +92,7 @@ class WidgetInteractionHandlerTest : SysuiTestCase() {
verify(activityStarter)
.startPendingIntentMaybeDismissingKeyguard(
eq(testIntent),
+ eq(false),
isNull(),
isNull(),
refEq(fillInIntent),
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt
index 0ca620751ddf..57d325129fa2 100644
--- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt
+++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImplTest.kt
@@ -33,6 +33,7 @@ import com.android.systemui.SysuiTestCase
import com.android.systemui.animation.ActivityTransitionAnimator
import com.android.systemui.animation.LaunchableView
import com.android.systemui.assist.AssistManager
+import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor
import com.android.systemui.keyguard.KeyguardViewMediator
import com.android.systemui.keyguard.WakefulnessLifecycle
import com.android.systemui.plugins.ActivityStarter.OnDismissAction
@@ -94,6 +95,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() {
@Mock private lateinit var deviceProvisionedController: DeviceProvisionedController
@Mock private lateinit var userTracker: UserTracker
@Mock private lateinit var activityIntentHelper: ActivityIntentHelper
+ @Mock private lateinit var communalSceneInteractor: CommunalSceneInteractor
private lateinit var underTest: LegacyActivityStarterInternalImpl
private val mainExecutor = FakeExecutor(FakeSystemClock())
private val shadeAnimationInteractor =
@@ -127,6 +129,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() {
userTracker = userTracker,
activityIntentHelper = activityIntentHelper,
mainExecutor = mainExecutor,
+ communalSceneInteractor = communalSceneInteractor,
)
whenever(userTracker.userHandle).thenReturn(UserHandle.OWNER)
}
@@ -138,7 +141,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() {
whenever(keyguardStateController.isShowing).thenReturn(true)
whenever(deviceProvisionedController.isDeviceProvisioned).thenReturn(true)
- underTest.startPendingIntentDismissingKeyguard(pendingIntent)
+ underTest.startPendingIntentDismissingKeyguard(intent = pendingIntent, dismissShade = true)
mainExecutor.runAllReady()
verify(statusBarKeyguardViewManager)
@@ -232,6 +235,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() {
underTest.startPendingIntentDismissingKeyguard(
intent = pendingIntent,
+ dismissShade = true,
intentSentUiThreadCallback = null,
associatedView = associatedView,
)
@@ -344,6 +348,7 @@ class LegacyActivityStarterInternalImplTest : SysuiTestCase() {
) {
underTest.startPendingIntentDismissingKeyguard(
intent = intent,
+ dismissShade = true,
intentSentUiThreadCallback = intentSentUiThreadCallback,
animationController = animationController,
showOverLockscreen = true,
diff --git a/packages/SystemUI/plugin/src/com/android/systemui/plugins/ActivityStarter.java b/packages/SystemUI/plugin/src/com/android/systemui/plugins/ActivityStarter.java
index 072ec9986c61..de659315e176 100644
--- a/packages/SystemUI/plugin/src/com/android/systemui/plugins/ActivityStarter.java
+++ b/packages/SystemUI/plugin/src/com/android/systemui/plugins/ActivityStarter.java
@@ -70,9 +70,11 @@ public interface ActivityStarter {
/**
* Similar to {@link #startPendingIntentMaybeDismissingKeyguard(PendingIntent, Runnable,
* ActivityTransitionAnimator.Controller)}, but also specifies a fill-in intent and extra
- * options that could be used to populate the pending intent and launch the activity.
+ * option that could be used to populate the pending intent and launch the activity. This also
+ * allows the caller to avoid dismissing the shade.
*/
void startPendingIntentMaybeDismissingKeyguard(PendingIntent intent,
+ boolean dismissShade,
@Nullable Runnable intentSentUiThreadCallback,
@Nullable ActivityTransitionAnimator.Controller animationController,
@Nullable Intent fillInIntent,
diff --git a/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt b/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt
index 6f20a8daf00a..e0b4fcf4fe99 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/CommunalSceneStartable.kt
@@ -32,10 +32,13 @@ import com.android.systemui.keyguard.domain.interactor.KeyguardTransitionInterac
import com.android.systemui.keyguard.shared.model.KeyguardState
import com.android.systemui.keyguard.shared.model.TransitionStep
import com.android.systemui.statusbar.NotificationShadeWindowController
+import com.android.systemui.statusbar.phone.CentralSurfaces
import com.android.systemui.util.kotlin.emitOnStart
+import com.android.systemui.util.kotlin.getValue
import com.android.systemui.util.kotlin.sample
import com.android.systemui.util.settings.SettingsProxyExt.observerFlow
import com.android.systemui.util.settings.SystemSettings
+import java.util.Optional
import javax.inject.Inject
import kotlin.time.Duration.Companion.milliseconds
import kotlin.time.Duration.Companion.seconds
@@ -67,6 +70,7 @@ constructor(
private val keyguardTransitionInteractor: KeyguardTransitionInteractor,
private val keyguardInteractor: KeyguardInteractor,
private val systemSettings: SystemSettings,
+ centralSurfacesOpt: Optional<CentralSurfaces>,
private val notificationShadeWindowController: NotificationShadeWindowController,
@Application private val applicationScope: CoroutineScope,
@Background private val bgScope: CoroutineScope,
@@ -78,6 +82,8 @@ constructor(
private var isDreaming: Boolean = false
+ private val centralSurfaces: CentralSurfaces? by centralSurfacesOpt
+
override fun start() {
// Handle automatically switching based on keyguard state.
keyguardTransitionInteractor.startedKeyguardTransitionStep
@@ -184,11 +190,15 @@ constructor(
val to = lastStartedTransition.to
val from = lastStartedTransition.from
val docked = dockManager.isDocked
+ val launchingActivityOverLockscreen =
+ centralSurfaces?.isLaunchingActivityOverLockscreen ?: false
return when {
- to == KeyguardState.OCCLUDED -> {
+ to == KeyguardState.OCCLUDED && !launchingActivityOverLockscreen -> {
// Hide communal when an activity is started on keyguard, to ensure the activity
- // underneath the hub is shown.
+ // underneath the hub is shown. When launching activities over lockscreen, we only
+ // change scenes once the activity launch animation is finished, so avoid
+ // changing the scene here.
CommunalScenes.Blank
}
to == KeyguardState.GLANCEABLE_HUB && from == KeyguardState.OCCLUDED -> {
diff --git a/packages/SystemUI/src/com/android/systemui/communal/widgets/WidgetInteractionHandler.kt b/packages/SystemUI/src/com/android/systemui/communal/widgets/WidgetInteractionHandler.kt
index 778d8cf56648..51a3a6d827dd 100644
--- a/packages/SystemUI/src/com/android/systemui/communal/widgets/WidgetInteractionHandler.kt
+++ b/packages/SystemUI/src/com/android/systemui/communal/widgets/WidgetInteractionHandler.kt
@@ -61,6 +61,7 @@ constructor(
activityStarter.startPendingIntentMaybeDismissingKeyguard(
pendingIntent,
+ /* dismissShade = */ false,
/* intentSentUiThreadCallback = */ null,
animationController,
fillInIntent,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt
index 6546db9a2868..2ab7aa95ff56 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterImpl.kt
@@ -42,7 +42,10 @@ constructor(
private val activityStarterInternal: ActivityStarterInternal = legacyActivityStarter.get()
override fun startPendingIntentDismissingKeyguard(intent: PendingIntent) {
- activityStarterInternal.startPendingIntentDismissingKeyguard(intent = intent)
+ activityStarterInternal.startPendingIntentDismissingKeyguard(
+ intent = intent,
+ dismissShade = true
+ )
}
override fun startPendingIntentDismissingKeyguard(
@@ -52,6 +55,7 @@ constructor(
activityStarterInternal.startPendingIntentDismissingKeyguard(
intent = intent,
intentSentUiThreadCallback = intentSentUiThreadCallback,
+ dismissShade = true,
)
}
@@ -64,6 +68,7 @@ constructor(
intent = intent,
intentSentUiThreadCallback = intentSentUiThreadCallback,
associatedView = associatedView,
+ dismissShade = true,
)
}
@@ -76,6 +81,7 @@ constructor(
intent = intent,
intentSentUiThreadCallback = intentSentUiThreadCallback,
animationController = animationController,
+ dismissShade = true,
)
}
@@ -89,11 +95,13 @@ constructor(
intentSentUiThreadCallback = intentSentUiThreadCallback,
animationController = animationController,
showOverLockscreen = true,
+ dismissShade = true,
)
}
override fun startPendingIntentMaybeDismissingKeyguard(
intent: PendingIntent,
+ dismissShade: Boolean,
intentSentUiThreadCallback: Runnable?,
animationController: ActivityTransitionAnimator.Controller?,
fillInIntent: Intent?,
@@ -104,6 +112,7 @@ constructor(
intentSentUiThreadCallback = intentSentUiThreadCallback,
animationController = animationController,
showOverLockscreen = true,
+ dismissShade = dismissShade,
fillInIntent = fillInIntent,
extraOptions = extraOptions,
)
@@ -179,6 +188,7 @@ constructor(
showOverLockscreenWhenLocked = showOverLockscreenWhenLocked,
)
}
+
override fun startActivity(
intent: Intent,
dismissShade: Boolean,
@@ -199,6 +209,7 @@ constructor(
postOnUiThread {
activityStarterInternal.startPendingIntentDismissingKeyguard(
intent = intent,
+ dismissShade = true,
)
}
}
@@ -211,6 +222,7 @@ constructor(
activityStarterInternal.startPendingIntentDismissingKeyguard(
intent = intent,
animationController = animationController,
+ dismissShade = true,
)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternal.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternal.kt
index e8443982d560..c9becb4289b9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternal.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternal.kt
@@ -34,6 +34,7 @@ interface ActivityStarterInternal {
*/
fun startPendingIntentDismissingKeyguard(
intent: PendingIntent,
+ dismissShade: Boolean,
intentSentUiThreadCallback: Runnable? = null,
associatedView: View? = null,
animationController: ActivityTransitionAnimator.Controller? = null,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternalImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternalImpl.kt
index c101755bcf38..e580f6458be8 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternalImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/ActivityStarterInternalImpl.kt
@@ -35,6 +35,7 @@ import javax.inject.Inject
class ActivityStarterInternalImpl @Inject constructor() : ActivityStarterInternal {
override fun startPendingIntentDismissingKeyguard(
intent: PendingIntent,
+ dismissShade: Boolean,
intentSentUiThreadCallback: Runnable?,
associatedView: View?,
animationController: ActivityTransitionAnimator.Controller?,
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
index 8fb552f167bc..7b7a35b4928f 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfaces.java
@@ -199,6 +199,11 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner, CoreStartable
boolean isLaunchingActivityOverLockscreen();
+ /**
+ * Whether an activity launch over lockscreen is causing the shade to be dismissed.
+ */
+ boolean isDismissingShadeForActivityLaunch();
+
void onKeyguardViewManagerStatesUpdated();
/** */
@@ -333,7 +338,8 @@ public interface CentralSurfaces extends Dumpable, LifecycleOwner, CoreStartable
/**
* Sets launching activity over LS state in central surfaces.
*/
- void setIsLaunchingActivityOverLockscreen(boolean isLaunchingActivityOverLockscreen);
+ void setIsLaunchingActivityOverLockscreen(
+ boolean isLaunchingActivityOverLockscreen, boolean dismissShade);
/**
* Gets an animation controller from a notification row.
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt
index 8af7ee8389e5..5ab56ae4be4d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesEmptyImpl.kt
@@ -39,6 +39,7 @@ abstract class CentralSurfacesEmptyImpl : CentralSurfaces {
override fun updateIsKeyguard(forceStateChange: Boolean) = false
override fun getKeyguardMessageArea(): AuthKeyguardMessageArea? = null
override fun isLaunchingActivityOverLockscreen() = false
+ override fun isDismissingShadeForActivityLaunch() = false
override fun onKeyguardViewManagerStatesUpdated() {}
override fun getCommandQueuePanelsEnabled() = false
override fun showWirelessChargingAnimation(batteryLevel: Int) {}
@@ -96,7 +97,10 @@ abstract class CentralSurfacesEmptyImpl : CentralSurfaces {
override fun setLaunchEmergencyActionOnFinishedWaking(launch: Boolean) {}
override fun getQSPanelController(): QSPanelController? = null
override fun getDisplayDensity() = 0f
- override fun setIsLaunchingActivityOverLockscreen(isLaunchingActivityOverLockscreen: Boolean) {}
+ override fun setIsLaunchingActivityOverLockscreen(
+ isLaunchingActivityOverLockscreen: Boolean,
+ dismissShade: Boolean,
+ ) {}
override fun getAnimatorControllerFromNotification(
associatedView: ExpandableNotificationRow?,
): ActivityTransitionAnimator.Controller? = null
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
index d3d2b1ebcb88..e0da2fe584b6 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CentralSurfacesImpl.java
@@ -544,6 +544,7 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
// Fingerprint (as computed by getLoggingFingerprint() of the last logged state.
private int mLastLoggedStateFingerprint;
private boolean mIsLaunchingActivityOverLockscreen;
+ private boolean mDismissingShadeForActivityLaunch;
private final LifecycleRegistry mLifecycle = new LifecycleRegistry(this);
protected final BatteryController mBatteryController;
@@ -1575,6 +1576,11 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
return mIsLaunchingActivityOverLockscreen;
}
+ @Override
+ public boolean isDismissingShadeForActivityLaunch() {
+ return mDismissingShadeForActivityLaunch;
+ }
+
/**
* To be called when there's a state change in StatusBarKeyguardViewManager.
*/
@@ -3306,8 +3312,10 @@ public class CentralSurfacesImpl implements CoreStartable, CentralSurfaces {
}
@Override
- public void setIsLaunchingActivityOverLockscreen(boolean isLaunchingActivityOverLockscreen) {
+ public void setIsLaunchingActivityOverLockscreen(
+ boolean isLaunchingActivityOverLockscreen, boolean dismissShade) {
mIsLaunchingActivityOverLockscreen = isLaunchingActivityOverLockscreen;
+ mDismissingShadeForActivityLaunch = dismissShade;
mKeyguardViewMediator.launchingActivityOverLockscreen(mIsLaunchingActivityOverLockscreen);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImpl.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImpl.kt
index bcc7db162ddd..b448d85bfd49 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LegacyActivityStarterInternalImpl.kt
@@ -33,10 +33,13 @@ import android.view.View
import android.view.WindowManager
import com.android.keyguard.KeyguardUpdateMonitor
import com.android.systemui.ActivityIntentHelper
+import com.android.systemui.Flags.communalHub
import com.android.systemui.animation.ActivityTransitionAnimator
import com.android.systemui.animation.DelegateTransitionAnimatorController
import com.android.systemui.assist.AssistManager
import com.android.systemui.camera.CameraIntents
+import com.android.systemui.communal.domain.interactor.CommunalSceneInteractor
+import com.android.systemui.communal.shared.model.CommunalScenes
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.DisplayId
import com.android.systemui.dagger.qualifiers.Main
@@ -89,6 +92,7 @@ constructor(
private val userTracker: UserTracker,
private val activityIntentHelper: ActivityIntentHelper,
@Main private val mainExecutor: DelayableExecutor,
+ private val communalSceneInteractor: CommunalSceneInteractor,
) : ActivityStarterInternal {
private val centralSurfaces: CentralSurfaces?
get() = centralSurfacesOptLazy.get().getOrNull()
@@ -219,6 +223,7 @@ constructor(
override fun startPendingIntentDismissingKeyguard(
intent: PendingIntent,
+ dismissShade: Boolean,
intentSentUiThreadCallback: Runnable?,
associatedView: View?,
animationController: ActivityTransitionAnimator.Controller?,
@@ -257,12 +262,12 @@ constructor(
val statusBarController =
wrapAnimationControllerForShadeOrStatusBar(
animationController = animationController,
- dismissShade = true,
+ dismissShade = dismissShade,
isLaunchForActivity = intent.isActivity,
)
val controller =
if (actuallyShowOverLockscreen) {
- wrapAnimationControllerForLockscreen(statusBarController)
+ wrapAnimationControllerForLockscreen(dismissShade, statusBarController)
} else {
statusBarController
}
@@ -270,7 +275,7 @@ constructor(
// If we animate, don't collapse the shade and defer the keyguard dismiss (in case we
// run the animation on the keyguard). The animation will take care of (instantly)
// collapsing the shade and hiding the keyguard once it is done.
- val collapse = !animate
+ val collapse = dismissShade && !animate
val runnable = Runnable {
try {
activityTransitionAnimator.startPendingIntentWithAnimation(
@@ -377,7 +382,7 @@ constructor(
dismissShade = dismissShade,
isLaunchForActivity = true,
)
- controller = wrapAnimationControllerForLockscreen(delegate)
+ controller = wrapAnimationControllerForLockscreen(dismissShade, delegate)
} else if (dismissShade) {
// The animation will take care of dismissing the shade at the end of the animation.
// If we don't animate, collapse it directly.
@@ -462,6 +467,9 @@ constructor(
if (dismissShade) {
shadeControllerLazy.get().collapseShadeForActivityStart()
}
+ if (communalHub()) {
+ communalSceneInteractor.snapToScene(CommunalScenes.Blank)
+ }
return deferred
}
@@ -532,6 +540,7 @@ constructor(
* lockscreen, the correct flags are set for it to be occluded.
*/
private fun wrapAnimationControllerForLockscreen(
+ dismissShade: Boolean,
animationController: ActivityTransitionAnimator.Controller?
): ActivityTransitionAnimator.Controller? {
return animationController?.let {
@@ -539,7 +548,7 @@ constructor(
override fun onIntentStarted(willAnimate: Boolean) {
delegate.onIntentStarted(willAnimate)
if (willAnimate) {
- centralSurfaces?.setIsLaunchingActivityOverLockscreen(true)
+ centralSurfaces?.setIsLaunchingActivityOverLockscreen(true, dismissShade)
}
}
@@ -570,7 +579,10 @@ constructor(
// mIsLaunchingActivityOverLockscreen being true means that we will
// collapse the shade (or at least run the post collapse runnables)
// later on.
- centralSurfaces?.setIsLaunchingActivityOverLockscreen(false)
+ centralSurfaces?.setIsLaunchingActivityOverLockscreen(false, false)
+ if (communalHub()) {
+ communalSceneInteractor.snapToScene(CommunalScenes.Blank)
+ }
delegate.onTransitionAnimationEnd(isExpandingFullyAbove)
}
@@ -586,7 +598,7 @@ constructor(
// mIsLaunchingActivityOverLockscreen being true means that we will
// collapse the shade (or at least run the // post collapse
// runnables) later on.
- centralSurfaces?.setIsLaunchingActivityOverLockscreen(false)
+ centralSurfaces?.setIsLaunchingActivityOverLockscreen(false, false)
delegate.onTransitionAnimationCancelled(newKeyguardOccludedState)
}
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
index 5bbc3bd92543..ebb62ec7bcac 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/StatusBarKeyguardViewManager.java
@@ -1071,12 +1071,17 @@ public class StatusBarKeyguardViewManager implements RemoteInputController.Callb
SysUiStatsLog.write(SysUiStatsLog.KEYGUARD_STATE_CHANGED,
SysUiStatsLog.KEYGUARD_STATE_CHANGED__STATE__OCCLUDED);
if (mCentralSurfaces.isLaunchingActivityOverLockscreen()) {
- // When isLaunchingActivityOverLockscreen() is true, we know for sure that the post
- // collapse runnables will be run.
- mShadeController.get().addPostCollapseAction(() -> {
+ final Runnable postCollapseAction = () -> {
mNotificationShadeWindowController.setKeyguardOccluded(isOccluded);
reset(true /* hideBouncerWhenShowing */);
- });
+ };
+ if (mCentralSurfaces.isDismissingShadeForActivityLaunch()) {
+ // When isDismissingShadeForActivityLaunch() is true, we know for sure that the
+ // post collapse runnables will be run.
+ mShadeController.get().addPostCollapseAction(postCollapseAction);
+ } else {
+ postCollapseAction.run();
+ }
return;
}
} else if (isShowing && isUnOccluding) {