Wear: re-enable wakelock

This commit is contained in:
Andries Smit 2022-01-06 08:31:12 +01:00
parent 4dd97e75ea
commit 6e5d14d470
2 changed files with 8 additions and 4 deletions

View file

@ -135,7 +135,7 @@ public class RawDisplayData {
}
private void updateData(DataMap dataMap) {
// wearUtil.getWakeLock("readingPrefs", 50);
PowerManager.WakeLock wl = wearUtil.getWakeLock("readingPrefs", 50);
sgvLevel = dataMap.getLong("sgvLevel");
datetime = dataMap.getLong("timestamp");
sSgv = dataMap.getString("sgvString");
@ -143,6 +143,7 @@ public class RawDisplayData {
sDelta = dataMap.getString("delta");
sAvgDelta = dataMap.getString("avgDelta");
sUnits = dataMap.getString("glucoseUnits");
wearUtil.releaseWakeLock(wl);
}
public DataMap updateStatusFromMessage(Intent intent, PowerManager.WakeLock wakeLock) {
@ -156,7 +157,7 @@ public class RawDisplayData {
}
private void updateStatus(DataMap dataMap) {
// wearUtil.getWakeLock("readingPrefs", 50);
PowerManager.WakeLock wl = wearUtil.getWakeLock("readingPrefs", 50);
sBasalRate = dataMap.getString("currentBasal");
sUploaderBattery = dataMap.getString("battery");
sRigBattery = dataMap.getString("rigBattery");
@ -170,6 +171,7 @@ public class RawDisplayData {
externalStatusString = dataMap.getString("externalStatusString");
batteryLevel = dataMap.getInt("batteryLevel");
openApsStatus = dataMap.getLong("openApsStatus");
wearUtil.releaseWakeLock(wl);
}
public DataMap updateBasalsFromMessage(Intent intent, PowerManager.WakeLock wakeLock) {
@ -183,8 +185,9 @@ public class RawDisplayData {
}
private void updateBasals(DataMap dataMap) {
// wearUtil.getWakeLock("readingPrefs", 500);
PowerManager.WakeLock wl = wearUtil.getWakeLock("readingPrefs", 500);
loadBasalsAndTemps(dataMap);
wearUtil.releaseWakeLock(wl);
}
private void loadBasalsAndTemps(DataMap dataMap) {

View file

@ -303,7 +303,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
Log.i(TAG, "onTimeChanged: ");
if (layoutSet && (newTime.hasHourChanged(oldTime) || newTime.hasMinuteChanged(oldTime))) {
Log.i(TAG, "onTimeChanged: time changed");
// wakeLock.acquire(50);
PowerManager.WakeLock wl = wearUtil.getWakeLock("readingPrefs", 50);
setDataFields();
setColor();
@ -316,6 +316,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferenc
} else {
mRelativeLayout.layout(0, 0, displaySize.x, displaySize.y);
}
wearUtil.releaseWakeLock(wl);
// invalidate();
}
}