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

Commit e9e13a60 authored by Haijie Hong's avatar Haijie Hong
Browse files

Update device details toggles

1. Merge spatial audio and profiles into the same group
2. Move audio device type to bottom

Bug: 399532172
Test: local tested
Flag: com.android.settings.flags.enable_bluetooth_settings_expressive_design_read_only
Change-Id: I0934889aed1c70937e58eb0b1fe2ad391fdf8649
parent 5d97a005
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -89,14 +89,20 @@
        android:key="hearing_device_group" />

    <PreferenceCategory
        android:key="bluetooth_audio_device_type_group"/>
        android:key="bluetooth_audio_device_type_group"
        android:featureFlag="!com.android.settings.flags.enable_bluetooth_settings_expressive_design_read_only"/>

    <PreferenceCategory
        android:key="spatial_audio_group"/>
        android:key="spatial_audio_group"
        android:featureFlag="!com.android.settings.flags.enable_bluetooth_settings_expressive_design_read_only"/>

    <PreferenceCategory
        android:key="bluetooth_profiles"/>

    <PreferenceCategory
        android:key="bluetooth_audio_device_type_group"
        android:featureFlag="com.android.settings.flags.enable_bluetooth_settings_expressive_design_read_only"/>

    <PreferenceCategory
        android:key="bt_extra_options"/>

+1 −1
Original line number Diff line number Diff line
@@ -123,6 +123,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
        if (invisibleProfiles != null) {
            mInvisibleProfiles = Set.copyOf(invisibleProfiles);
        }
        mProfilesContainer.setVisible(false);
        refresh();
    }

@@ -522,7 +523,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
     */
    @Override
    protected void refresh() {
        mProfilesContainer.setVisible(false);
        ThreadUtils.postOnBackgroundThread(
                () -> {
                    mAdditionalInvisibleProfiles.set(
+9 −10
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.settings.bluetooth;
import static android.media.Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE;

import android.app.settings.SettingsEnums;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.media.AudioDeviceAttributes;
import android.media.AudioDeviceInfo;
@@ -45,9 +44,6 @@ import com.android.settingslib.core.lifecycle.Lifecycle;
import com.android.settingslib.flags.Flags;
import com.android.settingslib.utils.ThreadUtils;

import com.google.common.collect.ImmutableSet;

import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

/**
@@ -58,6 +54,7 @@ public class BluetoothDetailsSpatialAudioController extends BluetoothDetailsCont

    private static final String TAG = "BluetoothSpatialAudioController";
    private static final String KEY_SPATIAL_AUDIO_GROUP = "spatial_audio_group";
    private static final String KEY_PROFILES_GROUP = "bluetooth_profiles";
    private static final String KEY_SPATIAL_AUDIO = "spatial_audio";
    private static final String KEY_HEAD_TRACKING = "head_tracking";

@@ -71,10 +68,6 @@ public class BluetoothDetailsSpatialAudioController extends BluetoothDetailsCont
    AtomicBoolean mHasHeadTracker = new AtomicBoolean(false);
    AtomicBoolean mInitialRefresh = new AtomicBoolean(true);

    public static final Set<Integer> SA_PROFILES =
            ImmutableSet.of(
                    BluetoothProfile.A2DP, BluetoothProfile.LE_AUDIO, BluetoothProfile.HEARING_AID);

    public BluetoothDetailsSpatialAudioController(
            Context context,
            PreferenceFragmentCompat fragment,
@@ -144,13 +137,17 @@ public class BluetoothDetailsSpatialAudioController extends BluetoothDetailsCont

    @Override
    public String getPreferenceKey() {
        if (com.android.settings.flags.Flags.enableBluetoothSettingsExpressiveDesignReadOnly()) {
            return KEY_PROFILES_GROUP;
        } else {
            return KEY_SPATIAL_AUDIO_GROUP;
        }
    }

    @Override
    protected void init(PreferenceScreen screen) {
        mProfilesContainer = screen.findPreference(getPreferenceKey());
        if (com.android.settings.flags.Flags.enableBluetoothSettingsExpressiveDesign()) {
        if (com.android.settings.flags.Flags.enableBluetoothSettingsExpressiveDesignReadOnly()) {
            mProfilesContainer.setLayoutResource(
                    com.android.settingslib.widget.theme.R.layout
                            .settingslib_expressive_preference_category_no_title);
@@ -243,6 +240,7 @@ public class BluetoothDetailsSpatialAudioController extends BluetoothDetailsCont
        pref.setTitle(context.getString(R.string.bluetooth_details_spatial_audio_title));
        pref.setSummary(context.getString(R.string.bluetooth_details_spatial_audio_summary));
        pref.setOnPreferenceClickListener(this);
        pref.setOrder(-2);
        return pref;
    }

@@ -253,6 +251,7 @@ public class BluetoothDetailsSpatialAudioController extends BluetoothDetailsCont
        pref.setTitle(context.getString(R.string.bluetooth_details_head_tracking_title));
        pref.setSummary(context.getString(R.string.bluetooth_details_head_tracking_summary));
        pref.setOnPreferenceClickListener(this);
        pref.setOrder(-1);
        return pref;
    }