summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/binary
diff options
context:
space:
mode:
authorEric Erfanian <erfanian@google.com>2017-03-21 10:11:17 -0700
committerEric Erfanian <erfanian@google.com>2017-03-21 10:11:17 -0700
commitfc37b02f5d3381a7882770941e461b13b679b6ef (patch)
tree23ce96100a89f1cf8847a4967efd35e56b6f8092 /java/com/android/dialer/binary
parent30ccc4f3aa6da94f0bb8a01a880a6353b883b263 (diff)
Update AOSP Dialer source from internal google3 repository at
cl/150756069 Test: make, treehugger This CL updates the AOSP Dialer source with all the changes that have gone into the private google3 repository. This includes all the changes from cl/150392808 (3/16/2017) to cl/150756069 (3/21/2017). This goal of these drops is to keep the AOSP source in sync with the internal google3 repository. Currently these sync are done by hand with very minor modifications to the internal source code. See the Android.mk file for list of modifications. Our current goal is to do frequent drops (daily if possible) and eventually switched to an automated process. Change-Id: I0888b5db52efb28eb8194600e0c7804592f975f3
Diffstat (limited to 'java/com/android/dialer/binary')
-rw-r--r--java/com/android/dialer/binary/aosp/AospDialerApplication.java7
-rw-r--r--java/com/android/dialer/binary/aosp/AospDialerRootComponent.java11
-rw-r--r--java/com/android/dialer/binary/common/DialerApplication.java26
3 files changed, 42 insertions, 2 deletions
diff --git a/java/com/android/dialer/binary/aosp/AospDialerApplication.java b/java/com/android/dialer/binary/aosp/AospDialerApplication.java
index f657a3987..4ca94e277 100644
--- a/java/com/android/dialer/binary/aosp/AospDialerApplication.java
+++ b/java/com/android/dialer/binary/aosp/AospDialerApplication.java
@@ -26,5 +26,10 @@ import com.android.dialer.inject.ContextModule;
*/
public class AospDialerApplication extends DialerApplication {
-
+ /** Returns a new instance of the root component for the AOSP Dialer. */
+ @Override
+ @NonNull
+ protected Object buildRootComponent() {
+ return DaggerAospDialerRootComponent.builder().contextModule(new ContextModule(this)).build();
+ }
}
diff --git a/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java b/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java
index 8628e90c2..54fedc2be 100644
--- a/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java
+++ b/java/com/android/dialer/binary/aosp/AospDialerRootComponent.java
@@ -27,4 +27,15 @@ import dagger.Component;
import javax.inject.Singleton;
/** Root component for the AOSP Dialer application. */
+@Singleton
+@Component(
+ modules = {
+ ContextModule.class,
+ SimulatorModule.class,
+ StubCallLocationModule.class,
+ StubEnrichedCallModule.class,
+ StubMapsModule.class,
+ VoicemailModule.class
+ }
+)
public interface AospDialerRootComponent extends BaseDialerRootComponent {}
diff --git a/java/com/android/dialer/binary/common/DialerApplication.java b/java/com/android/dialer/binary/common/DialerApplication.java
index c0be4328c..cc7befc90 100644
--- a/java/com/android/dialer/binary/common/DialerApplication.java
+++ b/java/com/android/dialer/binary/common/DialerApplication.java
@@ -22,9 +22,10 @@ import android.preference.PreferenceManager;
import android.support.annotation.NonNull;
import com.android.dialer.blocking.BlockedNumbersAutoMigrator;
import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler;
+import com.android.dialer.inject.HasRootComponent;
/** A common application subclass for all Dialer build variants. */
-public abstract class DialerApplication extends Application {
+public abstract class DialerApplication extends Application implements HasRootComponent {
private volatile Object rootComponent;
@@ -40,4 +41,27 @@ public abstract class DialerApplication extends Application {
Trace.endSection();
}
+ /**
+ * Returns a new instance of the root component for the application. Sub classes should define a
+ * root component that extends all the sub components "HasComponent" intefaces. The component
+ * should specify all modules that the application supports and provide stubs for the remainder.
+ */
+ @NonNull
+ protected abstract Object buildRootComponent();
+
+ /** Returns a cached instance of application's root component. */
+ @Override
+ @NonNull
+ public final Object component() {
+ Object result = rootComponent;
+ if (result == null) {
+ synchronized (this) {
+ result = rootComponent;
+ if (result == null) {
+ rootComponent = result = buildRootComponent();
+ }
+ }
+ }
+ return result;
+ }
}