Skip to content
Commit 183f8d21 authored by Zim's avatar Zim
Browse files

Skip computing proc states during app initialization [take #2]

Now that app initialization covers class loading, there can be
hundreds of milliseconds delay before a top app activity gets
scheduled to start. During this delay, computing proc states
overrides the top app special case set at attachApplication to
boost the sched group.

This is fixed with the following changes:
1. Skip computing proc states when the application hasn't finished
attach application
2. Trigger a proc state update immediately after scheduling
bindApplication. This ensures that the special cased proc state is
applied as soon as possible

The previous attempt had a bug where setting the verified
and raw oom_adj to foreground_app broke subseqeunt computations of
the oom_adj and proc states after finish attach application to compute
wrong scores and broke a bunch of tests. The curAdj is the value
that gets sent to the kernel when we apply oomAdj, and we set
that to foreground_app in the pending finish attach phase.

All those tests now pass with the new fix

Test: atest MockingOomAdjusterTests
Test: atest android.app.cts.ActivityManagerProcessStateTest
Test: atest android.app.cts.ActivityManagerFgsBgStartTest
Test: atest android.app.cts.ActivityManagerTest
Test: atest android.app.cts.ServiceTest
Test: atest android.permission.cts.FileSystemPermissionTest
Test: atest android.permission.cts.OneTimePermissionTest
Bug: 253908737
Bug: 272062082
Change-Id: I73885b0f424831a1417586701d5f804a64af9a29
parent d26c87b3
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment