Skip to content

Commit 6f85d38

Browse files
committed
logging: add wifi state to onResume, timestamp to scheduleRefresh, skip reason
- onResume now logs wifi state so you can see if WiFi was ready at resume time - scheduleRefresh logs the wall-clock wake time so a future dump shows whether the timer should have already fired - onResume logs when it skips a fetch because fetchInProgress=true
1 parent 64f4fbe commit 6f85d38

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/com/bpmct/trmnl_nook_simple_touch/DisplayActivity.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,9 @@ public void onReceive(Context context, Intent intent) {
377377
@Override
378378
protected void onResume() {
379379
super.onResume();
380-
logD("onResume pid=" + android.os.Process.myPid() + " fetchInProgress=" + fetchInProgress);
380+
logD("onResume pid=" + android.os.Process.myPid()
381+
+ " fetchInProgress=" + fetchInProgress
382+
+ " wifi=" + getWifiStateString());
381383
getWindow().setFlags(
382384
WindowManager.LayoutParams.FLAG_FULLSCREEN,
383385
WindowManager.LayoutParams.FLAG_FULLSCREEN);
@@ -405,6 +407,8 @@ protected void onResume() {
405407
} else {
406408
startFetch();
407409
}
410+
} else {
411+
logD("onResume: fetch already in progress, skipping");
408412
}
409413
// Don't schedule here - fetch completion will schedule the next refresh
410414
}
@@ -771,7 +775,14 @@ private void writeScreenshotToScreensaver(Bitmap bitmap) {
771775
int lastSlash = dirPath.lastIndexOf('/');
772776
if (lastSlash >= 0) dirPath = dirPath.substring(0, lastSlash);
773777
try {
774-
new File(dirPath).mkdirs();
778+
File dir = new File(dirPath);
779+
if (!dir.exists()) {
780+
boolean created = dir.mkdirs();
781+
if (!created) {
782+
logW("screensaver mkdir failed (skipping write): " + dirPath);
783+
return;
784+
}
785+
}
775786
} catch (Throwable t) {
776787
logW("screensaver mkdir: " + t);
777788
}
@@ -898,7 +909,8 @@ public void run() {
898909
};
899910
}
900911
refreshHandler.removeCallbacks(refreshRunnable);
901-
logD("next display in " + (refreshMs / 1000L) + "s");
912+
long wakeAt = System.currentTimeMillis() + refreshMs;
913+
logD("next display in " + (refreshMs / 1000L) + "s (at " + new java.util.Date(wakeAt) + ")");
902914
refreshHandler.postDelayed(refreshRunnable, refreshMs);
903915
}
904916

0 commit comments

Comments
 (0)