Revert "Revert "Migrating all model tests to Instrumentation tests""

This reverts commit 7a4a30d86d.

Test: Presubmit
Reason for revert: Fixing original bug

Bug: 196825541
Change-Id: Id4b1eb24a89564d264266d305aebea52917dfcd9
This commit is contained in:
Sunny Goyal
2021-08-27 21:22:17 +00:00
committed by Alex Chau
parent ee3814de1a
commit 777d49062f
31 changed files with 807 additions and 684 deletions

View File

@@ -47,7 +47,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
*
* Cache will also be updated if a key queried is missing (even if it has no listeners registered).
*/
public class SettingsCache extends ContentObserver {
public class SettingsCache extends ContentObserver implements SafeCloseable {
/** Hidden field Settings.Secure.NOTIFICATION_BADGING */
public static final Uri NOTIFICATION_BADGING_URI =
@@ -69,7 +69,6 @@ public class SettingsCache extends ContentObserver {
private final Map<Uri, CopyOnWriteArrayList<OnChangeListener>> mListenerMap = new HashMap<>();
protected final ContentResolver mResolver;
/**
* Singleton instance
*/
@@ -81,6 +80,11 @@ public class SettingsCache extends ContentObserver {
mResolver = context.getContentResolver();
}
@Override
public void close() {
mResolver.unregisterContentObserver(this);
}
@Override
public void onChange(boolean selfChange, Uri uri) {
// We use default of 1, but if we're getting an onChange call, can assume a non-default