Record max idle time

This commit is contained in:
M66B 2019-12-28 19:47:18 +01:00
parent 2b1459ef14
commit d11d15d771
2 changed files with 17 additions and 0 deletions

View File

@ -3308,6 +3308,22 @@ class Core {
}
}
private long maxIdle = 0;
private long lastActivity = 0;
synchronized void activity() {
long now = SystemClock.elapsedRealtime();
if (lastActivity > 0 && now - lastActivity > maxIdle) {
maxIdle = now - lastActivity;
Log.i("Max idle=" + (maxIdle / 1000));
}
lastActivity = now;
}
long getMaxIdle() {
return maxIdle;
}
@NonNull
@Override
public String toString() {

View File

@ -1020,6 +1020,7 @@ public class ServiceSynchronize extends ServiceBase implements SharedPreferences
while (ifolder.isOpen() && state.isRunning() && state.isRecoverable()) {
Log.i(folder.name + " do idle");
ifolder.idle(false);
state.activity();
}
} catch (Throwable ex) {
Log.e(folder.name, ex);