summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/spam/SpamComponent.java
diff options
context:
space:
mode:
authormaxwelb <maxwelb@google.com>2017-12-11 11:55:19 -0800
committerCopybara-Service <copybara-piper@google.com>2017-12-11 13:16:14 -0800
commit9ad8a72f81d9868e50e27199bbca248090e7aba9 (patch)
tree8d3fe7e8212bfaf312bb5159f898b56a7004f84e /java/com/android/dialer/spam/SpamComponent.java
parentaab6dc9f075fd8576ffc78c1f983b8fb1d3e77fa (diff)
Update Spam module to use Dagger
Test: TAP PiperOrigin-RevId: 178650781 Change-Id: I299907ac43d48b984b092433c9b651aadb17c62a
Diffstat (limited to 'java/com/android/dialer/spam/SpamComponent.java')
-rw-r--r--java/com/android/dialer/spam/SpamComponent.java39
1 files changed, 39 insertions, 0 deletions
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();
+ }
+}