diff options
author | atrost <atrost@google.com> | 2019-11-04 17:06:25 +0000 |
---|---|---|
committer | atrost <atrost@google.com> | 2019-11-11 18:04:30 +0000 |
commit | 69474bb15334afa41e1a8b6ec78f9b7954f23a0e (patch) | |
tree | 9a61fd1b3139262a1378526abf70d5cf04b22b9d | |
parent | 1c731827cd828799979bd0291be7d35b6baca06c (diff) |
Move android.compat.annotation package out of libcore
Test: m + flash
Bug: 142650523
Change-Id: I4c50bebb9fbfc3df89d948004c6c16dbb60ce8c7
-rw-r--r-- | JavaLibrary.bp | 3 | ||||
-rw-r--r-- | luni/src/main/java/android/compat/annotation/ChangeId.java | 51 | ||||
-rw-r--r-- | luni/src/main/java/android/compat/annotation/Disabled.java | 41 | ||||
-rw-r--r-- | luni/src/main/java/android/compat/annotation/EnabledAfter.java | 49 | ||||
-rw-r--r-- | mmodules/core_platform_api/api/platform/current-api.txt | 18 | ||||
-rw-r--r-- | mmodules/intracoreapi/api/intra/current-api.txt | 18 | ||||
-rw-r--r-- | non_openjdk_java_files.bp | 3 |
7 files changed, 6 insertions, 177 deletions
diff --git a/JavaLibrary.bp b/JavaLibrary.bp index 8429ca6349..1970354a9a 100644 --- a/JavaLibrary.bp +++ b/JavaLibrary.bp @@ -208,6 +208,7 @@ java_library { ":core_libart_java_files", ":openjdk_lambda_stub_files", ":openjdk_generated_annotation_stub_files", + ":app-compat-annotations-source", ], sdk_version: "none", @@ -498,12 +499,12 @@ java_library_static { "test-rules/src/platform_compat/**/*.java", "luni/src/main/java/libcore/api/CorePlatformApi.java", "luni/src/main/java/libcore/api/IntraCoreApi.java", - ], static_libs: [ "junit", "guava", "android-support-test", + "app-compat-annotations", ], platform_apis: true, // This builds classes that are in the java.base Java module: diff --git a/luni/src/main/java/android/compat/annotation/ChangeId.java b/luni/src/main/java/android/compat/annotation/ChangeId.java deleted file mode 100644 index ea91223fd2..0000000000 --- a/luni/src/main/java/android/compat/annotation/ChangeId.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package android.compat.annotation; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.ElementType.PARAMETER; -import static java.lang.annotation.RetentionPolicy.CLASS; - -import libcore.api.CorePlatformApi; -import libcore.api.IntraCoreApi; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Indicates that a field is a compatibility change ID. - * - * <p>A compatibility change is a change to the Android platform that may impact app behavior, - * relative to previous releases of Android. A change ID is a unique {@code long} identifying one - * such change. Compatibility change IDs should be defined as a {@code static final long}: - * - * <pre>{@code - * @ChangeId - * public static final long MY_CHANGE_ID = 123456789l; - * }</pre> - * - * <p>The value of the constant is the ID of an issue in <a href="https://issuetracker.google.com/"> - * buganizer</a>. - * - * @hide - */ -@Retention(CLASS) -@Target({FIELD, PARAMETER}) -@CorePlatformApi -@IntraCoreApi -public @interface ChangeId { -} diff --git a/luni/src/main/java/android/compat/annotation/Disabled.java b/luni/src/main/java/android/compat/annotation/Disabled.java deleted file mode 100644 index 4779a24f7e..0000000000 --- a/luni/src/main/java/android/compat/annotation/Disabled.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package android.compat.annotation; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.RetentionPolicy.CLASS; - -import libcore.api.CorePlatformApi; -import libcore.api.IntraCoreApi; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Used to indicate that a compatibility {@link ChangeId change} is disabled for all apps. - * - * <p>This annotation should only be applied to change ID constants that are also annotated with - * {@link ChangeId}. In any other context, this annotation will have no effect. - * - * @hide - */ -@Retention(CLASS) -@Target({FIELD}) -@CorePlatformApi -@IntraCoreApi -public @interface Disabled { -} diff --git a/luni/src/main/java/android/compat/annotation/EnabledAfter.java b/luni/src/main/java/android/compat/annotation/EnabledAfter.java deleted file mode 100644 index aeb62fdf1a..0000000000 --- a/luni/src/main/java/android/compat/annotation/EnabledAfter.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2019 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License - */ - -package android.compat.annotation; - -import static java.lang.annotation.ElementType.FIELD; -import static java.lang.annotation.RetentionPolicy.CLASS; - -import libcore.api.CorePlatformApi; -import libcore.api.IntraCoreApi; - -import java.lang.annotation.Retention; -import java.lang.annotation.Target; - -/** - * Used to indicate that a compatibility {@link ChangeId change} is enabled only for apps with a - * {@code targetSdkVersion} of <em>greater than</em> the given value. - * - * <p>This annotation should only be applied to change ID constants that are also annotated with - * {@link ChangeId}. In any other context, this annotation will have no effect. - * - * @hide - */ -@Retention(CLASS) -@Target({FIELD}) -@CorePlatformApi -@IntraCoreApi -public @interface EnabledAfter { - /** - * @return The maximum {@code targetSdkVersion} for which this change does not apply. Apps with - * a {@code targetSdkVersion} of greater than this value will get the change. - */ - @CorePlatformApi - @IntraCoreApi - int targetSdkVersion(); -} diff --git a/mmodules/core_platform_api/api/platform/current-api.txt b/mmodules/core_platform_api/api/platform/current-api.txt index f2960ee38c..bc6ebccc79 100644 --- a/mmodules/core_platform_api/api/platform/current-api.txt +++ b/mmodules/core_platform_api/api/platform/current-api.txt @@ -3,8 +3,8 @@ package android.compat { public final class Compatibility { method public static void clearOverrides(); - method public static boolean isChangeEnabled(@android.compat.annotation.ChangeId long); - method public static void reportChange(@android.compat.annotation.ChangeId long); + method public static boolean isChangeEnabled(long); + method public static void reportChange(long); method public static void setCallbacks(android.compat.Compatibility.Callbacks); method public static void setOverrides(android.compat.Compatibility.ChangeConfig); } @@ -28,20 +28,6 @@ package android.compat { } -package android.compat.annotation { - - @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.PARAMETER}) public @interface ChangeId { - } - - @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD}) public @interface Disabled { - } - - @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD}) public @interface EnabledAfter { - method public abstract int targetSdkVersion(); - } - -} - package android.system { public class Int32Ref { diff --git a/mmodules/intracoreapi/api/intra/current-api.txt b/mmodules/intracoreapi/api/intra/current-api.txt index 666c47dec8..4353608a76 100644 --- a/mmodules/intracoreapi/api/intra/current-api.txt +++ b/mmodules/intracoreapi/api/intra/current-api.txt @@ -2,8 +2,8 @@ package android.compat { @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public final class Compatibility { - method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public static boolean isChangeEnabled(@android.compat.annotation.ChangeId long); - method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public static void reportChange(@android.compat.annotation.ChangeId long); + method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public static boolean isChangeEnabled(long); + method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public static void reportChange(long); } @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public static final class Compatibility.ChangeConfig { @@ -19,20 +19,6 @@ package android.compat { } -package android.compat.annotation { - - @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.PARAMETER}) @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public @interface ChangeId { - } - - @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD}) @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public @interface Disabled { - } - - @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD}) @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public @interface EnabledAfter { - method @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public abstract int targetSdkVersion(); - } - -} - package dalvik.annotation.compat { @java.lang.annotation.Repeatable(UnsupportedAppUsage.Container.class) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.TYPE}) @libcore.api.CorePlatformApi @libcore.api.IntraCoreApi public @interface UnsupportedAppUsage { diff --git a/non_openjdk_java_files.bp b/non_openjdk_java_files.bp index 3109b1464a..afc8de86f0 100644 --- a/non_openjdk_java_files.bp +++ b/non_openjdk_java_files.bp @@ -131,9 +131,6 @@ filegroup { name: "non_openjdk_javadoc_luni_files", srcs: [ "luni/src/main/java/android/compat/Compatibility.java", - "luni/src/main/java/android/compat/annotation/ChangeId.java", - "luni/src/main/java/android/compat/annotation/Disabled.java", - "luni/src/main/java/android/compat/annotation/EnabledAfter.java", "luni/src/main/java/android/system/ErrnoException.java", "luni/src/main/java/android/system/GaiException.java", "luni/src/main/java/android/system/IcmpHeaders.java", |