summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/metrics/MetricsComponent.java
diff options
context:
space:
mode:
authorzachh <zachh@google.com>2018-02-14 17:46:51 -0800
committerCopybara-Service <copybara-piper@google.com>2018-02-22 01:23:54 -0800
commit7ca3851cdd7d87822b4615d58e1cb61dc232ddb8 (patch)
tree75223230a48052bef1e6971c44074983673a33d7 /java/com/android/dialer/metrics/MetricsComponent.java
parent86491a974ae881bdf66245d0bc31be1e743ae30e (diff)
Created a "Metrics" interface.
Bug: 70989667 Test: existing PiperOrigin-RevId: 185773466 Change-Id: Ib40632fe87682f672df2f5e94a0e5bc4ca5970e9
Diffstat (limited to 'java/com/android/dialer/metrics/MetricsComponent.java')
-rw-r--r--java/com/android/dialer/metrics/MetricsComponent.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/java/com/android/dialer/metrics/MetricsComponent.java b/java/com/android/dialer/metrics/MetricsComponent.java
new file mode 100644
index 000000000..f37129791
--- /dev/null
+++ b/java/com/android/dialer/metrics/MetricsComponent.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2018 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.metrics;
+
+import android.content.Context;
+import com.android.dialer.inject.HasRootComponent;
+import dagger.Subcomponent;
+
+/** Component for metrics. */
+@Subcomponent
+public abstract class MetricsComponent {
+
+ public abstract Metrics metrics();
+
+ public abstract Metrics.Initializer metricsInitializer();
+
+ public static MetricsComponent get(Context context) {
+ return ((MetricsComponent.HasComponent)
+ ((HasRootComponent) context.getApplicationContext()).component())
+ .metricsComponent();
+ }
+
+ /** Used to refer to the root application component. */
+ public interface HasComponent {
+ MetricsComponent metricsComponent();
+ }
+}