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

Commit c0a51abd authored by Daniel Sandler's avatar Daniel Sandler
Browse files

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

We should really have a separate string here to indicate
this case, but it's pretty late for that sort of thing, so I
left it at the generic "configure dock audio".

We might also want to dim this setting rather than popping
up a "Must dock phone first" dialog if the phone is not
docked.

Bug: 2469862
Change-Id: I4c61f5a50baac55881f5a21e523c370c456f0be8
parent 6e101d12
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 {