mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-24 19:06:53 +01:00
Fix tests and linter
This commit is contained in:
parent
1c2c1f710e
commit
18e08d13da
@ -178,10 +178,6 @@
|
||||
android:name=".devices.pebble.PebbleSettingsActivity"
|
||||
android:label="@string/pref_title_pebble_settings"
|
||||
android:parentActivityName=".activities.SettingsActivity" />
|
||||
<activity
|
||||
android:name=".devices.hplus.HPlusSettingsActivity"
|
||||
android:label="@string/preferences_hplus_settings"
|
||||
android:parentActivityName=".activities.SettingsActivity" />
|
||||
<activity
|
||||
android:name=".devices.zetime.ZeTimePreferenceActivity"
|
||||
android:label="@string/zetime_title_settings"
|
||||
|
@ -18,6 +18,7 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.btle;
|
||||
|
||||
import android.Manifest;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.Service;
|
||||
@ -326,8 +327,8 @@ public class BLEScanService extends Service {
|
||||
unregisterReceiver(bluetoothStateChangedReceiver);
|
||||
}
|
||||
|
||||
private boolean hasBluetoothPermission(){
|
||||
if(Build.VERSION.SDK_INT <= Build.VERSION_CODES.R){
|
||||
private boolean hasBluetoothPermission() {
|
||||
if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.R) {
|
||||
// workaround. Cannot give bluetooth permission on Android O
|
||||
LOG.warn("Running on android 11, skipping bluetooth permission check");
|
||||
return ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.ACCESS_COARSE_LOCATION) == PackageManager.PERMISSION_GRANTED;
|
||||
@ -335,6 +336,7 @@ public class BLEScanService extends Service {
|
||||
return ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.BLUETOOTH_SCAN) == PackageManager.PERMISSION_GRANTED;
|
||||
}
|
||||
|
||||
@SuppressLint("MissingPermission") // linter does not recognize the usage of hasBluetoothPermission
|
||||
private void restartScan(boolean applyFilters) {
|
||||
if (!hasBluetoothPermission()) {
|
||||
// this should never happen
|
||||
@ -357,7 +359,9 @@ public class BLEScanService extends Service {
|
||||
return;
|
||||
}
|
||||
if (currentState.isDoingAnyScan()) {
|
||||
scanner.stopScan(scanCallback);
|
||||
if (hasBluetoothPermission()) {
|
||||
scanner.stopScan(scanCallback);
|
||||
}
|
||||
}
|
||||
ArrayList<ScanFilter> scanFilters = null;
|
||||
|
||||
@ -375,7 +379,7 @@ public class BLEScanService extends Service {
|
||||
}
|
||||
}
|
||||
|
||||
if (scanFilters.size() == 0) {
|
||||
if (scanFilters.isEmpty()) {
|
||||
// no need to start scanning
|
||||
LOG.debug("restartScan: stopping BLE scan, no devices");
|
||||
currentState = ScanningState.NOT_SCANNING;
|
||||
|
@ -53,7 +53,7 @@ public class LanguageUtilsTest extends TestBase {
|
||||
final Map<String, String> tests = new LinkedHashMap<String, String>() {{
|
||||
put("Тхе qицк брон фоx јумпед овер тхе лаз* дог", "The qick bron fox jumped over the laz* dog");
|
||||
put("Српска ћирилица", "Srpska cirilica");
|
||||
put("Novak Đoković", "Novak Dokovic");
|
||||
put("Novak Đoković", "Novak Djokovic");
|
||||
put("Џ, Њ and Љ", "Dz, Nj and Lj");
|
||||
put("Љуљачка", "Ljuljacka");
|
||||
put("Наковањ", "Nakovanj");
|
||||
@ -63,7 +63,7 @@ public class LanguageUtilsTest extends TestBase {
|
||||
put("Ћ, ћ", "C, c");
|
||||
put("Ж, ж", "Z, z");
|
||||
put("Ш, ш", "S, s");
|
||||
put("Ђ, ђ", "D, d");
|
||||
put("Ђ, ђ", "Dj, dj");
|
||||
put("Џ, џ", "Dz, dz");
|
||||
put("Њ, њ", "Nj, nj");
|
||||
put("Љ, љ", "Lj, lj");
|
||||
|
Loading…
Reference in New Issue
Block a user