diff options
author | Riddle Hsu <riddlehsu@google.com> | 2020-11-13 21:54:19 -0600 |
---|---|---|
committer | Riddle Hsu <riddlehsu@google.com> | 2020-11-18 15:30:17 +0800 |
commit | f6e3f12715896b003a689d2ee026bade05434146 (patch) | |
tree | 0ef5ca1c92e8dd03a687c228be19c43e6f0fed65 /rs/java/android/renderscript/ProgramFragmentFixedFunction.java | |
parent | e12c50e04242730a54d0abae5e4efc55e5835bea (diff) |
Provide window visibility of uid without WM lock
The problems:
- ActivityTaskManagerInternal#isUidForeground is called frequently
from request of bind/start service. It is too heavy to acquire
WM lock each time.
- The isUidForeground calls isAnyNonToastWindowVisibleForUid. It is
inefficient to iterate entire window hierarchy. Especially the
calling uid usually doesn't have a window.
This change:
- Replace isAnyNonToastWindowVisibleForUid with hasActiveVisibleWindow
that queries VisibleActivityProcessTracker for activity, and
MirrorActiveUids for non-app (exclude toast) window. The separation
also makes it simpler to apply special rule to activity window for
background activity launch restriction in the future.
- Both the container have their own lock so WM lock is not needed for
ActivityTaskManagerService#hasActiveVisibleWindow.
- To reflect the latest state, if ActivityRecord#mVisibleRequested or
mVisible is changed, the process and uid state also need be updated.
- Launch a dozen activities after booting. With the same total
invocation count of isUidForegound, the total time becomes 20~30x
faster. While the state update time is negligible because the
structure is very simple and the frequency of change is not high.
- Remove a legacy workaround in WPC#computeProcessActivityState
that checks whether the activity belongs to the process. Because
it was fixed by ActivityRecord#detachFromProcess that ensures
the two-way relation.
Bug: 171490517
Test: WindowStateTests#testHasActiveVisibleWindow
ActivityStarterTests#testBackgroundActivityStarts*
ActivityManagerFgsBgStartTest
BackgroundActivityLaunchTest
Change-Id: Iadca2b79e8971c1a8633e2557f2e8a4184857650
Diffstat (limited to 'rs/java/android/renderscript/ProgramFragmentFixedFunction.java')
0 files changed, 0 insertions, 0 deletions