Remove workaround for R class conflict in Settings unit test.
The workaround is accessing the resources dynamically with
Resources.getIdentifier(), however this makes it incompatible with R8
which will think the resource is unused and remove it, resulting in a
runtime exception. There is currently no way to have consumer ProGuard
texts in Soong, and we cannot disable R8 for PermissionController
because it would severely regress our APK size and make build unhappy.
The real cause for the original test failure is that, Settings unit
test used to include SettingsLib libraries in its static_libs, and
this caused duplicate R classes to be included in its test APK (which
is already in Settings APK) and resulted in the wrong R class being
loaded when accessing resources from Settings context.
So we should remove the SettingsLib dependencies in Settings unit test
and remove the workaround here, to correctly fix the issue and unblock
R8 usage.
Bug: 183340630
Bug: 177638625
Bug: 183342958
Test: atest SettingsSliderPreferenceControllerTest
Test: atest PrivateVolumeForgetTest
Change-Id: I404892ccb7c2004ec3f81df69c1dc4bceed150df
2 files changed