pub struct UidObserverCodes {
pub register_code: u32,
pub unregister_code: u32,
pub register_for_uids_code: Option<u32>,
pub on_gone_code: u32,
pub on_active_code: u32,
pub on_idle_code: u32,
pub on_cached_code: u32,
pub on_state_code: u32,
pub on_adj_code: u32,
}Expand description
Uid lifecycle observer tx codes (uid-scoped, event-driven both ways).
registerUidObserver(observer, which, cutpoint, callingPackage) reports
per-uid lifecycle events: onUidGone (no more processes for the uid),
onUidActive (uid is no longer idle), onUidIdle, onUidCachedChanged
(cached state changed), plus onUidStateChanged/onUidProcAdjChanged
when the corresponding UID_OBSERVER_* flags are requested. The daemon
pins the app’s uid at handoff, so it can filter these events on that
single uid — no pid resolution, no /proc, no retry loop.
registerUidObserverForUids (added in S) is the filtered variant that
only delivers events for a caller-supplied uid list; it requires the
caller to hold PACKAGE_USAGE_STATS (or PERMISSION_GRANTED via
root/system canAccessUnexportedComponents).
Fields§
§register_code: u32TRANSACTION_registerUidObserver on IActivityManager$Stub
unregister_code: u32TRANSACTION_unregisterUidObserver on IActivityManager$Stub
register_for_uids_code: Option<u32>TRANSACTION_registerUidObserverForUids on IActivityManager$Stub
(filtered variant, API 31+)
on_gone_code: u32TRANSACTION_onUidGone on IUidObserver$Stub
on_active_code: u32TRANSACTION_onUidActive on IUidObserver$Stub
on_idle_code: u32TRANSACTION_onUidIdle on IUidObserver$Stub
on_cached_code: u32TRANSACTION_onUidCachedChanged on IUidObserver$Stub
on_state_code: u32TRANSACTION_onUidStateChanged on IUidObserver$Stub
on_adj_code: u32TRANSACTION_onUidProcAdjChanged on IUidObserver$Stub