Change default intent for AlarmTile

As most times, users would want to turn on an existing alarm, and
there's a button right there to add a new alarm, this intent is a better
landing point as default.

Test: atest AlarmTileTest
Fixes: 200710299
Change-Id: I97e929aa471fa45587104e82e592f87408a23e63
This commit is contained in:
Fabian Kozynski
2021-09-21 16:24:37 -04:00
parent fcf06e22b7
commit 0bf525571c
2 changed files with 7 additions and 1 deletions

View File

@@ -54,7 +54,7 @@ class AlarmTile @Inject constructor(
private var lastAlarmInfo: AlarmManager.AlarmClockInfo? = null
private val icon = ResourceIcon.get(R.drawable.ic_alarm)
@VisibleForTesting
internal val defaultIntent = Intent(AlarmClock.ACTION_SET_ALARM)
internal val defaultIntent = Intent(AlarmClock.ACTION_SHOW_ALARMS)
private val callback = NextAlarmController.NextAlarmChangeCallback { nextAlarm ->
lastAlarmInfo = nextAlarm
refreshState()

View File

@@ -3,6 +3,7 @@ package com.android.systemui.qs.tiles
import android.app.AlarmManager
import android.app.PendingIntent
import android.os.Handler
import android.provider.AlarmClock
import android.service.quicksettings.Tile
import android.testing.AndroidTestingRunner
import android.testing.TestableLooper
@@ -97,6 +98,11 @@ class AlarmTileTest : SysuiTestCase() {
assertThat(tile.state.handlesLongClick).isFalse()
}
@Test
fun testDefaultIntentShowAlarms() {
assertThat(tile.defaultIntent.action).isEqualTo(AlarmClock.ACTION_SHOW_ALARMS)
}
@Test
fun testInactiveByDefault() {
assertThat(tile.state.state).isEqualTo(Tile.STATE_INACTIVE)