Disable bluetooth controller if unsupported

Only disable the controllers not the whole fragment because
user might need to have entry for other features.

Fixes: 73664409
Merged-In: I98ed248cf33d11715dd523e711cbc68ebf128ef8
Change-Id: I98ed248cf33d11715dd523e711cbc68ebf128ef8
Signed-off-by: Weilun Du <wdu@google.com>
(cherry picked from commit 68a195ae93)
This commit is contained in:
Weilun Du
2018-03-06 12:05:32 -08:00
parent 83d9047ef4
commit d4e1b94b58
7 changed files with 191 additions and 30 deletions

View File

@@ -23,6 +23,7 @@ import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.VisibleForTesting;
import android.util.Log;
import com.android.internal.logging.nano.MetricsProto.MetricsEvent;
import com.android.settings.R;
@@ -71,7 +72,10 @@ public class BluetoothPairingDetail extends DeviceListPreferenceFragment impleme
@Override
public void onStart() {
super.onStart();
if (mLocalManager == null){
Log.e(TAG, "Bluetooth is not supported on this device");
return;
}
updateBluetooth();
mAvailableDevicesCategory.setProgress(mLocalAdapter.isDiscovering());
}
@@ -89,7 +93,10 @@ public class BluetoothPairingDetail extends DeviceListPreferenceFragment impleme
@Override
public void onStop() {
super.onStop();
if (mLocalManager == null){
Log.e(TAG, "Bluetooth is not supported on this device");
return;
}
// Make the device only visible to connected devices.
mAlwaysDiscoverable.stop();
disableScanning();