diff options
| author | 2024-11-07 22:20:02 +0000 | |
|---|---|---|
| committer | 2024-11-07 22:21:52 +0000 | |
| commit | f3ae4e09fa3c1c0b2229ae2128f5335e091b639a (patch) | |
| tree | 8db996785e2c3be7fa5e6a883a3383e915c1339f | |
| parent | e7a7053c14ccb9e2c2c082b257cd9187eb80cc7b (diff) | |
Formatting kotlin file
Fix the format issues reported by ktfmt.
Bug: 377546277
Bug: 354047572
Flag: com.android.server.notification.notification_minimalism
Test: EXEMPT refactor
Change-Id: I0b30c4b99f75cd72455aa385876ff57a08cf36dc
2 files changed, 34 insertions, 49 deletions
diff --git a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt index 7b73da2737e8..50db9f7268e4 100644 --- a/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt +++ b/packages/SystemUI/multivalentTests/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculatorTest.kt @@ -21,10 +21,10 @@ import android.service.notification.StatusBarNotification import android.view.View.VISIBLE import androidx.test.ext.junit.runners.AndroidJUnit4 import androidx.test.filters.SmallTest -import com.android.systemui.res.R import com.android.systemui.SysuiTestCase import com.android.systemui.kosmos.testScope import com.android.systemui.media.controls.domain.pipeline.MediaDataManager +import com.android.systemui.res.R import com.android.systemui.statusbar.LockscreenShadeTransitionController import com.android.systemui.statusbar.StatusBarState import com.android.systemui.statusbar.SysuiStatusBarStateController @@ -80,7 +80,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { testableResources.resources, ResourcesSplitShadeStateController(), seenNotificationsInteractor = seenNotificationsInteractor, - scope = kosmos.testScope, + scope = testScope, ) } @@ -93,7 +93,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { rows, spaceForNotifications = 0f, spaceForShelf = 0f, - shelfHeight = 0f + shelfHeight = 0f, ) assertThat(maxNotifications).isEqualTo(0) @@ -109,7 +109,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { rows, spaceForNotifications = Float.MAX_VALUE, spaceForShelf = Float.MAX_VALUE, - shelfHeight + shelfHeight, ) assertThat(maxNotifications).isEqualTo(numberOfRows) @@ -145,7 +145,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { listOf(row), /* spaceForNotifications= */ 5f, /* spaceForShelf= */ 0f, - /* shelfHeight= */ 0f + /* shelfHeight= */ 0f, ) assertThat(maxNotifications).isEqualTo(1) @@ -156,11 +156,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { setGapHeight(gapHeight) val shelfHeight = shelfHeight + dividerHeight val spaceForNotifications = - listOf( - rowHeight + dividerHeight, - gapHeight + rowHeight + dividerHeight, - ) - .sum() + listOf(rowHeight + dividerHeight, gapHeight + rowHeight + dividerHeight).sum() val spaceForShelf = gapHeight + dividerHeight + shelfHeight val rows = listOf(createMockRow(rowHeight), createMockRow(rowHeight), createMockRow(rowHeight)) @@ -170,7 +166,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { rows, spaceForNotifications + 1, spaceForShelf, - shelfHeight + shelfHeight, ) assertThat(maxNotifications).isEqualTo(2) @@ -181,12 +177,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { // Each row in separate section. setGapHeight(gapHeight) - val notifSpace = - listOf( - rowHeight, - dividerHeight + gapHeight + rowHeight, - ) - .sum() + val notifSpace = listOf(rowHeight, dividerHeight + gapHeight + rowHeight).sum() val shelfSpace = dividerHeight + gapHeight + shelfHeight val spaceUsed = notifSpace + shelfSpace @@ -217,7 +208,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { rows, spaceForNotifications + 1, spaceForShelf, - shelfHeight + shelfHeight, ) assertThat(maxNotifications).isEqualTo(1) @@ -260,7 +251,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { visibleIndex = 0, previousView = null, stack = stackLayout, - onLockscreen = true + onLockscreen = true, ) assertThat(space.whenEnoughSpace).isEqualTo(10f) } @@ -280,7 +271,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { visibleIndex = 0, previousView = null, stack = stackLayout, - onLockscreen = true + onLockscreen = true, ) assertThat(space.whenEnoughSpace).isEqualTo(5) } @@ -299,7 +290,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { visibleIndex = 0, previousView = null, stack = stackLayout, - onLockscreen = true + onLockscreen = true, ) assertThat(space.whenSavingSpace).isEqualTo(5) } @@ -319,7 +310,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { visibleIndex = 0, previousView = null, stack = stackLayout, - onLockscreen = true + onLockscreen = true, ) assertThat(space.whenSavingSpace).isEqualTo(5) } @@ -338,7 +329,7 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { visibleIndex = 0, previousView = null, stack = stackLayout, - onLockscreen = false + onLockscreen = false, ) assertThat(space.whenEnoughSpace).isEqualTo(rowHeight) assertThat(space.whenSavingSpace).isEqualTo(rowHeight) @@ -348,14 +339,14 @@ class NotificationStackSizeCalculatorTest : SysuiTestCase() { rows: List<ExpandableView>, spaceForNotifications: Float, spaceForShelf: Float, - shelfHeight: Float = this.shelfHeight + shelfHeight: Float = this.shelfHeight, ): Int { setupChildren(rows) return sizeCalculator.computeMaxKeyguardNotifications( stackLayout, spaceForNotifications, spaceForShelf, - shelfHeight + shelfHeight, ) } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt index 5d37c10b916f..5dff8120f33f 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/notification/stack/NotificationStackSizeCalculator.kt @@ -35,16 +35,14 @@ import com.android.systemui.statusbar.notification.shared.NotificationMinimalism import com.android.systemui.statusbar.policy.SplitShadeStateController import com.android.systemui.util.Compile import com.android.systemui.util.children -import kotlinx.coroutines.CoroutineScope -import kotlinx.coroutines.flow.Flow -import kotlinx.coroutines.flow.collectLatest -import kotlinx.coroutines.flow.flowOf -import kotlinx.coroutines.launch import java.io.PrintWriter import javax.inject.Inject import kotlin.math.max import kotlin.math.min import kotlin.properties.Delegates.notNull +import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.flow.collectLatest +import kotlinx.coroutines.launch private const val TAG = "NotifStackSizeCalc" private val DEBUG = Compile.IS_DEBUG && Log.isLoggable(TAG, Log.DEBUG) @@ -94,9 +92,7 @@ constructor( */ private var saveSpaceOnLockscreen = false - /** - * True when the lock screen notification minimalism feature setting is enabled - */ + /** True when the lock screen notification minimalism feature setting is enabled */ private var minimalismSettingEnabled = false init { @@ -216,7 +212,7 @@ constructor( canStackFitInSpace( heightResult, notifSpace = notifSpace, - shelfSpace = shelfSpace + shelfSpace = shelfSpace, ) == FitResult.FIT } @@ -246,7 +242,7 @@ constructor( canStackFitInSpace( heightResult, notifSpace = notifSpace, - shelfSpace = shelfSpace + shelfSpace = shelfSpace, ) != FitResult.NO_FIT } log { "\t--- maxNotifications=$maxNotifications" } @@ -294,7 +290,7 @@ constructor( fun computeHeight( stack: NotificationStackScrollLayout, maxNotifs: Int, - shelfHeight: Float + shelfHeight: Float, ): Float { log { "\n" } log { "computeHeight ---" } @@ -328,7 +324,7 @@ constructor( private enum class FitResult { FIT, FIT_IF_SAVE_SPACE, - NO_FIT + NO_FIT, } data class SpaceNeeded( @@ -336,7 +332,7 @@ constructor( val whenEnoughSpace: Float, // Float height of space needed when showing collapsed layout for FSI HUNs. - val whenSavingSpace: Float + val whenSavingSpace: Float, ) private data class StackHeight( @@ -352,7 +348,7 @@ constructor( val shelfHeightWithSpaceBefore: Float, /** Whether the stack should actually be forced into the shelf before this height. */ - val shouldForceIntoShelf: Boolean + val shouldForceIntoShelf: Boolean, ) private suspend fun trackLockScreenNotificationMinimalismSettingChanges() { @@ -404,7 +400,7 @@ constructor( stack, previous = currentNotification, current = children[firstViewInShelfIndex], - currentIndex = firstViewInShelfIndex + currentIndex = firstViewInShelfIndex, ) spaceBeforeShelf + shelfHeight } @@ -425,7 +421,7 @@ constructor( notifsHeight = notifications, notifsHeightSavingSpace = notifsWithCollapsedHun, shelfHeightWithSpaceBefore = shelfWithSpaceBefore, - shouldForceIntoShelf = counter?.shouldForceIntoShelf() ?: false + shouldForceIntoShelf = counter?.shouldForceIntoShelf() ?: false, ) ) } @@ -490,8 +486,10 @@ constructor( fun dump(pw: PrintWriter, args: Array<out String>) { pw.println("NotificationStackSizeCalculator saveSpaceOnLockscreen=$saveSpaceOnLockscreen") - pw.println("NotificationStackSizeCalculator " + - "limitLockScreenToOneImportant=$limitLockScreenToOneImportant") + pw.println( + "NotificationStackSizeCalculator " + + "limitLockScreenToOneImportant=$limitLockScreenToOneImportant" + ) } private fun ExpandableView.isShowable(onLockscreen: Boolean): Boolean { @@ -514,7 +512,7 @@ constructor( stack: NotificationStackScrollLayout, previous: ExpandableView?, current: ExpandableView?, - currentIndex: Int + currentIndex: Int, ): Float { if (currentIndex == 0) { return 0f @@ -566,11 +564,7 @@ constructor( takeWhile(predicate).count() - 1 /** Counts the number of notifications for each type of bucket */ - data class BucketTypeCounter( - var ongoing: Int = 0, - var important: Int = 0, - var other: Int = 0, - ) { + data class BucketTypeCounter(var ongoing: Int = 0, var important: Int = 0, var other: Int = 0) { fun incrementForBucket(@PriorityBucket bucket: Int?) { when (bucket) { BUCKET_MEDIA_CONTROLS, |