From 56f79ba6c6608f7041f5e65866b7164499ca7676 Mon Sep 17 00:00:00 2001 From: twyen Date: Mon, 30 Apr 2018 14:25:46 -0700 Subject: Refactor PreferredAccountWorker to provide the dialog to be shown. When dual SIM selection support is added to In Call UI it was a rush order and codes are duplicated. This CL moves the duplicated logic into PreferredAccountWorker so the same dialog can be shown for both. TEST=manual Bug: 69675796,72618783 Test: manual PiperOrigin-RevId: 194845320 Change-Id: Id283ca7616580b0efd4e8f02e63691c70ee7f93c --- .../dialer/preferredsim/PreferredSimComponent.java | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 java/com/android/dialer/preferredsim/PreferredSimComponent.java (limited to 'java/com/android/dialer/preferredsim/PreferredSimComponent.java') diff --git a/java/com/android/dialer/preferredsim/PreferredSimComponent.java b/java/com/android/dialer/preferredsim/PreferredSimComponent.java new file mode 100644 index 000000000..b8d7fa199 --- /dev/null +++ b/java/com/android/dialer/preferredsim/PreferredSimComponent.java @@ -0,0 +1,37 @@ +/* + * 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.preferredsim; + +import android.content.Context; +import com.android.dialer.inject.HasRootComponent; +import dagger.Subcomponent; + +/** Component for preferred SIM */ +@Subcomponent +public abstract class PreferredSimComponent { + public abstract PreferredAccountWorker preferredAccountWorker(); + + public static PreferredSimComponent get(Context context) { + return ((HasComponent) ((HasRootComponent) context.getApplicationContext()).component()) + .preferredSimComponent(); + } + + /** Used to refer to the root application component. */ + public interface HasComponent { + PreferredSimComponent preferredSimComponent(); + } +} -- cgit v1.2.3