1. the starting point of all the processes is to press the dialing key after dialing. The code for this step is twelvekeydialer in the/Android sourcecode/packages/contacts/src/COM/Android/contacts/directory. in the Java file, the related code is as follows:
dialButtonPressed() {.........final String number = mDigits.getText().toString();startActivity(newDialNumberIntent(number));mDigits.getText().clear();finish();}
The newdialnumberintent () method in the Code is defined as follows:
private Intent newDialNumberIntent(String number) {final Intent intent = new Intent(Intent.ACTION_CALL_PRIVILEGED, Uri.fromParts("tel", number, null));.............}
From the definition of newdialnumberintent, we can see that when the dialing key is pressed, twelvekeydial starts a specific component whose action is action_call_privileged. After searching, the component started by this action is under the following: a/Android sourcecode/packeges/phone/file under which androidmenifest. in XML, you can find that the name of the activity started by "action_call_privileged" is privilegedoutgoingcallbroadcast.
The file cannot be found under sourcecode/packeges/phone/src/..., because the file is marked as special in androidmenifest. xml:
<Activity-Alias/>. This label indicates that this activity is the alias of another activity. The actual activity is marked with "Android: targetactivity = outgoingcallbroadcast" in the tag, therefore, the actual "Identity" of the privilegedoutgoingcallbroadcast started by "action_call_privileged" is "outgoingcallbroadcast ".
2. At this time, the phone data has been transferred to outgoingcallbroadcast. java.
The oncreate () method of outgoingcallbroadcast. Java includes:
Protected void oncreate (bundle icicle ){....... intent intent = getintent ();........ string action = intent. getaction ();....... final Boolean emergencynum = (number! = NULL) & phonenumutils. isemergencynumber (number); // determines whether the number is an emergency number... If (intent. action_call_privileged.equals (Action) {Action = emergencynum? Intent. action_call_emergency: intent. action_call; intent. setaction (Action) ;}...... intent. setclass (this, incallscreen. Class); startactivity (intent );}In this method, if the received action is "action_call_privileged", convert the value based on whether the entered number is an emergency number. If it is an emergency number, Action = intent. action_call_emergency; otherwise, Action = intent. action_call, and start the conversion activity: incallscreen. java
3. incallscreen. Java is still in the/packeges/phone/src/COM/Android/phone directory.
In oncreate of incallscreen, call initincallscreen to initialize the call interface, and call registerforphonestates to register the call status listener.
The onnewintent () method includes:
protected void onNewIntent(Intent intent) {..........String action = intent.getAction();..........else if (action.equals(Intent.ACTION_CALL) || action.equals(Intent.ACTION_CALL_EMERGENCY)) {..........InCallInitStatus status = placeCall(intent);}}//placeCallprivate InCallInitStatus placeCall(Intent intent) {..............int callStatus = PhoneUtils.placeCall(........);}The placecall method in incallscreen. Java calls the placecall method of the phoneutils. Java file.
4. phoneutils. Java is still in the/packeges/phone/src/COM/Android/phone directory.
public static int placeCall(...) {Connection connection;connection = PhoneApp.getInstance().mCM.dial(phone, numberToDial);}Continue tracing. In phoneapp. Java, we found that MCM is an object of the CallManager. Java class, And CallManager. Java belongs to the frameworks layer. Therefore, the data stream has already entered frameworks.
5. Go to the/frameworks/base/telephony/Java/COM/Android/Internal/telephony directory.
In the dial () method of CallManager. Java, there are:
public Connection dial(Phone phone, String dialNumber) throws CallStateException {Phone basePhone = getPhoneBase(phone);Connection result;result = basePhone.dial(dialString);........}private static Phone getPhoneBase(Phone phone) {if (phone instanceof PhoneProxy) {return phone.getForegroundCall().getPhone();}return phone;}You will find that:
Phonebase. Java Abstract class implements the interface phone. Java, while gsmphone. Java implements the abstract class phonebase, so:
In the above Code: Phone. getforegroundcall () is equivalent to the getforegroundcall () method executed by the gsmphone object.
6. Continue to trace gsmphone. Java, which is located under/frameworks/base/telephony/Java/COM/Android/Internal/telephony/GSM.
GSMPhone.java:GsmCallTracker mCT;public GsmCall getForegroundCall() {return mCT.foregroundCall;}It can be seen that the getforegroundcall () function continues to call the foregroundcall attribute of gsmcalltracker. java.
7. gsmcalltracker. Java is located under/frameworks/base/telephony/Java/COM/Android/Internal/telephony/GSM.
GsmCallTracker.java:GSMCall foregroundCall = new GSMCall(this);
Open gsmcall. Java, find the getphone () method, and find:
GSMCallTracker owner;public Phone getPhone() {return owner.phone;}The following declaration is made in gsmcalltracker. Java:
GSMPhone phone;
At this point, we come to the conclusion that Part 1 of the Code marked with red returns the object of the gsmphone. We can further conclude that Part 2 of the Code marked with blue calls the dial method of the gsmphone object.
8. In gsmphone. Java:
GSMCallTracker mCT;public Connection dial(String dialString) throws CallStateException {return dial(dialString, null);}public Connection dial(String dialString, UUSInfo uusInfo) throws CallStateException {.......mCT.dial(.......);}Continue to call the dial () method in gsmcalltracker. Java:
GSMCallTracker.java:GSMCallTracker(GSMPhone phone) {cm = phone.mCM;}Connection dial(String dialString, int clirMode, UUSInfo uusInfo) {cm.dial(........);}Track mcm and find:
Public commandsinterface MCM;
Therefore, gsmcalltracker holds the commandsinterface object, that is, the RIL. Java class object. Therefore, "cm. Dial (...)" is to call the dial () method of the RIL class object.
9. RIL. Java
Boss appears.
The RIL object is responsible for sending the client call request to the "rild" socket in a certain format. At this point, the request process is complete.