Merge "settings: Fix more NPEs when bluetooth is missing." into nyc-dev
diff --git a/src/com/android/settings/ResetNetworkConfirm.java b/src/com/android/settings/ResetNetworkConfirm.java
index 777f4d4..110398f 100644
--- a/src/com/android/settings/ResetNetworkConfirm.java
+++ b/src/com/android/settings/ResetNetworkConfirm.java
@@ -16,6 +16,7 @@
package com.android.settings;
+import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothManager;
import android.content.Context;
import android.net.ConnectivityManager;
@@ -96,7 +97,10 @@
BluetoothManager btManager = (BluetoothManager)
context.getSystemService(Context.BLUETOOTH_SERVICE);
if (btManager != null) {
- btManager.getAdapter().factoryReset();
+ BluetoothAdapter btAdapter = btManager.getAdapter();
+ if (btAdapter != null) {
+ btAdapter.factoryReset();
+ }
}
ImsManager.factoryReset(context);
diff --git a/src/com/android/settings/widget/SettingsAppWidgetProvider.java b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
index d7cbaae..38fed94 100644
--- a/src/com/android/settings/widget/SettingsAppWidgetProvider.java
+++ b/src/com/android/settings/widget/SettingsAppWidgetProvider.java
@@ -454,6 +454,9 @@
return STATE_UNKNOWN; // On emulator?
}
sLocalBluetoothAdapter = manager.getBluetoothAdapter();
+ if (sLocalBluetoothAdapter == null) {
+ return STATE_UNKNOWN; // On emulator?
+ }
}
return bluetoothStateToFiveState(sLocalBluetoothAdapter.getBluetoothState());
}