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

Commit ad6b846c authored by Beth Thibodeau's avatar Beth Thibodeau Committed by Android (Google) Code Review
Browse files

Merge "Check for progress info from resume controls" into tm-qpr-dev

parents a502a821 dd6ab19b
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -361,6 +361,9 @@ object Flags {
    @JvmField
    val MEDIA_RECOMMENDATION_CARD_UPDATE = unreleasedFlag(914, "media_recommendation_card_update")

    // TODO(b/267007629): Tracking Bug
    val MEDIA_RESUME_PROGRESS = unreleasedFlag(915, "media_resume_progress")

    // 1000 - dock
    val SIMULATE_DOCK_THROUGH_CHARGING = releasedFlag(1000, "simulate_dock_through_charging")

+3 −0
Original line number Diff line number Diff line
@@ -92,6 +92,9 @@ data class MediaData(

    /** Whether explicit indicator exists */
    val isExplicit: Boolean = false,

    /** Track progress (0 - 1) to display for players where [resumption] is true */
    val resumeProgress: Double? = null,
) {
    companion object {
        /** Media is playing on the local device */
+18 −0
Original line number Diff line number Diff line
@@ -237,6 +237,24 @@ constructor(
        checkIfPollingNeeded()
    }

    /**
     * Set the progress to a fixed percentage value that cannot be changed by the user.
     *
     * @param percent value between 0 and 1
     */
    fun updateStaticProgress(percent: Double) {
        val position = (percent * 100).toInt()
        _data =
            Progress(
                enabled = true,
                seekAvailable = false,
                playing = false,
                scrubbing = false,
                elapsedTime = position,
                duration = 100,
            )
    }

    /**
     * Puts the seek bar into a resumption state.
     *
+7 −0
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ import com.android.systemui.media.controls.models.recommendation.SmartspaceMedia
import com.android.systemui.media.controls.models.recommendation.SmartspaceMediaDataProvider
import com.android.systemui.media.controls.resume.MediaResumeListener
import com.android.systemui.media.controls.util.MediaControllerFactory
import com.android.systemui.media.controls.util.MediaDataUtils
import com.android.systemui.media.controls.util.MediaFlags
import com.android.systemui.media.controls.util.MediaUiEventLogger
import com.android.systemui.plugins.ActivityStarter
@@ -667,6 +668,11 @@ class MediaDataManager(
                MediaConstants.METADATA_VALUE_ATTRIBUTE_PRESENT &&
                mediaFlags.isExplicitIndicatorEnabled()

        val progress =
            if (mediaFlags.isResumeProgressEnabled()) {
                MediaDataUtils.getDescriptionProgress(desc.extras)
            } else null

        val mediaAction = getResumeMediaAction(resumeAction)
        val lastActive = systemClock.elapsedRealtime()
        foregroundExecutor.execute {
@@ -697,6 +703,7 @@ class MediaDataManager(
                    instanceId = instanceId,
                    appUid = appUid,
                    isExplicit = isExplicit,
                    resumeProgress = progress,
                )
            )
        }
+8 −4
Original line number Diff line number Diff line
@@ -115,8 +115,6 @@ import com.android.systemui.util.animation.TransitionLayout;
import com.android.systemui.util.concurrency.DelayableExecutor;
import com.android.systemui.util.time.SystemClock;

import dagger.Lazy;

import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.List;
@@ -124,6 +122,7 @@ import java.util.concurrent.Executor;

import javax.inject.Inject;

import dagger.Lazy;
import kotlin.Triple;
import kotlin.Unit;

@@ -523,8 +522,13 @@ public class MediaControlPanel {
        }

        // Seek Bar
        if (data.getResumption() && data.getResumeProgress() != null) {
            double progress = data.getResumeProgress();
            mSeekBarViewModel.updateStaticProgress(progress);
        } else {
            final MediaController controller = getController();
            mBackgroundExecutor.execute(() -> mSeekBarViewModel.updateController(controller));
        }

        // Show the broadcast dialog button only when the le audio is enabled.
        mShowBroadcastDialogButton =
Loading