settings: Fix more NPEs when bluetooth is missing.

Fix a couple NPEs in the settings app when device doesn't support
bluetooth.

BUG:27600761
Change-Id: I356f5e7f321e8230f85ec74da9e405449431846b
This commit is contained in:
Prathmesh Prabhu
2016-03-11 13:27:17 -08:00
parent dccc582d26
commit 8d763c0302
2 changed files with 8 additions and 1 deletions

View File

@@ -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 @@ public class ResetNetworkConfirm extends InstrumentedFragment {
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);