From c1623fe219f3229bf9191afdcf0667efd0f549b8 Mon Sep 17 00:00:00 2001 From: twyen Date: Thu, 25 Jan 2018 15:54:00 -0800 Subject: Remove non call log dependencies on PhoneAccountUtil Methods moved to TelecomUtils Test: Unit tests PiperOrigin-RevId: 183305626 Change-Id: Idd6604e58c06a36066bd49870849dd71747969c6 --- .../dialer/calllogutils/CallLogIntents.java | 4 ++- .../dialer/calllogutils/PhoneAccountUtils.java | 32 ---------------------- 2 files changed, 3 insertions(+), 33 deletions(-) (limited to 'java/com/android/dialer/calllogutils') diff --git a/java/com/android/dialer/calllogutils/CallLogIntents.java b/java/com/android/dialer/calllogutils/CallLogIntents.java index b06fe6e93..05af8bfc7 100644 --- a/java/com/android/dialer/calllogutils/CallLogIntents.java +++ b/java/com/android/dialer/calllogutils/CallLogIntents.java @@ -24,6 +24,7 @@ import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.calllog.model.CoalescedRow; import com.android.dialer.precall.PreCall; +import com.android.dialer.telecom.TelecomUtil; /** Provides intents related to call log entries. */ public final class CallLogIntents { @@ -51,7 +52,8 @@ public final class CallLogIntents { context, new CallIntentBuilder(originalNumber, CallInitiationType.Type.CALL_LOG) .setPhoneAccountHandle( - PhoneAccountUtils.getAccount(row.phoneAccountComponentName(), row.phoneAccountId())) + TelecomUtil.composePhoneAccountHandle( + row.phoneAccountComponentName(), row.phoneAccountId())) .setIsVideoCall((row.features() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO)); } } diff --git a/java/com/android/dialer/calllogutils/PhoneAccountUtils.java b/java/com/android/dialer/calllogutils/PhoneAccountUtils.java index 153f29185..2ee50a134 100644 --- a/java/com/android/dialer/calllogutils/PhoneAccountUtils.java +++ b/java/com/android/dialer/calllogutils/PhoneAccountUtils.java @@ -16,47 +16,15 @@ package com.android.dialer.calllogutils; -import android.content.ComponentName; import android.content.Context; import android.support.annotation.Nullable; import android.telecom.PhoneAccount; import android.telecom.PhoneAccountHandle; -import android.text.TextUtils; import com.android.dialer.telecom.TelecomUtil; -import java.util.ArrayList; -import java.util.List; /** Methods to help extract {@code PhoneAccount} information from database and Telecomm sources. */ public class PhoneAccountUtils { - /** Return a list of phone accounts that are subscription/SIM accounts. */ - public static List getSubscriptionPhoneAccounts(Context context) { - List subscriptionAccountHandles = new ArrayList<>(); - final List accountHandles = - TelecomUtil.getCallCapablePhoneAccounts(context); - for (PhoneAccountHandle accountHandle : accountHandles) { - PhoneAccount account = TelecomUtil.getPhoneAccount(context, accountHandle); - if (account.hasCapabilities(PhoneAccount.CAPABILITY_SIM_SUBSCRIPTION)) { - subscriptionAccountHandles.add(accountHandle); - } - } - return subscriptionAccountHandles; - } - - /** Compose PhoneAccount object from component name and account id. */ - @Nullable - public static PhoneAccountHandle getAccount( - @Nullable String componentString, @Nullable String accountId) { - if (TextUtils.isEmpty(componentString) || TextUtils.isEmpty(accountId)) { - return null; - } - final ComponentName componentName = ComponentName.unflattenFromString(componentString); - if (componentName == null) { - return null; - } - return new PhoneAccountHandle(componentName, accountId); - } - /** Extract account label from PhoneAccount object. */ @Nullable public static String getAccountLabel( -- cgit v1.2.3