17ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh/*
27ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh * Copyright (C) 2018 The Android Open Source Project
37ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh *
47ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh * Licensed under the Apache License, Version 2.0 (the "License");
57ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh * you may not use this file except in compliance with the License.
67ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh * You may obtain a copy of the License at
77ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh *
87ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh *      http://www.apache.org/licenses/LICENSE-2.0
97ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh *
107ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh * Unless required by applicable law or agreed to in writing, software
117ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh * distributed under the License is distributed on an "AS IS" BASIS,
127ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
137ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh * See the License for the specific language governing permissions and
147ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh * limitations under the License
157ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh */
167ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh
177ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachhpackage com.android.dialer.metrics;
187ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh
197ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachhimport android.content.Context;
207ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachhimport com.android.dialer.inject.HasRootComponent;
217ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachhimport dagger.Subcomponent;
227ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh
237ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh/** Component for metrics. */
247ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh@Subcomponent
257ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachhpublic abstract class MetricsComponent {
267ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh
277ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh  public abstract Metrics metrics();
287ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh
297ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh  public abstract Metrics.Initializer metricsInitializer();
307ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh
31dfded3aac2c4628f74cafdd2eb096f553d0d48adzachh  public abstract FutureTimer futureTimer();
32dfded3aac2c4628f74cafdd2eb096f553d0d48adzachh
337ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh  public static MetricsComponent get(Context context) {
347ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh    return ((MetricsComponent.HasComponent)
357ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh            ((HasRootComponent) context.getApplicationContext()).component())
367ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh        .metricsComponent();
377ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh  }
387ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh
397ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh  /** Used to refer to the root application component. */
407ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh  public interface HasComponent {
417ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh    MetricsComponent metricsComponent();
427ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh  }
437ca3851cdd7d87822b4615d58e1cb61dc232ddb8zachh}
44