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

Commit c0e57b13 authored by Luna Zhang's avatar Luna Zhang Committed by Android (Google) Code Review
Browse files

Merge "Add media input module to desktop's audio details view" into main

parents 13759a57 e8201285
Loading
Loading
Loading
Loading
+44 −0
Original line number Original line 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 Original line 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 Original line Diff line number Diff line
@@ -17,18 +17,21 @@
package com.android.systemui.volume.dialog.domain.interactor
package com.android.systemui.volume.dialog.domain.interactor


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


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

    fun isEnabled(): Boolean {
        return isEnabled
    }
    }
}
}
+35 −0
Original line number Original line 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 Original line 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