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

This commit is contained in:
Daniel Sandler
2010-03-15 07:20:38 -07:00
committed by Android (Google) Code Review

View File

@@ -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 {