Prevent infinite appending default in retail mode
When in reatil mode, we restrict the tiles that are shown to a small
set. However, that set is the same size as the minimum number of tiles.
If any of those tiles cannot be created (for example, flashlight in
large devices), we end up with less tiles than the minimum, which will
trigger a `prependDefault`. However, as the CurrentTilesInteractor only
sees the retail tiles, this will keep happening and the tiles in
Settings will grow unbounded, crashing the device. We fix this at
a handful of points:
* When applying a change to the tiles, apply `distinct` so that only the
first copy of each tile is saved.
* Prevent TileSpecRepository from applying prependDefault when in
retailMode (same as other tile operations).
* When in retail mode, the min number of tiles in the
CurrentTilesInteractor is reduced to 1.
Test: atest com.android.systemui.qs.pipeline
Fixes: 340450011
Flag: EXEMPT Bug Fix
Change-Id: I8771f0a8ae8b88e5d3600b35ee96901fc46cbc53
9 files changed