Skip to content

Commit aec7a6d

Browse files
author
andreas
committed
make auto shutdown working again on android, max. time 600
1 parent a9b914d commit aec7a6d

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

android/app/src/main/java/de/wellenvogel/ochartsprovider/MainActivity.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public void run() {
121121
}
122122
}
123123
else{
124-
state=service.getProcessState();
124+
state=service.getProcessState(true);
125125
}
126126
if (state.isRunning){
127127
pid.setText("running");

android/app/src/main/java/de/wellenvogel/ochartsprovider/OchartsService.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -226,8 +226,10 @@ private boolean checkPermissions(boolean request){
226226
}
227227

228228

229-
public ProcessState getProcessState(){
230-
lastTrigger=SystemClock.uptimeMillis();
229+
public ProcessState getProcessState(boolean trigger){
230+
if (trigger) {
231+
lastTrigger = SystemClock.uptimeMillis();
232+
}
231233
if (processHandler != null) return processHandler.getState();
232234
return new ProcessState();
233235
}
@@ -537,7 +539,7 @@ void shutDown(){
537539
stopSelf();
538540
}
539541
private void broadcastInfo(){
540-
ProcessState pstate=getProcessState();
542+
ProcessState pstate=getProcessState(false);
541543
lastBroadcast=SystemClock.uptimeMillis();
542544
//intentionally set lastBroadcaset before check to avoid error flood
543545
if (!pstate.isRunning){

android/app/src/main/res/values/settings.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<string name="s_shutdown">shutdown</string>
1010
<integer name="s_shutdown_default">30</integer>
1111
<integer name="s_shutdown_min">0</integer>
12-
<integer name="s_shutdown_max">3600</integer>
12+
<integer name="s_shutdown_max">600</integer>
1313
<string name="s_memory">memory</string>
1414
<integer name="s_memory_min">10</integer>
1515
<integer name="s_memory_default">30</integer>

0 commit comments

Comments
 (0)