Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinator.kt +6 −16 Original line number Diff line number Diff line Loading @@ -18,12 +18,10 @@ package com.android.systemui.statusbar.notification.collection.coordinator import android.os.SystemProperties import android.os.UserHandle import android.provider.Settings import androidx.annotation.VisibleForTesting import com.android.systemui.Dumpable import com.android.systemui.Flags.notificationMinimalismPrototype import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dump.DumpManager Loading @@ -41,6 +39,7 @@ import com.android.systemui.statusbar.notification.collection.notifcollection.No import com.android.systemui.statusbar.notification.collection.provider.SectionHeaderVisibilityProvider import com.android.systemui.statusbar.notification.domain.interactor.SeenNotificationsInteractor import com.android.systemui.statusbar.notification.interruption.KeyguardNotificationVisibilityProvider import com.android.systemui.statusbar.notification.shared.NotificationMinimalismPrototype import com.android.systemui.statusbar.policy.HeadsUpManager import com.android.systemui.statusbar.policy.headsUpEvents import com.android.systemui.util.asIndenting Loading Loading @@ -264,7 +263,7 @@ constructor( } private fun unseenFeatureEnabled(): Flow<Boolean> { if (notificationMinimalismPrototype()) { if (NotificationMinimalismPrototype.V1.isEnabled) { return flowOf(true) } return secureSettings Loading Loading @@ -341,18 +340,6 @@ constructor( var hasFilteredAnyNotifs = false /** * the [notificationMinimalismPrototype] will now show seen notifications on the locked * shade by default, but this property read allows that to be quickly disabled for * testing */ private val minimalismShowOnLockedShade get() = SystemProperties.getBoolean( "persist.notification_minimalism_prototype.show_on_locked_shade", true ) /** * Encapsulates a definition of "being on the keyguard". Note that these two definitions * are wildly different: [StatusBarState.KEYGUARD] is when on the lock screen and does Loading @@ -364,7 +351,10 @@ constructor( * allow seen notifications to appear in the locked shade. */ private fun isOnKeyguard(): Boolean = if (notificationMinimalismPrototype() && minimalismShowOnLockedShade) { if ( NotificationMinimalismPrototype.V1.isEnabled && NotificationMinimalismPrototype.V1.showOnLockedShade ) { statusBarStateController.state == StatusBarState.KEYGUARD } else { keyguardRepository.isKeyguardShowing() Loading packages/SystemUI/src/com/android/systemui/statusbar/notification/shared/NotificationMinimalismPrototype.kt 0 → 100644 +79 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.notification.shared import android.os.SystemProperties import com.android.systemui.Flags import com.android.systemui.flags.FlagToken import com.android.systemui.flags.RefactorFlagUtils /** Helper for reading or using the minimalism prototype flag state. */ @Suppress("NOTHING_TO_INLINE") object NotificationMinimalismPrototype { object V1 { /** The aconfig flag name */ const val FLAG_NAME = Flags.FLAG_NOTIFICATION_MINIMALISM_PROTOTYPE /** A token used for dependency declaration */ val token: FlagToken get() = FlagToken(FLAG_NAME, isEnabled) /** Is the heads-up cycling animation enabled */ @JvmStatic inline val isEnabled get() = Flags.notificationMinimalismPrototype() /** * the prototype will now show seen notifications on the locked shade by default, but this * property read allows that to be quickly disabled for testing */ val showOnLockedShade: Boolean get() = if (isUnexpectedlyInLegacyMode()) false else SystemProperties.getBoolean( "persist.notification_minimalism_prototype.show_on_locked_shade", true ) /** gets the configurable max number of notifications */ val maxNotifs: Int get() = if (isUnexpectedlyInLegacyMode()) -1 else SystemProperties.getInt( "persist.notification_minimalism_prototype.lock_screen_max_notifs", 1 ) /** * Called to ensure code is only run when the flag is enabled. This protects users from the * unintended behaviors caused by accidentally running new logic, while also crashing on an * eng build to ensure that the refactor author catches issues in testing. */ @JvmStatic inline fun isUnexpectedlyInLegacyMode() = RefactorFlagUtils.isUnexpectedlyInLegacyMode(isEnabled, FLAG_NAME) /** * Called to ensure code is only run when the flag is disabled. This will throw an exception * if the flag is enabled to ensure that the refactor author catches issues in testing. */ @JvmStatic inline fun assertInLegacyMode() = RefactorFlagUtils.assertInLegacyMode(isEnabled, FLAG_NAME) } } packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt +4 −8 Original line number Diff line number Diff line Loading @@ -17,11 +17,9 @@ package com.android.systemui.statusbar.notification.stack import android.content.res.Resources import android.os.SystemProperties import android.util.Log import android.view.View.GONE import androidx.annotation.VisibleForTesting import com.android.systemui.Flags.notificationMinimalismPrototype import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.media.controls.domain.pipeline.MediaDataManager Loading @@ -31,6 +29,7 @@ import com.android.systemui.statusbar.StatusBarState.KEYGUARD import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableView import com.android.systemui.statusbar.notification.shared.NotificationMinimalismPrototype import com.android.systemui.statusbar.policy.SplitShadeStateController import com.android.systemui.util.Compile import com.android.systemui.util.children Loading Loading @@ -381,16 +380,13 @@ constructor( fun updateResources() { maxKeyguardNotifications = infiniteIfNegative( if (notificationMinimalismPrototype()) { SystemProperties.getInt( "persist.notification_minimalism_prototype.lock_screen_max_notifs", 1 ) if (NotificationMinimalismPrototype.V1.isEnabled) { NotificationMinimalismPrototype.V1.maxNotifs } else { resources.getInteger(R.integer.keyguard_max_notification_count) } ) maxNotificationsExcludesMedia = notificationMinimalismPrototype() maxNotificationsExcludesMedia = NotificationMinimalismPrototype.V1.isEnabled dividerHeight = max(1f, resources.getDimensionPixelSize(R.dimen.notification_divider_height).toFloat()) Loading Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/collection/coordinator/KeyguardCoordinator.kt +6 −16 Original line number Diff line number Diff line Loading @@ -18,12 +18,10 @@ package com.android.systemui.statusbar.notification.collection.coordinator import android.os.SystemProperties import android.os.UserHandle import android.provider.Settings import androidx.annotation.VisibleForTesting import com.android.systemui.Dumpable import com.android.systemui.Flags.notificationMinimalismPrototype import com.android.systemui.dagger.qualifiers.Application import com.android.systemui.dagger.qualifiers.Background import com.android.systemui.dump.DumpManager Loading @@ -41,6 +39,7 @@ import com.android.systemui.statusbar.notification.collection.notifcollection.No import com.android.systemui.statusbar.notification.collection.provider.SectionHeaderVisibilityProvider import com.android.systemui.statusbar.notification.domain.interactor.SeenNotificationsInteractor import com.android.systemui.statusbar.notification.interruption.KeyguardNotificationVisibilityProvider import com.android.systemui.statusbar.notification.shared.NotificationMinimalismPrototype import com.android.systemui.statusbar.policy.HeadsUpManager import com.android.systemui.statusbar.policy.headsUpEvents import com.android.systemui.util.asIndenting Loading Loading @@ -264,7 +263,7 @@ constructor( } private fun unseenFeatureEnabled(): Flow<Boolean> { if (notificationMinimalismPrototype()) { if (NotificationMinimalismPrototype.V1.isEnabled) { return flowOf(true) } return secureSettings Loading Loading @@ -341,18 +340,6 @@ constructor( var hasFilteredAnyNotifs = false /** * the [notificationMinimalismPrototype] will now show seen notifications on the locked * shade by default, but this property read allows that to be quickly disabled for * testing */ private val minimalismShowOnLockedShade get() = SystemProperties.getBoolean( "persist.notification_minimalism_prototype.show_on_locked_shade", true ) /** * Encapsulates a definition of "being on the keyguard". Note that these two definitions * are wildly different: [StatusBarState.KEYGUARD] is when on the lock screen and does Loading @@ -364,7 +351,10 @@ constructor( * allow seen notifications to appear in the locked shade. */ private fun isOnKeyguard(): Boolean = if (notificationMinimalismPrototype() && minimalismShowOnLockedShade) { if ( NotificationMinimalismPrototype.V1.isEnabled && NotificationMinimalismPrototype.V1.showOnLockedShade ) { statusBarStateController.state == StatusBarState.KEYGUARD } else { keyguardRepository.isKeyguardShowing() Loading
packages/SystemUI/src/com/android/systemui/statusbar/notification/shared/NotificationMinimalismPrototype.kt 0 → 100644 +79 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.systemui.statusbar.notification.shared import android.os.SystemProperties import com.android.systemui.Flags import com.android.systemui.flags.FlagToken import com.android.systemui.flags.RefactorFlagUtils /** Helper for reading or using the minimalism prototype flag state. */ @Suppress("NOTHING_TO_INLINE") object NotificationMinimalismPrototype { object V1 { /** The aconfig flag name */ const val FLAG_NAME = Flags.FLAG_NOTIFICATION_MINIMALISM_PROTOTYPE /** A token used for dependency declaration */ val token: FlagToken get() = FlagToken(FLAG_NAME, isEnabled) /** Is the heads-up cycling animation enabled */ @JvmStatic inline val isEnabled get() = Flags.notificationMinimalismPrototype() /** * the prototype will now show seen notifications on the locked shade by default, but this * property read allows that to be quickly disabled for testing */ val showOnLockedShade: Boolean get() = if (isUnexpectedlyInLegacyMode()) false else SystemProperties.getBoolean( "persist.notification_minimalism_prototype.show_on_locked_shade", true ) /** gets the configurable max number of notifications */ val maxNotifs: Int get() = if (isUnexpectedlyInLegacyMode()) -1 else SystemProperties.getInt( "persist.notification_minimalism_prototype.lock_screen_max_notifs", 1 ) /** * Called to ensure code is only run when the flag is enabled. This protects users from the * unintended behaviors caused by accidentally running new logic, while also crashing on an * eng build to ensure that the refactor author catches issues in testing. */ @JvmStatic inline fun isUnexpectedlyInLegacyMode() = RefactorFlagUtils.isUnexpectedlyInLegacyMode(isEnabled, FLAG_NAME) /** * Called to ensure code is only run when the flag is disabled. This will throw an exception * if the flag is enabled to ensure that the refactor author catches issues in testing. */ @JvmStatic inline fun assertInLegacyMode() = RefactorFlagUtils.assertInLegacyMode(isEnabled, FLAG_NAME) } }
packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt +4 −8 Original line number Diff line number Diff line Loading @@ -17,11 +17,9 @@ package com.android.systemui.statusbar.notification.stack import android.content.res.Resources import android.os.SystemProperties import android.util.Log import android.view.View.GONE import androidx.annotation.VisibleForTesting import com.android.systemui.Flags.notificationMinimalismPrototype import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.media.controls.domain.pipeline.MediaDataManager Loading @@ -31,6 +29,7 @@ import com.android.systemui.statusbar.StatusBarState.KEYGUARD import com.android.systemui.statusbar.SysuiStatusBarStateController import com.android.systemui.statusbar.notification.row.ExpandableNotificationRow import com.android.systemui.statusbar.notification.row.ExpandableView import com.android.systemui.statusbar.notification.shared.NotificationMinimalismPrototype import com.android.systemui.statusbar.policy.SplitShadeStateController import com.android.systemui.util.Compile import com.android.systemui.util.children Loading Loading @@ -381,16 +380,13 @@ constructor( fun updateResources() { maxKeyguardNotifications = infiniteIfNegative( if (notificationMinimalismPrototype()) { SystemProperties.getInt( "persist.notification_minimalism_prototype.lock_screen_max_notifs", 1 ) if (NotificationMinimalismPrototype.V1.isEnabled) { NotificationMinimalismPrototype.V1.maxNotifs } else { resources.getInteger(R.integer.keyguard_max_notification_count) } ) maxNotificationsExcludesMedia = notificationMinimalismPrototype() maxNotificationsExcludesMedia = NotificationMinimalismPrototype.V1.isEnabled dividerHeight = max(1f, resources.getDimensionPixelSize(R.dimen.notification_divider_height).toFloat()) Loading