The relevant code of the framework layer is mainly in Gsmphone, CallManager, Gsmcalltracker, Telephonymanager.
Gsmphone:
The main association with Gsmphone is Phone.java, Phonebase.java, Gsmphone.java. Phone as the base class, defines 25 handler message registration and logoff interface, and phonebase inherit the phone implementation of 24 pairs, and a pair implemented in Gsmphone, and Gsmphone inherited Phonebase.
How do I manage the phone object? The static method of calling Phonefactory in the Phoneapp of the application layer Makedefaultphones create the phone object, and the framework uses the proxy mode and the Factory mode to manifest, In Makedefaultphone, the PhoneProxy is created, the parameters are Gsmphone or Cdmaphone objects, and the security is increased by PhoneProxy indirect access Gsmphone.
Gsmphone inherited the Phonebase, and Phonebase inherited handler. The registrantlist message processing mechanism is used to register and unregister handler messages, and the Notifyxxx method is sent to send notifications for multiple notes. In the application layer to get the status of the current phone, Getforegroundcall, Getbackgroundcall, Getringingcall, actually get the MCT in Gsmphone is the property of Calltracker.
Calltracker Call Management
The main functions are implemented in Gsmcalltracker, gsmcalltracker inherit calltracker,calltracker inherit handler, So Gsmcalltracker's handlemessage receives the Calltracker message. The Gsmcalltracker class offers two major processing capabilities:
1, call control capabilities, such as dialing, answering calls, rejecting, multiparty calls (conference) and Exchange calls (Switchwaitingorholdingandactive), will eventually call the Operationcomplete method, Call management and control operations are completed, the method also queries the call list calls, after receiving the Event_call_state_change method (that is, after the call state changes), call the Pollcallswhensafe method, Queries the current calllist call list.
2, Handler message processing logic. Messages received from the Ril object cm, including changes in call status, modem for wireless communication module or radio, wireless communication module off or unavailable status, and receiving Calltracker messages.
The process is as follows:
CallManager can be called by the upper layer, it runs at the framework level, then calls Gsmphone MCT object calls dial, Acceptcall and other control calls, Calltracker will call cm control method, CM is the object of the RIL layer, After processing the RIL layer, the EVEMT_OPERATION_COMPLETE message is initiated, processed in Gsmcalltracker, Operationcomplete is called, the CM object of the RIL is called to query the call list list, and after the RIL layer query is completed , initiates a event_poll_calls_result message, Gsmcalltracker processes the message, invokes Handlepollcalls processing, updates the call status, and issues a related message notification.
Gsmcall's Call management model:
The gsmcall contains a list of state states and connections call connections. Gsmconnection saved the basic information of the call connection, multiple Gsmconnection objects make up a call, while Gsmcall manages state and connections, there are multiple call connections in the conversation, that is, multiparty calls.
Handlepollcalls Method:
By receiving the message, you get the call list, the object, and force the conversion to the list object, which is actually the object of the Drivercall,ril layer. Matches the corresponding Drivercall object in the connections and Drivercall lists. The dc.index== I++;conn represents the old call connection, while the DC represents the new call connection.