diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2017-12-11 21:48:29 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2017-12-11 21:48:29 +0000 |
commit | 04e88264e69ec2b6974a4d9d6acfa7cd27934e5a (patch) | |
tree | 8d3fe7e8212bfaf312bb5159f898b56a7004f84e /java/com/android/dialer/spam/SpamComponent.java | |
parent | aab6dc9f075fd8576ffc78c1f983b8fb1d3e77fa (diff) | |
parent | 9ad8a72f81d9868e50e27199bbca248090e7aba9 (diff) |
Merge "Update Spam module to use Dagger"
Diffstat (limited to 'java/com/android/dialer/spam/SpamComponent.java')
-rw-r--r-- | java/com/android/dialer/spam/SpamComponent.java | 39 |
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(); + } +} |