How to traverse the android underlying layer and the android underlying layer

Source: Internet
Author: User

How to traverse the android underlying layer and the android underlying layer

For android development, most of the work is actually at the application layer, but in order to reflect the "technical content", and "know why", so that the problem is not helpless. Therefore, it is necessary to understand the underlying working mechanism.

Because android is an open-source system, it is very easy to learn its internal working mechanism. At present, there are some books on android source code analysis.

I always think that development at the application layer has nothing to do with the underlying layer. However, one time I had some knowledge about the android framework layer due to application permission issues, using a source code analysis book to understand how android works is not as difficult as you think.

Different from other places, I use little-known code injection technology (not dependency injection). For android devices with root permissions, I only need to inject one to the system process. so file, and then use this. so file to get the jvm execution environment, you can load java code, so that your java code is injected into the system process.

After the java code is injected, the operation can be performed at the framework layer. Therefore, we have successfully crossed from the application layer to the android underlying layer.

Of course, if you want to execute your own code at the framework layer, you can simply replace the system file. One way is to download the android source code and build the compiling environment. Another way is to decompile the jar files in the system. This is also feasible. Reference (not tested): http://dss16694.iteye.com/blog/1436466

Code injection reference: http://blog.csdn.net/jiangwei0910410003/article/details/40949475

Of course, replacing system files and code injection requires the root permission. SELinux is enabled by default in the latest android system, and it may be difficult to obtain the root permission. Therefore, it is best to use a system lower than 4.3 for research.

Android is based on linux at the underlying layer. After the system is started, it runs linux first. The running environment of android starts to run from the executable file of app_process. rc specifies the file path and startup parameters. Started jvm in app_process, and then entered the java World. Most java programs are stored in the/system/framework folder, which is different from common jar packages, the java here is based on dalvik. Decompilation can obtain common jar files, which can be used as lib in the project. The system functions can be called through the jar function.

If you want to pop up the window and play it out, refer to here.
Http://blog.csdn.net/innost/article/details/47660193
(This is not a common form)

For more information about dalvik virtual machines and the latest art content, see Baidu or Google.

For more information about the loading process of the android system and the analysis of various system services, see the android source code analysis book.

From the structure of the android system, we can see that many android code is implemented in java, while java can be cross-platform, in theory, as long as the Startup Program app_process and related executable files can be run on windows and other systems, android can directly run on windows and other operating systems.

In fact, this porting has already been implemented by some people, so we can do it on Chrome ARC. Although a lot of software is still not running, we can see that WindowsAndroid is also running android through transplantation rather than through virtual machines, there may be others.

However, I have not seen any open-source projects or such open-source projects. If anyone knows, let me know.

Another interesting event is that you can take out the android UI separately, so that you can develop desktop applications by developing android applications, android UI has ready-made development tools and many developers. Swt and swing in java are almost forgotten.

Now, let's talk about this. For more information, please pay attention to my public account: zhaojieTec.

 

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.