1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-29 05:16:51 +01:00

Reenable the lollipop LE scanner, but after the plain BT scanner

This commit is contained in:
cpfeiffer 2016-09-26 22:30:15 +02:00
parent c2f8037f07
commit dbdd7366ed

View File

@ -33,6 +33,7 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.adapter.DeviceCandidateAdapter; import nodomain.freeyourgadget.gadgetbridge.adapter.DeviceCandidateAdapter;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
@ -63,7 +64,11 @@ public class DiscoveryActivity extends GBActivity implements AdapterView.OnItemC
// continue with LE scan, if available // continue with LE scan, if available
if (isScanning == Scanning.SCANNING_BT) { if (isScanning == Scanning.SCANNING_BT) {
checkAndRequestLocationPermission(); checkAndRequestLocationPermission();
if (GBApplication.isRunningLollipopOrLater()) {
startDiscovery(Scanning.SCANNING_NEW_BTLE);
} else {
startDiscovery(Scanning.SCANNING_BTLE); startDiscovery(Scanning.SCANNING_BTLE);
}
} else { } else {
discoveryFinished(); discoveryFinished();
} }
@ -261,13 +266,8 @@ public class DiscoveryActivity extends GBActivity implements AdapterView.OnItemC
LOG.warn("Not starting discovery, because already scanning."); LOG.warn("Not starting discovery, because already scanning.");
return; return;
} }
if (false && Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
// does not work for @ashimokawa
startDiscovery(Scanning.SCANNING_NEW_BTLE);
} else {
startDiscovery(Scanning.SCANNING_BT); startDiscovery(Scanning.SCANNING_BT);
} }
}
private void startDiscovery(Scanning what) { private void startDiscovery(Scanning what) {
LOG.info("Starting discovery: " + what); LOG.info("Starting discovery: " + what);