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

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

Merge changes I940a95b5,Ieacc6e2f,I6c474693 into main

* changes:
  [Media] Color extraction.
  [Media] Background loading improvements.
  [Media] Card carousel, top-level view-model, and interactor interface.
parents f44287b7 626bcf1d
Loading
Loading
Loading
Loading
+38 −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 com.android.systemui.media.remedia.domain.model.MediaSessionModel

/**
 * Defines interface for classes that can provide business logic in the domain of the media controls
 * element.
 */
interface MediaInteractor {

    /** The list of sessions. Needs to be backed by a compose snapshot state. */
    val sessions: List<MediaSessionModel>

    /** Seek to [to], in milliseconds on the media session with the given [sessionKey]. */
    fun seek(sessionKey: Any, to: Long)

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

    /** Open media settings. */
    fun openMediaSettings()
}
+27 −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.model

import com.android.systemui.common.shared.model.Icon

sealed interface MediaActionModel {
    data class Action(val icon: Icon, val onClick: (() -> Unit)?) : MediaActionModel

    data object ReserveSpace : MediaActionModel

    data object None : MediaActionModel
}
+21 −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.model

import com.android.systemui.common.shared.model.Icon

data class MediaOutputDeviceModel(val name: String, val icon: Icon, val isInProgress: Boolean)
+77 −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.model

import androidx.compose.runtime.Stable
import androidx.compose.ui.graphics.ImageBitmap
import com.android.systemui.common.shared.model.Icon
import com.android.systemui.media.remedia.shared.model.MediaCardActionButtonLayout
import com.android.systemui.media.remedia.shared.model.MediaColorScheme
import com.android.systemui.media.remedia.shared.model.MediaSessionState

/** Data model representing a media session. */
@Stable
interface MediaSessionModel {
    /** Unique identifier. */
    val key: Any

    val appName: String

    val appIcon: Icon

    val background: ImageBitmap?

    val colorScheme: MediaColorScheme

    val title: String

    val subtitle: String

    val onClick: () -> Unit

    /**
     * Whether the session is currently active. Under some UIs, only currently active session should
     * be shown.
     */
    val isActive: Boolean

    /** Whether the session can be hidden/dismissed by the user. */
    val canBeHidden: Boolean

    /**
     * Whether the session currently supports scrubbing (e.g. moving to a different position iin the
     * playback.
     */
    val canBeScrubbed: Boolean

    val state: MediaSessionState

    /** The position of the playback within the current track. */
    val positionMs: Long

    /** The total duration of the current track. */
    val durationMs: Long

    val outputDevice: MediaOutputDeviceModel

    /** How to lay out the action buttons. */
    val actionButtonLayout: MediaCardActionButtonLayout
    val playPauseAction: MediaActionModel
    val leftAction: MediaActionModel
    val rightAction: MediaActionModel
    val additionalActions: List<MediaActionModel.Action>
}
+23 −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.shared.model

enum class MediaActionState {
    Enabled,
    Disabled,
    Hidden,
}
Loading