Now, my android source code environment is getting started.

Source: Internet
Author: User

After the android source code environment was completed some time ago, we started to study the communication between threads and processes, because the task at hand is to continuously obtain device events, and then feedback the obtained events to the UI for updates. According to the android design framework, the process for applications to call lower-level services is as follows:

 

 

However, for me, the content of the android source code is a little more and cannot be digested ~~ This task mainly uses a similar process.

 

 

After learning the source code, we can find that when the source code continuously monitors device events, it will adopt loose and remote control mechanisms, and will wake up the thread through pipelines, message queues, or other methods. However, I do not know this method yet, so according to the degree to which I can implement it, after a slight modification, such:

 

 

First, describe 1 and 2:

1. When the event data of the device is successfully obtained in eventnative, the Java method in eventservice is called.

2. After completing step 1, notify the application to update the UI.

 

Because I do not use the logoff mechanism here, the system cannot help notify the wake-up thread, but this feature exists: After eventnative calls systemnative, thread blocking continues until systemnative successfully obtains the device event and sends the event to eventnative. This blocking is at the kernel level of the system, so it will not affect the interaction operation at the application layer. So I used this feature. When eventnative is blocked, I call the Java code at the frameworks layer to replace the pipeline wake-up in loose. This method is too often integrated and is not conducive to maintenance, but as a prelude to a deep understanding of the source code knowledge ~

The code is not provided for the time being, because tomorrow is the Spring Festival and I want to release these things. Secondly, more importantly, I just wrote my own demo, and I haven't had time to perform more tests and organization. So let's first introduce one of my ideas.

 

The Chinese New Year is coming. I wish you a happy holiday and a happy reception of red packets. What is the profit of red packets ~~ ^_^ In the new year, we are moving towards a new goal ~~~

Related Article

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.