1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 12:56:49 +01:00

Make travis green again

This commit is contained in:
Andreas Shimokawa 2019-05-20 21:53:53 +02:00
parent 61be82a499
commit 81b102654a

View File

@ -59,6 +59,7 @@ import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
import nodomain.freeyourgadget.gadgetbridge.database.DBOpenHelper; import nodomain.freeyourgadget.gadgetbridge.database.DBOpenHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager; import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoMaster; import nodomain.freeyourgadget.gadgetbridge.entities.DaoMaster;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.entities.Device; import nodomain.freeyourgadget.gadgetbridge.entities.Device;
import nodomain.freeyourgadget.gadgetbridge.externalevents.BluetoothStateChangeReceiver; import nodomain.freeyourgadget.gadgetbridge.externalevents.BluetoothStateChangeReceiver;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -618,7 +619,9 @@ public static String packageNameToPebbleMsgSender(String packageName) {
editor.putString(ActivityUser.PREF_USER_GENDER, Integer.toString(legacyGender_1)); editor.putString(ActivityUser.PREF_USER_GENDER, Integer.toString(legacyGender_1));
} }
if (oldVersion < 3) { if (oldVersion < 3) {
List<Device> activeDevices = DBHelper.getActiveDevices(lockHandler.getDaoSession()); try (DBHandler db = acquireDB()) {
DaoSession daoSession = db.getDaoSession();
List<Device> activeDevices = DBHelper.getActiveDevices(daoSession);
for (Device dbDevice : activeDevices) { for (Device dbDevice : activeDevices) {
SharedPreferences.Editor deviceSharedPrefsEdit = GBApplication.getDeviceSpecificSharedPrefs(dbDevice.getIdentifier()).edit(); SharedPreferences.Editor deviceSharedPrefsEdit = GBApplication.getDeviceSpecificSharedPrefs(dbDevice.getIdentifier()).edit();
if (sharedPrefs != null) { if (sharedPrefs != null) {
@ -656,6 +659,9 @@ public static String packageNameToPebbleMsgSender(String packageName) {
} }
editor.remove("miband3_language"); editor.remove("miband3_language");
editor.remove("amazfitbip_language"); editor.remove("amazfitbip_language");
} catch (Exception e) {
Log.w(TAG, "error acquiring DB lock");
}
} }
editor.putString(PREFS_VERSION, Integer.toString(CURRENT_PREFS_VERSION)); editor.putString(PREFS_VERSION, Integer.toString(CURRENT_PREFS_VERSION));
editor.apply(); editor.apply();