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

Commit b49eab03 authored by Tianfan Zhang's avatar Tianfan Zhang
Browse files

Use extra to control one tap delay time.

Bug: 427605660
Flag: com.android.systemui.enable_underlay
Test: Manual test
Change-Id: Icaf6e957bc1d761ccb5da79e2e7590b81d60209a
parent 8f8445ce
Loading
Loading
Loading
Loading
+1 −3
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@ private fun NavBarAmbientCue(
        onClick = {
            if (actions.size == 1 && actions[0].oneTapEnabled) {
                scope.launch {
                    delay(ONE_TAP_DELAY_MS)
                    delay(actions[0].oneTapDelayMs)
                    actions[0].onClick()
                }
            } else {
@@ -261,5 +261,3 @@ private const val SHORT_PILL_ACTIONS_VERTICAL_PADDING = 38
private const val NAV_BAR_ACTIONS_PADDING = NAV_BAR_HEIGHT_DP + 16
private const val ACTIONS_HORIZONTAL_PADDING = 32
private const val ACTIONS_TOP_PADDING = 32

private const val ONE_TAP_DELAY_MS = 500L
+8 −0
Original line number Diff line number Diff line
@@ -165,6 +165,11 @@ constructor(
                                    chip.extras?.getParcelable<ActivityId>(EXTRA_ACTIVITY_ID)
                                val actionType = chip.extras?.getString(EXTRA_ACTION_TYPE)
                                val oneTapEnabled = chip.extras?.getBoolean(EXTRA_ONE_TAP_ENABLED)
                                val oneTapDelayMs =
                                    chip.extras?.getLong(
                                        EXTRA_ONE_TAP_DELAY_MS,
                                        DEFAULT_ONE_TAP_DELAY_MS,
                                    )
                                ActionModel(
                                    icon =
                                        IconModel(
@@ -230,6 +235,7 @@ constructor(
                                    taskId = activityId?.taskId ?: INVALID_TASK_ID,
                                    actionType = actionType,
                                    oneTapEnabled = oneTapEnabled == true,
                                    oneTapDelayMs = oneTapDelayMs ?: DEFAULT_ONE_TAP_DELAY_MS,
                                )
                            }
                    if (DEBUG) {
@@ -406,6 +412,8 @@ constructor(
        const val EXTRA_ATTRIBUTION_DIALOG_PENDING_INTENT = "attributionDialogPendingIntent"
        @VisibleForTesting const val EXTRA_ACTION_TYPE = "actionType"
        private const val EXTRA_ONE_TAP_ENABLED = "oneTapEnabled"
        private const val EXTRA_ONE_TAP_DELAY_MS = "oneTapDelayMs"
        private const val DEFAULT_ONE_TAP_DELAY_MS = 200L

        // Timeout to hide cuebar if it wasn't interacted with
        private const val TAG = "AmbientCueRepository"
+1 −0
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ data class ActionModel(
    val taskId: Int = INVALID_TASK_ID,
    val actionType: String? = null,
    val oneTapEnabled: Boolean = false,
    val oneTapDelayMs: Long = 0L,
)

data class IconModel(val drawable: Drawable, val iconId: String)
+1 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ data class ActionViewModel(
    val onLongClick: () -> Unit,
    val actionType: ActionType,
    val oneTapEnabled: Boolean = false,
    val oneTapDelayMs: Long = 0L,
)

enum class ActionType {
+1 −0
Original line number Diff line number Diff line
@@ -214,6 +214,7 @@ constructor(
                                    else -> ActionType.Unknown
                                },
                            oneTapEnabled = action.oneTapEnabled,
                            oneTapDelayMs = action.oneTapDelayMs,
                        )
                    }
                },