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

Skip to content
Commit e6c3aeac authored by Thiago Vinícius Freire de Araújo Ribeiro's avatar Thiago Vinícius Freire de Araújo Ribeiro Committed by Danny Baumann
Browse files

Settings: Improve QS tiles config code

Tile configuration has some unusual coding, like having a
public static Map (QuickSettingsUtil.TILES) to hold all
tile information.

That map is modified directly during the execution of
QuickSettings.onCreate(), which removes unavailable tiles
from this global map. Once those tiles are removed, they
are gone for good (until the runtime decides that it must
reinitialize QuickSettingsUtil.TILES).

This patch tweaks this process a bit:
 - The global TILES variable is now immutable.
 - There is a distiction from disabling and removing a tile
   - Removed tiles are those related to the device
     capabilities, and can never be enabled, once removed.
   - Disabled tiles are those related to the device state,
     like the ProfileTile, which is unavailable if the user
     has disabled the profile feature. Disabled tiles can
     be re-enabled later.
 - All code that actually removes/disables tiles is now at
   QuickSettingsUtil. The results of such operations are
   reflected on the TILES immutable view.
 - It is possible to enable tiles that have been disabled.

This changes improve [citation needed] coding style a bit,
but, furthermore, allows one to disable and reenable tiles
when needed be. For instance, enabling Profiles or Expanded
Desktop will cause the corresponding tile to be available
for selection immediately. That would not possible to
accomplish, once those tiles were removed from the available
TILES map.

Patch set 2: Rebased
Patch set 3: Rebase, refactor
Patch set 4: Check network tile availability at every resume
Patch set 5: Sort tiles at the adapter, revoke caveats
Patch set 6: Some cleanup

Change-Id: Ifd46d81a49b0ce036e9ccd6d13b6e2251ecbf42a
parent 49d50784
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