Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 188d7273 authored by Matt Pietal's avatar Matt Pietal Committed by Automerger Merge Worker
Browse files

Merge "Controls UI - Remove focused control" into rvc-dev am: bf8d4b44 am:...

Merge "Controls UI - Remove focused control" into rvc-dev am: bf8d4b44 am: bca99609 am: 44a07dfa am: fd7c8424

Change-Id: I12da8e1a44a3b9a9d260580b852167d1326fea70
parents 55ad0a83 fd7c8424
Loading
Loading
Loading
Loading
+0 −8
Original line number Original line Diff line number Diff line
@@ -23,7 +23,6 @@ import android.service.controls.actions.ControlAction
import com.android.systemui.controls.ControlStatus
import com.android.systemui.controls.ControlStatus
import com.android.systemui.controls.UserAwareController
import com.android.systemui.controls.UserAwareController
import com.android.systemui.controls.management.ControlsFavoritingActivity
import com.android.systemui.controls.management.ControlsFavoritingActivity
import com.android.systemui.controls.ui.ControlWithState
import com.android.systemui.controls.ui.ControlsUiController
import com.android.systemui.controls.ui.ControlsUiController
import java.util.function.Consumer
import java.util.function.Consumer


@@ -110,13 +109,6 @@ interface ControlsController : UserAwareController {
        @ControlAction.ResponseResult response: Int
        @ControlAction.ResponseResult response: Int
    )
    )


    /**
     * When a control should be highlighted, dimming down what's around it.
     *
     * @param cws focused control, or {@code null} if nothing should be highlighted.
     */
    fun onFocusChanged(cws: ControlWithState?)

    // FAVORITE MANAGEMENT
    // FAVORITE MANAGEMENT


    /**
    /**
+0 −5
Original line number Original line Diff line number Diff line
@@ -41,7 +41,6 @@ import com.android.systemui.broadcast.BroadcastDispatcher
import com.android.systemui.controls.ControlStatus
import com.android.systemui.controls.ControlStatus
import com.android.systemui.controls.ControlsServiceInfo
import com.android.systemui.controls.ControlsServiceInfo
import com.android.systemui.controls.management.ControlsListingController
import com.android.systemui.controls.management.ControlsListingController
import com.android.systemui.controls.ui.ControlWithState
import com.android.systemui.controls.ui.ControlsUiController
import com.android.systemui.controls.ui.ControlsUiController
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dagger.qualifiers.Background
import com.android.systemui.dump.DumpManager
import com.android.systemui.dump.DumpManager
@@ -500,10 +499,6 @@ class ControlsControllerImpl @Inject constructor (
        }
        }
    }
    }


    override fun onFocusChanged(cws: ControlWithState?) {
        uiController.onFocusChanged(cws)
    }

    override fun refreshStatus(componentName: ComponentName, control: Control) {
    override fun refreshStatus(componentName: ComponentName, control: Control) {
        if (!confirmAvailability()) {
        if (!confirmAvailability()) {
            Log.d(TAG, "Controls not available")
            Log.d(TAG, "Controls not available")
+0 −5
Original line number Original line Diff line number Diff line
@@ -59,9 +59,4 @@ interface ControlActionCoordinator {
     * retain context with their favorited controls in the power menu.
     * retain context with their favorited controls in the power menu.
     */
     */
    fun longPress(cvh: ControlViewHolder)
    fun longPress(cvh: ControlViewHolder)

    /**
     * Event to inform the UI that the user has has focused on a single control.
     */
    fun setFocusedElement(cvh: ControlViewHolder?)
}
}
+0 −8
Original line number Original line Diff line number Diff line
@@ -26,14 +26,11 @@ import android.service.controls.actions.BooleanAction
import android.service.controls.actions.CommandAction
import android.service.controls.actions.CommandAction
import android.util.Log
import android.util.Log
import android.view.HapticFeedbackConstants
import android.view.HapticFeedbackConstants
import com.android.systemui.controls.controller.ControlsController
import com.android.systemui.globalactions.GlobalActionsComponent
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 dagger.Lazy

import javax.inject.Inject
import javax.inject.Inject
import javax.inject.Singleton
import javax.inject.Singleton


