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

Commit fedf9129 authored by Aurélien Pomini's avatar Aurélien Pomini
Browse files

Fix UiModeManager contrast + force invert for HSUM

UiModeManager instances can now register contrast listener to a
different userId, provided it has INTERACT_ACROSS_USERS_FULL. SystemUI
will use this overload to tackle the HSUM case.

Now, there is a map userId -> UserCallback, and the UserCallback class
contains the listeners and cached values for a specific user.

Instead of adding a global callback upon instantiation of the class,
have one callback per user, and add it whenever a listener is registered
for that user. Remove it when the last listener is removed.

A difference is that getContrast or getForceInvertState will now query
the value via AIDL instead of returning a cached value, unless a
listener is registered for the process. The rationale is that if a
process needs to query these values often, it should register a
listener, we should not register a listener on behalf of the process by
default.

Flag: android.app.fix_contrast_and_force_invert_state_for_multi_user
Bug: 362682063
Test: manual - verify that the bug is fixed, check with logs that
listeners logic is correct
Test: atest UiModeManagerTest

Change-Id: I4a6175d00dab7c92ec519e54c404a4c75ffa1d78
parent 433d2a92
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