From 2f63cc02b776fe7a806b878482440da75591e4ab Mon Sep 17 00:00:00 2001 From: Matt Pietal Date: Fri, 19 Jun 2020 15:21:13 -0400 Subject: [PATCH] Controls UI - Marquee + transient status == no good Temporary text was not given enough time to be visible, and could cause confusion. Remove all temporary text in favor of leaving it until the app decides to update, or the user takes another action. Fixes: 159163559 Test: manual, controls mock + large font, touch on TYPE_TV Change-Id: I6093c450e286cd1aac489847180877d78faa7ed3 --- .../ui/ControlActionCoordinatorImpl.kt | 4 +--- .../systemui/controls/ui/ControlViewHolder.kt | 21 +++++-------------- .../systemui/controls/ui/StatusBehavior.kt | 3 +-- 3 files changed, 7 insertions(+), 21 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt index d2501fa8a66bc..c073642afa4e4 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt @@ -35,7 +35,6 @@ import com.android.systemui.globalactions.GlobalActionsComponent import com.android.systemui.plugins.ActivityStarter import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.concurrency.DelayableExecutor -import com.android.systemui.R import javax.inject.Inject import javax.inject.Singleton @@ -164,8 +163,7 @@ class ControlActionCoordinatorImpl @Inject constructor( it.show() } } else { - cvh.setTransientStatus( - cvh.context.resources.getString(R.string.controls_error_failed)) + cvh.setErrorStatus() } } } diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt index 4eb7527bff6e1..865a38a2076c3 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt @@ -67,7 +67,6 @@ class ControlViewHolder( companion object { const val STATE_ANIMATION_DURATION = 700L - private const val UPDATE_DELAY_IN_MILLIS = 3000L private const val ALPHA_ENABLED = 255 private const val ALPHA_DISABLED = 0 private const val STATUS_ALPHA_ENABLED = 1f @@ -113,7 +112,6 @@ class ControlViewHolder( val context: Context = layout.getContext() val clipLayer: ClipDrawable lateinit var cws: ControlWithState - var cancelUpdate: Runnable? = null var behavior: Behavior? = null var lastAction: ControlAction? = null var isLoading = false @@ -148,8 +146,6 @@ class ControlViewHolder( this.cws = cws - cancelUpdate?.run() - // For the following statuses only, assume the title/subtitle could not be set properly // by the app and instead use the last known information from favorites if (controlStatus == Control.STATUS_UNKNOWN || controlStatus == Control.STATUS_NOT_FOUND) { @@ -188,11 +184,11 @@ class ControlViewHolder( lastChallengeDialog = null ControlAction.RESPONSE_UNKNOWN -> { lastChallengeDialog = null - setTransientStatus(context.resources.getString(R.string.controls_error_failed)) + setErrorStatus() } ControlAction.RESPONSE_FAIL -> { lastChallengeDialog = null - setTransientStatus(context.resources.getString(R.string.controls_error_failed)) + setErrorStatus() } ControlAction.RESPONSE_CHALLENGE_PIN -> { lastChallengeDialog = ChallengeDialogs.createPinDialog( @@ -219,17 +215,10 @@ class ControlViewHolder( visibleDialog = null } - fun setTransientStatus(tempStatus: String) { - val previousText = status.getText() - - cancelUpdate = uiExecutor.executeDelayed({ - animateStatusChange(/* animated */ true, { - setStatusText(previousText, /* immediately */ true) - }) - }, UPDATE_DELAY_IN_MILLIS) - + fun setErrorStatus() { + val text = context.resources.getString(R.string.controls_error_failed) animateStatusChange(/* animated */ true, { - setStatusText(tempStatus, /* immediately */ true) + setStatusText(text, /* immediately */ true) }) } diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/StatusBehavior.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/StatusBehavior.kt index dac55378dacaf..116f3ca898c0f 100644 --- a/packages/SystemUI/src/com/android/systemui/controls/ui/StatusBehavior.kt +++ b/packages/SystemUI/src/com/android/systemui/controls/ui/StatusBehavior.kt @@ -77,8 +77,7 @@ class StatusBehavior : Behavior { cws.control?.getAppIntent()?.send() context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) } catch (e: PendingIntent.CanceledException) { - cvh.setTransientStatus( - cvh.context.resources.getString(R.string.controls_error_failed)) + cvh.setErrorStatus() } dialog.dismiss() })