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

Commit dee13a94 authored by Daniel Sandler's avatar Daniel Sandler Committed by Android (Google) Code Review
Browse files

Merge "Disable dock audio settings if the dock doesn't have Bluetooth."

parents a6b9dcbb c0a51abd
Loading
Loading
Loading
Loading
+25 −12
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.settings;

import android.app.AlertDialog;
import android.app.Dialog;
import android.bluetooth.BluetoothDevice;
import android.content.BroadcastReceiver;
import android.content.ContentResolver;
import android.content.Context;
@@ -91,6 +92,16 @@ public class DockSettings extends PreferenceActivity {
    private void handleDockChange(Intent intent) {
        if (mAudioSettings != null) {
            int dockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0);

            boolean isBluetooth = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE) != null;

            if (!isBluetooth) {
                // No dock audio if not on Bluetooth.
                mAudioSettings.setEnabled(false);
                mAudioSettings.setSummary(R.string.dock_audio_summary_unknown);
            } else {
                mAudioSettings.setEnabled(true);

                mDockIntent = intent;
                int resId = R.string.dock_audio_summary_unknown;
                switch (dockState) {
@@ -104,6 +115,8 @@ public class DockSettings extends PreferenceActivity {
                    resId = R.string.dock_audio_summary_none;
                }
                mAudioSettings.setSummary(resId);
            }

            if (dockState != Intent.EXTRA_DOCK_STATE_UNDOCKED) {
                // remove undocked dialog if currently showing.
                try {