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

Commit 24062080 authored by Beth Thibodeau's avatar Beth Thibodeau Committed by Automerger Merge Worker
Browse files

Format media control files am: 0d8858f2

parents fc817591 0d8858f2
Loading
Loading
Loading
Loading
+0 −57
Original line number Diff line number Diff line
@@ -189,45 +189,8 @@
-packages/SystemUI/src/com/android/systemui/log/LogcatEchoTracker.kt
-packages/SystemUI/src/com/android/systemui/log/LogcatEchoTrackerDebug.kt
-packages/SystemUI/src/com/android/systemui/log/LogcatEchoTrackerProd.kt
-packages/SystemUI/src/com/android/systemui/media/AnimationBindHandler.kt
-packages/SystemUI/src/com/android/systemui/media/ColorSchemeTransition.kt
-packages/SystemUI/src/com/android/systemui/media/GutsViewHolder.kt
-packages/SystemUI/src/com/android/systemui/media/IlluminationDrawable.kt
-packages/SystemUI/src/com/android/systemui/media/KeyguardMediaController.kt
-packages/SystemUI/src/com/android/systemui/media/LightSourceDrawable.kt
-packages/SystemUI/src/com/android/systemui/media/LocalMediaManagerFactory.kt
-packages/SystemUI/src/com/android/systemui/media/MediaCarouselController.kt
-packages/SystemUI/src/com/android/systemui/media/MediaCarouselControllerLogger.kt
-packages/SystemUI/src/com/android/systemui/media/MediaCarouselScrollHandler.kt
-packages/SystemUI/src/com/android/systemui/media/MediaData.kt
-packages/SystemUI/src/com/android/systemui/media/MediaDataCombineLatest.kt
-packages/SystemUI/src/com/android/systemui/media/MediaDataFilter.kt
-packages/SystemUI/src/com/android/systemui/media/MediaDataManager.kt
-packages/SystemUI/src/com/android/systemui/media/MediaDeviceManager.kt
-packages/SystemUI/src/com/android/systemui/media/MediaFeatureFlag.kt
-packages/SystemUI/src/com/android/systemui/media/MediaFlags.kt
-packages/SystemUI/src/com/android/systemui/media/MediaHierarchyManager.kt
-packages/SystemUI/src/com/android/systemui/media/MediaHost.kt
-packages/SystemUI/src/com/android/systemui/media/MediaHostStatesManager.kt
-packages/SystemUI/src/com/android/systemui/media/MediaProjectionAppSelectorActivity.kt
-packages/SystemUI/src/com/android/systemui/media/MediaProjectionCaptureTarget.kt
-packages/SystemUI/src/com/android/systemui/media/MediaResumeListener.kt
-packages/SystemUI/src/com/android/systemui/media/MediaScrollView.kt
-packages/SystemUI/src/com/android/systemui/media/MediaSessionBasedFilter.kt
-packages/SystemUI/src/com/android/systemui/media/MediaTimeoutListener.kt
-packages/SystemUI/src/com/android/systemui/media/MediaTimeoutLogger.kt
-packages/SystemUI/src/com/android/systemui/media/MediaUiEventLogger.kt
-packages/SystemUI/src/com/android/systemui/media/MediaViewController.kt
-packages/SystemUI/src/com/android/systemui/media/MediaViewHolder.kt
-packages/SystemUI/src/com/android/systemui/media/MediaViewLogger.kt
-packages/SystemUI/src/com/android/systemui/media/MetadataAnimationHandler.kt
-packages/SystemUI/src/com/android/systemui/media/RecommendationViewHolder.kt
-packages/SystemUI/src/com/android/systemui/media/ResumeMediaBrowserLogger.kt
-packages/SystemUI/src/com/android/systemui/media/SeekBarObserver.kt
-packages/SystemUI/src/com/android/systemui/media/SeekBarViewModel.kt
-packages/SystemUI/src/com/android/systemui/media/SmartspaceMediaData.kt
-packages/SystemUI/src/com/android/systemui/media/SmartspaceMediaDataProvider.kt
-packages/SystemUI/src/com/android/systemui/media/SquigglyProgress.kt
-packages/SystemUI/src/com/android/systemui/media/dagger/MediaProjectionModule.kt
-packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputBroadcastDialogFactory.kt
-packages/SystemUI/src/com/android/systemui/media/dialog/MediaOutputDialogFactory.kt
@@ -653,26 +616,6 @@
-packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardUnlockAnimationControllerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/lifecycle/InstantTaskExecutorRule.kt
-packages/SystemUI/tests/src/com/android/systemui/log/LogBufferTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/AnimationBindHandlerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/ColorSchemeTransitionTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/KeyguardMediaControllerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/MediaCarouselControllerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/MediaControlPanelTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/MediaDataFilterTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/MediaDataManagerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/MediaDeviceManagerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/MediaHierarchyManagerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/MediaPlayerDataTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/MediaResumeListenerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/MediaSessionBasedFilterTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/MediaTestUtils.kt
-packages/SystemUI/tests/src/com/android/systemui/media/MediaTimeoutListenerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/MetadataAnimationHandlerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/ResumeMediaBrowserTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/SeekBarObserverTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/SeekBarViewModelTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/SmartspaceMediaDataTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/SquigglyProgressTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/muteawait/MediaMuteAwaitConnectionManagerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/nearby/NearbyMediaDevicesManagerTest.kt
-packages/SystemUI/tests/src/com/android/systemui/media/taptotransfer/MediaTttCommandLineHelperTest.kt
+1 −6
Original line number Diff line number Diff line
@@ -98,11 +98,6 @@ class GutsViewHolder constructor(itemView: View) {
    }

    companion object {
        val ids = setOf(
            R.id.remove_text,
            R.id.cancel,
            R.id.dismiss,
            R.id.settings
        )
        val ids = setOf(R.id.remove_text, R.id.cancel, R.id.dismiss, R.id.settings)
    }
}
+35 −87
Original line number Diff line number Diff line
@@ -27,69 +27,42 @@ import com.android.systemui.R
data class MediaData(
    val userId: Int,
    val initialized: Boolean = false,
    /**
     * App name that will be displayed on the player.
     */
    /** App name that will be displayed on the player. */
    val app: String?,
    /**
     * App icon shown on player.
     */
    /** App icon shown on player. */
    val appIcon: Icon?,
    /**
     * Artist name.
     */
    /** Artist name. */
    val artist: CharSequence?,
    /**
     * Song name.
     */
    /** Song name. */
    val song: CharSequence?,
    /**
     * Album artwork.
     */
    /** Album artwork. */
    val artwork: Icon?,
    /**
     * List of generic action buttons for the media player, based on notification actions
     */
    /** List of generic action buttons for the media player, based on notification actions */
    val actions: List<MediaAction>,
    /**
     * Same as above, but shown on smaller versions of the player, like in QQS or keyguard.
     */
    /** Same as above, but shown on smaller versions of the player, like in QQS or keyguard. */
    val actionsToShowInCompact: List<Int>,
    /**
     * Semantic actions buttons, based on the PlaybackState of the media session.
     * If present, these actions will be preferred in the UI over [actions]
     * Semantic actions buttons, based on the PlaybackState of the media session. If present, these
     * actions will be preferred in the UI over [actions]
     */
    val semanticActions: MediaButton? = null,
    /**
     * Package name of the app that's posting the media.
     */
    /** Package name of the app that's posting the media. */
    val packageName: String,
    /**
     * Unique media session identifier.
     */
    /** Unique media session identifier. */
    val token: MediaSession.Token?,
    /**
     * Action to perform when the player is tapped.
     * This is unrelated to {@link #actions}.
     */
    /** Action to perform when the player is tapped. This is unrelated to {@link #actions}. */
    val clickIntent: PendingIntent?,
    /**
     * Where the media is playing: phone, headphones, ear buds, remote session.
     */
    /** Where the media is playing: phone, headphones, ear buds, remote session. */
    val device: MediaDeviceData?,
    /**
     * When active, a player will be displayed on keyguard and quick-quick settings.
     * This is unrelated to the stream being playing or not, a player will not be active if
     * timed out, or in resumption mode.
     * When active, a player will be displayed on keyguard and quick-quick settings. This is
     * unrelated to the stream being playing or not, a player will not be active if timed out, or in
     * resumption mode.
     */
    var active: Boolean,
    /**
     * Action that should be performed to restart a non active session.
     */
    /** Action that should be performed to restart a non active session. */
    var resumeAction: Runnable?,
    /**
     * Playback location: one of PLAYBACK_LOCAL, PLAYBACK_CAST_LOCAL, or PLAYBACK_CAST_REMOTE
     */
    /** Playback location: one of PLAYBACK_LOCAL, PLAYBACK_CAST_LOCAL, or PLAYBACK_CAST_REMOTE */
    var playbackLocation: Int = PLAYBACK_LOCAL,
    /**
     * Indicates that this player is a resumption player (ie. It only shows a play actions which
@@ -102,29 +75,19 @@ data class MediaData(
    val notificationKey: String? = null,
    var hasCheckedForResume: Boolean = false,

    /**
     * If apps do not report PlaybackState, set as null to imply 'undetermined'
     */
    /** If apps do not report PlaybackState, set as null to imply 'undetermined' */
    val isPlaying: Boolean? = null,

    /**
     * Set from the notification and used as fallback when PlaybackState cannot be determined
     */
    /** Set from the notification and used as fallback when PlaybackState cannot be determined */
    val isClearable: Boolean = true,

    /**
     * Timestamp when this player was last active.
     */
    /** Timestamp when this player was last active. */
    var lastActive: Long = 0L,

    /**
     * Instance ID for logging purposes
     */
    /** Instance ID for logging purposes */
    val instanceId: InstanceId,

    /**
     * The UID of the app, used for logging
     */
    /** The UID of the app, used for logging */
    val appUid: Int
) {
    companion object {
@@ -141,37 +104,21 @@ data class MediaData(
    }
}

/**
 * Contains [MediaAction] objects which represent specific buttons in the UI
 */
/** Contains [MediaAction] objects which represent specific buttons in the UI */
data class MediaButton(
    /**
     * Play/pause button
     */
    /** Play/pause button */
    val playOrPause: MediaAction? = null,
    /**
     * Next button, or custom action
     */
    /** Next button, or custom action */
    val nextOrCustom: MediaAction? = null,
    /**
     * Previous button, or custom action
     */
    /** Previous button, or custom action */
    val prevOrCustom: MediaAction? = null,
    /**
     * First custom action space
     */
    /** First custom action space */
    val custom0: MediaAction? = null,
    /**
     * Second custom action space
     */
    /** Second custom action space */
    val custom1: MediaAction? = null,
    /**
     * Whether to reserve the empty space when the nextOrCustom is null
     */
    /** Whether to reserve the empty space when the nextOrCustom is null */
    val reserveNext: Boolean = false,
    /**
     * Whether to reserve the empty space when the prevOrCustom is null
     */
    /** Whether to reserve the empty space when the prevOrCustom is null */
    val reservePrev: Boolean = false
) {
    fun getActionById(id: Int): MediaAction? {
@@ -201,7 +148,8 @@ data class MediaAction(

/** State of the media device. */
data class MediaDeviceData
@JvmOverloads constructor(
@JvmOverloads
constructor(
    /** Whether or not to enable the chip */
    val enabled: Boolean,

@@ -221,8 +169,8 @@ data class MediaDeviceData
    val showBroadcastButton: Boolean
) {
    /**
     * Check whether [MediaDeviceData] objects are equal in all fields except the icon. The icon
     * is ignored because it can change by reference frequently depending on the device type's
     * Check whether [MediaDeviceData] objects are equal in all fields except the icon. The icon is
     * ignored because it can change by reference frequently depending on the device type's
     * implementation, but this is not usually relevant unless other info has changed
     */
    fun equalsWithoutIcon(other: MediaDeviceData?): Boolean {
+23 −39
Original line number Diff line number Diff line
@@ -30,9 +30,7 @@ import com.android.systemui.util.animation.TransitionLayout

private const val TAG = "MediaViewHolder"

/**
 * Holder class for media player view
 */
/** Holder class for media player view */
class MediaViewHolder constructor(itemView: View) {
    val player = itemView as TransitionLayout

@@ -53,8 +51,7 @@ class MediaViewHolder constructor(itemView: View) {
    // These views are only shown while the user is actively scrubbing
    val scrubbingElapsedTimeView: TextView =
        itemView.requireViewById(R.id.media_scrubbing_elapsed_time)
    val scrubbingTotalTimeView: TextView =
        itemView.requireViewById(R.id.media_scrubbing_total_time)
    val scrubbingTotalTimeView: TextView = itemView.requireViewById(R.id.media_scrubbing_total_time)

    val gutsViewHolder = GutsViewHolder(itemView)

@@ -87,15 +84,7 @@ class MediaViewHolder constructor(itemView: View) {
    }

    fun getTransparentActionButtons(): List<ImageButton> {
        return listOf(
                actionNext,
                actionPrev,
                action0,
                action1,
                action2,
                action3,
                action4
        )
        return listOf(actionNext, actionPrev, action0, action1, action2, action3, action4)
    }

    fun marquee(start: Boolean, delay: Long) {
@@ -109,10 +98,8 @@ class MediaViewHolder constructor(itemView: View) {
         * @param inflater LayoutInflater to use to inflate the layout.
         * @param parent Parent of inflated view.
         */
        @JvmStatic fun create(
            inflater: LayoutInflater,
            parent: ViewGroup
        ): MediaViewHolder {
        @JvmStatic
        fun create(inflater: LayoutInflater, parent: ViewGroup): MediaViewHolder {
            val mediaView = inflater.inflate(R.layout.media_session_view, parent, false)
            mediaView.setLayerType(View.LAYER_TYPE_HARDWARE, null)
            // Because this media view (a TransitionLayout) is used to measure and layout the views
@@ -125,7 +112,8 @@ class MediaViewHolder constructor(itemView: View) {
            }
        }

        val controlsIds = setOf(
        val controlsIds =
            setOf(
                R.id.icon,
                R.id.app_name,
                R.id.header_title,
@@ -146,15 +134,11 @@ class MediaViewHolder constructor(itemView: View) {
            )

        // Buttons used for notification-based actions
        val genericButtonIds = setOf(
            R.id.action0,
            R.id.action1,
            R.id.action2,
            R.id.action3,
            R.id.action4
        )
        val genericButtonIds =
            setOf(R.id.action0, R.id.action1, R.id.action2, R.id.action3, R.id.action4)

        val expandedBottomActionIds = setOf(
        val expandedBottomActionIds =
            setOf(
                R.id.actionPrev,
                R.id.actionNext,
                R.id.action0,
+54 −32
Original line number Diff line number Diff line
@@ -31,34 +31,49 @@ import com.android.systemui.media.controls.ui.SquigglyProgress
 *
 * <p>Updates the seek bar views in response to changes to the model.
 */
open class SeekBarObserver(
    private val holder: MediaViewHolder
) : Observer<SeekBarViewModel.Progress> {
open class SeekBarObserver(private val holder: MediaViewHolder) :
    Observer<SeekBarViewModel.Progress> {

    companion object {
        @JvmStatic val RESET_ANIMATION_DURATION_MS: Int = 750
        @JvmStatic val RESET_ANIMATION_THRESHOLD_MS: Int = 250
    }

    val seekBarEnabledMaxHeight = holder.seekBar.context.resources
        .getDimensionPixelSize(R.dimen.qs_media_enabled_seekbar_height)
    val seekBarDisabledHeight = holder.seekBar.context.resources
        .getDimensionPixelSize(R.dimen.qs_media_disabled_seekbar_height)
    val seekBarEnabledVerticalPadding = holder.seekBar.context.resources
                .getDimensionPixelSize(R.dimen.qs_media_session_enabled_seekbar_vertical_padding)
    val seekBarDisabledVerticalPadding = holder.seekBar.context.resources
                .getDimensionPixelSize(R.dimen.qs_media_session_disabled_seekbar_vertical_padding)
    val seekBarEnabledMaxHeight =
        holder.seekBar.context.resources.getDimensionPixelSize(
            R.dimen.qs_media_enabled_seekbar_height
        )
    val seekBarDisabledHeight =
        holder.seekBar.context.resources.getDimensionPixelSize(
            R.dimen.qs_media_disabled_seekbar_height
        )
    val seekBarEnabledVerticalPadding =
        holder.seekBar.context.resources.getDimensionPixelSize(
            R.dimen.qs_media_session_enabled_seekbar_vertical_padding
        )
    val seekBarDisabledVerticalPadding =
        holder.seekBar.context.resources.getDimensionPixelSize(
            R.dimen.qs_media_session_disabled_seekbar_vertical_padding
        )
    var seekBarResetAnimator: Animator? = null

    init {
        val seekBarProgressWavelength = holder.seekBar.context.resources
                .getDimensionPixelSize(R.dimen.qs_media_seekbar_progress_wavelength).toFloat()
        val seekBarProgressAmplitude = holder.seekBar.context.resources
                .getDimensionPixelSize(R.dimen.qs_media_seekbar_progress_amplitude).toFloat()
        val seekBarProgressPhase = holder.seekBar.context.resources
                .getDimensionPixelSize(R.dimen.qs_media_seekbar_progress_phase).toFloat()
        val seekBarProgressStrokeWidth = holder.seekBar.context.resources
                .getDimensionPixelSize(R.dimen.qs_media_seekbar_progress_stroke_width).toFloat()
        val seekBarProgressWavelength =
            holder.seekBar.context.resources
                .getDimensionPixelSize(R.dimen.qs_media_seekbar_progress_wavelength)
                .toFloat()
        val seekBarProgressAmplitude =
            holder.seekBar.context.resources
                .getDimensionPixelSize(R.dimen.qs_media_seekbar_progress_amplitude)
                .toFloat()
        val seekBarProgressPhase =
            holder.seekBar.context.resources
                .getDimensionPixelSize(R.dimen.qs_media_seekbar_progress_phase)
                .toFloat()
        val seekBarProgressStrokeWidth =
            holder.seekBar.context.resources
                .getDimensionPixelSize(R.dimen.qs_media_seekbar_progress_stroke_width)
                .toFloat()
        val progressDrawable = holder.seekBar.progressDrawable as? SquigglyProgress
        progressDrawable?.let {
            it.waveLength = seekBarProgressWavelength
@@ -98,16 +113,18 @@ open class SeekBarObserver(
        }

        holder.seekBar.setMax(data.duration)
        val totalTimeString = DateUtils.formatElapsedTime(
            data.duration / DateUtils.SECOND_IN_MILLIS)
        val totalTimeString =
            DateUtils.formatElapsedTime(data.duration / DateUtils.SECOND_IN_MILLIS)
        if (data.scrubbing) {
            holder.scrubbingTotalTimeView.text = totalTimeString
        }

        data.elapsedTime?.let {
            if (!data.scrubbing && !(seekBarResetAnimator?.isRunning ?: false)) {
                if (it <= RESET_ANIMATION_THRESHOLD_MS &&
                        holder.seekBar.progress > RESET_ANIMATION_THRESHOLD_MS) {
                if (
                    it <= RESET_ANIMATION_THRESHOLD_MS &&
                        holder.seekBar.progress > RESET_ANIMATION_THRESHOLD_MS
                ) {
                    // This animation resets for every additional update to zero.
                    val animator = buildResetAnimator(it)
                    animator.start()
@@ -117,13 +134,13 @@ open class SeekBarObserver(
                }
            }

            val elapsedTimeString = DateUtils.formatElapsedTime(
                it / DateUtils.SECOND_IN_MILLIS)
            val elapsedTimeString = DateUtils.formatElapsedTime(it / DateUtils.SECOND_IN_MILLIS)
            if (data.scrubbing) {
                holder.scrubbingElapsedTimeView.text = elapsedTimeString
            }

            holder.seekBar.contentDescription = holder.seekBar.context.getString(
            holder.seekBar.contentDescription =
                holder.seekBar.context.getString(
                    R.string.controls_media_seekbar_description,
                    elapsedTimeString,
                    totalTimeString
@@ -133,8 +150,13 @@ open class SeekBarObserver(

    @VisibleForTesting
    open fun buildResetAnimator(targetTime: Int): Animator {
        val animator = ObjectAnimator.ofInt(holder.seekBar, "progress",
                holder.seekBar.progress, targetTime + RESET_ANIMATION_DURATION_MS)
        val animator =
            ObjectAnimator.ofInt(
                holder.seekBar,
                "progress",
                holder.seekBar.progress,
                targetTime + RESET_ANIMATION_DURATION_MS
            )
        animator.setAutoCancel(true)
        animator.duration = RESET_ANIMATION_DURATION_MS.toLong()
        animator.interpolator = Interpolators.EMPHASIZED
Loading