summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllog/CallLogState.java
diff options
context:
space:
mode:
authorzachh <zachh@google.com>2018-03-27 18:13:49 -0700
committerCopybara-Service <copybara-piper@google.com>2018-03-27 18:16:10 -0700
commit68ea8cf4e1d5a19bf8ef44e9686305ded95852de (patch)
treec14d8aea364c511d69db8e8ab3b097ec1547b494 /java/com/android/dialer/calllog/CallLogState.java
parentbb4c1be2923ea7bfc9152e3cef9d0c12cb6664bd (diff)
Support new call log fragment in old peer.
This makes the old peer read the CallLogConfig#isNewCallLogFragmentEnabled and show the old or new fragment accordingly. If the user is viewing the NewCallLog and the CallLogConfig needs to disable the framework, the new fragment is immediately replaced with the old one. This is necessary because if the user were to scroll the fragment, the AnnotatedCallLog and PhoneLookupHistory databases would be read, which would trigger creation. I don't expect this to be a common case because 1) we hopefully never have to disable the framework and 2) Framework is only updated on Phenotype broadcasts and JobScheduler jobs, which hopefully don't typically happen when user is viewing the call log. However, I still want to make sure that if it happens we don't irreversibly break users when we turn the framework back on. I tested this by flipping flags and observing underlying data being removed: > dialer-cmd configprovider set new_voicemail_fragment_enabled false > adb shell ls /data/data/com.google.android.dialer/databases/ && echo && adb shell cat /data/user_de/0/com.google.android.dialer/shared_prefs/com.google.android.dialer_preferences.xml I test flipping flags back and forth on the call log tab, speed dial tab, and while the activity was paused (pressing Home after viewing call log). Note that this CL doesn't address showing missed calls and badge counts correctly with the new fragment; that will come in a later CL. Bug: 74821995 Test: unit and manual PiperOrigin-RevId: 190706481 Change-Id: I618d9c1649169abd65733502cfebc662a835e787
Diffstat (limited to 'java/com/android/dialer/calllog/CallLogState.java')
-rw-r--r--java/com/android/dialer/calllog/CallLogState.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/java/com/android/dialer/calllog/CallLogState.java b/java/com/android/dialer/calllog/CallLogState.java
index bdb30a769..6d2ec1e5e 100644
--- a/java/com/android/dialer/calllog/CallLogState.java
+++ b/java/com/android/dialer/calllog/CallLogState.java
@@ -54,6 +54,15 @@ public final class CallLogState {
}
/**
+ * Clear the call log state. This is useful for example if the annotated call log needs to be
+ * disabled because there was a problem.
+ */
+ @AnyThread
+ public void clearData() {
+ sharedPreferences.edit().remove(ANNOTATED_CALL_LOG_BUILT_PREF).apply();
+ }
+
+ /**
* Returns true if the annotated call log has been built at least once.
*
* <p>It may not yet have been built if the user was just upgraded to the new call log, or they