summaryrefslogtreecommitdiff
path: root/java/com/android/dialer/strictmode/StrictModeComponent.java
diff options
context:
space:
mode:
authorwangqi <wangqi@google.com>2017-09-27 10:13:49 -0700
committerEric Erfanian <erfanian@google.com>2017-09-28 08:33:56 -0700
commite37d60c2e304c599118a59e15ba4991f41cee785 (patch)
treeb1540b7210b312f8f47e31a2398130fd8850685e /java/com/android/dialer/strictmode/StrictModeComponent.java
parentc3c6126757e3b185587909e6ac9c7c6e897df4f9 (diff)
Refactor DialerStrictMode into an interface.
-bypassed violations are no longer logged in AospDialer The default implementation will use system strict mode and crash on bugfood build same as before. Bug: 66003745 Test: manual PiperOrigin-RevId: 170214128 Change-Id: Iab630f19499e90b15eb0b7f0707b4a70c7d81fbe
Diffstat (limited to 'java/com/android/dialer/strictmode/StrictModeComponent.java')
-rw-r--r--java/com/android/dialer/strictmode/StrictModeComponent.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/java/com/android/dialer/strictmode/StrictModeComponent.java b/java/com/android/dialer/strictmode/StrictModeComponent.java
new file mode 100644
index 000000000..7b9f48e20
--- /dev/null
+++ b/java/com/android/dialer/strictmode/StrictModeComponent.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2017 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.strictmode;
+
+import android.content.Context;
+import com.android.dialer.inject.HasRootComponent;
+import dagger.Subcomponent;
+
+/** Dagger component for DialerStrictMode. */
+@Subcomponent
+public abstract class StrictModeComponent {
+
+ public abstract DialerStrictMode getDialerStrictMode();
+
+ public static StrictModeComponent get(Context context) {
+ return ((StrictModeComponent.HasComponent)
+ ((HasRootComponent) context.getApplicationContext()).component())
+ .strictModeComponent();
+ }
+
+ /** Used to refer to the root application component. */
+ public interface HasComponent {
+ StrictModeComponent strictModeComponent();
+ }
+}