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

Commit ec676035 authored by jasonwshsu's avatar jasonwshsu
Browse files

Add HAP preset support in Hearing Devices Quick Settings Tile

This patch provides
* Preset basic UI
* Show and select preset for HAP hearing devices

Bug: 334071236
Test: atest HearingDevicesDialogDelegateTest
Flag: ACONFIG com.android.systemui.hearing_aids_qs_tile_dialog NEXTFOOD

Change-Id: I98cee446887a80c8416200c2d4a3dc9b2172cb83
parent 1d0ec789
Loading
Loading
Loading
Loading
+43 −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.
-->

<layer-list xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:paddingMode="stack">
    <item>
        <shape android:shape="rectangle">
            <corners android:radius="@dimen/hearing_devices_preset_spinner_background_radius" />
            <stroke
                android:width="1dp"
                android:color="?androidprv:attr/textColorTertiary" />
            <solid android:color="@android:color/transparent"/>
        </shape>
    </item>
    <item
        android:end="20dp"
        android:gravity="end|center_vertical">
        <vector
            android:width="@dimen/screenrecord_spinner_arrow_size"
            android:height="@dimen/screenrecord_spinner_arrow_size"
            android:viewportWidth="24"
            android:viewportHeight="24"
            android:tint="?androidprv:attr/colorControlNormal">
            <path
                android:fillColor="#FF000000"
                android:pathData="M7.41 7.84L12 12.42l4.59-4.58L18 9.25l-6 6-6-6z" />
        </vector>
    </item>
</layer-list>
 No newline at end of file
+22 −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.
-->

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:shape="rectangle">
    <corners android:radius="@dimen/hearing_devices_preset_spinner_background_radius"/>
    <solid android:color="?androidprv:attr/materialColorSurfaceContainer" />
</shape>
 No newline at end of file
+27 −2
Original line number Diff line number Diff line
@@ -17,6 +17,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:androidprv="http://schemas.android.com/apk/prv/res/android"
    android:id="@+id/root"
    style="@style/Widget.SliceView.Panel"
    android:layout_width="wrap_content"
@@ -26,9 +27,33 @@
        android:id="@+id/device_list"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintBottom_toTopOf="@id/pair_new_device_button" />
        app:layout_constraintBottom_toTopOf="@id/preset_spinner" />

    <Spinner
        android:id="@+id/preset_spinner"
        style="@style/BluetoothTileDialog.Device"
        android:layout_width="match_parent"
        android:layout_height="@dimen/hearing_devices_preset_spinner_height"
        android:layout_marginTop="@dimen/hearing_devices_preset_spinner_margin"
        android:layout_marginBottom="@dimen/hearing_devices_preset_spinner_margin"
        android:gravity="center_vertical"
        android:background="@drawable/hearing_devices_preset_spinner_background"
        android:popupBackground="@drawable/hearing_devices_preset_spinner_popup_background"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@id/device_list"
        app:layout_constraintBottom_toTopOf="@id/pair_new_device_button"
        android:visibility="gone"/>

    <androidx.constraintlayout.widget.Barrier
        android:id="@+id/device_barrier"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        app:barrierDirection="bottom"
        app:constraint_referenced_ids="device_list,preset_spinner" />

    <Button
        android:id="@+id/pair_new_device_button"
@@ -41,7 +66,7 @@
        android:contentDescription="@string/accessibility_hearing_device_pair_new_device"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintTop_toBottomOf="@id/device_list"
        app:layout_constraintTop_toBottomOf="@id/device_barrier"
        android:drawableStart="@drawable/ic_add"
        android:drawablePadding="20dp"
        android:drawableTint="?android:attr/textColorPrimary"
+8 −0
Original line number Diff line number Diff line
@@ -1762,6 +1762,14 @@
    <!-- The height of the main scroll view in bluetooth dialog with auto on toggle. -->
    <dimen name="bluetooth_dialog_scroll_view_min_height_with_auto_on">350dp</dimen>

    <!-- Hearing devices dialog related dimensions -->
    <dimen name="hearing_devices_preset_spinner_height">72dp</dimen>
    <dimen name="hearing_devices_preset_spinner_margin">24dp</dimen>
    <dimen name="hearing_devices_preset_spinner_text_padding_start">20dp</dimen>
    <dimen name="hearing_devices_preset_spinner_text_padding_end">80dp</dimen>
    <dimen name="hearing_devices_preset_spinner_arrow_size">24dp</dimen>
    <dimen name="hearing_devices_preset_spinner_background_radius">28dp</dimen>

    <!-- Height percentage of the parent container occupied by the communal view -->
    <item name="communal_source_height_percentage" format="float" type="dimen">0.80</item>

+2 −0
Original line number Diff line number Diff line
@@ -916,6 +916,8 @@
    <string name="quick_settings_pair_hearing_devices">Pair new device</string>
    <!-- QuickSettings: Content description of the hearing devices dialog pair new device [CHAR LIMIT=NONE] -->
    <string name="accessibility_hearing_device_pair_new_device">Click to pair new device</string>
    <!-- Message when selecting hearing aids presets failed. [CHAR LIMIT=NONE] -->
    <string name="hearing_devices_presets_error">Couldn\'t update preset</string>

    <!--- Title of dialog triggered if the microphone is disabled but an app tried to access it. [CHAR LIMIT=150] -->
    <string name="sensor_privacy_start_use_mic_dialog_title">Unblock device microphone?</string>
Loading