diff options
| author | 2025-01-30 16:19:11 +0100 | |
|---|---|---|
| committer | 2025-01-30 16:19:11 +0100 | |
| commit | bab932f258ebbb0fd41960603e79cab4e8bed8d6 (patch) | |
| tree | 5b6e6ad4538e02ae1e551378c756fd806ff4b7cb /libs/androidfw/Util.cpp | |
| parent | 7e6a7855470e5aa7621780959e95bc66b4dc025f (diff) | |
Generate sequential instead of random rule ids in TestModeBuilder
Because we were only generating numbers between 0 and 1000 for whatever reason, there was a relatively high chance that two Modes could end up with the same id. This is generally not a problem because ZenMode has a well-defined equals method and we rarely use the ids except for API calls (which unit tests don't exercise). However some parts of the code (notably ModesDialogViewModel) do match modes by id (for visual stability), so collisions would lead to wrong results and test flakiness.
With this change we will only get collisions if a test uses a list containing 4294967296 modes. Good luck with that!
Fixes: 391727306
Test: atest ModesDialogViewModelTest
Flag: TEST_ONLY
Change-Id: I1b7dfdd18f41ffe04bba7b2d6a54f53f259a0a05
Diffstat (limited to 'libs/androidfw/Util.cpp')
0 files changed, 0 insertions, 0 deletions