From 9ad8a72f81d9868e50e27199bbca248090e7aba9 Mon Sep 17 00:00:00 2001 From: maxwelb Date: Mon, 11 Dec 2017 11:55:19 -0800 Subject: Update Spam module to use Dagger Test: TAP PiperOrigin-RevId: 178650781 Change-Id: I299907ac43d48b984b092433c9b651aadb17c62a --- java/com/android/dialer/spam/SpamComponent.java | 39 +++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 java/com/android/dialer/spam/SpamComponent.java (limited to 'java/com/android/dialer/spam/SpamComponent.java') diff --git a/java/com/android/dialer/spam/SpamComponent.java b/java/com/android/dialer/spam/SpamComponent.java new file mode 100644 index 000000000..0bcdafac8 --- /dev/null +++ b/java/com/android/dialer/spam/SpamComponent.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2016 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.dialer.spam; + +import android.content.Context; +import com.android.dialer.inject.HasRootComponent; +import dagger.Subcomponent; + +/** Dagger component to get Spam. */ +@Subcomponent +public abstract class SpamComponent { + + public abstract Spam spam(); + + public static SpamComponent get(Context context) { + return ((SpamComponent.HasComponent) + ((HasRootComponent) context.getApplicationContext()).component()) + .spamComponent(); + } + + /** Used to refer to the root application component. */ + public interface HasComponent { + SpamComponent spamComponent(); + } +} -- cgit v1.2.3