1## 3.6\. API Namespaces
2
3Android follows the package and class namespace conventions defined by the Java
4programming language.  To ensure compatibility with third-party applications,
5device implementers MUST NOT make any prohibited modifications (see below) to
6these package namespaces:
7
8*   `java.*`
9*   `javax.*`
10*   `sun.*`
11*   `android.*`
12*   `androidx.*`
13*   `com.android.*`
14
15That is, they:
16
17*    [C-0-1] MUST NOT modify the publicly exposed APIs on the Android platform
18     by changing any method or class signatures, or by removing classes or class
19     fields.
20*    [C-0-2] MUST NOT add any publicly exposed elements (such as classes or
21     interfaces, or fields or methods to existing classes or interfaces) or Test
22     or System APIs to the APIs in the above namespaces. A “publicly exposed
23     element” is any construct that is not decorated with the “@hide” marker as
24     used in the upstream Android source code.
25
26Device implementers MAY modify the underlying implementation of the APIs, but
27such modifications:
28
29*    [C-0-3] MUST NOT impact the stated behavior and Java-language signature of
30     any publicly exposed APIs.
31*    [C-0-4] MUST NOT be advertised or otherwise exposed to developers.
32
33However, device implementers MAY add custom APIs outside the standard Android
34namespace, but the custom APIs:
35
36*    [C-0-5] MUST NOT be in a namespace owned by or referring to another
37     organization. For instance, device implementers MUST NOT add APIs to the
38     `com.google.*` or similar namespace: only Google may do so. Similarly,
39     Google MUST NOT add APIs to other companies' namespaces.
40*    [C-0-6] MUST be packaged in an Android shared library so that only apps
41     that explicitly use them (via the <uses-library> mechanism) are
42     affected by the increased memory usage of such APIs.
43
44If a device implementer proposes to improve one of the package namespaces above
45(such as by adding useful new functionality to an existing API, or adding a new
46API), the implementer SHOULD visit [source.android.com](
47http://source.android.com/) and begin the process for contributing changes and
48code, according to the information on that site.
49
50Note that the restrictions above correspond to standard conventions for naming
51APIs in the Java programming language; this section simply aims to reinforce
52those conventions and make them binding through inclusion in this Compatibility
53Definition.
54