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
Loading
Please register or sign in to comment