Skip to content

Conversation

@copybara-service
Copy link

Add support for many DeviceConfig methods using Settings.Config shadow methods

Add Shadow method implementations for the following Settings.Config methods:

  • Settings.Config.getString(...)
  • Settings.Config.getStrings(...)
  • Settings.Config.putString(...)
  • Settings.Config.setStrings(...)
  • Settings.Config.deleteString(...)

The advantage of this approach is that it uses the real DeviceConfig code. As
an additional benefit. this also avoids a race condition where calling
Settings.Config.getString on Android U could result in an NPE if invoked by a
leaking thread in between tests, due to a null
RuntimeEnvironment.activityThread member.

There are still some limitations, such as no content notifications when
DeviceConfig changes, but this also did not work prior to this CL, and can be
fixed in a forthcoming CL.

Also, add a large subset of the CTS DeviceConfigTest.

…w methods

Add Shadow method implementations for the following Settings.Config methods:
* Settings.Config.getString(...)
* Settings.Config.getStrings(...)
* Settings.Config.putString(...)
* Settings.Config.setStrings(...)
* Settings.Config.deleteString(...)

The advantage of this approach is that it uses the real DeviceConfig code. As
an additional benefit. this also avoids a race condition where calling
Settings.Config.getString on Android U could result in an NPE if invoked by a
leaking thread in between tests, due to a null
RuntimeEnvironment.activityThread member.

There are still some limitations, such as no content notifications when
DeviceConfig changes, but this also did not work prior to this CL, and can be
fixed in a forthcoming CL.

Also, add a large subset of the CTS DeviceConfigTest.

PiperOrigin-RevId: 633229653
@copybara-service copybara-service bot merged commit 4acc9e0 into google May 13, 2024
@copybara-service copybara-service bot deleted the piper_631497441 branch May 13, 2024 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants