1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 01:09:47 +01:00

Properly disable new ble scanning for testing

(inverted logic committed accidentially)
This commit is contained in:
Andreas Shimokawa 2019-08-03 23:40:07 +02:00
parent 461842a945
commit 57a235742d

View File

@ -49,6 +49,7 @@ import android.widget.ListView;
import android.widget.ProgressBar;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat;
import org.slf4j.Logger;
@ -77,6 +78,9 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
private ScanCallback newLeScanCallback = null;
// Disabled for testing, it seems worse for a few people
private final boolean disableNewBLEScanning = true;
private final Handler handler = new Handler();
private final BroadcastReceiver bluetoothReceiver = new BroadcastReceiver() {
@ -95,7 +99,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
// continue with LE scan, if available
if (isScanning == Scanning.SCANNING_BT) {
checkAndRequestLocationPermission();
if (!GBApplication.isRunningLollipopOrLater()) {
if (GBApplication.isRunningLollipopOrLater() && !disableNewBLEScanning) {
startDiscovery(Scanning.SCANNING_NEW_BTLE);
} else {
startDiscovery(Scanning.SCANNING_BTLE);
@ -297,7 +301,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
}
@Override
protected void onSaveInstanceState(Bundle outState) {
protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putParcelableArrayList("deviceCandidates", deviceCandidates);
}
@ -652,7 +656,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
super.onPause();
stopBTDiscovery();
stopBTLEDiscovery();
if (!GBApplication.isRunningLollipopOrLater()) {
if (GBApplication.isRunningLollipopOrLater() && !disableNewBLEScanning) {
stopNewBTLEDiscovery();
}
}