Android phone call process (call, answer, and stop) (2)

Source: Internet
Author: User

1. Modification

1. Let's talk about a simple modification. There is a menu in the native machine, which can be used for speaker, mute, and hanging up functions, however, the menu itself has a feature that the menu disappears after you click the screen. The company wants to make the menu always display on the screen, I tried a lot of work before and wanted to disable the function of clicking the screen menu. Unfortunately, I didn't get it out after trying for a long time. I don't know whether it was set at the underlying layer, later, I wrote a view on the Internet to "Impersonate" the menu and thought about it as a good method.

In the phone source code, the java files involved in menus include incallmenuview (inheriting viewgroup), incallmenu, and incallmenuitemview (inheriting textview). The level of incallmenu includes incallmenuview, while incallmenuview includes incallmenuitemview. Incallmenu has a lot of incallmenuitemview (display of each menu key). It also sets the icon and text of each menu key and binds its onclicklistener to incallscreen.

If you want to implement the "Impersonate" function:

(1) modify the UI part of the control: You can set UI properties in incallmenu.

(2) Compile the incallmenu configuration file (set the marginleft or something of each menu key)

(3) import the incallmenu configuration file in the incallscreen configuration file, indicating that the menu will remain in the call interface (native click the menu to import it)

(4) Of course, the menu key is blocked in incallscreen, so that the two menu interfaces are repeated.

Attached comparison diagram:

Native (menu display when menu is clicked ):

After modification (no matter whether you click menu, it is always displayed on the call interface ):

2. Call screen lock

As we all know, the incalltouchui interface is displayed only in incallscreen (equivalent to a keyguard on the incoming call page ),

So the company needs to change the incoming call screen lock page. Before that, I thought of two methods: 1. directly create a new screen lock page in incallscreen, later, we found that there were a lot of la s involved in incallscreen, and it was difficult to adjust the page if we created another screen lock page .. Therefore, the second method is used, that is, to create a screen lock page from the external, and then jump to incallscreen through the screen lock page, but there are still many intermediate operations.

First, let's take a look at the difficulties:

1. When a call is made, the system directly transmits the number to incallscreen. We need to extract the number and contacts from a code layer and display them to our own screen lock page.

2. If the lock status is displayed during a call, the system will unlock the lock and highlight incallscreen. We need to highlight our lock page.

3. If no incoming call is received, You need to close your screen lock page and add an unreceived prompt for the status bar.

To solve the first problem, first find the code layer where the number is sent to incallscreen.

1. The Code shows that the call information in the source code is obtained through phoneutils. startgetcallerinfo in the callcard. Java file, and phoneapp. Java is responsible for redirecting to incallscreen. But there is a problem here. callcard is included in incallscreen. The new call interface does not contain the callcard. Java file.

The solution is to port phoneutils. startgetcallerinfo to our incoming call page.

(1) phoneapp is responsible for redirecting to the incoming call page. java file. In phoneapp, there is a displaycallscreen (which contains the getcallscreenclassname method) method to jump to incallscreen. We only need to change the class to the class of our incoming call page class.

(2) After the call jumps to the call interface, call phoneutils. startgetcallerinfo in oncreate. Parameters: startgetcallerinfo (context, C, listener, cookie ).

For the parameter input values, see the callcard. Java file. The returned callerinfo contains the Caller information, which is then displayed on the UI.

(3) Please note that the contact profile may not be retrieved once using startgetcallerinfo, so Android adds a method to it.

 

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.