Name Date Size #Lines LOC

..--

java/src/org/chromium/base/H25-Apr-2025-27,93916,260

javatests/src/org/chromium/base/H25-Apr-2025-3,6912,778

jni_generator/H25-Apr-2025-64

junit/src/org/chromium/base/H25-Apr-2025-11,6308,609

library_loader/H25-Apr-2025-859534

linker/H25-Apr-2025-1,6781,054

orderfile/H25-Apr-2025-587390

proguard/H25-Apr-2025-165136

shared_preferences/H25-Apr-2025-11987

task_scheduler/H25-Apr-2025-310206

COMMON_METADATAH A D25-Apr-202512 21

DIR_METADATAH A D25-Apr-202541 21

README.mdH A D25-Apr-20252.7 KiB7049

android_hardware_buffer_compat.ccH A D25-Apr-20254 KiB12886

android_hardware_buffer_compat.hH A D25-Apr-20253.1 KiB7859

android_image_reader_compat.ccH A D25-Apr-2025475 2011

android_image_reader_compat.hH A D25-Apr-2025514 209

apk_assets.ccH A D25-Apr-20252.4 KiB7054

apk_assets.hH A D25-Apr-20251.7 KiB4821

application_status_listener.ccH A D25-Apr-20253.8 KiB12896

application_status_listener.hH A D25-Apr-20253.1 KiB9837

application_status_listener_unittest.ccH A D25-Apr-20253.7 KiB12987

base_jni_onload.ccH A D25-Apr-2025507 2213

base_jni_onload.hH A D25-Apr-2025521 2311

build_info.ccH A D25-Apr-20253.1 KiB9877

build_info.hH A D25-Apr-20256.5 KiB215129

bundle_utils.ccH A D25-Apr-20253.5 KiB10469

bundle_utils.hH A D25-Apr-20251.7 KiB4518

callback_android.ccH A D25-Apr-20252.8 KiB8163

callback_android.hH A D25-Apr-20251.8 KiB5332

child_process_binding_types.hH A D25-Apr-2025669 2715

child_process_service.ccH A D25-Apr-20252.9 KiB8567

child_process_unittest.ccH A D25-Apr-20251.2 KiB4330

command_line_android.ccH A D25-Apr-20253.1 KiB8664

content_uri_utils.ccH A D25-Apr-20252.8 KiB8765

content_uri_utils.hH A D25-Apr-20251.4 KiB4217

content_uri_utils_unittest.ccH A D25-Apr-20251.3 KiB3924

cpu_features.ccH A D25-Apr-2025522 2313

early_trace_event_binding.ccH A D25-Apr-20255 KiB136115

early_trace_event_binding.hH A D25-Apr-2025726 2510

event_log.ccH A D25-Apr-2025424 179

event_log.hH A D25-Apr-2025439 2110

feature_list_jni.ccH A D25-Apr-2025411 179

feature_map.ccH A D25-Apr-20254 KiB121100

feature_map.hH A D25-Apr-20251.1 KiB3717

features_jni.ccH A D25-Apr-20251.2 KiB3929

field_trial_list.ccH A D25-Apr-20253.9 KiB11275

important_file_writer_android.ccH A D25-Apr-20251 KiB3422

input_hint_checker.ccH A D25-Apr-20252.6 KiB9263

input_hint_checker.hH A D25-Apr-20252.1 KiB6933

int_string_callback.ccH A D25-Apr-2025960 2915

int_string_callback.hH A D25-Apr-2025783 2613

jank_metric_uma_recorder.ccH A D25-Apr-202513.9 KiB351299

jank_metric_uma_recorder.hH A D25-Apr-20251.8 KiB5738

jank_metric_uma_recorder_unittest.ccH A D25-Apr-202511.1 KiB294228

java_exception_reporter.ccH A D25-Apr-20253.5 KiB11181

java_exception_reporter.hH A D25-Apr-20251.7 KiB4920

java_handler_thread.ccH A D25-Apr-20256.4 KiB183137

java_handler_thread.hH A D25-Apr-20253.5 KiB11861

java_handler_thread_unittest.ccH A D25-Apr-20255.1 KiB153121

java_heap_dump_generator.ccH A D25-Apr-2025640 2514

java_heap_dump_generator.hH A D25-Apr-2025740 2511

java_runtime.ccH A D25-Apr-2025843 2617

java_runtime.hH A D25-Apr-2025741 2613

jni_android.ccH A D25-Apr-202510.8 KiB271177

jni_android.hH A D25-Apr-20254.1 KiB12166

jni_android_unittest.ccH A D25-Apr-20259 KiB263202

jni_array.ccH A D25-Apr-202518.7 KiB533453

jni_array.hH A D25-Apr-20259.1 KiB248156

jni_array_unittest.ccH A D25-Apr-202521.1 KiB627491

jni_bytebuffer.ccH A D25-Apr-20251.4 KiB4832

jni_bytebuffer.hH A D25-Apr-20251.6 KiB4417

jni_bytebuffer_unittest.ccH A D25-Apr-20252.1 KiB6845

jni_conversions.ccH A D25-Apr-20252.7 KiB9979

jni_registrar.ccH A D25-Apr-2025816 3122

jni_registrar.hH A D25-Apr-2025792 2914

jni_string.ccH A D25-Apr-20255.8 KiB159108

jni_string.hH A D25-Apr-20251.8 KiB5334

jni_string_unittest.ccH A D25-Apr-20252.4 KiB7965

jni_utils.ccH A D25-Apr-20251.3 KiB4633

jni_utils.hH A D25-Apr-2025813 3213

jni_weak_ref.ccH A D25-Apr-20251.9 KiB7957

jni_weak_ref.hH A D25-Apr-20251.8 KiB5226

locale_utils.ccH A D25-Apr-20251 KiB3524

locale_utils.hH A D25-Apr-2025738 3013

meminfo_dump_provider.ccH A D25-Apr-20254.4 KiB10658

meminfo_dump_provider.hH A D25-Apr-20251.2 KiB3925

meminfo_dump_provider_unittest.ccH A D25-Apr-20253.9 KiB10378

memory_pressure_listener_android.ccH A D25-Apr-20251,019 3320

memory_pressure_listener_android.hH A D25-Apr-2025868 3016

memory_purge_manager_android.ccH A D25-Apr-20251.3 KiB3123

memory_purge_manager_android.hH A D25-Apr-2025809 3015

native_uma_recorder.ccH A D25-Apr-202511.7 KiB335277

path_service_android.ccH A D25-Apr-2025536 2012

path_utils.ccH A D25-Apr-20252.9 KiB9576

path_utils.hH A D25-Apr-20252.2 KiB6019

path_utils_unittest.ccH A D25-Apr-20252 KiB6340

pmf_utils.ccH A D25-Apr-20252.9 KiB9365

pmf_utils.hH A D25-Apr-2025751 2817

pmf_utils_unittest.ccH A D25-Apr-20251.5 KiB4734

pre_freeze_background_memory_trimmer.ccH A D25-Apr-202513.1 KiB386277

pre_freeze_background_memory_trimmer.hH A D25-Apr-20256.2 KiB161106

pre_freeze_background_memory_trimmer_unittest.ccH A D25-Apr-202515.6 KiB527365

radio_utils.ccH A D25-Apr-20251.9 KiB7957

radio_utils.hH A D25-Apr-20251.5 KiB6747

radio_utils_unittest.ccH A D25-Apr-2025865 2615

requires_api.hH A D25-Apr-20251.5 KiB399

resource_exclusions.gniH A D25-Apr-20251.1 KiB2822

robolectric_jni_onload.ccH A D25-Apr-2025403 148

scoped_hardware_buffer_fence_sync.ccH A D25-Apr-2025974 3623

scoped_hardware_buffer_fence_sync.hH A D25-Apr-20251.4 KiB4527

scoped_hardware_buffer_handle.ccH A D25-Apr-20253.2 KiB12287

scoped_hardware_buffer_handle.hH A D25-Apr-20253.4 KiB9334

scoped_java_ref.hH A D25-Apr-2025930 3121

scoped_java_ref_unittest.ccH A D25-Apr-202510.6 KiB341267

statistics_recorder_android.ccH A D25-Apr-2025709 2615

sys_utils.ccH A D25-Apr-20251.7 KiB5637

sys_utils.hH A D25-Apr-2025713 2714

sys_utils_unittest.ccH A D25-Apr-2025702 2514

thread_instruction_count.ccH A D25-Apr-20252.6 KiB9163

thread_instruction_count.hH A D25-Apr-20251.9 KiB6431

timezone_utils.ccH A D25-Apr-2025650 2515

timezone_utils.hH A D25-Apr-2025527 2411

token_android.ccH A D25-Apr-20251.9 KiB5743

token_android.hH A D25-Apr-20251.2 KiB4426

token_android_unittest.ccH A D25-Apr-2025707 2716

trace_event_binding.ccH A D25-Apr-202521.3 KiB584505

trace_event_binding.hH A D25-Apr-2025528 2011

unguessable_token_android.ccH A D25-Apr-20251.4 KiB4534

unguessable_token_android.hH A D25-Apr-20251.4 KiB4526

unguessable_token_android_unittest.ccH A D25-Apr-20251.5 KiB4735

README.md

1# //base/android
2
3This directory contains:
4
5* C++ APIs that are broadly useful and are unique to `target_os="android"`, and
6* Java APIs that are broadly useful, along C++ bindings when necessary.
7
8This directory does not contain Android-specific implementations / extensions
9to APIs declared directly in `//base`. Those live in `//base/*_android.cc`, or
10behind `#ifdef`s.
11
12## Adding New APIs
13
14The advice laid out in [//base/README.md] applies to this directory as well.
15The bars for what APIs should exist and for code quality are generally higher
16than for other directories. If you find yourself wanting to add a new API, you
17should expect that code reviews take multiple revisions and that they be met
18with (respectful) scrutiny.
19
20If you are not sure whether an API would make sense to add, you can ask via
21[email protected].
22It is common to add APIs to `//chrome` (or elsewhere) first, and move them into
23`//base` after their usefulness has been proven.
24
25[//base/README.md]: /base/README.md
26
27### What Uses //base/android?
28
29The main two clients are Chrome and WebView, but it is also used by other
30Chromium-based apps, such as Chromecast and Chrome Remote desktop. Some
31`//base/android` classes are used by `//build` (this is a layering violation,
32tracked in [crbug/1364192] and [crbug/1377351]).
33
34Two considerations for WebView:
35
361. The application Context is that of the host app's.
372. The UI thread might be different from the main thread.
38
39[crbug/1364192]: https://crbug.com/1364192
40[crbug/1377351]: https://crbug.com/1377351
41
42
43### New API Checklist
44
45Here is a list of checks you should go through when adding a new API:
46
471. The functionality does not already exist in system libraries (Java APIs,
48   Android SDK) or in already adopted `third_party` libraries, such as AndroidX.
492. Reasonable effort has been made to ensure the new API is discoverable. E.g.:
50   Coordinate refactorings of existing patterns to it, add a [presubmit check],
51   to recommend it, etc.
523. Tests (ideally Robolectric) are added.
534. Thought has been put into API design.
54   * E.g. adding `@Nullable`, or `@DoNotMock`
55   * E.g. adding test helpers, such as `ForTesting()` methods or `TestRule`s
56   * E.g. adding asserts or comments about thread-safety
57   * E.g. could usage of the API be made harder to get wrong?
58
59[presumbit check]: https://chromium.googlesource.com/chromium/src/+/main/build/android/docs/java_toolchain.md#Static-Analysis-Code-Checks
60
61### Choosing a Reviewer
62
63All members of [`//base/android/OWNERS`] will be CC'ed on reviews through a
64[`//WATCHLIST`] entry. For new APIs, feel free to pick a reviewer at random.
65For modifying existing files, it is best to use a reviewer from prior changes to
66the file.
67
68[`//base/android/OWNERS`]: /base/android/OWNERS
69[`//WATCHLIST`]: /WATCHLIST
70