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

Commit e8201285 authored by Luna Zhang's avatar Luna Zhang
Browse files

Add media input module to desktop's audio details view

We will display media input information in desktop's audio details view. The UI would look similar as the media output section. This cl only creates a skeleton of the implementation. The actual UI will be added in follow up CLs.

Bug: b/378513663
Test: Manually tested
Flag: com.android.systemui.qs_tile_detailed_view

Change-Id: Ia7bf21f2869f4093fbf15ac505aa5b012f2acb68
parent d52027a4
Loading
Loading
Loading
Loading
+44 −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.volume.panel.component.mediainput

import com.android.systemui.volume.panel.component.mediainput.domain.MediaInputAvailabilityCriteria
import com.android.systemui.volume.panel.component.mediainput.ui.composable.MediaInputComponent
import com.android.systemui.volume.panel.component.shared.model.VolumePanelComponents
import com.android.systemui.volume.panel.domain.ComponentAvailabilityCriteria
import com.android.systemui.volume.panel.shared.model.VolumePanelUiComponent
import dagger.Binds
import dagger.Module
import dagger.multibindings.IntoMap
import dagger.multibindings.StringKey

/** Dagger module, that provides media input Volume Panel UI functionality. */
@Module
interface MediaInputModule {

    @Binds
    @IntoMap
    @StringKey(VolumePanelComponents.MEDIA_INPUT)
    fun bindVolumePanelUiComponent(component: MediaInputComponent): VolumePanelUiComponent

    @Binds
    @IntoMap
    @StringKey(VolumePanelComponents.MEDIA_INPUT)
    fun bindComponentAvailabilityCriteria(
        criteria: MediaInputAvailabilityCriteria
    ): ComponentAvailabilityCriteria
}
+37 −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.volume.panel.component.mediainput.ui.composable

import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import com.android.systemui.volume.panel.component.mediainput.ui.viewmodel.MediaInputViewModel
import com.android.systemui.volume.panel.dagger.scope.VolumePanelScope
import com.android.systemui.volume.panel.ui.composable.ComposeVolumePanelUiComponent
import com.android.systemui.volume.panel.ui.composable.VolumePanelComposeScope
import javax.inject.Inject

@VolumePanelScope
class MediaInputComponent @Inject constructor(private val viewModel: MediaInputViewModel) :
    ComposeVolumePanelUiComponent {

    @Composable
    override fun VolumePanelComposeScope.Content(modifier: Modifier) {
        // TODO(b/378513663): Implement the content of media input component
        Text(text = "Media Input")
    }
}
+7 −4
Original line number Diff line number Diff line
@@ -17,18 +17,21 @@
package com.android.systemui.volume.dialog.domain.interactor

import android.content.Context
import com.android.systemui.dagger.SysUISingleton
import com.android.systemui.dagger.qualifiers.Application
import com.android.systemui.qs.flags.QsDetailedView
import com.android.systemui.res.R
import com.android.systemui.volume.dialog.dagger.scope.VolumeDialogPluginScope
import javax.inject.Inject

@VolumeDialogPluginScope
@SysUISingleton
class DesktopAudioTileDetailsFeatureInteractor
@Inject
constructor(@Application private val context: Context) {
    fun isEnabled(): Boolean {
        return QsDetailedView.isEnabled &&
    private val isEnabled =
        QsDetailedView.isEnabled &&
            context.resources.getBoolean(R.bool.config_enableDesktopAudioTileDetailsView)

    fun isEnabled(): Boolean {
        return isEnabled
    }
}
+35 −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.volume.panel.component.mediainput.domain

import com.android.systemui.volume.dialog.domain.interactor.DesktopAudioTileDetailsFeatureInteractor
import com.android.systemui.volume.panel.dagger.scope.VolumePanelScope
import com.android.systemui.volume.panel.domain.ComponentAvailabilityCriteria
import javax.inject.Inject
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.flowOf

@VolumePanelScope
class MediaInputAvailabilityCriteria
@Inject
constructor(
    private val desktopAudioTileDetailsFeatureInteractor: DesktopAudioTileDetailsFeatureInteractor
) : ComponentAvailabilityCriteria {

    override fun isAvailable(): Flow<Boolean> =
        flowOf(desktopAudioTileDetailsFeatureInteractor.isEnabled())
}
+25 −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.volume.panel.component.mediainput.ui.viewmodel

import com.android.systemui.volume.panel.dagger.scope.VolumePanelScope
import javax.inject.Inject

@VolumePanelScope
class MediaInputViewModel @Inject constructor() {
    // TODO(b/378513663): Implement the content of media input view model
}
Loading