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