Android client: remove apps from memory if we're on batteries.

Because apps poll 10X/sec for messages from the client,
there is a CPU overhead in leaving suspended apps in memory,
which can cause battery drain.
This commit is contained in:
David Anderson 2013-06-12 12:15:57 -07:00
parent cd561b3084
commit af73b2b862
1 changed files with 9 additions and 0 deletions

View File

@ -1076,8 +1076,17 @@ void ACTIVE_TASK_SET::suspend_all(int reason) {
// //
atp->preempt(REMOVE_NEVER); atp->preempt(REMOVE_NEVER);
break; break;
#ifdef ANDROID
case SUSPEND_REASON_BATTERIES:
// On Android, remove apps from memory if on batteries.
// The message polling in the BOINC runtime system
// imposes an overhead which drains the battery a bit
atp->preempt(REMOVE_ALWAYS);
break;
#endif
default: default:
atp->preempt(REMOVE_MAYBE_USER); atp->preempt(REMOVE_MAYBE_USER);
break;
} }
} }
} }