Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3b7105ff authored by Fabián Kozynski's avatar Fabián Kozynski
Browse files

Add resize ui events

Flag: com.android.systemui.qs_ui_refactor_compose_fragment
Test: manual, toggle and observe atoms
Fixes: 33926836

Change-Id: I6e87d2d07cd6211136c566e5314f2ee9e5d298ba
parent e80f1b9a
Loading
Loading
Loading
Loading
+36 −69
Original line number Original line Diff line number Diff line
@@ -27,9 +27,7 @@ object QSEvents {
        private set
        private set


    fun setLoggerForTesting(): UiEventLoggerFake {
    fun setLoggerForTesting(): UiEventLoggerFake {
        return UiEventLoggerFake().also {
        return UiEventLoggerFake().also { qsUiEventsLogger = it }
            qsUiEventsLogger = it
        }
    }
    }


    fun resetLogger() {
    fun resetLogger() {
@@ -40,32 +38,28 @@ object QSEvents {
enum class QSEvent(private val _id: Int) : UiEventLogger.UiEventEnum {
enum class QSEvent(private val _id: Int) : UiEventLogger.UiEventEnum {
    @UiEvent(doc = "Tile clicked. It has an instance id and a spec (or packageName)")
    @UiEvent(doc = "Tile clicked. It has an instance id and a spec (or packageName)")
    QS_ACTION_CLICK(387),
    QS_ACTION_CLICK(387),

    @UiEvent(
    @UiEvent(doc = "Tile secondary button clicked. " +
        doc =
            "It has an instance id and a spec (or packageName)")
            "Tile secondary button clicked. " + "It has an instance id and a spec (or packageName)"
    )
    QS_ACTION_SECONDARY_CLICK(388),
    QS_ACTION_SECONDARY_CLICK(388),

    @UiEvent(doc = "Tile long clicked. It has an instance id and a spec (or packageName)")
    @UiEvent(doc = "Tile long clicked. It has an instance id and a spec (or packageName)")
    QS_ACTION_LONG_PRESS(389),
    QS_ACTION_LONG_PRESS(389),

    @UiEvent(doc = "Quick Settings panel expanded") QS_PANEL_EXPANDED(390),
    @UiEvent(doc = "Quick Settings panel expanded")
    @UiEvent(doc = "Quick Settings panel collapsed") QS_PANEL_COLLAPSED(391),
    QS_PANEL_EXPANDED(390),
    @UiEvent(

        doc =
    @UiEvent(doc = "Quick Settings panel collapsed")
            "Tile visible in Quick Settings panel. The tile may be in a different page. " +
    QS_PANEL_COLLAPSED(391),
                "It has an instance id and a spec (or packageName)"

    )
    @UiEvent(doc = "Tile visible in Quick Settings panel. The tile may be in a different page. " +
            "It has an instance id and a spec (or packageName)")
    QS_TILE_VISIBLE(392),
    QS_TILE_VISIBLE(392),

    @UiEvent(doc = "Quick Quick Settings panel expanded") QQS_PANEL_EXPANDED(393),
    @UiEvent(doc = "Quick Quick Settings panel expanded")
    @UiEvent(doc = "Quick Quick Settings panel collapsed") QQS_PANEL_COLLAPSED(394),
    QQS_PANEL_EXPANDED(393),
    @UiEvent(

        doc =
    @UiEvent(doc = "Quick Quick Settings panel collapsed")
            "Tile visible in Quick Quick Settings panel. " +
    QQS_PANEL_COLLAPSED(394),
                "It has an instance id and a spec (or packageName)"

    )
    @UiEvent(doc = "Tile visible in Quick Quick Settings panel. " +
            "It has an instance id and a spec (or packageName)")
    QQS_TILE_VISIBLE(395);
    QQS_TILE_VISIBLE(395);


    override fun getId() = _id
    override fun getId() = _id
@@ -73,47 +67,32 @@ enum class QSEvent(private val _id: Int) : UiEventLogger.UiEventEnum {


enum class QSEditEvent(private val _id: Int) : UiEventLogger.UiEventEnum {
enum class QSEditEvent(private val _id: Int) : UiEventLogger.UiEventEnum {


    @UiEvent(doc = "Tile removed from current tiles")
    @UiEvent(doc = "Tile removed from current tiles") QS_EDIT_REMOVE(210),
    QS_EDIT_REMOVE(210),
    @UiEvent(doc = "Tile added to current tiles") QS_EDIT_ADD(211),

    @UiEvent(doc = "Tile moved") QS_EDIT_MOVE(212),
    @UiEvent(doc = "Tile added to current tiles")
    @UiEvent(doc = "QS customizer open") QS_EDIT_OPEN(213),
    QS_EDIT_ADD(211),
    @UiEvent(doc = "QS customizer closed") QS_EDIT_CLOSED(214),

    @UiEvent(doc = "QS tiles reset") QS_EDIT_RESET(215),
    @UiEvent(doc = "Tile moved")
    @UiEvent(doc = "QS edit mode resize tile to large") QS_EDIT_RESIZE_LARGE(2122),
    QS_EDIT_MOVE(212),
    @UiEvent(doc = "QS edit mode resize tile to small") QS_EDIT_RESIZE_SMALL(2123);

    @UiEvent(doc = "QS customizer open")
    QS_EDIT_OPEN(213),

    @UiEvent(doc = "QS customizer closed")
    QS_EDIT_CLOSED(214),

    @UiEvent(doc = "QS tiles reset")
    QS_EDIT_RESET(215);


    override fun getId() = _id
    override fun getId() = _id
}
}


/**
/**
 * Events from the QS DND tile dialog. {@see QSZenModeDialogMetricsLogger}
 * Events from the QS DND tile dialog. {@see QSZenModeDialogMetricsLogger} Other names for DND (Do
 * Other names for DND (Do Not Disturb) include "Zen" and "Priority mode".
 * Not Disturb) include "Zen" and "Priority mode".
 */
 */
enum class QSDndEvent(private val _id: Int) : UiEventLogger.UiEventEnum {
enum class QSDndEvent(private val _id: Int) : UiEventLogger.UiEventEnum {
    @UiEvent(doc = "User selected an option on the DND dialog")
    @UiEvent(doc = "User selected an option on the DND dialog") QS_DND_CONDITION_SELECT(420),
    QS_DND_CONDITION_SELECT(420),

    @UiEvent(doc = "User increased countdown duration of DND from the DND dialog")
    @UiEvent(doc = "User increased countdown duration of DND from the DND dialog")
    QS_DND_TIME_UP(422),
    QS_DND_TIME_UP(422),

    @UiEvent(doc = "User decreased countdown duration of DND from the DND dialog")
    @UiEvent(doc = "User decreased countdown duration of DND from the DND dialog")
    QS_DND_TIME_DOWN(423),
    QS_DND_TIME_DOWN(423),

    @UiEvent(doc = "User enabled DND from the QS DND dialog to last until manually turned off")
    @UiEvent(doc = "User enabled DND from the QS DND dialog to last until manually turned off")
    QS_DND_DIALOG_ENABLE_FOREVER(946),
    QS_DND_DIALOG_ENABLE_FOREVER(946),

    @UiEvent(doc = "User enabled DND from the QS DND dialog to last until the next alarm goes off")
    @UiEvent(doc = "User enabled DND from the QS DND dialog to last until the next alarm goes off")
    QS_DND_DIALOG_ENABLE_UNTIL_ALARM(947),
    QS_DND_DIALOG_ENABLE_UNTIL_ALARM(947),

    @UiEvent(doc = "User enabled DND from the QS DND dialog to last until countdown is done")
    @UiEvent(doc = "User enabled DND from the QS DND dialog to last until countdown is done")
    QS_DND_DIALOG_ENABLE_UNTIL_COUNTDOWN(948);
    QS_DND_DIALOG_ENABLE_UNTIL_COUNTDOWN(948);


@@ -121,27 +100,15 @@ enum class QSDndEvent(private val _id: Int) : UiEventLogger.UiEventEnum {
}
}


enum class QSUserSwitcherEvent(private val _id: Int) : UiEventLogger.UiEventEnum {
enum class QSUserSwitcherEvent(private val _id: Int) : UiEventLogger.UiEventEnum {
    @UiEvent(doc = "The current user has been switched in the detail panel")
    @UiEvent(doc = "The current user has been switched in the detail panel") QS_USER_SWITCH(424),
    QS_USER_SWITCH(424),
    @UiEvent(doc = "User switcher QS dialog open") QS_USER_DETAIL_OPEN(425),

    @UiEvent(doc = "User switcher QS dialog closed") QS_USER_DETAIL_CLOSE(426),
    @UiEvent(doc = "User switcher QS dialog open")
    @UiEvent(doc = "User switcher QS dialog more settings pressed") QS_USER_MORE_SETTINGS(427),
    QS_USER_DETAIL_OPEN(425),
    @UiEvent(doc = "The user has added a guest in the detail panel") QS_USER_GUEST_ADD(754),

    @UiEvent(doc = "User switcher QS dialog closed")
    QS_USER_DETAIL_CLOSE(426),

    @UiEvent(doc = "User switcher QS dialog more settings pressed")
    QS_USER_MORE_SETTINGS(427),

    @UiEvent(doc = "The user has added a guest in the detail panel")
    QS_USER_GUEST_ADD(754),

    @UiEvent(doc = "The user selected 'Start over' after switching to the existing Guest user")
    @UiEvent(doc = "The user selected 'Start over' after switching to the existing Guest user")
    QS_USER_GUEST_WIPE(755),
    QS_USER_GUEST_WIPE(755),

    @UiEvent(doc = "The user selected 'Yes, continue' after switching to the existing Guest user")
    @UiEvent(doc = "The user selected 'Yes, continue' after switching to the existing Guest user")
    QS_USER_GUEST_CONTINUE(756),
    QS_USER_GUEST_CONTINUE(756),

    @UiEvent(doc = "The user has pressed 'Remove guest' in the detail panel")
    @UiEvent(doc = "The user has pressed 'Remove guest' in the detail panel")
    QS_USER_GUEST_REMOVE(757);
    QS_USER_GUEST_REMOVE(757);


+14 −0
Original line number Original line Diff line number Diff line
@@ -16,15 +16,18 @@


package com.android.systemui.qs.panels.domain.interactor
package com.android.systemui.qs.panels.domain.interactor


import com.android.internal.logging.UiEventLogger
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.LogBuffer
import com.android.systemui.log.core.LogLevel
import com.android.systemui.log.core.LogLevel
import com.android.systemui.qs.QSEditEvent
import com.android.systemui.qs.panels.data.repository.DefaultLargeTilesRepository
import com.android.systemui.qs.panels.data.repository.DefaultLargeTilesRepository
import com.android.systemui.qs.panels.data.repository.LargeTileSpanRepository
import com.android.systemui.qs.panels.data.repository.LargeTileSpanRepository
import com.android.systemui.qs.panels.shared.model.PanelsLog
import com.android.systemui.qs.panels.shared.model.PanelsLog
import com.android.systemui.qs.pipeline.domain.interactor.CurrentTilesInteractor
import com.android.systemui.qs.pipeline.domain.interactor.CurrentTilesInteractor
import com.android.systemui.qs.pipeline.shared.TileSpec
import com.android.systemui.qs.pipeline.shared.TileSpec
import com.android.systemui.qs.pipeline.shared.metricSpec
import javax.inject.Inject
import javax.inject.Inject
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.SharingStarted
@@ -40,6 +43,7 @@ constructor(
    private val repo: DefaultLargeTilesRepository,
    private val repo: DefaultLargeTilesRepository,
    private val currentTilesInteractor: CurrentTilesInteractor,
    private val currentTilesInteractor: CurrentTilesInteractor,
    private val preferencesInteractor: QSPreferencesInteractor,
    private val preferencesInteractor: QSPreferencesInteractor,
    private val uiEventLogger: UiEventLogger,
    largeTilesSpanRepo: LargeTileSpanRepository,
    largeTilesSpanRepo: LargeTileSpanRepository,
    @PanelsLog private val logBuffer: LogBuffer,
    @PanelsLog private val logBuffer: LogBuffer,
    @Application private val applicationScope: CoroutineScope,
    @Application private val applicationScope: CoroutineScope,
@@ -70,8 +74,18 @@ constructor(
        val isIcon = !largeTilesSpecs.value.contains(spec)
        val isIcon = !largeTilesSpecs.value.contains(spec)
        if (toIcon && !isIcon) {
        if (toIcon && !isIcon) {
            preferencesInteractor.setLargeTilesSpecs(largeTilesSpecs.value - spec)
            preferencesInteractor.setLargeTilesSpecs(largeTilesSpecs.value - spec)
            uiEventLogger.log(
                /* event= */ QSEditEvent.QS_EDIT_RESIZE_SMALL,
                /* uid= */ 0,
                /* packageName= */ spec.metricSpec,
            )
        } else if (!toIcon && isIcon) {
        } else if (!toIcon && isIcon) {
            preferencesInteractor.setLargeTilesSpecs(largeTilesSpecs.value + spec)
            preferencesInteractor.setLargeTilesSpecs(largeTilesSpecs.value + spec)
            uiEventLogger.log(
                /* event= */ QSEditEvent.QS_EDIT_RESIZE_LARGE,
                /* uid= */ 0,
                /* packageName= */ spec.metricSpec,
            )
        }
        }
    }
    }


+2 −0
Original line number Original line Diff line number Diff line
@@ -16,6 +16,7 @@


package com.android.systemui.qs.panels.domain.interactor
package com.android.systemui.qs.panels.domain.interactor


import com.android.internal.logging.uiEventLoggerFake
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.kosmos.applicationCoroutineScope
import com.android.systemui.log.core.FakeLogBuffer
import com.android.systemui.log.core.FakeLogBuffer
@@ -29,6 +30,7 @@ val Kosmos.iconTilesInteractor by
            defaultLargeTilesRepository,
            defaultLargeTilesRepository,
            currentTilesInteractor,
            currentTilesInteractor,
            qsPreferencesInteractor,
            qsPreferencesInteractor,
            uiEventLoggerFake,
            largeTileSpanRepository,
            largeTileSpanRepository,
            FakeLogBuffer.Factory.create(),
            FakeLogBuffer.Factory.create(),
            applicationCoroutineScope,
            applicationCoroutineScope,