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

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

Merge "Implement media interactor methods" into main

parents dca07755 4e3a5b98
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -17,14 +17,18 @@
package com.android.systemui.media.remedia.domain.interactor

import android.content.Context
import android.content.Intent
import android.provider.Settings
import androidx.compose.ui.graphics.ImageBitmap
import androidx.compose.ui.graphics.asImageBitmap
import com.android.internal.logging.InstanceId
import com.android.systemui.biometrics.Utils.toBitmap
import com.android.systemui.common.shared.model.ContentDescription
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.lifecycle.ExclusiveActivatable
import com.android.systemui.media.controls.domain.pipeline.MediaDataProcessor
import com.android.systemui.media.controls.domain.pipeline.getNotificationActions
import com.android.systemui.media.controls.shared.model.MediaAction
import com.android.systemui.media.remedia.data.model.MediaDataModel
@@ -52,7 +56,7 @@ interface MediaInteractor {
    fun seek(sessionKey: Any, to: Long)

    /** Hide the representation of the media session with the given [sessionKey]. */
    fun hide(sessionKey: Any)
    fun hide(sessionKey: Any, delayMs: Long)

    /** Open media settings. */
    fun openMediaSettings()
@@ -64,6 +68,7 @@ class MediaInteractorImpl
constructor(
    @Application val applicationContext: Context,
    val repository: MediaRepository,
    val mediaDataProcessor: MediaDataProcessor,
    private val activityStarter: ActivityStarter,
) : MediaInteractor, ExclusiveActivatable() {

@@ -71,15 +76,15 @@ constructor(
        get() = repository.currentMedia.map { toMediaSessionModel(it) }

    override fun seek(sessionKey: Any, to: Long) {
        TODO("Not yet implemented")
        repository.seek(sessionKey as InstanceId, to)
    }

    override fun hide(sessionKey: Any) {
        TODO("Not yet implemented")
    override fun hide(sessionKey: Any, delayMs: Long) {
        mediaDataProcessor.dismissMediaData(sessionKey as InstanceId, delayMs, userInitiated = true)
    }

    override fun openMediaSettings() {
        TODO("Not yet implemented")
        activityStarter.startActivity(settingsIntent, true)
    }

    private fun toMediaSessionModel(dataModel: MediaDataModel): MediaSessionModel {
@@ -210,4 +215,8 @@ constructor(
            )
        } ?: MediaActionModel.None
    }

    companion object {
        private val settingsIntent: Intent = Intent(Settings.ACTION_MEDIA_CONTROLS_SETTINGS)
    }
}
+5 −1
Original line number Diff line number Diff line
@@ -163,7 +163,10 @@ constructor(
                                            falsingSystem.runIfNotFalseTap(
                                                FalsingManager.LOW_PENALTY
                                            ) {
                                                interactor.hide(session.key)
                                                interactor.hide(
                                                    session.key,
                                                    MEDIA_PLAYER_ANIMATION_DELAY_MS,
                                                )
                                                isGutsVisible = false
                                            }
                                        },
@@ -387,5 +390,6 @@ constructor(
    companion object {
        private const val OneMinuteInSec = 60
        private const val OneHourInSec = OneMinuteInSec * 60
        private const val MEDIA_PLAYER_ANIMATION_DELAY_MS = 334L
    }
}
+33 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.media.remedia.domain.interactor

import android.content.applicationContext
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.media.controls.domain.pipeline.mediaDataProcessor
import com.android.systemui.media.remedia.data.repository.mediaRepository
import com.android.systemui.plugins.activityStarter

val Kosmos.mediaInteractor by
    Kosmos.Fixture {
        MediaInteractorImpl(
            applicationContext = applicationContext,
            repository = mediaRepository,
            mediaDataProcessor = mediaDataProcessor,
            activityStarter = activityStarter,
        )
    }