Do not update tile state when unsure

This commit is contained in:
Mygod
2018-12-25 12:57:25 +08:00
parent 36b0284573
commit b2534eb2c0
6 changed files with 35 additions and 25 deletions

View File

@@ -57,7 +57,7 @@ class RepeaterTileService : KillableTileService() {
private fun updateTile(group: WifiP2pGroup? = binder?.group) {
qsTile?.run {
when (binder?.service?.status) {
when ((binder ?: return).service.status) {
RepeaterService.Status.IDLE -> {
state = Tile.STATE_INACTIVE
label = getText(R.string.title_repeater)
@@ -66,7 +66,7 @@ class RepeaterTileService : KillableTileService() {
state = Tile.STATE_ACTIVE
label = group?.networkName
}
else -> { // STARTING, null or DESTROYED, which should never occur
else -> { // STARTING or DESTROYED, which should never occur
state = Tile.STATE_UNAVAILABLE
label = getText(R.string.title_repeater)
}