diff options
-rw-r--r-- | AndroidManifest.xml | 1 | ||||
-rw-r--r-- | src/com/android/dialer/CallDetailActivity.java | 4 | ||||
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 6 | ||||
-rw-r--r-- | src/com/android/dialer/calllog/IntentProvider.java | 8 | ||||
-rw-r--r-- | src/com/android/dialer/dialpad/DialpadFragment.java | 8 | ||||
-rw-r--r-- | src/com/android/dialer/interactions/PhoneNumberInteraction.java | 4 | ||||
-rw-r--r-- | src/com/android/dialer/util/CallIntentUtil.java (renamed from src/com/android/dialer/util/PrivilegedCallUtil.java) | 7 | ||||
-rw-r--r-- | src/com/android/dialer/util/DialerUtils.java | 10 | ||||
-rw-r--r-- | tests/src/com/android/dialer/util/TestConstants.java | 2 |
9 files changed, 24 insertions, 26 deletions
diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 5b7944d2c..8ca8e4c97 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -19,7 +19,6 @@ coreApp="true"> <uses-permission android:name="android.permission.CALL_PHONE" /> - <uses-permission android:name="android.permission.CALL_PRIVILEGED" /> <uses-permission android:name="android.permission.READ_CONTACTS" /> <uses-permission android:name="android.permission.WRITE_CONTACTS" /> <uses-permission android:name="android.permission.READ_CALL_LOG" /> diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java index 5dae9d07d..dbcfa64af 100644 --- a/src/com/android/dialer/CallDetailActivity.java +++ b/src/com/android/dialer/CallDetailActivity.java @@ -63,7 +63,7 @@ import com.android.dialer.calllog.PhoneNumberDisplayHelper; import com.android.dialer.calllog.PhoneNumberUtilsWrapper; import com.android.dialer.util.AsyncTaskExecutor; import com.android.dialer.util.AsyncTaskExecutors; -import com.android.dialer.util.PrivilegedCallUtil; +import com.android.dialer.util.CallIntentUtil; import com.android.dialer.util.DialerUtils; import com.android.dialer.voicemail.VoicemailPlaybackFragment; import com.android.dialer.voicemail.VoicemailStatusHelper; @@ -317,7 +317,7 @@ public class CallDetailActivity extends Activity implements ProximitySensorAware getSystemService(Context.TELEPHONY_SERVICE); if (tm.getCallState() == TelephonyManager.CALL_STATE_IDLE) { DialerUtils.startActivityWithErrorToast(this, - PrivilegedCallUtil.getCallIntent(Uri.fromParts(PhoneAccount.SCHEME_TEL, + CallIntentUtil.getCallIntent(Uri.fromParts(PhoneAccount.SCHEME_TEL, mNumber, null)), R.string.call_not_available); return true; } diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 787b6fae4..2bda09184 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -82,7 +82,7 @@ import com.android.dialer.list.SearchFragment; import com.android.dialer.list.SmartDialSearchFragment; import com.android.dialer.list.SpeedDialFragment; import com.android.dialer.settings.DialerSettingsActivity; -import com.android.dialer.util.PrivilegedCallUtil; +import com.android.dialer.util.CallIntentUtil; import com.android.dialer.util.DialerUtils; import com.android.dialer.widget.ActionBarController; import com.android.dialer.widget.SearchEditTextLayout; @@ -1158,8 +1158,8 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O @Override public void onCallNumberDirectly(String phoneNumber, boolean isVideoCall) { Intent intent = isVideoCall ? - PrivilegedCallUtil.getVideoCallIntent(phoneNumber, getCallOrigin()) : - PrivilegedCallUtil.getCallIntent(phoneNumber, getCallOrigin()); + CallIntentUtil.getVideoCallIntent(phoneNumber, getCallOrigin()) : + CallIntentUtil.getCallIntent(phoneNumber, getCallOrigin()); DialerUtils.startActivityWithErrorToast(this, intent); mClearSearchOnPause = true; } diff --git a/src/com/android/dialer/calllog/IntentProvider.java b/src/com/android/dialer/calllog/IntentProvider.java index 2bd3f2eef..73c7e8212 100644 --- a/src/com/android/dialer/calllog/IntentProvider.java +++ b/src/com/android/dialer/calllog/IntentProvider.java @@ -30,7 +30,7 @@ import com.android.contacts.common.model.ContactLoader; import com.android.dialer.CallDetailActivity; import com.android.dialer.DialtactsActivity; import com.android.dialer.PhoneCallDetails; -import com.android.dialer.util.PrivilegedCallUtil; +import com.android.dialer.util.CallIntentUtil; import java.util.ArrayList; @@ -54,7 +54,7 @@ public abstract class IntentProvider { return new IntentProvider() { @Override public Intent getIntent(Context context) { - return PrivilegedCallUtil.getCallIntent(number, accountHandle); + return CallIntentUtil.getCallIntent(number, accountHandle); } }; } @@ -68,7 +68,7 @@ public abstract class IntentProvider { return new IntentProvider() { @Override public Intent getIntent(Context context) { - return PrivilegedCallUtil.getVideoCallIntent(number, accountHandle); + return CallIntentUtil.getVideoCallIntent(number, accountHandle); } }; } @@ -77,7 +77,7 @@ public abstract class IntentProvider { return new IntentProvider() { @Override public Intent getIntent(Context context) { - return PrivilegedCallUtil.getVoicemailIntent(); + return CallIntentUtil.getVoicemailIntent(); } }; } diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index f18903b93..d8b507eaa 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -78,7 +78,7 @@ import com.android.dialer.NeededForReflection; import com.android.dialer.R; import com.android.dialer.SpecialCharSequenceMgr; import com.android.dialer.calllog.PhoneAccountUtils; -import com.android.dialer.util.PrivilegedCallUtil; +import com.android.dialer.util.CallIntentUtil; import com.android.dialer.util.DialerUtils; import com.android.phone.common.CallLogAsync; import com.android.phone.common.HapticFeedback; @@ -1001,7 +1001,7 @@ public class DialpadFragment extends Fragment } public void callVoicemail() { - DialerUtils.startActivityWithErrorToast(getActivity(), PrivilegedCallUtil + DialerUtils.startActivityWithErrorToast(getActivity(), CallIntentUtil .getVoicemailIntent()); hideAndClearDialpad(false); } @@ -1098,7 +1098,7 @@ public class DialpadFragment extends Fragment // Clear the digits just in case. clearDialpad(); } else { - final Intent intent = PrivilegedCallUtil.getCallIntent(number, + final Intent intent = CallIntentUtil.getCallIntent(number, (getActivity() instanceof DialtactsActivity ? ((DialtactsActivity) getActivity()).getCallOrigin() : null)); DialerUtils.startActivityWithErrorToast(getActivity(), intent); @@ -1616,7 +1616,7 @@ public class DialpadFragment extends Fragment } private Intent newFlashIntent() { - final Intent intent = PrivilegedCallUtil.getCallIntent(EMPTY_NUMBER); + final Intent intent = CallIntentUtil.getCallIntent(EMPTY_NUMBER); intent.putExtra(EXTRA_SEND_EMPTY_FLASH, true); return intent; } diff --git a/src/com/android/dialer/interactions/PhoneNumberInteraction.java b/src/com/android/dialer/interactions/PhoneNumberInteraction.java index 78c468bbc..8d6de7162 100644 --- a/src/com/android/dialer/interactions/PhoneNumberInteraction.java +++ b/src/com/android/dialer/interactions/PhoneNumberInteraction.java @@ -52,7 +52,7 @@ import com.android.contacts.common.activity.TransactionSafeActivity; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.R; import com.android.dialer.contact.ContactUpdateService; -import com.android.dialer.util.PrivilegedCallUtil; +import com.android.dialer.util.CallIntentUtil; import com.android.dialer.util.DialerUtils; import com.google.common.annotations.VisibleForTesting; @@ -322,7 +322,7 @@ public class PhoneNumberInteraction implements OnLoadCompleteListener<Cursor> { Intent.ACTION_SENDTO, Uri.fromParts("sms", phoneNumber, null)); break; default: - intent = PrivilegedCallUtil.getCallIntent(phoneNumber, callOrigin); + intent = CallIntentUtil.getCallIntent(phoneNumber, callOrigin); break; } DialerUtils.startActivityWithErrorToast(context, intent); diff --git a/src/com/android/dialer/util/PrivilegedCallUtil.java b/src/com/android/dialer/util/CallIntentUtil.java index 367f36566..2d9fef3d6 100644 --- a/src/com/android/dialer/util/PrivilegedCallUtil.java +++ b/src/com/android/dialer/util/CallIntentUtil.java @@ -27,12 +27,11 @@ import com.android.contacts.common.CallUtil; import com.android.phone.common.PhoneConstants; /** - * Utilities related to calls that can only be used by system apps. These - * use {@link Intent#ACTION_CALL_PRIVILEGED}. + * Utilities for creation of {@link Intent#ACTION_CALL} intents. */ -public class PrivilegedCallUtil { +public class CallIntentUtil { - public static final String CALL_ACTION = Intent.ACTION_CALL_PRIVILEGED; + public static final String CALL_ACTION = Intent.ACTION_CALL; /** * Return an Intent for making a phone call. Scheme (e.g. tel, sip) will be determined diff --git a/src/com/android/dialer/util/DialerUtils.java b/src/com/android/dialer/util/DialerUtils.java index d59deb4ef..3899b3736 100644 --- a/src/com/android/dialer/util/DialerUtils.java +++ b/src/com/android/dialer/util/DialerUtils.java @@ -71,9 +71,8 @@ public class DialerUtils { */ public static void startActivityWithErrorToast(Context context, Intent intent, int msgId) { try { - if ((Intent.ACTION_CALL.equals(intent.getAction()) - || Intent.ACTION_CALL_PRIVILEGED.equals(intent.getAction())) - && context instanceof Activity) { + if ((CallIntentUtil.CALL_ACTION.equals(intent.getAction()) + && context instanceof Activity)) { // All dialer-initiated calls should pass the touch point to the InCallUI Point touchPoint = TouchPointManager.getInstance().getPoint(); if (touchPoint.x != 0 || touchPoint.y != 0) { @@ -81,8 +80,9 @@ public class DialerUtils { extras.putParcelable(TouchPointManager.TOUCH_POINT, touchPoint); intent.putExtra(TelecomManager.EXTRA_OUTGOING_CALL_EXTRAS, extras); } - - ((Activity) context).startActivityForResult(intent, 0); + final TelecomManager tm = + (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE); + tm.placeCall(intent.getData(), intent.getExtras()); } else { context.startActivity(intent); } diff --git a/tests/src/com/android/dialer/util/TestConstants.java b/tests/src/com/android/dialer/util/TestConstants.java index ff4a2faad..8ebf7f1e9 100644 --- a/tests/src/com/android/dialer/util/TestConstants.java +++ b/tests/src/com/android/dialer/util/TestConstants.java @@ -1,5 +1,5 @@ package com.android.dialer.util; public class TestConstants { - public static final String CALL_INTENT_ACTION = PrivilegedCallUtil.CALL_ACTION; + public static final String CALL_INTENT_ACTION = CallIntentUtil.CALL_ACTION; } |