summaryrefslogtreecommitdiff
path: root/core/java/android/annotation
Commit message (Collapse)AuthorAgeFilesLines
* Move annotations in public api to frameworks/baseAnton Hansson2021-09-162-0/+74
| | | | | | | | | | | | These two are the only annotations in the android.annotations package that are not @hide -- they are actually in the public API. As such, they are not suitable in the annotations library. Move them back to frameworks/base where the other core java APIs live. Bug: 186197911 Test: m Change-Id: Ide01e4e7840bddf1e024e9024771e528d17a1d80
* Remove annotations that have been relocatedChris Wailes2021-04-3072-3176/+0
| | | | | | | | | | These annotations have been relocated to frameworks/libs/modules-utils. This CL removes the files and updates necessary build rules. Bug: 183133670 Test: m Merged-In: I834b9f5320e0b6fe8cb9feb7194c82085b805e07 Change-Id: I834b9f5320e0b6fe8cb9feb7194c82085b805e07
* Annotations for Bluetooth broadcast intents.Jeff Sharkey2021-04-212-0/+13
| | | | | | | | | | | | | | | | Recent work has been using Error Prone rules and annotations to reflect the current state of permission enforcement across the Bluetooth stack, and we're now in a position were we can add new permission enforcement that had been missing. We've currently standardized on saying that APIs that return device or Bluetooth state information (without sharing details about any particular remote Bluetooth device) do not need to be permission protected. Bug: 183626724 Test: ./build/soong/soong_ui.bash --make-mode Bluetooth RUN_ERROR_PRONE=true Change-Id: I53ac7a4fe1dea57316048c3cac4fa237b6ba3d38
* More Bluetooth API annotation updates.Jeff Sharkey2021-04-161-0/+36
| | | | | | | | | | | | | | | | | | This change adds a "BluetoothPermissionChecker" that ensures that all Bluetooth permission annotations are consistent. In addition, it verifies that all Bluetooth public APIs have been audited to be permission protected where relevant. We've currently standardized on saying that APIs that return device or Bluetooth state information (without sharing details about any particular remote Bluetooth device) do not need to be permission protected. This change is only annotations and has no behavior changes. Bug: 183626724 Test: ./build/soong/soong_ui.bash --make-mode Bluetooth RUN_ERROR_PRONE=true Change-Id: Ie80b15b058359bf1e9a6ee881b89cb3e5b584ca1
* Make @RequiresPermission RetentionPolicy.CLASS.Jeff Sharkey2021-04-151-2/+2
| | | | | | | | | | | | | | As part of Error Prone checks, we're now placing these annotations directly on AIDL interfaces. However, many portions of the OS are built using prebuilt AIDL files, where RetentionPolicy.SOURCE annotations have been stripped away. To retain these annotations for aiding permission enforcement checks, this change upgrades to RetentionPolicy.CLASS. Bug: 183626724 Test: ./build/soong/soong_ui.bash --make-mode Bluetooth RUN_ERROR_PRONE=true Change-Id: Ic88cbf470efc1d50926fe2ff16f0e2f6cd7b1173
* Prepare role code for modularization.Hai Zhang2021-01-221-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | - PooledLambda: PoolLambda is replaced with plain lambdas, to avoid adding ~20 classes to boot classpath (for each module that uses lambda). - SystemServiceRegistry: RoleFrameworkInitializer is added to add ROLE_SERVICE, similar to other modules. - RoleService: RoleManagerService is renamed to RoleService to better reflect the manager/service relationship. - @MainThread: import for Looper is removed because it's only used in javadoc and triggers package not exist error during build. @linkplain in the javadoc is also removed because it triggers an error in Metalava parsing and isn't critical. - Added small utilities: These utilities has their full version in platform, but is too large and contains too many internal references in methods unreferenced by role, whereas actually role only needs 1 or 2 methods from them. So just create a small copy of the used methods for role modularization, and they will be moved into APEX with role. Bug: 158736025 Test: manual Change-Id: I74f20b37d23370e258e7fc7130e28c5312abf46c
* Add enforcement parameter to RequiresFeatureDaniel Bright2020-11-191-3/+10
| | | | | | | | | | * Allows for a broader range of enforcement checks * Designed to match androix so that it can be easily slotted into Android Studio lint checks Test: Built Bug: 173735303 Change-Id: Ia4cc8be8fdccbdeeecee956e4ccf02bda6d91845
* Proper API hierarchy between MODULE_LIBS and PRIV_APPS system APIsMakoto Onuki2020-07-141-2/+0
| | | | | | Test: build / treehugger Bug: 146727827 Change-Id: Ie1ad6711c490c679ebcfacd97154380a8810ba1c
* Remove nullablility annotations from module-libAnton Hansson2020-05-202-6/+0
| | | | | | | | | | | | | | | | | | They were added to workaround the problem of package-private versions being added to the stubs, which prevented use of the annotations from mainline modules. Having them in the API leads to a different problem -- this version of the nullability annotations have SOURCE retention. However in the stubs build we want to have CLASS retention, so that kotlin can make use of their presence. This is arguably a much cleaner fix, since having a source-retention annotation doesn't really make much sense. Bug: 157010342 Test: m Change-Id: Id78f00da5b6af2930224a82faa24cb8235362521
* Add SystemApi(MODULE_LIBRARIES) to AtomicFile APIDmitri Plotnikov2020-05-141-0/+41
| | | | | | | | | Cleaning up the API in the process Test: atest android.jobscheduler.cts Bug: 142281756 Change-Id: Ia52dc6fda867f3015ecbf068a0a69cc0f17cd92a
* Merge "Introduce @(Non)UiContext and @DisplayContext"TreeHugger Robot2020-05-143-0/+167
|\
| * Introduce @(Non)UiContext and @DisplayContextCharles Chen2020-05-123-0/+167
| | | | | | | | | | | | | | | | | | This annotations is used for marking generic Context. It will be furthur used for lint checks. Test: flash and build Bug: 151414704 Change-Id: Ic17f4f7f393590b5f8403bf978e168ea3fc3d39c
* | Merge "Remove atrost (and dbrazdil) from OWNERS files." am: 06e2fe837a am: ↵Anna Trostanetski2020-05-121-1/+1
|\ \ | |/ |/| | | | | | | 389fa5ce4f Change-Id: I43430577015ddbcd5aabb10794d250a960eb5def
| * Remove atrost (and dbrazdil) from OWNERS files.atrost2020-05-121-1/+1
| | | | | | | | | | Test: none Change-Id: If82422229d1b4cbed5e72d1c9042bd6a38be54e5
| * Stop building against core_platform where possibleAnton Hansson2020-05-052-10/+9
| | | | | | | | | | | | | | | | | | | | | | | | This is not a stable API surface, so modules shouldn't be building against it. Compiling against core_platform also disables link-checking, which can hide other problems. Bug: 137191822 Test: m Change-Id: I7ce7dad8c02b094c565daf8c178bc6f89bb610ef Merged-In: I7ce7dad8c02b094c565daf8c178bc6f89bb610ef (cherry picked from commit 791551a70fce9267626bb39aa03af80e269e5506)
| * Add @Nullable and @NonNull to module APIAnton Hansson2020-02-122-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These two annotations are already in the public/system stubs, but are re-written to be package private instead of public. This makes them inaccessible to libs building against these stubs. When setting sdk_version:<X>, the stubs of X will appear before any other libraries on the classpath. This also makes it impossible for modules to add Nullable annotations of their own when setting sdk_version. Exposing these annotations as public in the module stubs makes it possible for modules using these annotation to specify an sdk_version. Bug: 146758669 Test: m Test: downstream CLs using sdk_version:module_current Change-Id: I71fb766d02f833ed9a1b3a7dbfbc1c8118882b30 Merged-In: I71fb766d02f833ed9a1b3a7dbfbc1c8118882b30 (cherry picked from commit c8fc90a0c2b04a5f6f5e6006155ca1e9a09db4e3)
* | Rephrase NonNull javadoc to make it more genericSantiago Seifert2020-04-061-2/+2
| | | | | | | | | | | | | | | | | | | | Makes the javadocs more applicable to scenarios where the client is receiving a non-null parameter or returning a non-null value. Bug: 150289352 Test: Not applicable. Change-Id: If800dc9abcb20f00c1b73c71379465ea812b43ec
* | Add @Nullable and @NonNull to module APIAnton Hansson2020-02-082-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These two annotations are already in the public/system stubs, but are re-written to be package private instead of public. This makes them inaccessible to libs building against these stubs. When setting sdk_version:<X>, the stubs of X will appear before any other libraries on the classpath. This also makes it impossible for modules to add Nullable annotations of their own when setting sdk_version. Exposing these annotations as public in the module stubs makes it possible for modules using these annotation to specify an sdk_version. Bug: 146758669 Test: m Test: downstream CLs using sdk_version:module_current Change-Id: I71fb766d02f833ed9a1b3a7dbfbc1c8118882b30
* | Merge "Finalize @SystemApi annotation" am: 8de85f4b50 am: da086e20c0 am: ↵Automerger Merge Worker2020-02-051-32/+4
|\| | | | | | | | | | | 031040a9b4 Change-Id: Id6a9504b955a291129ea14a9ccc37b6d23f83d2b
| * Finalize @SystemApi annotationMakoto Onuki2020-02-041-32/+4
| | | | | | | | | | | | Bug: 148177503 Test: Build & tree hugger Change-Id: I4f2394afcc25cdb2b03d58ebcc8d3fb1e4962e1e
| * Merge "Remove unused UnsupportedAppUsage annotations."satayev2020-01-291-170/+0
| |\
| | * Remove unused UnsupportedAppUsage annotations.Artur Satayev2020-01-291-170/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new annotation is android.compat.annotation.UnsupportedAppUsage. Test: m Bug: 145132366 Exempt-From-Owner-Approval: approved in internal Change-Id: Ie12e28eee0ed20b5677ee3162143700813b7ab64 Merged-In: Ie12e28eee0ed20b5677ee3162143700813b7ab64
* | | Remove unused UnsupportedAppUsage annotations.Artur Satayev2020-01-291-170/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | The new annotation is android.compat.annotation.UnsupportedAppUsage. Test: m Bug: 145132366 Exempt-From-Owner-Approval: previously approved change Change-Id: Ie12e28eee0ed20b5677ee3162143700813b7ab64
* | | Merge "SystemApi is @Repeatable" am: 9e01566c50 am: 7a343584f5 am: a752387886Automerger Merge Worker2020-01-281-0/+12
|\| | | | | | | | | | | Change-Id: I1d39c017c5758879673629f2e151cf690cf87134
| * | Merge "SystemApi is @Repeatable"Treehugger Robot2020-01-281-0/+12
| |\ \
| | * | SystemApi is @RepeatableJiyong Park2020-01-161-0/+12
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows us to annotate a class as below: /** @hide */ @SystemApi @SystemApi(client=MODULE_APPS) public class SomeClass { /** @hide */ @SystemApi public void foo() {...} /** @hide */ @SystemApi(client=MODULE_APPS) public void bar() {...} } SomeClass is already annotated as @SystemApi. And we want to make bar() method in it as SystemApi(MODULE_APPS). To do so, the containing class SomeClass has additionally to be annotated as SystemApi(MODULE_APPS), resulting SystemApi annotation to be repeated. Bug: N/A Test: add @SystemApi(client=MODULE_APPS) to an hidden method of an existing SystemApi class (e.g. SystemProperties.set()) and execute `m updata-api`. -> api/module-app-current.txt is updated while api/system-current.txt is unchanged Change-Id: Ifd4d32a6983cfc38f0dd13618652439f6162e0d3
* | | Merge "Preparing to finalize @SystemApi" am: 9f85cd1bdb am: 934364211c am: ↵Automerger Merge Worker2020-01-271-13/+22
|\| | | | | | | | | | | | | | | | | 4ee0d79fb0 Change-Id: I5a51f19e1a309e908e9f1ce467ff2a43e21bf11c
| * | Preparing to finalize @SystemApiMakoto Onuki2020-01-271-13/+22
| |/ | | | | | | | | | | | | | | | | | | | | - MODULE_APPS is considered to be too confusing, we're going to remove it, and may revive it once ART is able to support runtime protection - Change SYSTEM_SERVER to a "client". Test: Build / treehugger Bug: 148177503 Change-Id: Id847e29ab211c4c009c234a2e1e469575914e12e
| * Merge changes I4af73809,Iba6a564a,I3305b71eJiyong Park2019-12-221-0/+45
| |\ | | | | | | | | | | | | | | | | | | * changes: Hide com.android.server package with @hide javadoc tag Add more enums for the client and process attributes of SystemApi SystemApi is parameterized
| | * Add more enums for the client and process attributes of SystemApiJiyong Park2019-12-191-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the client attribute, we have - MODULE_APPS for representing APKs implementing modules which are considered part of the platform - MODULE_LIBRARIES for representing jars inside modules. For the process attribute, we have - SYSTEM_SERVER for representing the system_server process. For example, @SystemApi(client=MODULE_LIBRARIES,process=ALL) actually means that the API is meant to be available for classes in the bootclasspath but not to the classes from the app classloader. Bug: 140202860 Test: m Exempt-From-Owner-Approval: cherry-picked from internal Merged-In: Iba6a564a0967e4d109164849ee6d6500d46469de (cherry picked from commit 88d5e494c48318c2de047511ea7494428e4aeb1e) Change-Id: Iba6a564a0967e4d109164849ee6d6500d46469de
| | * SystemApi is parameterizedJiyong Park2019-12-171-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have decided to reuse the existing annotation @SystemApi for all Java APIs regardless of whether they are for apps or platform internal modules. This was because introducing new annotation types every time when we have to create new API surfaces will only increase the confusion without giving much benefit. Instead, to differenciate the different API surfaces of @SystemApi, the annotation type is parameterized. Specifically, it has to axises. client: specifies the intended client of the API. process: specifies the process(es) that the API is available. The default for client and process are priv-apps and all, respectively, which corresponds to the today's @SystemApi for privileged apps like GMS. Exempt-From-Owner-Approval: cherry-pick from internal Bug: 140202860 Test: m Merged-In: I3305b71e22970e80db95f3daf3d7713603c7d68d (cherry picked from commit 119afc0695cf7632700119bab62a965793c34fd1) Change-Id: I3305b71e22970e80db95f3daf3d7713603c7d68d
| * | Replace import with fully qualified javadoc.Jeff Sharkey2019-12-201-3/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | Some internal changes are depending more strongly on annotations being "leaves" which don't directly reference other parts of the OS, so replace the direct import of Intent with a qualified javadoc reference. Bug: 144247087 Test: atest --test-mapping packages/providers/MediaProvider Change-Id: I198d84a755b5e270a19b41328f6a6e152112c40a Merged-In: I198d84a755b5e270a19b41328f6a6e152112c40a
* | SystemService annotation: Remove import of ContextDavid Su2020-01-121-5/+3
| | | | | | | | | | | | | | | | | | Remove import of Context to allow this annotation to be statically linked easily. Bug: 142886292 Test: compiles Change-Id: I74b02d562a9df1729e4046c7a1e6d5d8033f21e2
* | Stop building against core_platform where possibleAnton Hansson2019-12-212-10/+9
| | | | | | | | | | | | | | | | | | | | This is not a stable API surface, so modules shouldn't be building against it. Compiling against core_platform also disables link-checking, which can hide other problems. Bug: 137191822 Test: m Change-Id: I7ce7dad8c02b094c565daf8c178bc6f89bb610ef
* | Adjustments after moving MediaStore inside APEX.Jeff Sharkey2019-12-201-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "core_platform" SDK technically includes non-stable APIs, so we need to shift to "core_current" instead. While we're here, tidy up some older @removed APIs that never shipped and replace HexEncoding with a local implementation. Since MediaProvider itself is free to use @hide APIs from its own framework code in MediaStore.java, we can include all sources from "framework-mediaprovider-sources" directly. Also since the "framework-annotations" filegroup in Android.bp is a very limited subset of leaf source code, it can't directly reference Intent, so adjust the javadoc so we can drop the "import." Bug: 144247087 Test: atest --test-mapping packages/providers/MediaProvider Change-Id: I198d84a755b5e270a19b41328f6a6e152112c40a
* | Add more enums for the client and process attributes of SystemApiJiyong Park2019-12-191-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For the client attribute, we have - MODULE_APPS for representing APKs implementing modules which are considered part of the platform - MODULE_LIBRARIES for representing jars inside modules. For the process attribute, we have - SYSTEM_SERVER for representing the system_server process. For example, @SystemApi(client=MODULE_LIBRARIES,process=ALL) actually means that the API is meant to be available for classes in the bootclasspath but not to the classes from the app classloader. Bug: 140202860 Test: m Change-Id: Iba6a564a0967e4d109164849ee6d6500d46469de
* | Merge "Add aurimas as the owners of the android.annotation package" am: ↵Automerger Merge Worker2019-12-161-0/+1
|\| | | | | | | | | | | b65218c561 am: 001cf41de5 am: ba109b3f30 Change-Id: I28596883b3369c1bf3ba2bcd55afc0ac14780978
| * Add aurimas as the owners of the android.annotation packageJiyong Park2019-12-161-0/+1
| | | | | | | | | | | | Bug: N/A Test: N/A Change-Id: I5feb978f8390c35d87a2b8b9fb82a3f63de936f2
| * Add android.annotation.HideJiyong Park2019-12-111-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds android.annotation.Hide class which can be used to hide an API without using the @hide javadoc tag. This opens up the possibility of running metalava over the compiled jar, which is expected to be much faster than when ran with source files. In the short-term, this will be only used inside services.jar and not for framework.jar. Bug: 139391334 Test: m Exempt-From-Owner-Approval: cherry-pick from internal Merged-In: I589f1deb63e621a96a76d2f613d283c2d3cdfd17 (cherry picked from commit 404b9b2cf2dfe15ee1b9e4bd16ade7362d7cd648) Change-Id: I589f1deb63e621a96a76d2f613d283c2d3cdfd17
* | SystemApi is parameterizedJiyong Park2019-12-131-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have decided to reuse the existing annotation @SystemApi for all Java APIs regardless of whether they are for apps or platform internal modules. This was because introducing new annotation types every time when we have to create new API surfaces will only increase the confusion without giving much benefit. Instead, to differenciate the different API surfaces of @SystemApi, the annotation type is parameterized. Specifically, it has to axises. client: specifies the intended client of the API. process: specifies the process(es) that the API is available. The default for client and process are priv-apps and all, respectively, which corresponds to the today's @SystemApi for privileged apps like GMS. Bug: 140202860 Test: m Change-Id: I3305b71e22970e80db95f3daf3d7713603c7d68d
* | Add android.annotation.HideJiyong Park2019-12-061-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This change adds android.annotation.Hide class which can be used to hide an API without using the @hide javadoc tag. This opens up the possibility of running metalava over the compiled jar, which is expected to be much faster than when ran with source files. In the short-term, this will be only used inside services.jar and not for framework.jar. Bug: 139391334 Test: m Change-Id: I589f1deb63e621a96a76d2f613d283c2d3cdfd17
* | Merge "Handle overrideSourcePosition in unsupportedappusageprocessor." am: ↵satayev2019-12-041-0/+12
|\| | | | | | | | | | | | | | | 168c609085 am: be7b380039 am: 271ca11abe Change-Id: I05d1a54032c456b9e07674199e334a4d483298f2
| * Handle overrideSourcePosition in unsupportedappusageprocessor.Mathew Inwood2019-12-021-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The property is currently set by the AIDL compiler to indicate the original position of the annotation in the AIDL file. Use this position in preference to the annotation position within Java code if it's present. Also rework the tests to use the google compile-testing library rather than my crufty javac library. This makes testing failure conditions much nicer. Bug: 145120552 Test: atest unsupportedappusage-processor-test Test: m framework-annotation-proc Change-Id: Icaac9b40672dce028095b578c19950b688506c0d
* | Add annotation for APIs that support Context.getUser/getUserIdValentin Iftime2019-11-121-0/+49
|/ | | | | | | | Annotation for APIs that use context.getUser/getUserId to execute as other users Bug:143738055 Test: - Change-Id: Ieeb54812bcdc5ce0b8ee4a7cfd37aa692712efd6
* Fix docs to be clearer and more maintainableNeil Fuller2019-10-181-6/+3
| | | | | | | | The mention of P in the doc was unclear. Also, listing the specific values allowed is a maintenance issue. Test: None Change-Id: I9c46eec353090ecd822f10a0a9e8433fa46246a0
* Merge "Add publicAlternatives to @UnsupportedAppUsage" am: 2ac6496fb8Andrei-Valentin Onea2019-05-141-0/+26
|\ | | | | | | | | | | am: d9a8aaa62b Change-Id: Ibda505834ff9f238e0b1bf499a56f968cb058fda
| * Merge "Add publicAlternatives to @UnsupportedAppUsage"Andrei-Valentin Onea2019-05-141-0/+26
| |\
| | * Add publicAlternatives to @UnsupportedAppUsageAndrei Onea2019-05-101-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new field to UnsupportedAppUsage, to allow specifying public API alternatives to hidden APIs. This change mirrors the one in libcore. Bug: 130721457 Test: m Change-Id: I12592db123fab1ced2d62fbf507c13cade0ef0ba
* | | Merge "Extend OWNERS for UnsupportedAppUsage.java" am: cc3a1ccbceAndrei-Valentin Onea2019-05-141-1/+1
|\| | | | | | | | | | | | | | | | | am: aa4871c6b7 Change-Id: Ia841601cc4c26600a8cf77117008ba0d0b2a336b
| * | Extend OWNERS for UnsupportedAppUsage.javaAndrei Onea2019-05-141-1/+1
| |/ | | | | | | | | | | | | Add compat-team members as owners of UnsupportedAppUsage.java Test: n/a Change-Id: I85c15cca2675b6b52049da16955710797067d05b