summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/calllog/CallLogFramework.java
diff options
context:
space:
mode:
Diffstat (limited to 'java/com/android/dialer/calllog/CallLogFramework.java')
-rw-r--r--java/com/android/dialer/calllog/CallLogFramework.java70
1 files changed, 4 insertions, 66 deletions
diff --git a/java/com/android/dialer/calllog/CallLogFramework.java b/java/com/android/dialer/calllog/CallLogFramework.java
index 440055de6..7da8d9c0c 100644
--- a/java/com/android/dialer/calllog/CallLogFramework.java
+++ b/java/com/android/dialer/calllog/CallLogFramework.java
@@ -17,40 +17,26 @@
package com.android.dialer.calllog;
import android.content.Context;
-import android.content.SharedPreferences;
-import android.support.annotation.MainThread;
-import android.support.annotation.Nullable;
-import android.support.annotation.VisibleForTesting;
import com.android.dialer.calllog.datasources.CallLogDataSource;
import com.android.dialer.calllog.datasources.DataSources;
-import com.android.dialer.common.Assert;
import com.android.dialer.common.LogUtil;
import com.android.dialer.configprovider.ConfigProviderBindings;
-import com.android.dialer.storage.Unencrypted;
import javax.inject.Inject;
import javax.inject.Singleton;
/**
- * Coordinates work across CallLog data sources to detect if the annotated call log is out of date
- * ("dirty") and update it if necessary.
+ * Coordinates work across {@link DataSources}.
*
* <p>All methods should be called on the main thread.
*/
@Singleton
-public final class CallLogFramework implements CallLogDataSource.ContentObserverCallbacks {
-
- @VisibleForTesting(otherwise = VisibleForTesting.PACKAGE_PRIVATE)
- public static final String PREF_FORCE_REBUILD = "callLogFrameworkForceRebuild";
+public final class CallLogFramework {
private final DataSources dataSources;
- private final SharedPreferences sharedPreferences;
-
- @Nullable private CallLogUi ui;
@Inject
- CallLogFramework(DataSources dataSources, @Unencrypted SharedPreferences sharedPreferences) {
+ CallLogFramework(DataSources dataSources) {
this.dataSources = dataSources;
- this.sharedPreferences = sharedPreferences;
}
/** Registers the content observers for all data sources. */
@@ -63,58 +49,10 @@ public final class CallLogFramework implements CallLogDataSource.ContentObserver
// TODO(zachh): Find a way to access Main#isNewUiEnabled without creating a circular dependency.
if (ConfigProviderBindings.get(appContext).getBoolean("is_nui_shortcut_enabled", false)) {
for (CallLogDataSource dataSource : dataSources.getDataSourcesIncludingSystemCallLog()) {
- dataSource.registerContentObservers(appContext, this);
+ dataSource.registerContentObservers(appContext);
}
} else {
LogUtil.i("CallLogFramework.registerContentObservers", "not registering content observers");
}
}
-
- /**
- * Attach a UI component to the framework so that it may be notified of changes to the annotated
- * call log.
- */
- public void attachUi(CallLogUi ui) {
- LogUtil.enterBlock("CallLogFramework.attachUi");
- this.ui = ui;
- }
-
- /**
- * Detaches the UI from the framework. This should be called when the UI is hidden or destroyed
- * and no longer needs to be notified of changes to the annotated call log.
- */
- public void detachUi() {
- LogUtil.enterBlock("CallLogFramework.detachUi");
- this.ui = null;
- }
-
- /**
- * Marks the call log as dirty and notifies any attached UI components. If there are no UI
- * components currently attached, this is an efficient operation since it is just writing a shared
- * pref.
- *
- * <p>We don't want to actually force a rebuild when there is no UI running because we don't want
- * to be constantly rebuilding the database when the device is sitting on a desk and receiving a
- * lot of calls, for example.
- */
- @Override
- @MainThread
- public void markDirtyAndNotify(Context appContext) {
- Assert.isMainThread();
- LogUtil.enterBlock("CallLogFramework.markDirtyAndNotify");
-
- sharedPreferences.edit().putBoolean(PREF_FORCE_REBUILD, true).apply();
-
- if (ui != null) {
- ui.invalidateUi();
- }
- }
-
- /** Callbacks invoked on listening UI components. */
- public interface CallLogUi {
-
- /** Notifies the call log UI that the annotated call log is out of date. */
- @MainThread
- void invalidateUi();
- }
}