Merge "Stay discoverable in Bluetooth settings and pairing pages" into oc-dr1-dev

am: 49cd8f2327

Change-Id: I4b8989fd95405bfeb7ada518b0ce2f76dec5cdb3
This commit is contained in:
Antony Sargent
2017-08-10 07:25:53 +00:00
committed by android-build-merger
5 changed files with 223 additions and 6 deletions

View File

@@ -80,6 +80,7 @@ public class BluetoothSettings extends DeviceListPreferenceFragment implements I
FooterPreference mFooterPreference;
private Preference mPairingPreference;
private BluetoothEnabler mBluetoothEnabler;
private AlwaysDiscoverable mAlwaysDiscoverable;
private SwitchBar mSwitchBar;
@@ -111,6 +112,9 @@ public class BluetoothSettings extends DeviceListPreferenceFragment implements I
mMetricsFeatureProvider, Utils.getLocalBtManager(activity),
MetricsEvent.ACTION_BLUETOOTH_TOGGLE);
mBluetoothEnabler.setupSwitchController();
if (mLocalAdapter != null) {
mAlwaysDiscoverable = new AlwaysDiscoverable(getContext(), mLocalAdapter);
}
}
@Override
@@ -157,7 +161,9 @@ public class BluetoothSettings extends DeviceListPreferenceFragment implements I
}
// Make the device only visible to connected devices.
mLocalAdapter.setScanMode(BluetoothAdapter.SCAN_MODE_CONNECTABLE);
if (mAlwaysDiscoverable != null) {
mAlwaysDiscoverable.stop();
}
if (isUiRestricted()) {
return;
@@ -188,7 +194,9 @@ public class BluetoothSettings extends DeviceListPreferenceFragment implements I
mPairedDevicesCategory.addPreference(mPairingPreference);
updateFooterPreference(mFooterPreference);
mLocalAdapter.setScanMode(BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE);
if (mAlwaysDiscoverable != null) {
mAlwaysDiscoverable.start();
}
return; // not break
case BluetoothAdapter.STATE_TURNING_OFF: