From a95b9d7d40d4847085b6cfb1a473ee4b695710fb Mon Sep 17 00:00:00 2001 From: Candice Lo Date: Mon, 20 Feb 2023 02:31:05 +0000 Subject: [PATCH] Long Click to show the settings page Opening the Settings page for text reading when the user long clicks the font scaling tile. Bug: 268626725 Test: manually - attach a video to bug Test: atest FontScalingTileTest Change-Id: Idf3cb7e80b361fa77a5e2f73f3f2d63e1252f8de --- .../src/com/android/systemui/qs/tiles/FontScalingTile.kt | 7 +++---- .../com/android/systemui/qs/tiles/FontScalingTileTest.kt | 9 +++++++++ 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/qs/tiles/FontScalingTile.kt b/packages/SystemUI/src/com/android/systemui/qs/tiles/FontScalingTile.kt index 9b4ac1b3437e7..a915ddba4f1c5 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/tiles/FontScalingTile.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/tiles/FontScalingTile.kt @@ -18,6 +18,7 @@ package com.android.systemui.qs.tiles import android.content.Intent import android.os.Handler import android.os.Looper +import android.provider.Settings import android.view.View import com.android.internal.jank.InteractionJankMonitor import com.android.internal.logging.MetricsLogger @@ -72,9 +73,7 @@ constructor( } override fun newTileState(): QSTile.State { - val state = QSTile.State() - state.handlesLongClick = false - return state + return QSTile.State() } override fun handleClick(view: View?) { @@ -98,7 +97,7 @@ constructor( } override fun getLongClickIntent(): Intent? { - return null + return Intent(Settings.ACTION_TEXT_READING_SETTINGS) } override fun getTileLabel(): CharSequence { diff --git a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/FontScalingTileTest.kt b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/FontScalingTileTest.kt index 257d42a83ba4c..9d62cfd3743ac 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/FontScalingTileTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/qs/tiles/FontScalingTileTest.kt @@ -15,7 +15,9 @@ */ package com.android.systemui.qs.tiles +import android.content.Intent import android.os.Handler +import android.provider.Settings import android.testing.AndroidTestingRunner import android.testing.TestableLooper import android.view.View @@ -113,4 +115,11 @@ class FontScalingTileTest : SysuiTestCase() { verify(dialogLaunchAnimator).showFromView(any(), eq(view), nullable(), anyBoolean()) } + + @Test + fun getLongClickIntent_getExpectedIntent() { + val intent: Intent? = fontScalingTile.getLongClickIntent() + + assertThat(intent!!.action).isEqualTo(Settings.ACTION_TEXT_READING_SETTINGS) + } }