Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 857de2fe authored by twyen's avatar twyen Committed by Copybara-Service
Browse files

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
parent 4791039e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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.");
+6 −0
Original line number Diff line number Diff line
@@ -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);
  }