Commit f46723b
Christopher Tate
Implement background vs foreground broadcasts
Before now, receiving a broadcast would cause a process to be hoisted
to foreground priority / cgroup. This is no longer the case: broadcasts
by default are handled in the background, with a suitably increased
timeout interval. When a given broadcast needs to be dealt with in a
more timely manner, the issuer can set the new FLAG_BROADCAST_FOREGROUND
flag on the Intent, which will produce the old foreground-priority
behavior.
To avoid priority inversions, foreground broadcasts are tracked on a
separate outgoing queue and can be in flight simultaneously with a
background-priority broadcast. If there is already a background-level
broadcast in flight to a given app and then a foreground-level one is
dispatched to that app, the app [and its handling of both broadcasts]
will be properly hoisted to foreground priority.
This change is also essentially the first step towards refactoring the
broadcast-handling portions of the Activity Manager into a more
independent existence. Making BroadcastQueue a top-level class and
regularizing its operation viz the primary Activity Manager operation
is the next step.
Change-Id: If1be33156dc22dcce318edbb5846b08df8e7bed51 parent c97992b commit f46723b
File tree
4 files changed
+972
-757
lines changed- api
- core/java/android/content
- services/java/com/android/server/am
4 files changed
+972
-757
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5640 | 5640 | | |
5641 | 5641 | | |
5642 | 5642 | | |
| 5643 | + | |
5643 | 5644 | | |
5644 | 5645 | | |
5645 | 5646 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2956 | 2956 | | |
2957 | 2957 | | |
2958 | 2958 | | |
| 2959 | + | |
| 2960 | + | |
| 2961 | + | |
| 2962 | + | |
| 2963 | + | |
| 2964 | + | |
| 2965 | + | |
2959 | 2966 | | |
2960 | 2967 | | |
2961 | 2968 | | |
| |||
2969 | 2976 | | |
2970 | 2977 | | |
2971 | 2978 | | |
2972 | | - | |
| 2979 | + | |
2973 | 2980 | | |
2974 | 2981 | | |
2975 | 2982 | | |
2976 | 2983 | | |
2977 | 2984 | | |
2978 | 2985 | | |
2979 | | - | |
| 2986 | + | |
2980 | 2987 | | |
2981 | 2988 | | |
2982 | 2989 | | |
| |||
0 commit comments