diff options
Diffstat (limited to 'java/com/android/incallui/maps/MapsComponent.java')
-rw-r--r-- | java/com/android/incallui/maps/MapsComponent.java | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/java/com/android/incallui/maps/MapsComponent.java b/java/com/android/incallui/maps/MapsComponent.java index 796abaa92..1ca17b781 100644 --- a/java/com/android/incallui/maps/MapsComponent.java +++ b/java/com/android/incallui/maps/MapsComponent.java @@ -19,18 +19,29 @@ package com.android.incallui.maps; import android.content.Context; import com.android.dialer.inject.HasRootComponent; import dagger.Subcomponent; +import com.android.incallui.maps.stub.StubMapsModule; /** Subcomponent that can be used to access the maps implementation. */ -@Subcomponent -public abstract class MapsComponent { +public class MapsComponent { - public abstract Maps getMaps(); + private static MapsComponent instance; + private Maps maps; + + public Maps getMaps() { + if (maps == null) { + maps = new StubMapsModule.StubMaps(); + } + return maps; + } public static MapsComponent get(Context context) { - return ((HasComponent) ((HasRootComponent) context.getApplicationContext()).component()) - .mapsComponent(); + if (instance == null) { + instance = new MapsComponent(); + } + return instance; } + /** Used to refer to the root application component. */ public interface HasComponent { MapsComponent mapsComponent(); |