Call process details analysis, call process details
Because the dial-up process is synchronized from the application layer to the framework layer, you can call it through analysis.
DialpadFragment
Focus on intent build and pass dial number information
@ Overridepublic void onClick (View view) {int resId = view. getId (); if (resId = R. id. dialpad_floating_action_button) {if (isConfigAvailableNetwork) {dialAfterNetworkCheck ();} else {view. performHapticFeedback (HapticFeedbackConstants. VIRTUAL_KEY); handleDialButtonPressed () ;}} private void handleDialButtonPressed () {boolean isDigitsShown = mDigits. isShown (); final String number = isDigitsShown ? MDigits. getText (). toString (): mRecipients. getText (). toString (). trim (); final Intent intent = CallUtil. getCallIntent (number); // build intent, key information number if (! IsDigitsShown) {// must be dial conference add extra intent. putExtra (EXTRA_DIAL_CONFERENCE_URI, true);} intent. putExtra (add_participant ipant_key, mAddParticipant ipant & isPhoneInUse (); DialerUtils. startActivityWithErrorToast (getActivity (), intent); hideAndClearDialpad (false );}
DialerUtils
Mainly add information to intent
Public static void startActivityWithErrorToast (Context context, Intent intent) {startActivityWithErrorToast (context, intent, R. string. activity_not_available);} public static void startActivityWithErrorToast (Context context, Intent intent, int msgId) {if (IntentUtil. CALL_ACTION.equals (intent. getAction () & context instanceof Activity) {// All dialer-initiated cballs shocould pass the touch point t O the InCallUI Point touchPoint = TouchPointManager. getInstance (). getPoint (); if (touchPoint. x! = 0 | touchPoint. y! = 0) {Bundle extras; // Make sure to not accidentally clobber any existing extras if (intent. hasExtra (TelecomManager. EXTRA_OUTGOING_CALL_EXTRAS) {extras = intent. getParcelableExtra (TelecomManager. EXTRA_OUTGOING_CALL_EXTRAS);} else {extras = new Bundle ();} extras. putParcelable (TouchPointManager. TOUCH_POINT, touchPoint); intent. putExtra (TelecomManager. EXTRA_OUTGOING_CALL_EXTRAS, extras);} fin Al boolean hasCallPermission = TelecomUtil. placeCall (Activity) context, intent); // next if (! HasCallPermission) {// TODO: Make calling activity show request permission dialog and handle // callback results appropriately. toast. makeText (context, "Cannot place call without Phone permission", Toast. LENGTH_SHORT) ;}} else {context. startActivity (intent );}}
TelecomUtil
public static boolean placeCall(Activity activity, Intent intent) { if (hasCallPhonePermission(activity)) { TelecomManagerCompat.placeCall(activity, getTelecomManager(activity), intent); return true; } return false;}
TelecomManagerCompat
Public static void placeCall (@ Nullable Activity, @ Nullable TelecomManager telecomManager, @ Nullable Intent intent) {if (activity = null | telecomManager = null | intent = null) {return;} if (CompatUtils. isw.mallowcompatible () {telecomManager. placeCall (intent. getData (), intent. getExtras (); // The placeCall method will go all the way to return;} activity. startActivityForResult (intent, 0 );}
TelecomManager
@ RequiresPermission (android. manifest. permission. CALL_PHONE) public void placeCall (Uri address, Bundle extras) {// specific adil mechanism needs to be clarified, // The mBinderImpl variable in TelecomServiceImpl is the specific implementation class of ITelecomService service = getTelecomService (); if (service! = Null) {if (address = null) {Log. w (TAG, "Cannot place call to empty address. ");} try {service. placeCall (address, extras = null? New Bundle (): extras, mContext. getOpPackageName ();} catch (RemoteException e) {Log. e (TAG, "Error calling ITelecomService # placeCall", e );}}}