133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee/* 233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Copyright (C) 2014 The Android Open Source Project 333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Licensed under the Apache License, Version 2.0 (the "License"); 533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * you may not use this file except in compliance with the License. 633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * You may obtain a copy of the License at 733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * http://www.apache.org/licenses/LICENSE-2.0 933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 1033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Unless required by applicable law or agreed to in writing, software 1133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * distributed under the License is distributed on an "AS IS" BASIS, 1233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * See the License for the specific language governing permissions and 1433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * limitations under the License. 1533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee */ 1633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 177cc70b4f0ad1064a4a0dce6056ad82b205887160Tyler Gunnpackage com.android.server.telecom; 1833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 1933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Leeimport android.app.Activity; 2033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Leeimport android.content.BroadcastReceiver; 2133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Leeimport android.content.Context; 2233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Leeimport android.content.Intent; 2333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Leeimport android.content.res.Resources; 2433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Leeimport android.net.Uri; 2533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Leeimport android.os.UserHandle; 267cc70b4f0ad1064a4a0dce6056ad82b205887160Tyler Gunnimport android.telecom.GatewayInfo; 277cc70b4f0ad1064a4a0dce6056ad82b205887160Tyler Gunnimport android.telecom.PhoneAccount; 287cc70b4f0ad1064a4a0dce6056ad82b205887160Tyler Gunnimport android.telecom.TelecomManager; 297cc70b4f0ad1064a4a0dce6056ad82b205887160Tyler Gunnimport android.telecom.VideoProfile; 30d7255872e2204a074bc5dfb5dceb4da13574864cYorke Leeimport android.telephony.DisconnectCause; 3133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Leeimport android.telephony.PhoneNumberUtils; 3233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Leeimport android.text.TextUtils; 3333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 3491d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn// TODO: Needed for move to system service: import com.android.internal.R; 3591d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn 3633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee/** 3733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * OutgoingCallIntentBroadcaster receives CALL and CALL_PRIVILEGED Intents, and broadcasts the 3833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * ACTION_NEW_OUTGOING_CALL intent. ACTION_NEW_OUTGOING_CALL is an ordered broadcast intent which 3933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * contains the phone number being dialed. Applications can use this intent to (1) see which numbers 4033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * are being dialed, (2) redirect a call (change the number being dialed), or (3) prevent a call 4133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * from being placed. 4233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 4333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * After the other applications have had a chance to see the ACTION_NEW_OUTGOING_CALL intent, it 4433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * finally reaches the {@link NewOutgoingCallBroadcastIntentReceiver}. 4533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 4633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Calls where no number is present (like for a CDMA "empty flash" or a nonexistent voicemail 4733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * number) are exempt from being broadcast. 4833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 4933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Calls to emergency numbers are still broadcast for informative purposes. The call is placed 5033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * prior to sending ACTION_NEW_OUTGOING_CALL and cannot be redirected nor prevented. 5133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee */ 5233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Leeclass NewOutgoingCallIntentBroadcaster { 5333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee /** Required permission for any app that wants to consume ACTION_NEW_OUTGOING_CALL. */ 5433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee private static final String PERMISSION = android.Manifest.permission.PROCESS_OUTGOING_CALLS; 5533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 5633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee private static final String EXTRA_ACTUAL_NUMBER_TO_DIAL = 577cc70b4f0ad1064a4a0dce6056ad82b205887160Tyler Gunn "android.telecom.extra.ACTUAL_NUMBER_TO_DIAL"; 5833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 5933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee /** 6033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Legacy string constants used to retrieve gateway provider extras from intents. These still 6133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * need to be copied from the source call intent to the destination intent in order to 6233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * support third party gateway providers that are still using old string constants in 6333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Telephony. 6433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee */ 6533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee public static final String EXTRA_GATEWAY_PROVIDER_PACKAGE = 6633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee "com.android.phone.extra.GATEWAY_PROVIDER_PACKAGE"; 6733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee public static final String EXTRA_GATEWAY_URI = "com.android.phone.extra.GATEWAY_URI"; 68571f0737002251f09b9ef696dc8b4c9ce02abbaeSantos Cordon public static final String EXTRA_GATEWAY_ORIGINAL_URI = 69571f0737002251f09b9ef696dc8b4c9ce02abbaeSantos Cordon "com.android.phone.extra.GATEWAY_ORIGINAL_URI"; 7033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 7133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee private final CallsManager mCallsManager; 720d3076c3dfa54f1102a843735ca774759e52d8b8Nancy Chen private final Call mCall; 7333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee private final Intent mIntent; 7491d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn private final Context mContext; 7591d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn 76cce5deb2bc998d6385152292153a9423f5206c28Yorke Lee /* 77cce5deb2bc998d6385152292153a9423f5206c28Yorke Lee * Whether or not the outgoing call intent originated from the default phone application. If 78cce5deb2bc998d6385152292153a9423f5206c28Yorke Lee * so, it will be allowed to make emergency calls, even with the ACTION_CALL intent. 79cce5deb2bc998d6385152292153a9423f5206c28Yorke Lee */ 80cce5deb2bc998d6385152292153a9423f5206c28Yorke Lee private final boolean mIsDefaultOrSystemPhoneApp; 8133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 8291d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn NewOutgoingCallIntentBroadcaster(Context context, CallsManager callsManager, Call call, 8391d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn Intent intent, boolean isDefaultPhoneApp) { 8491d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn mContext = context; 8533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee mCallsManager = callsManager; 860d3076c3dfa54f1102a843735ca774759e52d8b8Nancy Chen mCall = call; 8733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee mIntent = intent; 88cce5deb2bc998d6385152292153a9423f5206c28Yorke Lee mIsDefaultOrSystemPhoneApp = isDefaultPhoneApp; 8933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 9033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 9133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee /** 9233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Processes the result of the outgoing call broadcast intent, and performs callbacks to 9333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * the OutgoingCallIntentBroadcasterListener as necessary. 9433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee */ 9533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee private class NewOutgoingCallBroadcastIntentReceiver extends BroadcastReceiver { 9633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 9733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee @Override 9833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee public void onReceive(Context context, Intent intent) { 99b33087514fb354c9d10c29f9cb071ed2ae2a6124Sailesh Nepal Log.v(this, "onReceive: %s", intent); 10033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 10133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee // Once the NEW_OUTGOING_CALL broadcast is finished, the resultData is used as the 10233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee // actual number to call. (If null, no call will be placed.) 103308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen String resultNumber = getResultData(); 104308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen Log.v(this, "- got number from resultData: %s", Log.pii(resultNumber)); 10533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 1062d0b331f659e4e95621e738bbddaa38a80a70d4cSantos Cordon boolean endEarly = false; 107308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen if (resultNumber == null) { 10833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.v(this, "Call cancelled (null number), returning..."); 1092d0b331f659e4e95621e738bbddaa38a80a70d4cSantos Cordon endEarly = true; 11091d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn } else if (PhoneNumberUtils.isPotentialLocalEmergencyNumber(mContext, resultNumber)) { 111308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen Log.w(this, "Cannot modify outgoing call to emergency number %s.", resultNumber); 1122d0b331f659e4e95621e738bbddaa38a80a70d4cSantos Cordon endEarly = true; 1132d0b331f659e4e95621e738bbddaa38a80a70d4cSantos Cordon } 1142d0b331f659e4e95621e738bbddaa38a80a70d4cSantos Cordon 1152d0b331f659e4e95621e738bbddaa38a80a70d4cSantos Cordon if (endEarly) { 1162d0b331f659e4e95621e738bbddaa38a80a70d4cSantos Cordon if (mCall != null) { 1172d0b331f659e4e95621e738bbddaa38a80a70d4cSantos Cordon mCall.disconnect(); 1182d0b331f659e4e95621e738bbddaa38a80a70d4cSantos Cordon } 11933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee return; 12033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 12133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 122d75fabf9b3787b851a29e1396d9525706c11864dNancy Chen Uri resultHandleUri = Uri.fromParts(PhoneNumberUtils.isUriNumber(resultNumber) ? 12356a76b79e2a03eb0fe070d3ef17e474ae27bb6f3Jay Shrauner PhoneAccount.SCHEME_SIP : PhoneAccount.SCHEME_TEL, resultNumber, null); 12433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 12533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Uri originalUri = mIntent.getData(); 12633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 127308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen if (originalUri.getSchemeSpecificPart().equals(resultNumber)) { 128308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen Log.v(this, "Call number unmodified after new outgoing call intent broadcast."); 12933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } else { 13033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.v(this, "Retrieved modified handle after outgoing call intent broadcast: " 13133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee + "Original: %s, Modified: %s", 13233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.pii(originalUri), 13333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.pii(resultHandleUri)); 13433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 13533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 13633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee GatewayInfo gatewayInfo = getGateWayInfoFromIntent(intent, resultHandleUri); 137bc9ef17acc7940fdaec78a5dc1efdd29dff41488Nancy Chen mCallsManager.placeOutgoingCall(mCall, resultHandleUri, gatewayInfo, 1387cc70b4f0ad1064a4a0dce6056ad82b205887160Tyler Gunn mIntent.getBooleanExtra(TelecomManager.EXTRA_START_CALL_WITH_SPEAKERPHONE, 139c4abd91cd8a67b530ebafe146af10136db8e6605Tyler Gunn false), 1407cc70b4f0ad1064a4a0dce6056ad82b205887160Tyler Gunn mIntent.getIntExtra(TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, 1416fb37c87836b5245046bd3b14320823ab839a10cIhab Awad VideoProfile.VideoState.AUDIO_ONLY)); 14233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 14333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 14433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 14533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee /** 14633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Processes the supplied intent and starts the outgoing call broadcast process relevant to the 14733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * intent. 14833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 14933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * This method will handle three kinds of actions: 15033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 15133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * - CALL (intent launched by all third party dialers) 15233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * - CALL_PRIVILEGED (intent launched by system apps e.g. system Dialer, voice Dialer) 15333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * - CALL_EMERGENCY (intent launched by lock screen emergency dialer) 154cce5deb2bc998d6385152292153a9423f5206c28Yorke Lee * 155d7255872e2204a074bc5dfb5dceb4da13574864cYorke Lee * @return {@link CallActivity#OUTGOING_CALL_SUCCEEDED} if the call succeeded, and an 156d7255872e2204a074bc5dfb5dceb4da13574864cYorke Lee * appropriate {@link DisconnectCause} if the call did not, describing why it failed. 15733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee */ 158d7255872e2204a074bc5dfb5dceb4da13574864cYorke Lee int processIntent() { 15933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.v(this, "Processing call intent in OutgoingCallIntentBroadcaster."); 16033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 16133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Intent intent = mIntent; 162308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen String action = intent.getAction(); 163308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen final Uri handle = intent.getData(); 164308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen 165308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen if (handle == null) { 166308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen Log.w(this, "Empty handle obtained from the call intent."); 167308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen return DisconnectCause.INVALID_NUMBER; 168308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen } 16933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 17056a76b79e2a03eb0fe070d3ef17e474ae27bb6f3Jay Shrauner boolean isVoicemailNumber = PhoneAccount.SCHEME_VOICEMAIL.equals(handle.getScheme()); 171308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen if (isVoicemailNumber) { 172308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen if (Intent.ACTION_CALL.equals(action)) { 173308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen // Voicemail calls will be handled directly by the telephony connection manager 174308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen Log.i(this, "Placing call immediately instead of waiting for " 175308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen + " OutgoingCallBroadcastReceiver: %s", intent); 17633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 177308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen boolean speakerphoneOn = mIntent.getBooleanExtra( 1787cc70b4f0ad1064a4a0dce6056ad82b205887160Tyler Gunn TelecomManager.EXTRA_START_CALL_WITH_SPEAKERPHONE, false); 179308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen mCallsManager.placeOutgoingCall(mCall, handle, null, speakerphoneOn, 180308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen VideoProfile.VideoState.AUDIO_ONLY); 181308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen 182308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen return DisconnectCause.NOT_DISCONNECTED; 183d7255872e2204a074bc5dfb5dceb4da13574864cYorke Lee } else { 184308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen Log.i(this, "Unhandled intent %s. Ignoring and not placing call.", intent); 185308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen return DisconnectCause.OUTGOING_CANCELED; 186d7255872e2204a074bc5dfb5dceb4da13574864cYorke Lee } 18733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 18833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 18991d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn String number = PhoneNumberUtils.getNumberFromIntent(intent, mContext); 190308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen if (TextUtils.isEmpty(number)) { 191308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen Log.w(this, "Empty number obtained from the call intent."); 192308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen return DisconnectCause.NO_PHONE_NUMBER_SUPPLIED; 193308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen } 194b58f453c46a695347a69f8c973a77796e5c1fdf7Santos Cordon 195308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen boolean isUriNumber = PhoneNumberUtils.isUriNumber(number); 196b58f453c46a695347a69f8c973a77796e5c1fdf7Santos Cordon if (!isUriNumber) { 197308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen number = PhoneNumberUtils.convertKeypadLettersToDigits(number); 198308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen number = PhoneNumberUtils.stripSeparators(number); 19933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 20033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 20191d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn final boolean isPotentialEmergencyNumber = isPotentialEmergencyNumber(number); 20233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.v(this, "isPotentialEmergencyNumber = %s", isPotentialEmergencyNumber); 20333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 20433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee rewriteCallIntentAction(intent, isPotentialEmergencyNumber); 205e05257c9cd0b86f0c161bc12fc913c76e7b8ae6cYorke Lee action = intent.getAction(); 20633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee // True for certain types of numbers that are not intended to be intercepted or modified 20733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee // by third parties (e.g. emergency numbers). 20833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee boolean callImmediately = false; 20933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 21033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee if (Intent.ACTION_CALL.equals(action)) { 21133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee if (isPotentialEmergencyNumber) { 212cce5deb2bc998d6385152292153a9423f5206c28Yorke Lee if (!mIsDefaultOrSystemPhoneApp) { 213cce5deb2bc998d6385152292153a9423f5206c28Yorke Lee Log.w(this, "Cannot call potential emergency number %s with CALL Intent %s " 214308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen + "unless caller is system or default dialer.", number, intent); 21591d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn launchSystemDialer(intent.getData()); 216d7255872e2204a074bc5dfb5dceb4da13574864cYorke Lee return DisconnectCause.OUTGOING_CANCELED; 217cce5deb2bc998d6385152292153a9423f5206c28Yorke Lee } else { 218cce5deb2bc998d6385152292153a9423f5206c28Yorke Lee callImmediately = true; 219cce5deb2bc998d6385152292153a9423f5206c28Yorke Lee } 22033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 22133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } else if (Intent.ACTION_CALL_EMERGENCY.equals(action)) { 22233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee if (!isPotentialEmergencyNumber) { 22333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.w(this, "Cannot call non-potential-emergency number %s with EMERGENCY_CALL " 224308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen + "Intent %s.", number, intent); 225d7255872e2204a074bc5dfb5dceb4da13574864cYorke Lee return DisconnectCause.OUTGOING_CANCELED; 22633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 22733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee callImmediately = true; 22833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } else { 22933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.w(this, "Unhandled Intent %s. Ignoring and not placing call.", intent); 230d7255872e2204a074bc5dfb5dceb4da13574864cYorke Lee return DisconnectCause.INVALID_NUMBER; 23133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 23233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 23333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee if (callImmediately) { 23433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.i(this, "Placing call immediately instead of waiting for " 23533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee + " OutgoingCallBroadcastReceiver: %s", intent); 23656a76b79e2a03eb0fe070d3ef17e474ae27bb6f3Jay Shrauner String scheme = isUriNumber ? PhoneAccount.SCHEME_SIP : PhoneAccount.SCHEME_TEL; 237905dfba7883666f45a0c6958d8bc6c19d68972d9Sailesh Nepal boolean speakerphoneOn = mIntent.getBooleanExtra( 2387cc70b4f0ad1064a4a0dce6056ad82b205887160Tyler Gunn TelecomManager.EXTRA_START_CALL_WITH_SPEAKERPHONE, false); 239905dfba7883666f45a0c6958d8bc6c19d68972d9Sailesh Nepal int videoState = mIntent.getIntExtra( 2407cc70b4f0ad1064a4a0dce6056ad82b205887160Tyler Gunn TelecomManager.EXTRA_START_CALL_WITH_VIDEO_STATE, 2416fb37c87836b5245046bd3b14320823ab839a10cIhab Awad VideoProfile.VideoState.AUDIO_ONLY); 242308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen mCallsManager.placeOutgoingCall(mCall, Uri.fromParts(scheme, number, null), null, 2430d3076c3dfa54f1102a843735ca774759e52d8b8Nancy Chen speakerphoneOn, videoState); 24433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 24533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee // Don't return but instead continue and send the ACTION_NEW_OUTGOING_CALL broadcast 24633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee // so that third parties can still inspect (but not intercept) the outgoing call. When 24733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee // the broadcast finally reaches the OutgoingCallBroadcastReceiver, we'll know not to 24833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee // initiate the call again because of the presence of the EXTRA_ALREADY_CALLED extra. 24933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 25033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 25191d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn broadcastIntent(intent, number, !callImmediately); 252d7255872e2204a074bc5dfb5dceb4da13574864cYorke Lee return DisconnectCause.NOT_DISCONNECTED; 25333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 25433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 25533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee /** 25633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Sends a new outgoing call ordered broadcast so that third party apps can cancel the 25733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * placement of the call or redirect it to a different number. 25833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 25933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * @param originalCallIntent The original call intent. 260308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen * @param number Call number that was stored in the original call intent. 26133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * @param receiverRequired Whether or not the result from the ordered broadcast should be 26233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * processed using a {@link NewOutgoingCallIntentBroadcaster}. 26333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee */ 26433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee private void broadcastIntent( 26533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Intent originalCallIntent, 266308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen String number, 26733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee boolean receiverRequired) { 26833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Intent broadcastIntent = new Intent(Intent.ACTION_NEW_OUTGOING_CALL); 269308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen if (number != null) { 270308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen broadcastIntent.putExtra(Intent.EXTRA_PHONE_NUMBER, number); 27133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 27233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 27333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee // Force receivers of this broadcast intent to run at foreground priority because we 27433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee // want to finish processing the broadcast intent as soon as possible. 27533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee broadcastIntent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND); 27633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.v(this, "Broadcasting intent: %s.", broadcastIntent); 27733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 27877d2d0e90bc2a67d526743b8e32f920a0d755fbaNancy Chen checkAndCopyProviderExtras(originalCallIntent, broadcastIntent); 27933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 28091d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn mContext.sendOrderedBroadcastAsUser( 28133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee broadcastIntent, 2826dc1c75ff9fbabce11540c2bbe3972159899b414Yorke Lee UserHandle.CURRENT, 28333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee PERMISSION, 28433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee receiverRequired ? new NewOutgoingCallBroadcastIntentReceiver() : null, 28533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee null, // scheduler 28633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Activity.RESULT_OK, // initialCode 287308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen number, // initialData: initial value for the result data (number to be modified) 28833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee null); // initialExtras 28933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 29033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 29133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee /** 29233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Copy all the expected extras set when a 3rd party gateway provider is to be used, from the 29333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * source intent to the destination one. 29433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 29533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * @param src Intent which may contain the provider's extras. 29633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * @param dst Intent where a copy of the extras will be added if applicable. 29733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee */ 29877d2d0e90bc2a67d526743b8e32f920a0d755fbaNancy Chen public void checkAndCopyProviderExtras(Intent src, Intent dst) { 29977d2d0e90bc2a67d526743b8e32f920a0d755fbaNancy Chen if (src == null) { 30077d2d0e90bc2a67d526743b8e32f920a0d755fbaNancy Chen return; 30177d2d0e90bc2a67d526743b8e32f920a0d755fbaNancy Chen } 30233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee if (hasGatewayProviderExtras(src)) { 30333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee dst.putExtra(EXTRA_GATEWAY_PROVIDER_PACKAGE, 30433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee src.getStringExtra(EXTRA_GATEWAY_PROVIDER_PACKAGE)); 30533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee dst.putExtra(EXTRA_GATEWAY_URI, 30633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee src.getStringExtra(EXTRA_GATEWAY_URI)); 30733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.d(this, "Found and copied gateway provider extras to broadcast intent."); 30833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee return; 30933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 31033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 31177d2d0e90bc2a67d526743b8e32f920a0d755fbaNancy Chen Log.d(this, "No provider extras found in call intent."); 31233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 31333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 31433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee /** 31533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Check if valid gateway provider information is stored as extras in the intent 31633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 31733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * @param intent to check for 31833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * @return true if the intent has all the gateway information extras needed. 31933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee */ 32033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee private boolean hasGatewayProviderExtras(Intent intent) { 32133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee final String name = intent.getStringExtra(EXTRA_GATEWAY_PROVIDER_PACKAGE); 32233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee final String uriString = intent.getStringExtra(EXTRA_GATEWAY_URI); 32333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 32433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee return !TextUtils.isEmpty(name) && !TextUtils.isEmpty(uriString); 32533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 32633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 32733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee private static Uri getGatewayUriFromString(String gatewayUriString) { 32833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee return TextUtils.isEmpty(gatewayUriString) ? null : Uri.parse(gatewayUriString); 32933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 33033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 33133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee /** 33233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Extracts gateway provider information from a provided intent.. 33333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 33433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * @param intent to extract gateway provider information from. 33533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * @param trueHandle The actual call handle that the user is trying to dial 33633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * @return GatewayInfo object containing extracted gateway provider information as well as 33733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * the actual handle the user is trying to dial. 33833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee */ 33933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee public static GatewayInfo getGateWayInfoFromIntent(Intent intent, Uri trueHandle) { 34033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee if (intent == null) { 34133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee return null; 34233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 34333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 34433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee // Check if gateway extras are present. 34533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee String gatewayPackageName = intent.getStringExtra(EXTRA_GATEWAY_PROVIDER_PACKAGE); 34633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Uri gatewayUri = getGatewayUriFromString(intent.getStringExtra(EXTRA_GATEWAY_URI)); 34733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee if (!TextUtils.isEmpty(gatewayPackageName) && gatewayUri != null) { 34833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee return new GatewayInfo(gatewayPackageName, gatewayUri, trueHandle); 34933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 35033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 35133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee return null; 35233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 35333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 35491d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn private void launchSystemDialer(Uri handle) { 35533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Intent systemDialerIntent = new Intent(); 35691d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn final Resources resources = mContext.getResources(); 35733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee systemDialerIntent.setClassName( 35833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee resources.getString(R.string.ui_default_package), 35933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee resources.getString(R.string.dialer_default_class)); 36033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee systemDialerIntent.setAction(Intent.ACTION_DIAL); 36133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee systemDialerIntent.setData(handle); 36233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee systemDialerIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 36333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.v(this, "calling startActivity for default dialer: %s", systemDialerIntent); 36439d94c1b821e7da3a551f487b052ee347e3377a7Yorke Lee mContext.startActivityAsUser(systemDialerIntent, UserHandle.CURRENT); 36533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 36633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 36733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee /** 36833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Check whether or not this is an emergency number, in order to enforce the restriction 36933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * that only the CALL_PRIVILEGED and CALL_EMERGENCY intents are allowed to make emergency 37033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * calls. 37133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 37233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * To prevent malicious 3rd party apps from making emergency calls by passing in an 37333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * "invalid" number like "9111234" (that isn't technically an emergency number but might 37433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * still result in an emergency call with some networks), we use 37533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * isPotentialLocalEmergencyNumber instead of isLocalEmergencyNumber. 37633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 377308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen * @param number number to inspect in order to determine whether or not an emergency number 37833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * is potentially being dialed 37933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * @return True if the handle is potentially an emergency number. 38033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee */ 38191d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn private boolean isPotentialEmergencyNumber(String number) { 382308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen Log.v(this, "Checking restrictions for number : %s", Log.pii(number)); 38391d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn return (number != null) && PhoneNumberUtils.isPotentialLocalEmergencyNumber(mContext, 38491d43cf9c985cc5a83795f256ef5c46ebb8fbdc1Tyler Gunn number); 38533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 38633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 38733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee /** 38833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * Given a call intent and whether or not the number to dial is an emergency number, rewrite 38933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * the call intent action to an appropriate one. 39033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * 39133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * @param intent Intent to rewrite the action for 392308ab8bd691f4a1bc4c7c094bcffc84f5fe345aaNancy Chen * @param isPotentialEmergencyNumber Whether or not the number is potentially an emergency 39333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee * number. 39433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee */ 39533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee private void rewriteCallIntentAction(Intent intent, boolean isPotentialEmergencyNumber) { 39633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee String action = intent.getAction(); 39733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee 39833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee /* Change CALL_PRIVILEGED into CALL or CALL_EMERGENCY as needed. */ 39933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee if (Intent.ACTION_CALL_PRIVILEGED.equals(action)) { 40033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee if (isPotentialEmergencyNumber) { 40133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.i(this, "ACTION_CALL_PRIVILEGED is used while the number is a potential" 40233501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee + " emergency number. Using ACTION_CALL_EMERGENCY as an action instead."); 40333501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee action = Intent.ACTION_CALL_EMERGENCY; 40433501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } else { 40533501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee action = Intent.ACTION_CALL; 40633501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 40733501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee Log.v(this, " - updating action from CALL_PRIVILEGED to %s", action); 40833501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee intent.setAction(action); 40933501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 41033501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee } 41133501635c2cd21f40793041eff3b8ce3a5710d49Yorke Lee} 412