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