diff options
author | twyen <twyen@google.com> | 2018-04-30 14:25:46 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-30 18:18:34 -0700 |
commit | 56f79ba6c6608f7041f5e65866b7164499ca7676 (patch) | |
tree | 7699f1e6bd1b2180d70144327d68f6df94dd3265 /java/com/android/dialer/preferredsim/PreferredSimComponent.java | |
parent | 90a68377c36abccde8c4f1e5d3aa781944a1413c (diff) |
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
Diffstat (limited to 'java/com/android/dialer/preferredsim/PreferredSimComponent.java')
-rw-r--r-- | java/com/android/dialer/preferredsim/PreferredSimComponent.java | 37 |
1 files changed, 37 insertions, 0 deletions
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(); + } +} |