From 7ddcb36b527fb94b54ca7a99bbdd1acd2966decb Mon Sep 17 00:00:00 2001 From: Michael Chan <> Date: Tue, 31 Mar 2009 13:55:18 -0700 Subject: [PATCH] AI 143628: am: CL 143480 Fixed the problem where Settings would crash if you enable airplane mode, go Home, go back to Wireless Settings. This only happens in emulator. Bluetooth isn't supported in emulator but the crash was fixed so users can enable/disable Airplane Mode. Original author: chanm Merged from: //branches/donutburger/... Automated import of CL 143628 --- .../settings/bluetooth/LocalBluetoothManager.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/com/android/settings/bluetooth/LocalBluetoothManager.java b/src/com/android/settings/bluetooth/LocalBluetoothManager.java index 1a848b2d066..273f79748e4 100644 --- a/src/com/android/settings/bluetooth/LocalBluetoothManager.java +++ b/src/com/android/settings/bluetooth/LocalBluetoothManager.java @@ -199,9 +199,17 @@ public class LocalBluetoothManager { } private void syncBluetoothState() { - setBluetoothStateInt(mManager.isEnabled() - ? BluetoothDevice.BLUETOOTH_STATE_ON - : BluetoothDevice.BLUETOOTH_STATE_OFF); + int bluetoothState; + + if (mManager != null) { + bluetoothState = mManager.isEnabled() + ? BluetoothDevice.BLUETOOTH_STATE_ON + : BluetoothDevice.BLUETOOTH_STATE_OFF; + } else { + bluetoothState = BluetoothError.ERROR; + } + + setBluetoothStateInt(bluetoothState); } public void setBluetoothEnabled(boolean enabled) {