Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 075f9fe4 authored by Adam Bookatz's avatar Adam Bookatz
Browse files

Stop inactive bg user if memory pressure

Overhauls the previous scheduled stopping of background user mechanism
and replaces it with the following logic:
* We don't automatically schedule the background user for stopping right
  away.
* Instead, we schedule a later *judgement* of that user, which will
  hinge upon how long the user has been in the background and whether
  there has been evidence of memory pressure during that time.
* If the user remains inactive for a long (configurable) time, we will
  judge the user to be dispensable, meaning that it isn't important.
  Even then, we still don't necessarily stop the user yet.
* If the number of low memory kills (lmks) of better-than-cached apps
  has increased during this time (a sign of memory pressure and a sign
  that the user's apps have largely been killed anyway), then we will
  render judgement that this dispensable background user should be
  stopped.

Note that the old mechanism was never enabled, since its flag was never
turned on at all. We repurpose the flag for the updated mechanism.

Internal design doc: go/stopping-background-users-under-pressure

Bug: 425992644
Bug: 330351042
Test: atest FrameworksServicesTests:UserControllerTest
Flag: android.multiuser.schedule_stop_of_background_user_by_default
Change-Id: I3e73c572d6540a1cf5115a44ea22331501c3542f
parent 2ef30ecf
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment