summaryrefslogtreecommitdiff
path: root/packages
diff options
context:
space:
mode:
authorLuK1337 <priv.luk@gmail.com>2022-02-21 17:05:38 +0100
committeralk3pInjection <webmaster@raspii.tech>2022-05-07 00:20:58 +0800
commit4b86959e89736e252f1e1dc7254c765a1897b0c9 (patch)
treee130618430193b23b3277f3f2f34db112d0ad602 /packages
parentce4ba6450dc195ee80e6c3d28ceafa4f710b4829 (diff)
SystemUI: Don't store pending ControlAction if the device is locked
Passing control action to activityStarter.dismissKeyguardThenExecute() is enough to toggle it post device unlock. Test: Use a control action from locked device, notice that it's no longer toggled twice. Change-Id: I48cb9e0ad2425d35063fddefc738ab36c01690b8
Diffstat (limited to 'packages')
-rw-r--r--packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt6
-rw-r--r--packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt17
-rw-r--r--packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt2
3 files changed, 1 insertions, 24 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt
index 8029ba844850..c4c23124b39e 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt
@@ -68,12 +68,6 @@ interface ControlActionCoordinator {
fun setValue(cvh: ControlViewHolder, templateId: String, newValue: Float)
/**
- * Actions may have been put on hold while the device is unlocked. Invoke this action if
- * present.
- */
- fun runPendingAction(controlId: String)
-
- /**
* User interaction with a control may be blocked for a period of time while actions are being
* executed by the application. When the response returns, run this method to enable further
* user interaction.
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 6f30ac3901e1..676fbe368ea2 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt
@@ -60,7 +60,6 @@ class ControlActionCoordinatorImpl @Inject constructor(
) : ControlActionCoordinator {
private var dialog: Dialog? = null
private val vibrator = context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
- private var pendingAction: Action? = null
private var actionsInProgress = mutableSetOf<String>()
private val isLocked: Boolean
get() = !keyguardStateController.isUnlocked()
@@ -122,14 +121,6 @@ class ControlActionCoordinatorImpl @Inject constructor(
}, false /* blockable */))
}
- override fun runPendingAction(controlId: String) {
- if (isLocked) return
- if (pendingAction?.controlId == controlId) {
- pendingAction?.invoke()
- pendingAction = null
- }
- }
-
@MainThread
override fun enableActionOnTouch(controlId: String) {
actionsInProgress.remove(controlId)
@@ -148,17 +139,11 @@ class ControlActionCoordinatorImpl @Inject constructor(
@VisibleForTesting
fun bouncerOrRun(action: Action) {
if (keyguardStateController.isShowing()) {
- if (isLocked) {
- context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS))
-
- // pending actions will only run after the control state has been refreshed
- pendingAction = action
- }
activityStarter.dismissKeyguardThenExecute({
Log.d(ControlsUiController.TAG, "Device unlocked, invoking controls action")
action.invoke()
true
- }, { pendingAction = null }, true /* afterKeyguardGone */)
+ }, null, true /* afterKeyguardGone */)
} else {
action.invoke()
}
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 47e749cd1185..f23bf560c968 100644
--- a/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt
+++ b/packages/SystemUI/src/com/android/systemui/controls/ui/ControlViewHolder.kt
@@ -172,8 +172,6 @@ class ControlViewHolder(
controlActionCoordinator.longPress(this@ControlViewHolder)
true
})
-
- controlActionCoordinator.runPendingAction(cws.ci.controlId)
}
val wasLoading = isLoading