Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt +1 −3 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,6 @@ import com.android.systemui.globalactions.GlobalActionsComponent import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.ActivityStarter import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.concurrency.DelayableExecutor import com.android.systemui.util.concurrency.DelayableExecutor import com.android.systemui.R import javax.inject.Inject import javax.inject.Inject import javax.inject.Singleton import javax.inject.Singleton Loading Loading @@ -164,8 +163,7 @@ class ControlActionCoordinatorImpl @Inject constructor( it.show() it.show() } } } else { } else { cvh.setTransientStatus( cvh.setErrorStatus() cvh.context.resources.getString(R.string.controls_error_failed)) } } } } } } Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt +5 −16 Original line number Original line Diff line number Diff line Loading @@ -67,7 +67,6 @@ class ControlViewHolder( companion object { companion object { const val STATE_ANIMATION_DURATION = 700L const val STATE_ANIMATION_DURATION = 700L private const val UPDATE_DELAY_IN_MILLIS = 3000L private const val ALPHA_ENABLED = 255 private const val ALPHA_ENABLED = 255 private const val ALPHA_DISABLED = 0 private const val ALPHA_DISABLED = 0 private const val STATUS_ALPHA_ENABLED = 1f private const val STATUS_ALPHA_ENABLED = 1f Loading Loading @@ -113,7 +112,6 @@ class ControlViewHolder( val context: Context = layout.getContext() val context: Context = layout.getContext() val clipLayer: ClipDrawable val clipLayer: ClipDrawable lateinit var cws: ControlWithState lateinit var cws: ControlWithState var cancelUpdate: Runnable? = null var behavior: Behavior? = null var behavior: Behavior? = null var lastAction: ControlAction? = null var lastAction: ControlAction? = null var isLoading = false var isLoading = false Loading Loading @@ -148,8 +146,6 @@ class ControlViewHolder( this.cws = cws this.cws = cws cancelUpdate?.run() // For the following statuses only, assume the title/subtitle could not be set properly // 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 // by the app and instead use the last known information from favorites if (controlStatus == Control.STATUS_UNKNOWN || controlStatus == Control.STATUS_NOT_FOUND) { if (controlStatus == Control.STATUS_UNKNOWN || controlStatus == Control.STATUS_NOT_FOUND) { Loading Loading @@ -188,11 +184,11 @@ class ControlViewHolder( lastChallengeDialog = null lastChallengeDialog = null ControlAction.RESPONSE_UNKNOWN -> { ControlAction.RESPONSE_UNKNOWN -> { lastChallengeDialog = null lastChallengeDialog = null setTransientStatus(context.resources.getString(R.string.controls_error_failed)) setErrorStatus() } } ControlAction.RESPONSE_FAIL -> { ControlAction.RESPONSE_FAIL -> { lastChallengeDialog = null lastChallengeDialog = null setTransientStatus(context.resources.getString(R.string.controls_error_failed)) setErrorStatus() } } ControlAction.RESPONSE_CHALLENGE_PIN -> { ControlAction.RESPONSE_CHALLENGE_PIN -> { lastChallengeDialog = ChallengeDialogs.createPinDialog( lastChallengeDialog = ChallengeDialogs.createPinDialog( Loading @@ -219,17 +215,10 @@ class ControlViewHolder( visibleDialog = null visibleDialog = null } } fun setTransientStatus(tempStatus: String) { fun setErrorStatus() { val previousText = status.getText() val text = context.resources.getString(R.string.controls_error_failed) cancelUpdate = uiExecutor.executeDelayed({ animateStatusChange(/* animated */ true, { setStatusText(previousText, /* immediately */ true) }) }, UPDATE_DELAY_IN_MILLIS) animateStatusChange(/* animated */ true, { animateStatusChange(/* animated */ true, { setStatusText(tempStatus, /* immediately */ true) setStatusText(text, /* immediately */ true) }) }) } } Loading packages/SystemUI/src/com/android/systemui/controls/ui/StatusBehavior.kt +1 −2 Original line number Original line Diff line number Diff line Loading @@ -77,8 +77,7 @@ class StatusBehavior : Behavior { cws.control?.getAppIntent()?.send() cws.control?.getAppIntent()?.send() context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) } catch (e: PendingIntent.CanceledException) { } catch (e: PendingIntent.CanceledException) { cvh.setTransientStatus( cvh.setErrorStatus() cvh.context.resources.getString(R.string.controls_error_failed)) } } dialog.dismiss() dialog.dismiss() }) }) Loading Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt +1 −3 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,6 @@ import com.android.systemui.globalactions.GlobalActionsComponent import com.android.systemui.plugins.ActivityStarter import com.android.systemui.plugins.ActivityStarter import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.concurrency.DelayableExecutor import com.android.systemui.util.concurrency.DelayableExecutor import com.android.systemui.R import javax.inject.Inject import javax.inject.Inject import javax.inject.Singleton import javax.inject.Singleton Loading Loading @@ -164,8 +163,7 @@ class ControlActionCoordinatorImpl @Inject constructor( it.show() it.show() } } } else { } else { cvh.setTransientStatus( cvh.setErrorStatus() cvh.context.resources.getString(R.string.controls_error_failed)) } } } } } } Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt +5 −16 Original line number Original line Diff line number Diff line Loading @@ -67,7 +67,6 @@ class ControlViewHolder( companion object { companion object { const val STATE_ANIMATION_DURATION = 700L const val STATE_ANIMATION_DURATION = 700L private const val UPDATE_DELAY_IN_MILLIS = 3000L private const val ALPHA_ENABLED = 255 private const val ALPHA_ENABLED = 255 private const val ALPHA_DISABLED = 0 private const val ALPHA_DISABLED = 0 private const val STATUS_ALPHA_ENABLED = 1f private const val STATUS_ALPHA_ENABLED = 1f Loading Loading @@ -113,7 +112,6 @@ class ControlViewHolder( val context: Context = layout.getContext() val context: Context = layout.getContext() val clipLayer: ClipDrawable val clipLayer: ClipDrawable lateinit var cws: ControlWithState lateinit var cws: ControlWithState var cancelUpdate: Runnable? = null var behavior: Behavior? = null var behavior: Behavior? = null var lastAction: ControlAction? = null var lastAction: ControlAction? = null var isLoading = false var isLoading = false Loading Loading @@ -148,8 +146,6 @@ class ControlViewHolder( this.cws = cws this.cws = cws cancelUpdate?.run() // For the following statuses only, assume the title/subtitle could not be set properly // 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 // by the app and instead use the last known information from favorites if (controlStatus == Control.STATUS_UNKNOWN || controlStatus == Control.STATUS_NOT_FOUND) { if (controlStatus == Control.STATUS_UNKNOWN || controlStatus == Control.STATUS_NOT_FOUND) { Loading Loading @@ -188,11 +184,11 @@ class ControlViewHolder( lastChallengeDialog = null lastChallengeDialog = null ControlAction.RESPONSE_UNKNOWN -> { ControlAction.RESPONSE_UNKNOWN -> { lastChallengeDialog = null lastChallengeDialog = null setTransientStatus(context.resources.getString(R.string.controls_error_failed)) setErrorStatus() } } ControlAction.RESPONSE_FAIL -> { ControlAction.RESPONSE_FAIL -> { lastChallengeDialog = null lastChallengeDialog = null setTransientStatus(context.resources.getString(R.string.controls_error_failed)) setErrorStatus() } } ControlAction.RESPONSE_CHALLENGE_PIN -> { ControlAction.RESPONSE_CHALLENGE_PIN -> { lastChallengeDialog = ChallengeDialogs.createPinDialog( lastChallengeDialog = ChallengeDialogs.createPinDialog( Loading @@ -219,17 +215,10 @@ class ControlViewHolder( visibleDialog = null visibleDialog = null } } fun setTransientStatus(tempStatus: String) { fun setErrorStatus() { val previousText = status.getText() val text = context.resources.getString(R.string.controls_error_failed) cancelUpdate = uiExecutor.executeDelayed({ animateStatusChange(/* animated */ true, { setStatusText(previousText, /* immediately */ true) }) }, UPDATE_DELAY_IN_MILLIS) animateStatusChange(/* animated */ true, { animateStatusChange(/* animated */ true, { setStatusText(tempStatus, /* immediately */ true) setStatusText(text, /* immediately */ true) }) }) } } Loading
packages/SystemUI/src/com/android/systemui/controls/ui/StatusBehavior.kt +1 −2 Original line number Original line Diff line number Diff line Loading @@ -77,8 +77,7 @@ class StatusBehavior : Behavior { cws.control?.getAppIntent()?.send() cws.control?.getAppIntent()?.send() context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) } catch (e: PendingIntent.CanceledException) { } catch (e: PendingIntent.CanceledException) { cvh.setTransientStatus( cvh.setErrorStatus() cvh.context.resources.getString(R.string.controls_error_failed)) } } dialog.dismiss() dialog.dismiss() }) }) Loading