From fc0eb8ccebcc7846db5e8b5c5430070055679bfa Mon Sep 17 00:00:00 2001 From: Eric Erfanian Date: Thu, 31 Aug 2017 06:57:16 -0700 Subject: Update Dialer source to latest internal Google revision. Previously, Android's Dialer app was developed in an internal Google source control system and only exported to public during AOSP drops. The Dialer team is now switching to a public development model similar to the telephony team. This CL represents all internal Google changes that were committed to Dialer between the public O release and today's tip of tree on internal master. This CL squashes those changes into a single commit. In subsequent changes, changes will be exported on a per-commit basis. (cherry picked from commit 2ca4318cc1ee57dda907ba2069bd61d162b1baef and amended to match paths of dependencies under prebuilts/maven_repo/bumptech/com/github/bumptech/glide/.) This CL was generated using these commands from a repository at stage-stage-master at revision ea7b4dc89590ffa3332766a531e0eab6ffb9aebd ("Merge "Update Dialer source to latest internal Google revision." am: c39ea3c55f -s ours"): git diff --binary 2ca4318cc1ee57dda907ba2069bd61d162b1baef | git apply -R --index git commit -c 2ca4318cc1ee57dda907ba2069bd61d162b1baef Test: make, flash install, run Change-Id: I529aaeb88535b9533c0ae4ef4e6c1222d4e0f1c8 PiperOrigin-RevId: 167068436 --- .../interactions/PhoneNumberInteraction.java | 33 +++++++++++++--------- .../res/layout/phone_disambig_item.xml | 0 2 files changed, 20 insertions(+), 13 deletions(-) mode change 100644 => 100755 java/com/android/dialer/interactions/res/layout/phone_disambig_item.xml (limited to 'java/com/android/dialer/interactions') diff --git a/java/com/android/dialer/interactions/PhoneNumberInteraction.java b/java/com/android/dialer/interactions/PhoneNumberInteraction.java index ef468a9f3..c42be42ec 100644 --- a/java/com/android/dialer/interactions/PhoneNumberInteraction.java +++ b/java/com/android/dialer/interactions/PhoneNumberInteraction.java @@ -15,7 +15,6 @@ */ package com.android.dialer.interactions; -import android.Manifest; import android.annotation.SuppressLint; import android.app.Activity; import android.app.AlertDialog; @@ -28,7 +27,6 @@ import android.content.DialogInterface; import android.content.Intent; import android.content.Loader; import android.content.Loader.OnLoadCompleteListener; -import android.content.pm.PackageManager; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; @@ -42,7 +40,6 @@ import android.provider.ContactsContract.RawContacts; import android.support.annotation.IntDef; import android.support.annotation.VisibleForTesting; import android.support.v4.app.ActivityCompat; -import android.support.v4.content.ContextCompat; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -63,10 +60,12 @@ import com.android.dialer.common.LogUtil; import com.android.dialer.logging.InteractionEvent; import com.android.dialer.logging.Logger; import com.android.dialer.util.DialerUtils; +import com.android.dialer.util.PermissionsUtil; import com.android.dialer.util.TransactionSafeActivity; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; /** @@ -184,6 +183,7 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener { intent = new CallIntentBuilder(phoneNumber, callSpecificAppData) .setIsVideoCall(isVideoCall) + .setAllowAssistedDial(callSpecificAppData.getAllowAssistedDialing()) .build(); break; } @@ -221,20 +221,27 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener { // It's possible for a shortcut to have been created, and then permissions revoked. To avoid a // crash when the user tries to use such a shortcut, check for this condition and ask the user // for the permission. - if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.CALL_PHONE) - != PackageManager.PERMISSION_GRANTED) { - LogUtil.i("PhoneNumberInteraction.startInteraction", "No phone permissions"); + String[] deniedPhonePermissions = + PermissionsUtil.getPermissionsCurrentlyDenied( + mContext, PermissionsUtil.allPhoneGroupPermissionsUsedInDialer); + if (deniedPhonePermissions.length > 0) { + LogUtil.i( + "PhoneNumberInteraction.startInteraction", + "Need phone permissions: " + Arrays.toString(deniedPhonePermissions)); ActivityCompat.requestPermissions( - (Activity) mContext, new String[] {Manifest.permission.CALL_PHONE}, REQUEST_CALL_PHONE); + (Activity) mContext, deniedPhonePermissions, REQUEST_CALL_PHONE); return; } - if (ContextCompat.checkSelfPermission(mContext, Manifest.permission.READ_CONTACTS) - != PackageManager.PERMISSION_GRANTED) { - LogUtil.i("PhoneNumberInteraction.startInteraction", "No contact permissions"); + + String[] deniedContactsPermissions = + PermissionsUtil.getPermissionsCurrentlyDenied( + mContext, PermissionsUtil.allContactsGroupPermissionsUsedInDialer); + if (deniedContactsPermissions.length > 0) { + LogUtil.i( + "PhoneNumberInteraction.startInteraction", + "Need contact permissions: " + Arrays.toString(deniedContactsPermissions)); ActivityCompat.requestPermissions( - (Activity) mContext, - new String[] {Manifest.permission.READ_CONTACTS}, - REQUEST_READ_CONTACTS); + (Activity) mContext, deniedContactsPermissions, REQUEST_READ_CONTACTS); return; } diff --git a/java/com/android/dialer/interactions/res/layout/phone_disambig_item.xml b/java/com/android/dialer/interactions/res/layout/phone_disambig_item.xml old mode 100644 new mode 100755 -- cgit v1.2.3