Online look at the Android system source code, those brief encounter of several programs

Source: Internet
Author: User

Please respect the results of sharing, reproduced please indicate the source, this article from the countercurrent fish yuiop, the original link: http://blog.csdn.net/hejjunlin/article/details/53454514

Foreword: Recently in the study Mediacodec,u disk bad, before the source of the download is naturally no, really a sad thing, not because there is no source, will block my plan ah, so is today a article, online to see the Android source code, and many people also have to my message, How to look at the source of Android system, today to knock on the blackboard, the focus.

Whether it is to do Android underlying development, or to do application layer development, on the Android road down, must be enough for the Android source code to understand, such as a certain function, a mechanism, or an API, how it is implemented, the need to Read the fucking Source code, you know it, know why. Here are some ways to see the source code online:

1,http://androidxref.com

2,http://www.grepcode.com/

3,android SDK Search Plugin

To say that these three ways of experience, http://androidxref.com, this synchronization of the official source, the latest 7.0, the above has already had, I also prefer this, the application of some of the 2nd, and still stay in the 5.1 stage, can not find what I want, so decisively gave up. Android SDK Search is also OK. The following highlights the Android SDK Search plugin and androidxref.

http://www.grepcode.com/

Android SDK Search

When it comes to Android development or source code analysis, it's common to look at Google's official Android API, and if you want to drill down into the details of the API implementation, the best way is to see the source. For online API documentation, it is certainly best to view the source code if you are viewing it. Under Chrome, you can install the Android SDK Search extension for this purpose, as shown in the Chrome Web Store. After the extension is installed, after searching the Android API again, a view source link is added after the corresponding search results. For example, search Activity class, as shown in result 4. Click on the View Source link, you can open the Activity class source code, from the Web page can be seen in fact is linked to Google's Android source Git

Androidxref

Androidxref (http://androidxref.com/) project provides a cross-index of Android source code, can quickly search for the specific conditions of the Android source codes, background is based on Opengrok engine, Opengrok is a fast, Easy-to-use source search engines and control engines that help us quickly search, locate, and control the code tree. ANDROIDXREF provides an index of the complete Android kernel source code. The available source versions are shown on the right side of the Androidxref home page,
Click the appropriate source version link

You can enter the corresponding source branch, and I enter the latest branch of 6.0:

This article from the countercurrent fish yuiop, the original link: http://blog.csdn.net/hejjunlin/article/details/53454514

The right side provides search in a specific directory, for example, when analyzing the framework source code, you can choose the frameworks directory, which can reduce the search scope, shorten the search time, and more accurately locate the required source. The left side is a condition that provides some search, meaning the following (under the specified Project (s)):

    • Full search: Search by text to match all words, strings, identifiers, and numbers, such as "Mediacodec" under frameworks

Clicking "Search" displays all results that contain MEDIACODEC characters (ignoring case), even if a comment is displayed, such as clicking on the corresponding link will open the folder containing the Mediacodec.

Clicking on the left file name such as Trackdecoder.java link will open the file containing the MEDIACODC string;

And so on, clicking on the search results link on the right side of each row will also open the corresponding file content;

    • Definition: Search symbol definition related code, such as search OnDraw function definition, display the result

If you want to find Ondraw,onchilddraw and other methods, we click OnDraw, immediately jump to the following page:

As you can see from the search results, all classes of the OnDraw method are listed, to page 6th, to find the familiar Textureview, and click inside.

    • Symbol: Search for symbols, such as the ability to search for member variables in a class, showing the results of searching for feature_no_title by symbol


Usually we are in this.requestwindowfeature (window.feature_no_title);//Remove the title bar, this feature_no_title is in the Window.java,
This article from the countercurrent fish yuiop, the original link: http://blog.csdn.net/hejjunlin/article/details/53454514

    • File path: Search for files with the given string in the source file name, for example, if you want to search for the file name containing mediacodec source files, you can fill in the file path with Mediacodec to search, the result is as follows

This is exactly what I want, compared to one in the IDE, this feature has to say 6 of the fly.

    • History: This is almost useless, certainly not very useful, I have tried various searches.

The above is just a single search, what if it is multiple conditions? It's still satisfying,
For example, search for the start function in Mediacodec.cpp:

Because Androidxref uses the Opengrok engine, it also supports some other search methods: In "Http://androidxref.com/6.0.0_r5/help.jsp", written in quite detailed, interested classmates can see.

This article from the countercurrent fish yuiop, the original link: http://blog.csdn.net/hejjunlin/article/details/53454514

The first time to get blog update reminders, as well as more Android dry, source code Analysis , Welcome to follow my public number, sweep the bottom QR code or long press to identify two-dimensional code, you can pay attention to.




If you feel good, easy to praise, but also to the author's affirmation, can also share this public number to you more people, original not easy

Online look at the Android system source code, those brief encounter of several programs

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.