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

Commit 116d80ea authored by Adam Bookatz's avatar Adam Bookatz
Browse files

UserTypeFactory: use method, not static final int

For certain mocking tests, usage of a static final int causes problems,
since the constant sometimes happens to be evaluated first by a test
fakes some of the values, resulting in a wrong constant for all
subsequent tests in the suite. To fix this, we use a method, and
recalculate the value each time. In real life, this is only 3
evaluations, which are very cheap, so this workaround is fine.

For posterity, note that the without this cl, running the test
atest UserManagerServiceMockedTest
works fine, since the evaluated constant happens to be correct,
but when run as part of a larger suite, say via
atest FrameworksMockingServicesTests:com.android.server.pm
the tests would fail due to an earlier test misinitializing the
constant.

Bug: 436331608
Flag: EXEMPT BUGFIX
Test: atest FrameworksMockingServicesTests:com.android.server.pm
Change-Id: I41ba1533397b979f48913e20d07af8cbac6a1386
parent 3df32c4e
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