diff options
Diffstat (limited to 'java/com/android/incallui/calllocation/CallLocationComponent.java')
-rw-r--r-- | java/com/android/incallui/calllocation/CallLocationComponent.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/java/com/android/incallui/calllocation/CallLocationComponent.java b/java/com/android/incallui/calllocation/CallLocationComponent.java index 46ca669db..6b1faf299 100644 --- a/java/com/android/incallui/calllocation/CallLocationComponent.java +++ b/java/com/android/incallui/calllocation/CallLocationComponent.java @@ -17,18 +17,26 @@ package com.android.incallui.calllocation; import android.content.Context; -import com.android.dialer.inject.HasRootComponent; import dagger.Subcomponent; +import com.android.incallui.calllocation.stub.StubCallLocationModule; /** Subcomponent that can be used to access the call location implementation. */ -@Subcomponent -public abstract class CallLocationComponent { +public class CallLocationComponent { + private static CallLocationComponent instance; + private CallLocation callLocation; - public abstract CallLocation getCallLocation(); + public CallLocation getCallLocation(){ + if (callLocation == null) { + callLocation = new StubCallLocationModule.StubCallLocation(); + } + return callLocation; + } public static CallLocationComponent get(Context context) { - return ((HasComponent) ((HasRootComponent) context.getApplicationContext()).component()) - .callLocationComponent(); + if (instance == null) { + instance = new CallLocationComponent(); + } + return instance; } /** Used to refer to the root application component. */ |