diff options
Diffstat (limited to 'java/com/android/contacts/common/compat/PhoneAccountCompat.java')
-rw-r--r-- | java/com/android/contacts/common/compat/PhoneAccountCompat.java | 55 |
1 files changed, 2 insertions, 53 deletions
diff --git a/java/com/android/contacts/common/compat/PhoneAccountCompat.java b/java/com/android/contacts/common/compat/PhoneAccountCompat.java index 6a24ec033..aa22c6861 100644 --- a/java/com/android/contacts/common/compat/PhoneAccountCompat.java +++ b/java/com/android/contacts/common/compat/PhoneAccountCompat.java @@ -20,33 +20,10 @@ import android.graphics.drawable.Drawable; import android.graphics.drawable.Icon; import android.support.annotation.Nullable; import android.telecom.PhoneAccount; -import android.util.Log; -import com.android.dialer.compat.CompatUtils; /** Compatiblity class for {@link android.telecom.PhoneAccount} */ public class PhoneAccountCompat { - private static final String TAG = PhoneAccountCompat.class.getSimpleName(); - - /** - * Gets the {@link Icon} associated with the given {@link PhoneAccount} - * - * @param phoneAccount the PhoneAccount from which to retrieve the Icon - * @return the Icon, or null - */ - @Nullable - public static Icon getIcon(@Nullable PhoneAccount phoneAccount) { - if (phoneAccount == null) { - return null; - } - - if (CompatUtils.isMarshmallowCompatible()) { - return phoneAccount.getIcon(); - } - - return null; - } - /** * Builds and returns an icon {@code Drawable} to represent this {@code PhoneAccount} in a user * interface. @@ -61,44 +38,16 @@ public class PhoneAccountCompat { if (phoneAccount == null || context == null) { return null; } - - if (CompatUtils.isMarshmallowCompatible()) { - return createIconDrawableMarshmallow(phoneAccount, context); - } - - if (CompatUtils.isLollipopMr1Compatible()) { - return createIconDrawableLollipopMr1(phoneAccount, context); - } - return null; + return createIconDrawableMarshmallow(phoneAccount, context); } @Nullable private static Drawable createIconDrawableMarshmallow( PhoneAccount phoneAccount, Context context) { - Icon accountIcon = getIcon(phoneAccount); + Icon accountIcon = phoneAccount.getIcon(); if (accountIcon == null) { return null; } return accountIcon.loadDrawable(context); } - - @Nullable - private static Drawable createIconDrawableLollipopMr1( - PhoneAccount phoneAccount, Context context) { - try { - return (Drawable) - PhoneAccount.class - .getMethod("createIconDrawable", Context.class) - .invoke(phoneAccount, context); - } catch (ReflectiveOperationException e) { - return null; - } catch (Throwable t) { - Log.e( - TAG, - "Unexpected exception when attempting to call " - + "android.telecom.PhoneAccount#createIconDrawable", - t); - return null; - } - } } |