Dumpsys support for quick affordances.
Should aid in debugging.
Bug: 257066487
Test: Manually verified that running:
adb shell dumpsys activity service com.android.systemui/.SystemUIService KeyguardQuickAffordances
Properly outputs the right text, for example:
KeyguardQuickAffordances:
----------------------------------------------------------------------------
Slots & selections:
bottom_start: home (capacity = 1)
bottom_end is empty (capacity = 1)
Available affordances on device:
home ("Home")
wallet ("Wallet")
qr_code_scanner ("QR code scanner")
Change-Id: I5278e977a775aa7346914514a964fdacfc082bf0
This commit is contained in:
committed by
Ale Nijamkin
parent
1f6d4e0e1b
commit
45fdabd5f9
@@ -18,14 +18,17 @@
|
||||
package com.android.systemui.keyguard.data.repository
|
||||
|
||||
import android.content.Context
|
||||
import com.android.systemui.Dumpable
|
||||
import com.android.systemui.R
|
||||
import com.android.systemui.dagger.SysUISingleton
|
||||
import com.android.systemui.dagger.qualifiers.Application
|
||||
import com.android.systemui.dump.DumpManager
|
||||
import com.android.systemui.keyguard.data.quickaffordance.KeyguardQuickAffordanceConfig
|
||||
import com.android.systemui.keyguard.data.quickaffordance.KeyguardQuickAffordanceLegacySettingSyncer
|
||||
import com.android.systemui.keyguard.data.quickaffordance.KeyguardQuickAffordanceSelectionManager
|
||||
import com.android.systemui.keyguard.shared.model.KeyguardQuickAffordancePickerRepresentation
|
||||
import com.android.systemui.keyguard.shared.model.KeyguardSlotPickerRepresentation
|
||||
import java.io.PrintWriter
|
||||
import javax.inject.Inject
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.flow.SharingStarted
|
||||
@@ -43,6 +46,7 @@ constructor(
|
||||
private val selectionManager: KeyguardQuickAffordanceSelectionManager,
|
||||
legacySettingSyncer: KeyguardQuickAffordanceLegacySettingSyncer,
|
||||
private val configs: Set<@JvmSuppressWildcards KeyguardQuickAffordanceConfig>,
|
||||
dumpManager: DumpManager,
|
||||
) {
|
||||
/**
|
||||
* List of [KeyguardQuickAffordanceConfig] instances of the affordances at the slot with the
|
||||
@@ -87,6 +91,7 @@ constructor(
|
||||
|
||||
init {
|
||||
legacySettingSyncer.startSyncing()
|
||||
dumpManager.registerDumpable("KeyguardQuickAffordances", Dumpster())
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,6 +163,30 @@ constructor(
|
||||
return _slotPickerRepresentations
|
||||
}
|
||||
|
||||
private inner class Dumpster : Dumpable {
|
||||
override fun dump(pw: PrintWriter, args: Array<out String>) {
|
||||
val slotPickerRepresentations = getSlotPickerRepresentations()
|
||||
val selectionsBySlotId = getSelections()
|
||||
pw.println("Slots & selections:")
|
||||
slotPickerRepresentations.forEach { slotPickerRepresentation ->
|
||||
val slotId = slotPickerRepresentation.id
|
||||
val capacity = slotPickerRepresentation.maxSelectedAffordances
|
||||
val affordanceIds = selectionsBySlotId[slotId]
|
||||
|
||||
val selectionText =
|
||||
if (!affordanceIds.isNullOrEmpty()) {
|
||||
": ${affordanceIds.joinToString(", ")}"
|
||||
} else {
|
||||
" is empty"
|
||||
}
|
||||
|
||||
pw.println(" $slotId$selectionText (capacity = $capacity)")
|
||||
}
|
||||
pw.println("Available affordances on device:")
|
||||
configs.forEach { config -> pw.println(" ${config.key} (\"${config.pickerName}\")") }
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val SLOT_CONFIG_DELIMITER = ":"
|
||||
}
|
||||
|
||||
@@ -115,6 +115,7 @@ class KeyguardQuickAffordanceProviderTest : SysuiTestCase() {
|
||||
secureSettings = FakeSettings(),
|
||||
selectionsManager = selectionManager,
|
||||
),
|
||||
dumpManager = mock(),
|
||||
)
|
||||
underTest.interactor =
|
||||
KeyguardQuickAffordanceInteractor(
|
||||
|
||||
@@ -91,6 +91,7 @@ class KeyguardQuickAffordanceRepositoryTest : SysuiTestCase() {
|
||||
selectionsManager = selectionManager,
|
||||
),
|
||||
configs = setOf(config1, config2),
|
||||
dumpManager = mock(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -266,6 +266,7 @@ class KeyguardQuickAffordanceInteractorParameterizedTest : SysuiTestCase() {
|
||||
selectionsManager = selectionManager,
|
||||
),
|
||||
configs = setOf(homeControls, quickAccessWallet, qrCodeScanner),
|
||||
dumpManager = mock(),
|
||||
)
|
||||
underTest =
|
||||
KeyguardQuickAffordanceInteractor(
|
||||
|
||||
@@ -127,6 +127,7 @@ class KeyguardQuickAffordanceInteractorTest : SysuiTestCase() {
|
||||
selectionsManager = selectionManager,
|
||||
),
|
||||
configs = setOf(homeControls, quickAccessWallet, qrCodeScanner),
|
||||
dumpManager = mock(),
|
||||
)
|
||||
featureFlags =
|
||||
FakeFeatureFlags().apply {
|
||||
|
||||
@@ -155,6 +155,7 @@ class KeyguardBottomAreaViewModelTest : SysuiTestCase() {
|
||||
quickAccessWalletAffordanceConfig,
|
||||
qrCodeScannerAffordanceConfig,
|
||||
),
|
||||
dumpManager = mock(),
|
||||
)
|
||||
underTest =
|
||||
KeyguardBottomAreaViewModel(
|
||||
|
||||
Reference in New Issue
Block a user