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

Commit e7b906b6 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[Chipbar] Remove the media-specific window title from...

Merge "[Chipbar] Remove the media-specific window title from TemporaryViewDisplayController." into tm-qpr-dev
parents 1e345178 d4f3dee0
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -26,6 +26,10 @@ import com.android.systemui.R
/** Utility methods for media tap-to-transfer. */
class MediaTttUtils {
    companion object {
        // Used in CTS tests UpdateMediaTapToTransferSenderDisplayTest and
        // UpdateMediaTapToTransferReceiverDisplayTest
        const val WINDOW_TITLE = "Media Transfer Chip View"

        /**
         * Returns the information needed to display the icon.
         *
+1 −0
Original line number Diff line number Diff line
@@ -71,6 +71,7 @@ class MediaTttChipControllerReceiver @Inject constructor(
        configurationController,
        powerManager,
        R.layout.media_ttt_chip_receiver,
        MediaTttUtils.WINDOW_TITLE,
) {
    @SuppressLint("WrongConstant") // We're allowed to use LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS
    override val windowLayoutParams = commonWindowLayoutParams.apply {
+1 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ class MediaTttChipControllerSender @Inject constructor(
        configurationController,
        powerManager,
        R.layout.media_ttt_chip,
        MediaTttUtils.WINDOW_TITLE,
) {
    override val windowLayoutParams = commonWindowLayoutParams.apply {
        gravity = Gravity.TOP.or(Gravity.CENTER_HORIZONTAL)
+5 −5
Original line number Diff line number Diff line
@@ -46,6 +46,9 @@ import com.android.systemui.util.concurrency.DelayableExecutor
 * display the view in a certain state, since they receive <T> in [updateView].
 *
 * TODO(b/245610654): Remove all the media-specific logic from this class.
 *
 * @property windowTitle the title to use for the window that displays the temporary view. Should be
 *   normally cased, like "Window Title".
 */
abstract class TemporaryViewDisplayController<T : TemporaryViewInfo>(
    internal val context: Context,
@@ -56,6 +59,7 @@ abstract class TemporaryViewDisplayController<T : TemporaryViewInfo>(
    private val configurationController: ConfigurationController,
    private val powerManager: PowerManager,
    @LayoutRes private val viewLayoutRes: Int,
    private val windowTitle: String,
) {
    /**
     * Window layout params that will be used as a starting point for the [windowLayoutParams] of
@@ -67,7 +71,7 @@ abstract class TemporaryViewDisplayController<T : TemporaryViewInfo>(
        height = WindowManager.LayoutParams.WRAP_CONTENT
        type = WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY
        flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
        title = WINDOW_TITLE
        title = windowTitle
        format = PixelFormat.TRANSLUCENT
        setTrustedOverlay()
    }
@@ -189,10 +193,6 @@ abstract class TemporaryViewDisplayController<T : TemporaryViewInfo>(
    open fun animateViewIn(view: ViewGroup) {}
}

// Used in CTS tests UpdateMediaTapToTransferSenderDisplayTest and
// UpdateMediaTapToTransferReceiverDisplayTest
private const val WINDOW_TITLE = "Media Transfer Chip View"

object TemporaryDisplayRemovalReason {
    const val REASON_TIMEOUT = "TIMEOUT"
    const val REASON_SCREEN_TAP = "SCREEN_TAP"
+1 −0
Original line number Diff line number Diff line
@@ -231,6 +231,7 @@ class TemporaryViewDisplayControllerTest : SysuiTestCase() {
        configurationController,
        powerManager,
        R.layout.media_ttt_chip,
        "Window Title",
    ) {
        var mostRecentViewInfo: ViewInfo? = null