mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-28 12:56:49 +01:00
Call getDevice always when connected
This fixes a longstanding bug where device attributes where ONLY updated when fetching activity data or when pairing a new device
This commit is contained in:
parent
24752d3455
commit
723ad53588
@ -169,12 +169,13 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
||||
boolean enableReceivers = mDeviceSupport != null && (mDeviceSupport.useAutoConnect() || mGBDevice.isInitialized());
|
||||
setReceiversEnableState(enableReceivers);
|
||||
GB.updateNotification(mGBDevice.getName() + " " + mGBDevice.getStateString(), mGBDevice.isInitialized(), context);
|
||||
if (device.isInitialized() && (device.getType() != DeviceType.VIBRATISSIMO)) {
|
||||
|
||||
if (device.isInitialized()) {
|
||||
try (DBHandler dbHandler = GBApplication.acquireDB()) {
|
||||
DaoSession session = dbHandler.getDaoSession();
|
||||
if (DBHelper.findDevice(device, session) == null) {
|
||||
DBHelper dbHelper = new DBHelper(context);
|
||||
DBHelper.getDevice(device, session); // implicitly creates it :P
|
||||
if (DBHelper.findDevice(device, session) == null && (device.getType() != DeviceType.VIBRATISSIMO)) {
|
||||
if (dbHelper.getOldActivityDatabaseHandler() != null) {
|
||||
Intent startIntent = new Intent(context, OnboardingActivity.class);
|
||||
startIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
@ -182,7 +183,7 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
||||
startActivity(startIntent);
|
||||
}
|
||||
}
|
||||
} catch (Exception _ignore) {
|
||||
} catch (Exception ignore) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -426,11 +427,11 @@ public class DeviceCommunicationService extends Service implements SharedPrefere
|
||||
break;
|
||||
case ACTION_SETMUSICSTATE:
|
||||
MusicStateSpec stateSpec = new MusicStateSpec();
|
||||
stateSpec.shuffle = intent.getByteExtra(EXTRA_MUSIC_SHUFFLE, (byte)0);
|
||||
stateSpec.repeat = intent.getByteExtra(EXTRA_MUSIC_REPEAT, (byte)0);
|
||||
stateSpec.shuffle = intent.getByteExtra(EXTRA_MUSIC_SHUFFLE, (byte) 0);
|
||||
stateSpec.repeat = intent.getByteExtra(EXTRA_MUSIC_REPEAT, (byte) 0);
|
||||
stateSpec.position = intent.getIntExtra(EXTRA_MUSIC_POSITION, 0);
|
||||
stateSpec.playRate = intent.getIntExtra(EXTRA_MUSIC_RATE, 0);
|
||||
stateSpec.state = intent.getByteExtra(EXTRA_MUSIC_STATE, (byte)0);
|
||||
stateSpec.state = intent.getByteExtra(EXTRA_MUSIC_STATE, (byte) 0);
|
||||
mDeviceSupport.onSetMusicState(stateSpec);
|
||||
break;
|
||||
case ACTION_REQUEST_APPINFO:
|
||||
|
Loading…
Reference in New Issue
Block a user