12f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian/*
22f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian * Copyright (C) 2017 The Android Open Source Project
32f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian *
42f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian * Licensed under the Apache License, Version 2.0 (the "License");
52f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian * you may not use this file except in compliance with the License.
62f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian * You may obtain a copy of the License at
72f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian *
82f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian *      http://www.apache.org/licenses/LICENSE-2.0
92f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian *
102f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian * Unless required by applicable law or agreed to in writing, software
112f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian * distributed under the License is distributed on an "AS IS" BASIS,
122f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
132f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian * See the License for the specific language governing permissions and
142f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian * limitations under the License
152f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian */
162f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
172f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianpackage com.android.dialer.common.concurrent;
182f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
192f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianimport android.content.Context;
202f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianimport com.android.dialer.inject.HasRootComponent;
212f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianimport dagger.Subcomponent;
222f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
232f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian/** Dagger component which provides a {@link DialerExecutorFactory}. */
242f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian@Subcomponent
252f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanianpublic abstract class DialerExecutorComponent {
262f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
272f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  public abstract DialerExecutorFactory dialerExecutorFactory();
282f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
292f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  public static DialerExecutorComponent get(Context context) {
302f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian    return ((DialerExecutorComponent.HasComponent)
312f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian            ((HasRootComponent) context.getApplicationContext()).component())
322f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian        .dialerExecutorComponent();
332f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  }
342f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian
352f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  /** Used to refer to the root application component. */
362f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  public interface HasComponent {
372f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian    DialerExecutorComponent dialerExecutorComponent();
382f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian  }
392f1c7586bcce334ca69022eb8dc6d8965ceb6a05Eric Erfanian}
40