@@ -41,7 +38,6 @@ import javax.inject.Singleton
class ControlActionCoordinatorImpl @Inject constructor(
class ControlActionCoordinatorImpl @Inject constructor(
    private val context: Context,
    private val context: Context,
    private val bgExecutor: DelayableExecutor,
    private val bgExecutor: DelayableExecutor,
    private val controlsController: Lazy<ControlsController>,
    private val activityStarter: ActivityStarter,
    private val activityStarter: ActivityStarter,
    private val keyguardStateController: KeyguardStateController,
    private val keyguardStateController: KeyguardStateController,
    private val globalActionsComponent: GlobalActionsComponent
    private val globalActionsComponent: GlobalActionsComponent
@@ -95,10 +91,6 @@ class ControlActionCoordinatorImpl @Inject constructor(
        }
        }
    }
    }


    override fun setFocusedElement(cvh: ControlViewHolder?) {
        controlsController.get().onFocusChanged(cvh?.cws)
    }

    private fun bouncerOrRun(f: () -> Unit) {
    private fun bouncerOrRun(f: () -> Unit) {
        if (!keyguardStateController.isUnlocked()) {
        if (!keyguardStateController.isUnlocked()) {
            context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS))
            context.sendBroadcast(Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS))
+2 −10
Original line number Original line Diff line number Diff line
@@ -73,8 +73,6 @@ class ControlViewHolder(


    private val toggleBackgroundIntensity: Float = layout.context.resources
    private val toggleBackgroundIntensity: Float = layout.context.resources
            .getFraction(R.fraction.controls_toggle_bg_intensity, 1, 1)
            .getFraction(R.fraction.controls_toggle_bg_intensity, 1, 1)
    private val dimmedAlpha: Float = layout.context.resources
            .getFraction(R.fraction.controls_dimmed_alpha, 1, 1)
    private var stateAnimator: ValueAnimator? = null
    private var stateAnimator: ValueAnimator? = null
    private val baseLayer: GradientDrawable
    private val baseLayer: GradientDrawable
    val icon: ImageView = layout.requireViewById(R.id.icon)
    val icon: ImageView = layout.requireViewById(R.id.icon)
@@ -91,11 +89,6 @@ class ControlViewHolder(


    val deviceType: Int
    val deviceType: Int
        get() = cws.control?.let { it.getDeviceType() } ?: cws.ci.deviceType
        get() = cws.control?.let { it.getDeviceType() } ?: cws.ci.deviceType
    var dimmed: Boolean = false
        set(value) {
            field = value
            bindData(cws)
        }


    init {
    init {
        val ld = layout.getBackground() as LayerDrawable
        val ld = layout.getBackground() as LayerDrawable
@@ -222,7 +215,6 @@ class ControlViewHolder(


        val fg = context.resources.getColorStateList(ri.foreground, context.theme)
        val fg = context.resources.getColorStateList(ri.foreground, context.theme)
        val bg = context.resources.getColor(R.color.control_default_background, context.theme)
        val bg = context.resources.getColor(R.color.control_default_background, context.theme)
        val dimAlpha = if (dimmed) dimmedAlpha else 1f
        var (newClipColor, newAlpha) = if (enabled) {
        var (newClipColor, newAlpha) = if (enabled) {
            // allow color overrides for the enabled state only
            // allow color overrides for the enabled state only
            val color = cws.control?.getCustomColor()?.let {
            val color = cws.control?.getCustomColor()?.let {
@@ -269,7 +261,7 @@ class ControlViewHolder(
                        setColor(ColorUtils.blendARGB(oldColor, newClipColor, it.animatedFraction))
                        setColor(ColorUtils.blendARGB(oldColor, newClipColor, it.animatedFraction))
                        baseLayer.setColor(ColorUtils.blendARGB(oldBaseColor,
                        baseLayer.setColor(ColorUtils.blendARGB(oldBaseColor,
                                newBaseColor, it.animatedFraction))
                                newBaseColor, it.animatedFraction))
                        layout.alpha = MathUtils.lerp(oldAlpha, dimAlpha, it.animatedFraction)
                        layout.alpha = MathUtils.lerp(oldAlpha, 1f, it.animatedFraction)
                    }
                    }
                    addListener(object : AnimatorListenerAdapter() {
                    addListener(object : AnimatorListenerAdapter() {
                        override fun onAnimationEnd(animation: Animator?) {
                        override fun onAnimationEnd(animation: Animator?) {
@@ -284,7 +276,7 @@ class ControlViewHolder(
                alpha = newAlpha
                alpha = newAlpha
                setColor(newClipColor)
                setColor(newClipColor)
                baseLayer.setColor(newBaseColor)
                baseLayer.setColor(newBaseColor)
                layout.alpha = dimAlpha
                layout.alpha = 1f
            }
            }
        }
        }
    }
    }
Loading