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

Commit 7a27b85c authored by Wenyi Wang's avatar Wenyi Wang
Browse files

Guard against SecurityException in QuickContact

Bug: 31304557

Test: manual - verify PhoneNumberListAdapter and QuickContact that
               invoke the method are working as intended.

Change-Id: I72351a93b4da70892023a33fa1da6147dfe04fc5
parent d5702716
Loading
Loading
Loading
Loading
+25 −16
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ import com.android.contacts.common.compat.CompatUtils;
import com.android.contacts.common.compat.PhoneAccountSdkCompat;
import com.android.contacts.common.util.PermissionsUtil;
import com.android.contacts.common.util.PhoneNumberHelper;
import com.android.contactsbind.FeedbackHelper;
import com.android.phone.common.PhoneConstants;

import android.content.Context;
@@ -41,6 +42,8 @@ import java.util.List;
 */
public class CallUtil {

    public static final String TAG = "CallUtil";

    /**
     * Indicates that the video calling is not available.
     */
@@ -140,6 +143,7 @@ public class CallUtil {
            return VIDEO_CALLING_DISABLED;
        }

        try {
            List<PhoneAccountHandle> accountHandles = telecommMgr.getCallCapablePhoneAccounts();
            for (PhoneAccountHandle accountHandle : accountHandles) {
                PhoneAccount account = telecommMgr.getPhoneAccount(accountHandle);
@@ -151,8 +155,8 @@ public class CallUtil {
                        }

                        int videoCapabilities = VIDEO_CALLING_ENABLED;
                    if (account.hasCapabilities(
                            PhoneAccountSdkCompat.CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE)) {
                        if (account.hasCapabilities(PhoneAccountSdkCompat
                                .CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE)) {
                            videoCapabilities |= VIDEO_CALLING_PRESENCE;
                        }
                        return videoCapabilities;
@@ -160,6 +164,11 @@ public class CallUtil {
                }
            }
            return VIDEO_CALLING_DISABLED;
        } catch (SecurityException e) {
            FeedbackHelper.sendFeedback(context, TAG,
                    "Security exception when querying intent activities", e);
            return VIDEO_CALLING_DISABLED;
        }
    }

    /**