summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt82
-rw-r--r--packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java17
2 files changed, 37 insertions, 62 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt
index 6a8da10944d8..f387021daeac 100644
--- a/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt
+++ b/packages/SystemUI/compose/features/src/com/android/systemui/keyguard/ui/composable/section/NotificationSection.kt
@@ -19,11 +19,6 @@ package com.android.systemui.keyguard.ui.composable.section
import android.content.Context
import android.view.ViewGroup
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.DisposableEffect
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import com.android.compose.animation.scene.SceneScope
import com.android.systemui.dagger.SysUISingleton
@@ -45,7 +40,6 @@ import com.android.systemui.statusbar.notification.stack.ui.viewmodel.Notificati
import com.android.systemui.statusbar.notification.stack.ui.viewmodel.SharedNotificationContainerViewModel
import javax.inject.Inject
import kotlinx.coroutines.CoroutineDispatcher
-import kotlinx.coroutines.DisposableHandle
@SysUISingleton
class NotificationSection
@@ -53,74 +47,54 @@ class NotificationSection
constructor(
@Application private val context: Context,
private val viewModel: NotificationsPlaceholderViewModel,
- private val controller: NotificationStackScrollLayoutController,
- private val sceneContainerFlags: SceneContainerFlags,
- private val sharedNotificationContainer: SharedNotificationContainer,
- private val sharedNotificationContainerViewModel: SharedNotificationContainerViewModel,
- private val stackScrollLayout: NotificationStackScrollLayout,
- private val notificationStackAppearanceViewModel: NotificationStackAppearanceViewModel,
- private val ambientState: AmbientState,
- private val notificationStackSizeCalculator: NotificationStackSizeCalculator,
+ controller: NotificationStackScrollLayoutController,
+ sceneContainerFlags: SceneContainerFlags,
+ sharedNotificationContainer: SharedNotificationContainer,
+ sharedNotificationContainerViewModel: SharedNotificationContainerViewModel,
+ stackScrollLayout: NotificationStackScrollLayout,
+ notificationStackAppearanceViewModel: NotificationStackAppearanceViewModel,
+ ambientState: AmbientState,
+ notificationStackSizeCalculator: NotificationStackSizeCalculator,
@Main private val mainDispatcher: CoroutineDispatcher,
) {
- @Composable
- fun SceneScope.Notifications(modifier: Modifier = Modifier) {
- if (KeyguardShadeMigrationNssl.isUnexpectedlyInLegacyMode()) {
+
+ init {
+ if (!KeyguardShadeMigrationNssl.isUnexpectedlyInLegacyMode()) {
// This scene container section moves the NSSL to the SharedNotificationContainer.
// This also requires that SharedNotificationContainer gets moved to the
// SceneWindowRootView by the SceneWindowRootViewBinder. Prior to Scene Container,
// but when the KeyguardShadeMigrationNssl flag is enabled, NSSL is moved into this
// container by the NotificationStackScrollLayoutSection.
- return
- }
-
- var isBound by remember { mutableStateOf(false) }
-
- DisposableEffect(Unit) {
- val disposableHandles: MutableList<DisposableHandle> = mutableListOf()
-
// Ensure stackScrollLayout is a child of sharedNotificationContainer.
+
if (stackScrollLayout.parent != sharedNotificationContainer) {
(stackScrollLayout.parent as? ViewGroup)?.removeView(stackScrollLayout)
sharedNotificationContainer.addNotificationStackScrollLayout(stackScrollLayout)
}
- disposableHandles.add(
- SharedNotificationContainerBinder.bind(
- sharedNotificationContainer,
- sharedNotificationContainerViewModel,
- sceneContainerFlags,
- controller,
- notificationStackSizeCalculator,
- mainDispatcher,
- )
+ SharedNotificationContainerBinder.bind(
+ sharedNotificationContainer,
+ sharedNotificationContainerViewModel,
+ sceneContainerFlags,
+ controller,
+ notificationStackSizeCalculator,
+ mainDispatcher,
)
if (sceneContainerFlags.flexiNotifsEnabled()) {
- disposableHandles.add(
- NotificationStackAppearanceViewBinder.bind(
- context,
- sharedNotificationContainer,
- notificationStackAppearanceViewModel,
- ambientState,
- controller,
- )
+ NotificationStackAppearanceViewBinder.bind(
+ context,
+ sharedNotificationContainer,
+ notificationStackAppearanceViewModel,
+ ambientState,
+ controller,
)
}
-
- isBound = true
-
- onDispose {
- disposableHandles.forEach { it.dispose() }
- disposableHandles.clear()
- isBound = false
- }
- }
-
- if (!isBound) {
- return
}
+ }
+ @Composable
+ fun SceneScope.Notifications(modifier: Modifier = Modifier) {
NotificationStack(
viewModel = viewModel,
modifier = modifier,
diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
index 4766a84b97ee..8f08efa92ad6 100644
--- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
+++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java
@@ -689,17 +689,18 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable,
} else {
resetStateLocked();
}
- }
- if (simState == TelephonyManager.SIM_STATE_ABSENT) {
- // MVNO SIMs can become transiently NOT_READY when switching networks,
- // so we should only lock when they are ABSENT.
- if (lastSimStateWasLocked) {
- if (DEBUG_SIM_STATES) Log.d(TAG, "SIM moved to ABSENT when the "
- + "previous state was locked. Reset the state.");
+ } else {
+ if (lastSimStateWasLocked && mShowing) {
+ if (DEBUG_SIM_STATES) {
+ Log.d(TAG, "SIM moved to "
+ + "NOT_READY/ABSENT/UNKNOWN when the previous state "
+ + "was locked. Reset the state.");
+ }
resetStateLocked();
}
- mSimWasLocked.append(slotId, false);
}
+
+ mSimWasLocked.append(slotId, false);
}
break;
case TelephonyManager.SIM_STATE_PIN_REQUIRED: