Certain APIs require that a device have a specific feature to operate
correctly, so start annotating them.
Test: builds, boots
Bug: 72284763
Change-Id: Ie2f30284bdfdb6acc4067f434eba3b5433837606
Exempt-From-Owner-Approval: simple annotations
SystemApi annotation is now retained at runtime in order for the
CtsSignatureTest to extract the list of System APIs from the device and
compare it with the known list of the APIs. Until now, the test only
ensured that the known list of the APIs exist in the device, but didn't
ensured the opposite. In order words, it was possible for device
manufacturers to revive the APIs that were once deleted. This will
become a problem when SystemAPIs will be allowed to non-system partitions
such as vendor. An apk in the vendor partition which is using the
revived-but-officially-deleted System API will break when the system
partition is replaced with the Generic System Image (GSI) built from
AOSP, which doesn't have the deleted API. (Running CTS on GSI is part of
the Treble compliance tests)
The overhead of retaining this annotation at runtime is small, because
the relationship from an entity (a class, a field, a member, etc) to the
annotation is recorded as a 4 byte offset field [1].
[1] https://source.android.com/devices/tech/dalvik/dex-format#annotations-directory
Bug: 70832217
Bug: 67891551
Test: measure the size increment before and after. framework.jar was
increased by 2964 byte.
Change-Id: I679b19ac5ce57d33ce59e32b3b1753f8a1962e11
After discussion in API council, our new best-practices are to have
developers provide an Executor to dispatch callbacks/listeners on,
instead of the previous guidance of using a Handler.
Define Context.getMainExecutor() to easily obtain an Executor
associated with the main thread of application. This allows new
APIs to require a @NonNull Executor. Also define a new
@CallbackExecutor auto-doc annotation that explains background and
points developers at new Context method above.
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.cts.ContextTest#testMainLooper
Test: cts-tradefed run commandAndExit cts-dev -m CtsContentTestCases -t android.content.cts.ContextTest#testMainExecutor
Bug: 70348426
Change-Id: I536892bcd80fcfba1bb1ddf67648c08a26d7ddd2
This CL mirrors changes made to the android.support.annotation version
of IntDef, to keep the usage and semantics identical (though the
internal version of @IntDef and @LongDef are of course hidden and not
part of the SDK.)
Test: These annotations have source retention and therefore have
no runtime impact; the change was compiling the SDK.
Change-Id: Idaf47e8d983c88be1bd8f938615c86611014b45a
Behaves pretty much the same as @IntDef, but now supports "suffix"
in addition to "prefix" when matching constants.
Test: manual docs output looks sane
Bug: 70406696
Change-Id: I35064b0f9f36f1f13ccdb40302d818a004014f15
This allows us to indicate that an argument (especially a lambda or
method reference) will be invoked on a separate thread. This will be
used to improve interprocedural thread annotation checks.
Test: n/a
Change-Id: I035733f8bfb1ba47f0995f38783681d105661dc5
Most @SystemApi methods should be protected with system (or higher)
permissions, so annotate common methods with @RequiresPermission to
make automatic verification easier.
Verification is really only relevant when calling into system
services (where permissions checking can happen on the other side of
a Binder call), so annotate managers with the new @SystemService
annotation, which is now automatically documented.
This is purely a docs change; no logic changes are being made.
Test: make -j32 update-api && make -j32 offline-sdk-docs
Bug: 62263906
Change-Id: I2554227202d84465676aa4ab0dd336b5c45fc651
They reference constant references, not constant values,
and this cannot be expressed in the .class file for
annotations; the data is instead extracted at build time
into external annotation data files.
Test: Manual
Change-Id: I06b366ba8815d1da40e6cbf906ebae09899c1b8e
Update docs based on what new lint detector found. Add new @IntDef
to parameters or methods returning constants or flags, and add
@RequiresPermission to methods mentioning permissions.
Test: make -j32 offline-sdk-docs
Bug: 37526420
Change-Id: I7f640f7883fcb66b911a52ae93b83f77306571ec
Add support for AnyThread, CallSuper, and UiThread.
Another related CL started documenting @RequiresPermission, so remove
duplicated information in existing APIs.
Suppress auto-doc on a handful of classes that are already
well-documented.
Test: make -j32 offline-sdk-docs
Bug: 37526420
Change-Id: I791437dccec0f11d5349a23b982ba098cb551af8
We have a handful of annotations that we've been sprinkling across
the platform APIs, such as @Nullable, @NonNull, @IntDef, etc. It
would be really helpful to surface these contracts to developers
through the SDK docs.
This change allows annotations like those mentioned above to declare
the following new javadoc fields:
@memberDoc: docs to append to a field or method definition.
@paramDoc: docs to append to a @param definition.
@returnDoc: docs to append to a @return definition.
This change also builds a docstring to describe the list of all
constants listed in an @IntDef annotation. Sadly AnnotationDesc
only passes along raw constant values, so we need the help of the
new "prefix" annotation argument to help find the field names.
Test: builds
Bug: 37526420
Change-Id: I4cfc00dd904e5dfa945b406d546e36846b7c0c28
This will be used to help document the expected behavior of various
broadcast actions defined by the OS.
Also add logic to PackageParser that will then yell at developers
whose manifests are making bad assumptions about which broadcasts
they'll receive.
Test: builds, boots
Bug: 35925551
Change-Id: I059c2bf8aa3ce53d9ff18dcc263db7620cd14bd6
This change implements the loading and parsing
of xml type font resources, and makes sure it is
used properly by TextView styles.
Test: run cts -m CtsContentTestCases -t android.content.res.cts.ResourcesTest
run cts -m CtsWidgetTestCases -t android.widget.cts.TextViewTest#testFontResources*
Change-Id: I5a2930b3ba7dad67d9607e9036a5dde6bab0c5a4
This class can be used to define color spaces. A color space has a color model
and a profile connection space (CIE XYZ D50). This implementation can be used
to query various properties of RGB color spaces or perform conversions between
various color spaces (RGB, XYZ and Lab).
Refer to the documentation for more details.
Test: cts-tradefed run singleCommand cts-dev --module CtsGraphicsTestCases --test android.graphics.cts.ColorSpaceTest
Bug: 32984164
Change-Id: Ie2117c1212c1375a7d403d3c1afaf73d7c2e0b47
This CL has a companion CL to add the @HalfFloat annotation to the
support library.
Test: cts-tradefed run singleCommand cts-dev --module CtsUtilTestCases --test android.util.cts.HalfTest
Bug: 29940137
Change-Id: I4e1dc456687c1c026437150e9cc94a54f3264d4e
This gives callers the ability to request details for missing
packages. Also add annotations for userId and appId variables and
start tagging their usage.
Change-Id: I63d5d7f870ac4b7ebae501e0ba4f40e08b14f3f6
The body of {@code} must not be HTML escaped. This is one of
several changes that fix the source in conjunction with a
doclava fix.
Bug: 25757239
Change-Id: Ib38a0fa2dd2a3d68e467f78a812071e763d7e881
This allows us to build a special jar with methods exposed strictly
for CTS. An @TestApi should not be a public API or a system
API.
Bug: 25608286
Change-Id: Ifbc64bb6958d2deec5b9cf0b944acfd068f0f051
(Will be used to for example solve
181789: Incorrect/inconsistent lint + documentation for Snackbar
)
Change-Id: I843a9286b6af6e14640391e6f0261c398d6963fa
This allows you to express that the permission requirement
on a method depends on a given parameter; static analysis
tools should then trace the supplied value backwards to
see whether it points to a constant which in turn has been
annotated with @RequiresPermission.
Change-Id: Ifaf3c2517a2c416b00409d646d6ec881c6b7af18
These describe threading requirements for a given method,
or threading promises made to a callback.
Change-Id: If496067b12df3a0adedc32e4b4005cd1c2d400f3
These annotations allow you to annotate an int parameter or return
value to indicate that the int should correspond to a resource
constant (such a R.string.app_name).
Change-Id: I3a0b2ef0b943bdf9d5a2e1f978ccf3445eed829a
These should not be used in app code; instead, we will add
class-file retention versions of these to the support
library.
Change-Id: I13275bd28529f5da04d923688655be35c77dbb1c
This changeset adds some annotations for recording whether a
method return value or method parameter can be null (@Nullable),
can never be null (@NotNull), or must be an integer enum or flag
using one of the given constants.
Change-Id: Ic932592ea3bac781c1df364447c57042461333c5