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

Commit 782ad66a authored by Jason Hsu's avatar Jason Hsu Committed by Automerger Merge Worker
Browse files

Merge "Move 'Audio Output' to Accessibility hearing device page" into udc-dev am: 181cfa3a

parents 5c64b78f 181cfa3a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -129,7 +129,9 @@
    <!-- Title for all hearing devices related controls section. [CHAR LIMIT=60] -->
    <string name="bluetooth_device_controls_general">For all available hearing devices</string>
    <!-- Connected devices settings. Title of the preference to show the entrance of the hearing device controls related page. [CHAR LIMIT=65] -->
    <string name="bluetooth_device_controls_title">Shortcuts &amp; hearing aid compatibility</string>
    <string name="bluetooth_device_controls_title">Hearing device settings</string>
    <!-- Connected devices settings. Title of the preference to show the entrance of the hearing device controls related page. [CHAR LIMIT=65] -->
    <string name="bluetooth_device_controls_summary">Audio output, shortcut, hearing aid compatibility</string>
    <!-- Title for this device specific controls section. [CHAR LIMIT=30] -->
    <string name="bluetooth_device_controls_specific">For this device</string>
    <!-- Connected devices settings. Title of the preference to show the entrance of the audio output page. It can change different types of audio are played on phone or other bluetooth devices. [CHAR LIMIT=35] -->
+4 −4
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@
        android:key="audio_routing_ringtone"
        android:persistent="false"
        android:title="@string/bluetooth_ringtone_title"
        settings:controller="com.android.settings.bluetooth.HearingDeviceRingtoneRoutingPreferenceController" />
        settings:controller="com.android.settings.accessibility.HearingDeviceRingtoneRoutingPreferenceController" />

    <ListPreference
        android:entries="@array/bluetooth_audio_routing_titles"
@@ -40,7 +40,7 @@
        android:key="audio_routing_call"
        android:persistent="false"
        android:title="@string/bluetooth_call_title"
        settings:controller="com.android.settings.bluetooth.HearingDeviceCallRoutingPreferenceController" />
        settings:controller="com.android.settings.accessibility.HearingDeviceCallRoutingPreferenceController" />

    <ListPreference
        android:entries="@array/bluetooth_audio_routing_titles"
@@ -49,7 +49,7 @@
        android:key="audio_routing_media"
        android:persistent="false"
        android:title="@string/bluetooth_media_title"
        settings:controller="com.android.settings.bluetooth.HearingDeviceMediaRoutingPreferenceController" />
        settings:controller="com.android.settings.accessibility.HearingDeviceMediaRoutingPreferenceController" />

    <ListPreference
        android:entries="@array/bluetooth_audio_routing_titles"
@@ -58,7 +58,7 @@
        android:key="audio_routing_system_sounds"
        android:persistent="false"
        android:title="@string/bluetooth_system_sounds_title"
        settings:controller="com.android.settings.bluetooth.HearingDeviceSystemSoundsRoutingPreferenceController" />
        settings:controller="com.android.settings.accessibility.HearingDeviceSystemSoundsRoutingPreferenceController" />

    <com.android.settings.accessibility.AccessibilityFooterPreference
        android:key="hearing_device_footer"
+9 −0
Original line number Diff line number Diff line
@@ -45,8 +45,17 @@
    <PreferenceCategory
        android:key="hearing_options_category"
        android:title="@string/accessibility_screen_option">

        <Preference
            android:key="audio_routing"
            android:title="@string/bluetooth_audio_routing_title"
            android:summary="@string/bluetooth_audio_routing_summary"
            android:fragment="com.android.settings.accessibility.AccessibilityAudioRoutingFragment"
            settings:controller="com.android.settings.accessibility.HearingAidAudioRoutingPreferenceController"/>

        <SwitchPreference
            android:key="hearing_aid_compatibility"
            android:order="30"
            android:title="@string/accessibility_hac_mode_title"
            android:summary="@string/accessibility_hac_mode_summary"
            settings:searchable="true"
+1 −6
Original line number Diff line number Diff line
@@ -69,12 +69,7 @@
        android:key="device_companion_apps"/>

    <PreferenceCategory
        android:key="device_controls_general"
        android:title="@string/bluetooth_device_controls_general"/>

    <PreferenceCategory
        android:key="device_controls_specific"
        android:title="@string/bluetooth_device_controls_specific"/>
        android:key="device_controls_general" />

    <PreferenceCategory
        android:key="spatial_audio_group"/>
+52 −0
Original line number Diff line number Diff line
@@ -14,74 +14,39 @@
 * limitations under the License.
 */

package com.android.settings.bluetooth;
package com.android.settings.accessibility;

import static android.os.UserManager.DISALLOW_CONFIG_BLUETOOTH;

import static com.android.settings.bluetooth.BluetoothDeviceDetailsFragment.KEY_DEVICE_ADDRESS;

import android.app.settings.SettingsEnums;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.util.Log;

import androidx.annotation.VisibleForTesting;

import com.android.settings.R;
import com.android.settings.dashboard.RestrictedDashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.bluetooth.CachedBluetoothDevice;
import com.android.settingslib.bluetooth.CachedBluetoothDeviceManager;
import com.android.settingslib.bluetooth.LocalBluetoothManager;

/** Settings fragment containing bluetooth audio routing. */
public class BluetoothDetailsAudioRoutingFragment extends RestrictedDashboardFragment {

    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
            new BaseSearchIndexProvider(R.xml.bluetooth_audio_routing_fragment);
    private static final String TAG = "BluetoothDetailsAudioRoutingFragment";
    @VisibleForTesting
    CachedBluetoothDevice mCachedDevice;
public class AccessibilityAudioRoutingFragment extends RestrictedDashboardFragment {
    private static final String TAG = "AccessibilityAudioRoutingFragment";

    public BluetoothDetailsAudioRoutingFragment() {
    public AccessibilityAudioRoutingFragment() {
        super(DISALLOW_CONFIG_BLUETOOTH);
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        final LocalBluetoothManager localBtMgr = Utils.getLocalBtManager(context);
        final CachedBluetoothDeviceManager cachedDeviceMgr = localBtMgr.getCachedDeviceManager();
        final BluetoothDevice bluetoothDevice = localBtMgr.getBluetoothAdapter().getRemoteDevice(
                getArguments().getString(KEY_DEVICE_ADDRESS));

        mCachedDevice = cachedDeviceMgr.findDevice(bluetoothDevice);
        if (mCachedDevice == null) {
            // Close this page if device is null with invalid device mac address
            Log.w(TAG, "onAttach() CachedDevice is null! Can not find address: "
                    + bluetoothDevice.getAnonymizedAddress());
            finish();
            return;
        }

        use(HearingDeviceRingtoneRoutingPreferenceController.class).init(mCachedDevice);
        use(HearingDeviceCallRoutingPreferenceController.class).init(mCachedDevice);
        use(HearingDeviceMediaRoutingPreferenceController.class).init(mCachedDevice);
        use(HearingDeviceSystemSoundsRoutingPreferenceController.class).init(mCachedDevice);
    }

    @Override
    public int getMetricsCategory() {
        return SettingsEnums.BLUETOOTH_AUDIO_ROUTING;
        return SettingsEnums.HEARING_AID_AUDIO_ROUTING;
    }

    @Override
    protected int getPreferenceScreenResId() {
        return R.xml.bluetooth_audio_routing_fragment;
        return R.xml.accessibility_audio_routing_fragment;
    }

    @Override
    protected String getLogTag() {
        return TAG;
    }

    public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
            new BaseSearchIndexProvider(R.xml.accessibility_audio_routing_fragment);
}
Loading