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
This commit is contained in:
@@ -18,6 +18,7 @@ package com.android.settings;
|
|||||||
|
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Dialog;
|
import android.app.Dialog;
|
||||||
|
import android.bluetooth.BluetoothDevice;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
@@ -91,6 +92,16 @@ public class DockSettings extends PreferenceActivity {
|
|||||||
private void handleDockChange(Intent intent) {
|
private void handleDockChange(Intent intent) {
|
||||||
if (mAudioSettings != null) {
|
if (mAudioSettings != null) {
|
||||||
int dockState = intent.getIntExtra(Intent.EXTRA_DOCK_STATE, 0);
|
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;
|
mDockIntent = intent;
|
||||||
int resId = R.string.dock_audio_summary_unknown;
|
int resId = R.string.dock_audio_summary_unknown;
|
||||||
switch (dockState) {
|
switch (dockState) {
|
||||||
@@ -104,6 +115,8 @@ public class DockSettings extends PreferenceActivity {
|
|||||||
resId = R.string.dock_audio_summary_none;
|
resId = R.string.dock_audio_summary_none;
|
||||||
}
|
}
|
||||||
mAudioSettings.setSummary(resId);
|
mAudioSettings.setSummary(resId);
|
||||||
|
}
|
||||||
|
|
||||||
if (dockState != Intent.EXTRA_DOCK_STATE_UNDOCKED) {
|
if (dockState != Intent.EXTRA_DOCK_STATE_UNDOCKED) {
|
||||||
// remove undocked dialog if currently showing.
|
// remove undocked dialog if currently showing.
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user