From 857de2fe89bd9daa3fa836998568208d7c8ce575 Mon Sep 17 00:00:00 2001 From: twyen Date: Mon, 21 May 2018 13:05:30 -0700 Subject: Check READ_PHONE_STATE for isVoicemailAvailable() TelecomUtil.has*Permission() pass if the dialer is the default dialer. In reality most API does not allow the default dialer do whatever they want. PermissionUtil should be used instead. TEST=uabdullah please fix your "Temporary" @Ignore Bug: 77907588 Test: uabdullah please fix your "Temporary" @Ignore PiperOrigin-RevId: 197442842 Change-Id: I1e6f275e2b8e6d3cfa54ddb8cd24f7d47f9462ca --- java/com/android/dialer/main/impl/OldMainActivityPeer.java | 2 +- java/com/android/dialer/telecom/TelecomUtil.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'java/com') diff --git a/java/com/android/dialer/main/impl/OldMainActivityPeer.java b/java/com/android/dialer/main/impl/OldMainActivityPeer.java index 402edb3d5..a0e92a8cb 100644 --- a/java/com/android/dialer/main/impl/OldMainActivityPeer.java +++ b/java/com/android/dialer/main/impl/OldMainActivityPeer.java @@ -372,7 +372,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen private static boolean isVoicemailAvailable( Context context, PhoneAccountHandle defaultUserSelectedAccount) { - if (!TelecomUtil.hasReadPhoneStatePermission(context)) { + if (!PermissionsUtil.hasReadPhoneStatePermissions(context)) { LogUtil.i( "OldMainActivityPeer.isVoicemailAvailable", "No read phone permisison or not the default dialer."); diff --git a/java/com/android/dialer/telecom/TelecomUtil.java b/java/com/android/dialer/telecom/TelecomUtil.java index 8c0090928..c08814688 100644 --- a/java/com/android/dialer/telecom/TelecomUtil.java +++ b/java/com/android/dialer/telecom/TelecomUtil.java @@ -275,15 +275,21 @@ public abstract class TelecomUtil { && hasPermission(context, Manifest.permission.WRITE_VOICEMAIL)); } + /** @deprecated use {@link com.android.dialer.util.PermissionsUtil} */ + @Deprecated public static boolean hasModifyPhoneStatePermission(Context context) { return isDefaultDialer(context) || hasPermission(context, Manifest.permission.MODIFY_PHONE_STATE); } + /** @deprecated use {@link com.android.dialer.util.PermissionsUtil} */ + @Deprecated public static boolean hasReadPhoneStatePermission(Context context) { return isDefaultDialer(context) || hasPermission(context, Manifest.permission.READ_PHONE_STATE); } + /** @deprecated use {@link com.android.dialer.util.PermissionsUtil} */ + @Deprecated public static boolean hasCallPhonePermission(Context context) { return isDefaultDialer(context) || hasPermission(context, Manifest.permission.CALL_PHONE); } -- cgit v1.2.3