Introduce SettingsProx in place of Settings.
This introduces SecureSettings, GlobalSettings, and SystemSettings that are instantiable classes that proxy calls through to the static methods of Settings.Secure, Settings.Global, and Settings.System. This allows instances to be mocked and faked in tests. This also removes any concern of changing shared settings between tests. This also addes registerContentObserver and unregisterContentObserver to these classes as a convenient way of unifying access to settings. Previously, settings were read and written via static methods, but changes to settings were observeed through ContentResolver, an entirely separate class. An example refactor using these new utilities is shown in DozeTriggers. Fixes: 159904757 Test: atest SystemUITests && manual Change-Id: I3a907c2066de427676472769e212fe58cd38cf69
Loading
Please register or sign in to comment