Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt +3 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import android.service.controls.Control */ interface ControlActionCoordinator { // Handle actions launched from GlobalActionsDialog or ControlDialog var startedFromGlobalActions: Boolean /** * Close any dialogs which may have been open */ Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt +15 −5 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.service.controls.actions.CommandAction import android.service.controls.actions.FloatAction import android.util.Log import android.view.HapticFeedbackConstants import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.globalactions.GlobalActionsComponent Loading @@ -37,6 +38,7 @@ import com.android.systemui.plugins.ActivityStarter import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.concurrency.DelayableExecutor import com.android.wm.shell.TaskViewFactory import dagger.Lazy import java.util.Optional import javax.inject.Inject Loading @@ -48,13 +50,17 @@ class ControlActionCoordinatorImpl @Inject constructor( private val activityStarter: ActivityStarter, private val keyguardStateController: KeyguardStateController, private val globalActionsComponent: GlobalActionsComponent, private val taskViewFactory: Optional<TaskViewFactory> private val taskViewFactory: Optional<TaskViewFactory>, private val broadcastDispatcher: BroadcastDispatcher, private val lazyUiController: Lazy<ControlsUiController> ) : 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>() override var startedFromGlobalActions: Boolean = true companion object { private const val RESPONSE_TIMEOUT_IN_MILLIS = 3000L } Loading Loading @@ -131,8 +137,8 @@ class ControlActionCoordinatorImpl @Inject constructor( private fun bouncerOrRun(action: Action) { if (keyguardStateController.isShowing()) { var closeGlobalActions = !keyguardStateController.isUnlocked() if (closeGlobalActions) { var closeDialog = !keyguardStateController.isUnlocked() if (closeDialog) { context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) // pending actions will only run after the control state has been refreshed Loading @@ -141,8 +147,12 @@ class ControlActionCoordinatorImpl @Inject constructor( activityStarter.dismissKeyguardThenExecute({ Log.d(ControlsUiController.TAG, "Device unlocked, invoking controls action") if (closeGlobalActions) { if (closeDialog) { if (startedFromGlobalActions) { globalActionsComponent.handleShowGlobalActionsMenu() } else { ControlsDialog(context, broadcastDispatcher).show(lazyUiController.get()) } } else { action.invoke() } Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlsDialog.kt +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ class ControlsDialog( val vg = requireViewById<ViewGroup>(com.android.systemui.R.id.global_actions_controls) vg.alpha = 0f controller.show(vg, { /* do nothing */ }) controller.show(vg, { /* do nothing */ }, false /* startedFromGlobalActions */) vg.animate() .alpha(1f) Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ interface ControlsUiController { public const val EXTRA_ANIMATE = "extra_animate" } fun show(parent: ViewGroup, dismissGlobalActions: Runnable) fun show(parent: ViewGroup, onDismiss: Runnable, startedFromGlobalActions: Boolean) fun hide() /** Loading packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt +11 −5 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ class ControlsUiControllerImpl @Inject constructor ( private lateinit var lastItems: List<SelectionItem> private var popup: ListPopupWindow? = null private var hidden = true private lateinit var dismissGlobalActions: Runnable private lateinit var onDismiss: Runnable private val popupThemedContext = ContextThemeWrapper(context, R.style.Control_ListPopupWindow) private var retainCache = false Loading Loading @@ -145,13 +145,19 @@ class ControlsUiControllerImpl @Inject constructor ( } } override fun show(parent: ViewGroup, dismissGlobalActions: Runnable) { override fun show( parent: ViewGroup, onDismiss: Runnable, startedFromGlobalActions: Boolean ) { Log.d(ControlsUiController.TAG, "show()") this.parent = parent this.dismissGlobalActions = dismissGlobalActions this.onDismiss = onDismiss hidden = false retainCache = false controlActionCoordinator.startedFromGlobalActions = startedFromGlobalActions allStructures = controlsController.get().getFavorites() selectedStructure = loadPreference(allStructures) Loading Loading @@ -187,7 +193,7 @@ class ControlsUiControllerImpl @Inject constructor ( controlViewsById.clear() controlsById.clear() show(parent, dismissGlobalActions) show(parent, onDismiss, controlActionCoordinator.startedFromGlobalActions) val showAnim = ObjectAnimator.ofFloat(parent, "alpha", 0.0f, 1.0f) showAnim.setInterpolator(DecelerateInterpolator(1.0f)) showAnim.setDuration(FADE_IN_MILLIS) Loading Loading @@ -260,7 +266,7 @@ class ControlsUiControllerImpl @Inject constructor ( private fun startActivity(context: Context, intent: Intent) { // Force animations when transitioning from a dialog to an activity intent.putExtra(ControlsUiController.EXTRA_ANIMATE, true) dismissGlobalActions.run() onDismiss.run() activityStarter.dismissKeyguardThenExecute({ shadeController.collapsePanel(false) Loading Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinator.kt +3 −0 Original line number Diff line number Diff line Loading @@ -24,6 +24,9 @@ import android.service.controls.Control */ interface ControlActionCoordinator { // Handle actions launched from GlobalActionsDialog or ControlDialog var startedFromGlobalActions: Boolean /** * Close any dialogs which may have been open */ Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlActionCoordinatorImpl.kt +15 −5 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import android.service.controls.actions.CommandAction import android.service.controls.actions.FloatAction import android.util.Log import android.view.HapticFeedbackConstants import com.android.systemui.broadcast.BroadcastDispatcher import com.android.systemui.dagger.SysUISingleton import com.android.systemui.dagger.qualifiers.Main import com.android.systemui.globalactions.GlobalActionsComponent Loading @@ -37,6 +38,7 @@ import com.android.systemui.plugins.ActivityStarter import com.android.systemui.statusbar.policy.KeyguardStateController import com.android.systemui.util.concurrency.DelayableExecutor import com.android.wm.shell.TaskViewFactory import dagger.Lazy import java.util.Optional import javax.inject.Inject Loading @@ -48,13 +50,17 @@ class ControlActionCoordinatorImpl @Inject constructor( private val activityStarter: ActivityStarter, private val keyguardStateController: KeyguardStateController, private val globalActionsComponent: GlobalActionsComponent, private val taskViewFactory: Optional<TaskViewFactory> private val taskViewFactory: Optional<TaskViewFactory>, private val broadcastDispatcher: BroadcastDispatcher, private val lazyUiController: Lazy<ControlsUiController> ) : 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>() override var startedFromGlobalActions: Boolean = true companion object { private const val RESPONSE_TIMEOUT_IN_MILLIS = 3000L } Loading Loading @@ -131,8 +137,8 @@ class ControlActionCoordinatorImpl @Inject constructor( private fun bouncerOrRun(action: Action) { if (keyguardStateController.isShowing()) { var closeGlobalActions = !keyguardStateController.isUnlocked() if (closeGlobalActions) { var closeDialog = !keyguardStateController.isUnlocked() if (closeDialog) { context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)) // pending actions will only run after the control state has been refreshed Loading @@ -141,8 +147,12 @@ class ControlActionCoordinatorImpl @Inject constructor( activityStarter.dismissKeyguardThenExecute({ Log.d(ControlsUiController.TAG, "Device unlocked, invoking controls action") if (closeGlobalActions) { if (closeDialog) { if (startedFromGlobalActions) { globalActionsComponent.handleShowGlobalActionsMenu() } else { ControlsDialog(context, broadcastDispatcher).show(lazyUiController.get()) } } else { action.invoke() } Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlsDialog.kt +1 −1 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ class ControlsDialog( val vg = requireViewById<ViewGroup>(com.android.systemui.R.id.global_actions_controls) vg.alpha = 0f controller.show(vg, { /* do nothing */ }) controller.show(vg, { /* do nothing */ }, false /* startedFromGlobalActions */) vg.animate() .alpha(1f) Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiController.kt +1 −1 Original line number Diff line number Diff line Loading @@ -29,7 +29,7 @@ interface ControlsUiController { public const val EXTRA_ANIMATE = "extra_animate" } fun show(parent: ViewGroup, dismissGlobalActions: Runnable) fun show(parent: ViewGroup, onDismiss: Runnable, startedFromGlobalActions: Boolean) fun hide() /** Loading
packages/SystemUI/src/com/android/systemui/controls/ui/ControlsUiControllerImpl.kt +11 −5 Original line number Diff line number Diff line Loading @@ -102,7 +102,7 @@ class ControlsUiControllerImpl @Inject constructor ( private lateinit var lastItems: List<SelectionItem> private var popup: ListPopupWindow? = null private var hidden = true private lateinit var dismissGlobalActions: Runnable private lateinit var onDismiss: Runnable private val popupThemedContext = ContextThemeWrapper(context, R.style.Control_ListPopupWindow) private var retainCache = false Loading Loading @@ -145,13 +145,19 @@ class ControlsUiControllerImpl @Inject constructor ( } } override fun show(parent: ViewGroup, dismissGlobalActions: Runnable) { override fun show( parent: ViewGroup, onDismiss: Runnable, startedFromGlobalActions: Boolean ) { Log.d(ControlsUiController.TAG, "show()") this.parent = parent this.dismissGlobalActions = dismissGlobalActions this.onDismiss = onDismiss hidden = false retainCache = false controlActionCoordinator.startedFromGlobalActions = startedFromGlobalActions allStructures = controlsController.get().getFavorites() selectedStructure = loadPreference(allStructures) Loading Loading @@ -187,7 +193,7 @@ class ControlsUiControllerImpl @Inject constructor ( controlViewsById.clear() controlsById.clear() show(parent, dismissGlobalActions) show(parent, onDismiss, controlActionCoordinator.startedFromGlobalActions) val showAnim = ObjectAnimator.ofFloat(parent, "alpha", 0.0f, 1.0f) showAnim.setInterpolator(DecelerateInterpolator(1.0f)) showAnim.setDuration(FADE_IN_MILLIS) Loading Loading @@ -260,7 +266,7 @@ class ControlsUiControllerImpl @Inject constructor ( private fun startActivity(context: Context, intent: Intent) { // Force animations when transitioning from a dialog to an activity intent.putExtra(ControlsUiController.EXTRA_ANIMATE, true) dismissGlobalActions.run() onDismiss.run() activityStarter.dismissKeyguardThenExecute({ shadeController.collapsePanel(false) Loading