Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
May 13, 2024

Conversation

copybara-service[bot]
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.

None yet

1 participant