diff options
Diffstat (limited to 'java/com')
11 files changed, 46 insertions, 0 deletions
diff --git a/java/com/android/dialer/calllog/datasources/CallLogDataSource.java b/java/com/android/dialer/calllog/datasources/CallLogDataSource.java index dbed1d81c..03a571675 100644 --- a/java/com/android/dialer/calllog/datasources/CallLogDataSource.java +++ b/java/com/android/dialer/calllog/datasources/CallLogDataSource.java @@ -105,4 +105,7 @@ public interface CallLogDataSource { @MainThread void registerContentObservers(Context appContext); + + @MainThread + void unregisterContentObservers(Context appContext); } diff --git a/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java b/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java index ff8c931ad..40b0090b9 100644 --- a/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java +++ b/java/com/android/dialer/calllog/datasources/phonelookup/PhoneLookupDataSource.java @@ -294,6 +294,11 @@ public final class PhoneLookupDataSource implements CallLogDataSource { compositePhoneLookup.registerContentObservers(appContext); } + @Override + public void unregisterContentObservers(Context appContext) { + compositePhoneLookup.unregisterContentObservers(appContext); + } + private static ImmutableSet<DialerPhoneNumber> queryDistinctDialerPhoneNumbersFromAnnotatedCallLog(Context appContext) { ImmutableSet.Builder<DialerPhoneNumber> numbers = ImmutableSet.builder(); diff --git a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java index 6daa5e757..3c34fa6a5 100644 --- a/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java +++ b/java/com/android/dialer/calllog/datasources/systemcalllog/SystemCallLogDataSource.java @@ -120,6 +120,11 @@ public class SystemCallLogDataSource implements CallLogDataSource { } @Override + public void unregisterContentObservers(Context appContext) { + appContext.getContentResolver().unregisterContentObserver(markDirtyObserver); + } + + @Override public ListenableFuture<Boolean> isDirty(Context appContext) { return backgroundExecutorService.submit(() -> isDirtyInternal(appContext)); } diff --git a/java/com/android/dialer/calllog/datasources/voicemail/VoicemailDataSource.java b/java/com/android/dialer/calllog/datasources/voicemail/VoicemailDataSource.java index e8dc3e1eb..86f3d47ce 100644 --- a/java/com/android/dialer/calllog/datasources/voicemail/VoicemailDataSource.java +++ b/java/com/android/dialer/calllog/datasources/voicemail/VoicemailDataSource.java @@ -108,4 +108,7 @@ public class VoicemailDataSource implements CallLogDataSource { @Override public void registerContentObservers(Context appContext) {} + + @Override + public void unregisterContentObservers(Context appContext) {} } diff --git a/java/com/android/dialer/phonelookup/PhoneLookup.java b/java/com/android/dialer/phonelookup/PhoneLookup.java index a7974ad10..016a8a854 100644 --- a/java/com/android/dialer/phonelookup/PhoneLookup.java +++ b/java/com/android/dialer/phonelookup/PhoneLookup.java @@ -85,4 +85,7 @@ public interface PhoneLookup<T> { @MainThread void registerContentObservers(Context appContext); + + @MainThread + void unregisterContentObservers(Context appContext); } diff --git a/java/com/android/dialer/phonelookup/blockednumber/DialerBlockedNumberPhoneLookup.java b/java/com/android/dialer/phonelookup/blockednumber/DialerBlockedNumberPhoneLookup.java index b6b02e135..3491070ad 100644 --- a/java/com/android/dialer/phonelookup/blockednumber/DialerBlockedNumberPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/blockednumber/DialerBlockedNumberPhoneLookup.java @@ -177,4 +177,9 @@ public final class DialerBlockedNumberPhoneLookup implements PhoneLookup<DialerB true, // FilteredNumberProvider notifies on the item markDirtyObserver); } + + @Override + public void unregisterContentObservers(Context appContext) { + appContext.getContentResolver().unregisterContentObserver(markDirtyObserver); + } } diff --git a/java/com/android/dialer/phonelookup/blockednumber/SystemBlockedNumberPhoneLookup.java b/java/com/android/dialer/phonelookup/blockednumber/SystemBlockedNumberPhoneLookup.java index d791e9b9e..def1f017d 100644 --- a/java/com/android/dialer/phonelookup/blockednumber/SystemBlockedNumberPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/blockednumber/SystemBlockedNumberPhoneLookup.java @@ -181,4 +181,9 @@ public class SystemBlockedNumberPhoneLookup implements PhoneLookup<SystemBlocked true, // BlockedNumbers notifies on the item markDirtyObserver); } + + @Override + public void unregisterContentObservers(Context appContext) { + appContext.getContentResolver().unregisterContentObserver(markDirtyObserver); + } } diff --git a/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java b/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java index 0d84a2eda..4be43dade 100644 --- a/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java +++ b/java/com/android/dialer/phonelookup/composite/CompositePhoneLookup.java @@ -222,6 +222,14 @@ public final class CompositePhoneLookup { } } + /** Delegates to sub-lookups' {@link PhoneLookup#unregisterContentObservers(Context)}. */ + @MainThread + public void unregisterContentObservers(Context appContext) { + for (PhoneLookup phoneLookup : phoneLookups) { + phoneLookup.unregisterContentObservers(appContext); + } + } + private static String getMostRecentInfoEventName(Object classNameSource, boolean isBuilt) { return String.format( !isBuilt diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java b/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java index a79eb19db..b023500dc 100644 --- a/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/cp2/Cp2DefaultDirectoryPhoneLookup.java @@ -627,6 +627,9 @@ public final class Cp2DefaultDirectoryPhoneLookup implements PhoneLookup<Cp2Info // Do nothing since CP2 changes are too noisy. } + @Override + public void unregisterContentObservers(Context appContext) {} + /** * 1. get all contact ids. if the id is unset, add the number to the list of contacts to look up. * 2. reduce our list of contact ids to those that were updated after lastModified. 3. Now we have diff --git a/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java b/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java index 519ec5f82..873658b05 100644 --- a/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/cp2/Cp2ExtendedDirectoryPhoneLookup.java @@ -233,4 +233,7 @@ public final class Cp2ExtendedDirectoryPhoneLookup implements PhoneLookup<Cp2Inf // For contacts in local (but not default) directories (e.g., the local work directory), we // don't register a content observer for now. } + + @Override + public void unregisterContentObservers(Context appContext) {} } diff --git a/java/com/android/dialer/phonelookup/spam/SpamPhoneLookup.java b/java/com/android/dialer/phonelookup/spam/SpamPhoneLookup.java index 7661a15da..2a856280b 100644 --- a/java/com/android/dialer/phonelookup/spam/SpamPhoneLookup.java +++ b/java/com/android/dialer/phonelookup/spam/SpamPhoneLookup.java @@ -156,4 +156,7 @@ public final class SpamPhoneLookup implements PhoneLookup<SpamInfo> { // No content observer can be registered as Spam is not based on a content provider. // Each Spam implementation should be responsible for notifying any data changes. } + + @Override + public void unregisterContentObservers(Context appContext) {} } |