Application layer analysis of android4.2 telephone

Source: Internet
Author: User

Incallscreen.java

Copy the display of the call interface and provide the interface of human-computer interaction, enter the interface of the first call OnCreate, otherwise enter the onnewintent, the configuration file is Incall_ Screen.xml, where Incallpanel is a call contact information and status display, the configuration file is call_card.xml, contains the view definition of two calls Incalltouchui display through the management of the control UI, the corresponding configuration file is incall_touch_ui.xml;

The mhandle Handlemessage method receives changes to the different phone states emitted by the callmanager of the framework, updating the UI. The type of consumer interest is as follows:

supp_service_failed: Eject Msuppservicefailuredialog

phone_state_changed: Call Requestupdatescreen Method Request Update call interface, send request_update_screen message

Request_update_screen: Internal call Updatescreen

phone_disconnect: Call when a call connection fails, exit the call interface in Delayedcleanupafterdisconnect

Handleonscreenbuttonclick -click button in response to call control, related processing logic involving call capability control

static methods in the Phoneutils class, such as answering calls, hanging up the phone, resuming, maintaining calls and other call control operations.

Contact information: Callcard

The display and update of the call contact information is actually done in the updatescreen of the Incallscreen, calling Callcard's Updatestate square method, Displaymaincallstatus Displays the information for updating the first call, Displayonholdcallstatus displays the second call information that holds the hold call. The Callerinfo object is obtained by Phoneutils.getcallerinfo and the basic information of the call contact is saved.

Incalltouchui Call Control:

Incomingcallwid Get : Required to connect/hang up/SMS reply;

Manageconferencebutton : Multi-party call interface Jump control button, only when the multi-party call is displayed.

Dialpadbutton : That is to show or hide the dial pad (DTMF);

Span style= "font-size:18px" > Audiobutton : Toggle speaker on/off,

Mutebutton : Mute the microphone on/off, and the other person cannot hear you when it is turned on;

Holdbutton : Turn on/off call hold;

AddButton : Increase multi-channel calls , that is, during the call, you can pause the current call, make another call and connect;

Call control-related controls are updated in the Incalltouchui updatestate to implement the Ontriggerlistener interface, which is a lock screen control interface. Here 4.2 has made a modification, in the Ontrigger function, distinguishes between three directions up, left and right to define the 0,1,2 directly, rather than the class with Slidingtab . Register Action_headset_plug in Incallscreen's Onresume and OnPause to receive the headset handsfree event Broadcast, send event_headset_plug_state_changed messages, Call Showaudiomodepopup to display the menu and enter Incalltouchui's onmenuitemclick to toggle the audio output strategy.

Dtmftwelvekeydialer

The layout file is Dtmf_twelve_key_dialer_view.xml and consists of the input box Dtmfdialerfield and the 12 button dialpad.xml.

phoneglobals:

4.2 Moves the contents of the Phoneapp in 4.0 to Phoneglobals.

Mwakelock and Mpartialwakelock are created in OnCreate for power management of the phone app. When Mwakelock is acquired, the sleep time in the setting does not work, and the screen is highlighted until the lock is released or the power key is pressed manually. After getting the Mpartialwakelock, you can turn off the screen and keyboard light at this time, but not the horse is off until the sleep time is set to off.

sensor sensor Gets the current position of the phone and determines if the phone is close to the face.

Mproximitywakelock Power wake-up lock, after getting, turn off the screen.

mediabuttonboardcastreceive receives the broadcast event of the headset hook and calls Phoneutils's handleheadsethook to respond to the headset's hook event.

phoneappboardcastreceive handles miscellaneous broadcast events in the phone app, such as flight mode, data connection, SIM status, and more.

callnotify:
Onnewringingconnect after receiving the incoming call processing, call Startincommingcallquery query contact information. Get gsmconnection userdata query to Callerinfo through Phoneutils's startgetcallerinfo.
onphonestatechanged The processing of change of call state. ondisconnect call connection disconnected processing. There are three types of connection disconnects Calllogtype:
Incomming_type (incoming
call)
Outgoing_type (call)
Missed_type (Missed Call)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.