[Settings] Fix crashes caused by null bluetooth adapter and ethernet
manager
Emulator system image doesn't support bluetooth and ethernet manager
yet.
BUG: 150408099
Signed-off-by: Weilun Du <wdu@google.com>
Change-Id: Iab4f7b962f01755fe7d84956f9b54374f1e17408
(cherry picked from commit 08e95d0db0
)
This commit is contained in:
@@ -212,7 +212,8 @@ public class TetherEnabler implements SwitchWidgetController.OnSwitchChangeListe
|
||||
// Only check bluetooth tethering state if not stopped by user already.
|
||||
if (!mBluetoothTetheringStoppedByUser) {
|
||||
final BluetoothPan pan = mBluetoothPan.get();
|
||||
if (mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON
|
||||
if (mBluetoothAdapter != null &&
|
||||
mBluetoothAdapter.getState() == BluetoothAdapter.STATE_ON
|
||||
&& pan != null && pan.isTetheringOn()) {
|
||||
tetherState |= TETHERING_BLUETOOTH_ON;
|
||||
}
|
||||
@@ -279,7 +280,7 @@ public class TetherEnabler implements SwitchWidgetController.OnSwitchChangeListe
|
||||
|
||||
if (choice == TETHERING_BLUETOOTH) {
|
||||
mBluetoothTetheringStoppedByUser = false;
|
||||
if (isBluetoothTethering(state)) {
|
||||
if (mBluetoothAdapter == null || isBluetoothTethering(state)) {
|
||||
return;
|
||||
} else if (mBluetoothAdapter.getState() == BluetoothAdapter.STATE_OFF) {
|
||||
if (DEBUG) {
|
||||
|
Reference in New Issue
Block a user