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

Commit 10d9499d authored by Anton Potapov's avatar Anton Potapov Committed by Android (Google) Code Review
Browse files

Merge "Fix spatial audio icons when headtracking is unavailable." into main

parents f8c0f1ab e89fe7ed
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
package com.android.systemui.volume.panel.component.spatialaudio.ui.composable

import android.view.Gravity
import androidx.annotation.VisibleForTesting
import androidx.compose.foundation.basicMarquee
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.MaterialTheme
@@ -71,7 +72,8 @@ constructor(
    }

    @Composable
    private fun Content(dialog: SystemUIDialog) {
    @VisibleForTesting
    fun Content(dialog: SystemUIDialog) {
        val isAvailable by viewModel.isAvailable.collectAsStateWithLifecycle()

        if (!isAvailable) {
+2 −2
Original line number Diff line number Diff line
@@ -57,7 +57,7 @@ constructor(
                    .toViewModel(
                        isChecked = isEnabled is SpatialAudioEnabledModel.SpatialAudioEnabled,
                        isHeadTrackingAvailable =
                            isAvailable is SpatialAudioAvailabilityModel.SpatialAudio,
                            isAvailable is SpatialAudioAvailabilityModel.HeadTracking,
                    )
                    .copy(label = context.getString(R.string.volume_panel_spatial_audio_title))
            }
@@ -69,7 +69,7 @@ constructor(
                // head tracking availability means there are three possible states for the spatial
                // audio: disabled, enabled regular, enabled with head tracking.
                // Show popup in this case instead of a togglealbe button.
                it is SpatialAudioAvailabilityModel.SpatialAudio
                it is SpatialAudioAvailabilityModel.HeadTracking
            }
            .stateIn(scope, SharingStarted.Eagerly, false)

+2 −2
Original line number Diff line number Diff line
@@ -16,16 +16,16 @@

package com.android.systemui.animation

import android.content.applicationContext
import com.android.systemui.jank.interactionJankMonitor
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.kosmos.testCase

val Kosmos.dialogTransitionAnimator by Fixture {
    fakeDialogTransitionAnimator(
        // The main thread is checked in a bunch of places inside the different transitions
        // animators, so we have to pass the real main executor here.
        mainExecutor = testCase.context.mainExecutor,
        mainExecutor = applicationContext.mainExecutor,
        interactionJankMonitor = interactionJankMonitor,
    )
}
+24 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 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.popup.ui.composable

import com.android.systemui.animation.dialogTransitionAnimator
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.statusbar.phone.systemUIDialogFactory

val Kosmos.volumePanelPopup: VolumePanelPopup by
    Kosmos.Fixture { VolumePanelPopup(systemUIDialogFactory, dialogTransitionAnimator) }