Google is making it easier to search AOSP with a new Android Code Search tool
Android’s source code resides at the Android Open Source Project Git repositories, and by extension, where the source code for every new Android version is uploaded. While having the source code open-sourced and available freely is definitely a major plus, searching through AOSP has not been a pleasant and effortless affair so far. If you want to search for how certain classes and methods are constructed, you can either clone the repository and search manually using a tool like grep, or you have to rely on online tools like AndroidXRef or Opersys. Google is making it even easier to search within AOSP with the new public Android code search tool for the Android Open Source Project.
Cloning AOSP and searching a local version is not feasible for everyone, as the AOSP is massive and constantly updated. The online tools are also not the perfect solution, as they often are not updated with the latest source code releases. Google’s new Android code search tool, however, works with code right after it is merged to one of the public AOSP Git repositories. This makes it useful for not only finding out how certain features work within Android, but it will also help in providing links in bug reports, and making quick searches on non-development devices. The tool also incorporates cross-referencing support, allowing developers to search for when something is used elsewhere within AOSP. Android code search tool also supports more advanced search tools, and you can find all of them documented over here.
As of right now, the Android code search tool can only search through the master branch of AOSP, i.e. the most up-to-date release of AOSP, which does present a limitation in that you cannot see how AOSP behaved at certain other releases. However, Google notes that the tool will become more sophisticated over time, so we expect it to gain more utility in the future.
Source: Android Developers Blog