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

Commit edd94807 authored by Peter Liang's avatar Peter Liang Committed by Android (Google) Code Review
Browse files

Merge "Bring Live Caption toggle back to volume rocker." into main

parents 5c2c8647 bb39373f
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -654,6 +654,13 @@ flag {
    bug: "368308908"
}

flag {
    name: "captions_toggle_in_volume_dialog_v1"
    namespace: "systemui"
    description: "Bring the captions toggle back to the volume rocker."
    bug: "425471100"
}

flag {
    name: "clipboard_announce_live_region"
    namespace: "systemui"
+57 −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.dialog.captions.domain

import android.platform.test.annotations.EnableFlags
import android.testing.TestableLooper
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.SmallTest
import com.android.systemui.Flags
import com.android.systemui.SysuiTestCase
import com.android.systemui.kosmos.collectLastValue
import com.android.systemui.kosmos.runTest
import com.android.systemui.testKosmosNew
import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Test
import org.junit.runner.RunWith

/** Tests for [VolumeDialogCaptionsButtonInteractor]. */
@SmallTest
@RunWith(AndroidJUnit4::class)
@TestableLooper.RunWithLooper
class VolumeDialogCaptionsButtonInteractorTest : SysuiTestCase() {
    private val kosmos = testKosmosNew()
    private lateinit var underTest: VolumeDialogCaptionsButtonInteractor

    @Before
    fun setUp() {
        underTest = kosmos.volumeDialogCaptionsButtonInteractor
    }

    @Test
    @EnableFlags(Flags.FLAG_CAPTIONS_TOGGLE_IN_VOLUME_DIALOG_V1)
    fun onButtonClicked_verifySetIsSystemAudioCaptioningEnabled() =
        kosmos.runTest {
            val current = underTest.isEnabled.value
            val latest by collectLastValue(underTest.isEnabled)

            underTest.onButtonClicked()

            assertThat(latest).isEqualTo(!current)
        }
}
+21 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?><!--
    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.
-->

<transition xmlns:android="http://schemas.android.com/apk/res/android"
            android:paddingMode="stack">
    <item android:drawable="@drawable/volume_ringer_item_bg"/>
    <item android:drawable="@drawable/volume_drawer_selection_bg"/>
</transition>
+10 −8
Original line number Diff line number Diff line
@@ -13,7 +13,8 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:id="@+id/volume_dialog"
    android:layout_width="wrap_content"
@@ -65,12 +66,13 @@
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.5"/>

    <FrameLayout
    <LinearLayout
        android:id="@+id/volume_dialog_bottom_section_container"
        android:layout_width="0dp"
        android:layout_height="0dp"
        android:layout_marginTop="@dimen/volume_dialog_components_spacing"
        android:clipChildren="false"
        android:orientation="vertical"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="@id/volume_dialog_background"
        app:layout_constraintHeight_default="wrap"
@@ -80,7 +82,7 @@
        app:layout_constraintWidth_default="wrap">

        <include layout="@layout/volume_dialog_bottom_section"/>
    </FrameLayout>
    </LinearLayout>

    <LinearLayout
        android:id="@+id/volume_dialog_floating_sliders_container"
+26 −12
Original line number Diff line number Diff line
@@ -13,8 +13,21 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<ImageButton xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
<merge xmlns:android="http://schemas.android.com/apk/res/android"
       xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">

    <com.android.systemui.volume.CaptionsToggleImageButton
        android:id="@+id/odi_captions_icon"
        android:src="@drawable/ic_volume_odi_captions_disabled"
        android:layout_width="@dimen/volume_dialog_button_size"
        android:layout_height="@dimen/volume_dialog_button_size"
        android:tint="@androidprv:color/materialColorPrimary"
        android:background="@drawable/volume_dialog_captions_button_transition_bg"
        android:scaleType="centerInside"
        android:soundEffectsEnabled="false"
        android:visibility="gone"/>

    <ImageButton
        android:id="@+id/volume_dialog_settings"
        android:layout_width="@dimen/volume_dialog_button_size"
        android:layout_height="@dimen/volume_dialog_button_size"
@@ -25,3 +38,4 @@
        android:soundEffectsEnabled="false"
        android:padding="4dp"
        android:tint="@androidprv:color/materialColorPrimary"/>
</merge>
Loading