TestableSettingsProvider: tear down properly
We were finding that if a test that had to change settings (such as
com.android.test.input.AnrTest) ran after one that used TestableContext,
it would fail because its settings changes weren't applied.
This was because when its test finished, TestableContext would run the
same clearValuesAndCheck method that it used on setup. This cleared any
saved settings from the TestableSettingsProvider and reset the
Settings.ContentProviderHolder caches that still pointed to it, but it
would then make some settings put and get calls using the
TestableContext (and its content resolver), which would prime those
caches with the TestableSettingsProvider again. When subsequent tests
tried to make settings changes, they would go into the
TestableSettingsProvider's mValues hashmap and wouldn't get applied.
Instead, create a separate unregister method that only clears the
Settings.ContentProviderHolder caches, and call that on teardown.
Bug: 339924248
Test: $ atest TestableSettingsProviderTest
Test: $ atest --no-group-test \
InputTests:com.android.server.input.debug.TouchpadDebugViewTest \
InputTests:com.android.server.input.debug.TouchpadDebugViewControllerTests \
InputTests:com.android.test.input.AnrTest
Flag: TEST_ONLY
Change-Id: If42843a32609c84bcc21127703dab25d5bd3fc64
Loading
Please register or sign in to comment