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

Commit 4fafae68 authored by Chih-Yu Huang's avatar Chih-Yu Huang
Browse files

Decouple ProcessStateRecord with Observer pattern

This CL introduces the `ProcessStateRecord.Observer` and
`ProcessStateRecord.StartedServiceObserver` interfaces to decouple
`ProcessStateRecord` from directly interacting with `ProcessRecord`'s
`WindowProcessController` and `ProcessProfileRecord`.

Previously, `ProcessStateRecord` directly updated `ProcessRecord`'s
components (like `WindowProcessController` and `ProcessProfileRecord`)
upon internal state changes (e.g., OOM adj, process state). This created
a tight coupling.

This change introduces:
- New `ProcessStateRecord.Observer` and
  `ProcessStateRecord.StartedServiceObserver`interfaces with callbacks
  for various state changes.
- `WindowProcessController` and `ProcessProfileRecord` now implement the
  observer interfaces and register with the corresponding
  `ProcessStateRecord` instance.
- `ProcessStateRecord` now notifies its observers of state changes.

Bug: 425766486
Test: atest MockingOomAdjusterTests
Flag: EXEMPT pure refactor
Change-Id: Iaa5f824ff923eaae6744688879a33fcfe435d6ab
parent ea8e96ba
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