From 06b6b56e9eaa91ebf757ea641e38a9c885fa40bd Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Mon, 20 Mar 2017 08:50:25 -0700 Subject: Update AOSP Dialer source from internal google3 repository at cl/150622237 Test: make, treehugger, on device testing. 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/150622237 (3/20/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: Id53e0e580a4ef73760a8afb7bb8c265ee27ad535 --- .../dialer/binary/common/DialerApplication.java | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'java/com/android/dialer/binary/common/DialerApplication.java') 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; + } } -- cgit v1.2.3