: Click on any class, method, or variable to jump to its definition or see every instance where it is called.
: Standard text search (like grep ) only matches strings. Xref tools analyze the abstract syntax tree (AST) of the code, allowing you to click on a function call and jump directly to its definition.
Historically, developers relied on third-party tools like AndroidXRef (based on OpenGrok ) to browse code online. However, Google eventually launched the official Android Code Search , which integrates advanced cross-referencing (Kythe-based) directly into a web interface. Core Features of AOSP XRef Tools
: Search for text, regular expressions, or specific symbol definitions across the entire historical archive of Android releases. xref aosp
Eliminates the need to manually iterate through stack frames or search for call addresses by hand.
If you need to find where the ActivityManagerService class is defined, searching for the plain text will yield thousands of log and comment results. Instead, use symbol definitions: defs:ActivityManagerService
In this post, I’ll show you how to set up and use xref on AOSP to find definitions, callers, and class hierarchies in seconds. : Click on any class, method, or variable
. He was deep in the C++ layers now. Then, he saw it—a small change in the Apache 2.0 licensed
┌────────────────────────────────────────────────────────┐ │ cs.android.com Interface │ ├────────────────────────────────────────────────────────┤ │ [ File Tree ] │ Clickable Code Symbol -> Opens Panel │ │ │ │ │ • frameworks │ public void startActivity(Intent i) { │ │ • packages │ └─► [Click Symbol] │ │ • system │ │ ├───────────────┴────────────────────────────────────────┤ │ [ Cross-Reference Panel ] │ │ ► Definitions (Where the symbol is created) │ │ ► References (Every caller across AOSP repos) │ └────────────────────────────────────────────────────────┘ Android Code search - Android Open Source Project
Report: AOSP Code Search with Cross-References (XREF) The provides a specialized Code Search tool that incorporates Cross-References (XREF) to help developers navigate its massive codebase. This tool is essential for understanding the complex relationships between different components of the Android operating system. Overview of XREF in AOSP Eliminates the need to manually iterate through stack
While Google’s official web-based tool is the gold standard, the open-source nature of Android has led to community-driven alternatives. Projects like AOSPXRef and xrefandroid allow organizations to host their own indexed versions of the source code. These are particularly valuable for developers working on custom ROMs or proprietary hardware where they may need to index private additions alongside the public AOSP tree. Conclusion
While AndroidXRef is largely static or legacy now, its query layout shaped how Android platform developers thought about tracking down code linkages.
Before deep-diving into usage, it is important to understand the landscape of AOSP cross-referencing. The community has shifted from fragmented third-party solutions to an enterprise-grade official platform.