mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-04 01:09:47 +01:00
Make disabling new BLE scanning an option in preference
It was disabled in master, but not in the Fossil Q branch, now both is possible
This also reverts ca9761c336
which disabled classic BT scanning
This commit is contained in:
parent
e9f84449ac
commit
b9d3ec6df3
@ -81,7 +81,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||||||
private ScanCallback newLeScanCallback = null;
|
private ScanCallback newLeScanCallback = null;
|
||||||
|
|
||||||
// Disabled for testing, it seems worse for a few people
|
// Disabled for testing, it seems worse for a few people
|
||||||
private final boolean disableNewBLEScanning = false;
|
private boolean disableNewBLEScanning = false;
|
||||||
|
|
||||||
private final Handler handler = new Handler();
|
private final Handler handler = new Handler();
|
||||||
|
|
||||||
@ -268,6 +268,11 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
disableNewBLEScanning = GBApplication.getPrefs().getBoolean("disable_new_ble_scanning", false);
|
||||||
|
if (disableNewBLEScanning) {
|
||||||
|
LOG.info("new BLE scanning disabled via settings, using old method");
|
||||||
|
}
|
||||||
|
|
||||||
setContentView(R.layout.activity_discovery);
|
setContentView(R.layout.activity_discovery);
|
||||||
startButton = findViewById(R.id.discovery_start);
|
startButton = findViewById(R.id.discovery_start);
|
||||||
startButton.setOnClickListener(new View.OnClickListener() {
|
startButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@ -395,11 +400,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
|
|||||||
LOG.warn("Not starting discovery, because already scanning.");
|
LOG.warn("Not starting discovery, because already scanning.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (GBApplication.isRunningLollipopOrLater() && !disableNewBLEScanning) {
|
startDiscovery(Scanning.SCANNING_BT);
|
||||||
startDiscovery(Scanning.SCANNING_NEW_BTLE);
|
|
||||||
} else {
|
|
||||||
startDiscovery(Scanning.SCANNING_BTLE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void startDiscovery(Scanning what) {
|
private void startDiscovery(Scanning what) {
|
||||||
|
@ -252,6 +252,10 @@
|
|||||||
<string name="pref_auto_fetch_summary">Fetch happens upon screen unlock. Only works if a lock mechanism is set!</string>
|
<string name="pref_auto_fetch_summary">Fetch happens upon screen unlock. Only works if a lock mechanism is set!</string>
|
||||||
<string name="pref_auto_fetch_limit_fetches">Minimum time between fetches</string>
|
<string name="pref_auto_fetch_limit_fetches">Minimum time between fetches</string>
|
||||||
<string name="pref_auto_fetch_limit_fetches_summary">Fetches every %d minutes</string>
|
<string name="pref_auto_fetch_limit_fetches_summary">Fetches every %d minutes</string>
|
||||||
|
<!-- developer/debug preferences-->
|
||||||
|
<string name="pref_disable_new_ble_scanning">Disable new BLE scanning</string>
|
||||||
|
<string name="pref_summary_disable_new_ble_scanning">Check this option if your device cannot be found during discovery</string>
|
||||||
|
|
||||||
<string name="not_connected">Not connected</string>
|
<string name="not_connected">Not connected</string>
|
||||||
<string name="connecting">Connecting</string>
|
<string name="connecting">Connecting</string>
|
||||||
<string name="connected">Connected</string>
|
<string name="connected">Connected</string>
|
||||||
|
@ -627,5 +627,12 @@
|
|||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:key="log_to_file"
|
android:key="log_to_file"
|
||||||
android:title="@string/pref_write_logfiles" />
|
android:title="@string/pref_write_logfiles" />
|
||||||
|
<CheckBoxPreference
|
||||||
|
android:layout="@layout/preference_checkbox"
|
||||||
|
android:defaultValue="false"
|
||||||
|
android:key="disable_new_ble_scanning"
|
||||||
|
android:summary="@string/pref_summary_disable_new_ble_scanning"
|
||||||
|
android:title="@string/pref_disable_new_ble_scanning" />
|
||||||
|
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
Loading…
Reference in New Issue
Block a user