From e37d60c2e304c599118a59e15ba4991f41cee785 Mon Sep 17 00:00:00 2001 From: wangqi Date: Wed, 27 Sep 2017 10:13:49 -0700 Subject: 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 --- .../dialer/strictmode/StrictModeComponent.java | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 java/com/android/dialer/strictmode/StrictModeComponent.java (limited to 'java/com/android/dialer/strictmode/StrictModeComponent.java') 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(); + } +} -- cgit v1.2.3