aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-08 16:02:14 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2022-04-08 16:02:14 +0000
commit9089c958e18fc38f10e81dc35ec066f123e04ab4 (patch)
tree29bf7af027ddabb668699c0344c44b4f9242b26d
parentf82f4b295faa60e5d888d8209d13c563d0d94bf9 (diff)
parent78d67130a91e1abf0c190ec981c72d2ac8d93084 (diff)
downloadmodules-utils-aml_tz2_305400300.tar.gz
Change-Id: Ifff0b433231f6859d45119c5f15d3ddfb0c1a816
-rw-r--r--OWNERS3
-rw-r--r--PREUPLOAD.cfg9
-rw-r--r--TEST_MAPPING3
-rw-r--r--build/include/android-modules-utils/sdk_level.h35
-rw-r--r--java/Android.bp69
-rw-r--r--java/android/annotation/AnimRes.java37
-rw-r--r--java/android/annotation/AnimatorRes.java37
-rw-r--r--java/android/annotation/AnyRes.java39
-rw-r--r--java/android/annotation/AnyThread.java51
-rw-r--r--java/android/annotation/AppIdInt.java36
-rw-r--r--java/android/annotation/ArrayRes.java37
-rw-r--r--java/android/annotation/AttrRes.java37
-rw-r--r--java/android/annotation/BinderThread.java43
-rw-r--r--java/android/annotation/BoolRes.java37
-rw-r--r--java/android/annotation/BroadcastBehavior.java59
-rw-r--r--java/android/annotation/BytesLong.java36
-rw-r--r--java/android/annotation/CallSuper.java43
-rw-r--r--java/android/annotation/CallbackExecutor.java39
-rw-r--r--java/android/annotation/CheckResult.java58
-rw-r--r--java/android/annotation/ColorInt.java42
-rw-r--r--java/android/annotation/ColorLong.java48
-rw-r--r--java/android/annotation/ColorRes.java37
-rw-r--r--java/android/annotation/Condemned.java44
-rw-r--r--java/android/annotation/CurrentTimeMillisLong.java39
-rw-r--r--java/android/annotation/CurrentTimeSecondsLong.java39
-rw-r--r--java/android/annotation/DimenRes.java37
-rw-r--r--java/android/annotation/Dimension.java50
-rw-r--r--java/android/annotation/Discouraged.java53
-rw-r--r--java/android/annotation/DisplayContext.java54
-rw-r--r--java/android/annotation/DrawableRes.java37
-rw-r--r--java/android/annotation/DurationMillisLong.java36
-rw-r--r--java/android/annotation/ElapsedRealtimeLong.java39
-rw-r--r--java/android/annotation/FloatRange.java55
-rw-r--r--java/android/annotation/FontRes.java37
-rw-r--r--java/android/annotation/FractionRes.java37
-rw-r--r--java/android/annotation/HalfFloat.java48
-rw-r--r--java/android/annotation/Hide.java41
-rw-r--r--java/android/annotation/IdRes.java37
-rw-r--r--java/android/annotation/IntDef.java64
-rw-r--r--java/android/annotation/IntRange.java48
-rw-r--r--java/android/annotation/IntegerRes.java37
-rw-r--r--java/android/annotation/InterpolatorRes.java37
-rw-r--r--java/android/annotation/LayoutRes.java37
-rw-r--r--java/android/annotation/LongDef.java62
-rw-r--r--java/android/annotation/MainThread.java47
-rw-r--r--java/android/annotation/MenuRes.java37
-rw-r--r--java/android/annotation/NavigationRes.java37
-rw-r--r--java/android/annotation/NonNull.java38
-rw-r--r--java/android/annotation/NonUiContext.java45
-rw-r--r--java/android/annotation/Nullable.java45
-rw-r--r--java/android/annotation/OWNERS2
-rw-r--r--java/android/annotation/PluralsRes.java37
-rw-r--r--java/android/annotation/Px.java42
-rw-r--r--java/android/annotation/RawRes.java37
-rw-r--r--java/android/annotation/RequiresFeature.java51
-rw-r--r--java/android/annotation/RequiresNoPermission.java48
-rw-r--r--java/android/annotation/RequiresPermission.java137
-rw-r--r--java/android/annotation/SdkConstant.java36
-rw-r--r--java/android/annotation/Size.java52
-rw-r--r--java/android/annotation/StringDef.java56
-rw-r--r--java/android/annotation/StringRes.java37
-rw-r--r--java/android/annotation/StyleRes.java37
-rw-r--r--java/android/annotation/StyleableRes.java37
-rw-r--r--java/android/annotation/SuppressAutoDoc.java39
-rw-r--r--java/android/annotation/SystemApi.java80
-rw-r--r--java/android/annotation/SystemService.java42
-rw-r--r--java/android/annotation/TestApi.java42
-rw-r--r--java/android/annotation/TransitionRes.java37
-rw-r--r--java/android/annotation/UiContext.java52
-rw-r--r--java/android/annotation/UiThread.java49
-rw-r--r--java/android/annotation/UptimeMillisLong.java39
-rw-r--r--java/android/annotation/UserHandleAware.java96
-rw-r--r--java/android/annotation/UserIdInt.java36
-rw-r--r--java/android/annotation/Widget.java37
-rw-r--r--java/android/annotation/WorkerThread.java48
-rw-r--r--java/android/annotation/XmlRes.java37
-rw-r--r--java/com/android/internal/annotations/CompositeRWLock.java47
-rw-r--r--java/com/android/internal/annotations/GuardedBy.java58
-rw-r--r--java/com/android/internal/annotations/Immutable.java30
-rw-r--r--java/com/android/internal/annotations/VisibleForNative.java28
-rw-r--r--java/com/android/internal/annotations/VisibleForTesting.java50
-rw-r--r--java/com/android/internal/util/Android.bp34
-rw-r--r--java/com/android/internal/util/Preconditions.java771
-rw-r--r--java/com/android/modules/utils/Android.bp71
-rw-r--r--java/com/android/modules/utils/BackgroundThread.java100
-rw-r--r--java/com/android/modules/utils/BytesMatcher.java298
-rw-r--r--java/com/android/modules/utils/HandlerExecutor.java43
-rw-r--r--java/com/android/modules/utils/build/Android.bp15
-rw-r--r--java/com/android/modules/utils/build/SdkLevel.java51
-rw-r--r--java/com/android/modules/utils/build/testing/Android.bp28
-rw-r--r--java/com/android/modules/utils/build/testing/DeviceSdkLevel.java70
-rw-r--r--javatests/Android.bp25
-rw-r--r--javatests/com/android/modules/utils/Android.bp24
-rw-r--r--javatests/com/android/modules/utils/AndroidManifest.xml (renamed from javatests/AndroidManifest.xml)0
-rw-r--r--javatests/com/android/modules/utils/BackgroundThreadTest.java34
-rw-r--r--javatests/com/android/modules/utils/BytesMatcherTest.java140
96 files changed, 85 insertions, 5127 deletions
diff --git a/OWNERS b/OWNERS
index 91ab3a3..db56bd5 100644
--- a/OWNERS
+++ b/OWNERS
@@ -3,6 +3,3 @@ hackbod@google.com
hansson@google.com
narayan@google.com
omakoto@google.com
-
-# Modularization team
-file:platform/packages/modules/common:/OWNERS
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index b53cbf1..fd78ff1 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -1,12 +1,3 @@
-[Builtin Hooks]
-bpfmt = true
-clang_format = true
-commit_msg_changeid_field = true
-commit_msg_test_field = true
-
-[Builtin Hooks Options]
-clang_format = --commit ${PREUPLOAD_COMMIT} --style file --extensions c,h,cc,cpp
-
[Hook Scripts]
do_not_use_DO_NOT_MERGE = ${REPO_ROOT}/build/soong/scripts/check_do_not_merge.sh ${PREUPLOAD_COMMIT}
check_java_paths = ${REPO_ROOT}/frameworks/libs/modules-utils/tools/check_java_paths.py \ No newline at end of file
diff --git a/TEST_MAPPING b/TEST_MAPPING
index 99cb80d..463e628 100644
--- a/TEST_MAPPING
+++ b/TEST_MAPPING
@@ -4,9 +4,6 @@
{
// Unit tests for framework-wifi.jar
"name": "FrameworksWifiApiTests"
- },
- {
- "name": "ModulesUtilsTests"
}
// TODO: Re-enable when this is stable.
// {
diff --git a/build/include/android-modules-utils/sdk_level.h b/build/include/android-modules-utils/sdk_level.h
index 6e24430..a373178 100644
--- a/build/include/android-modules-utils/sdk_level.h
+++ b/build/include/android-modules-utils/sdk_level.h
@@ -17,30 +17,31 @@
#pragma once
#include <android-base/properties.h>
-#include <android/api-level.h>
namespace android {
namespace modules {
namespace sdklevel {
-// Checks if the codename is a matching or higher version than the device's
-// codename.
-static bool IsAtLeastPreReleaseCodename(const std::string &codename) {
- const std::string &deviceCodename =
- android::base::GetProperty("ro.build.version.codename", "");
- return "REL" != deviceCodename && deviceCodename.compare(codename) >= 0;
+// Return true iff the running Android SDK is at least "R".
+static inline bool IsAtLeastR() {
+ return android::base::GetIntProperty("ro.build.version.sdk", -1) >= 30;
}
-// Checks if the device is running on release version of Android R or newer.
-static inline bool IsAtLeastR() { return android_get_device_api_level() >= 30; }
-
-// Checks if the device is running on a pre-release version of Android S or a
-// release version of Android S or newer.
-static inline bool IsAtLeastS() { return android_get_device_api_level() >= 31; }
-
-// Checks if the device is running on a pre-release version of Android T or a
-// release version of Android T or newer.
-static inline bool IsAtLeastT() { return IsAtLeastPreReleaseCodename("T"); }
+// Returns true iff the running Android SDK is pre-release "S" or "T", built
+// based on "R" SDK.
+//
+// If new SDK versions are added > R, then this method needs to be updated to
+// recognise them (e.g. if we add SDK version for R-QPR, the current
+// implementation will not recognise pre-release "S" versions built on that).
+static inline bool IsAtLeastS() {
+ // TODO(b/170831689) This should check SDK_INT >= S once S sdk finalised.
+ // Note that removing the current conditions may lead to issues in
+ // mainlinefood (and possibly public beta?).
+ std::string codename =
+ android::base::GetProperty("ro.build.version.codename", "");
+ return android::base::GetIntProperty("ro.build.version.sdk", -1) == 30 &&
+ (codename == "S" || codename == "T");
+}
} // namespace utils
} // namespace modules
diff --git a/java/Android.bp b/java/Android.bp
index b5380f5..f73e180 100644
--- a/java/Android.bp
+++ b/java/Android.bp
@@ -17,62 +17,6 @@ package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
-filegroup {
- name: "framework-annotations",
- srcs: [
- ":framework-metalava-annotations",
- "com/android/internal/annotations/*.java",
- ],
-
- // TODO: Prune this list
- visibility: [
- "//frameworks/base",
- "//frameworks/base/services/net",
- "//frameworks/base/tools/processors/intdef_mappings",
- "//frameworks/libs/net/common",
- "//packages/apps/CellBroadcastReceiver",
- "//packages/apps/CellBroadcastReceiver/legacy",
- "//packages/modules/CellBroadcastService",
- "//packages/modules/NetworkStack/common/netlinkclient",
- "//packages/modules/NetworkStack/common/networkstackclient",
- "//packages/services/Iwlan",
- ],
-}
-
-filegroup {
- name: "framework-metalava-annotations",
- srcs: ["android/annotation/*.java"],
- visibility: [
- // This group of files is needed by any metalava invocation that enabled enhancement of
- // documentation (via javadoc tags like @paramDoc and @returnDoc). They are public for
- // this purpose. However, java compilation should generally depend (dynamically) on
- // framework-annotations-lib instead.
- "//visibility:public",
- ],
-}
-
-java_library {
- name: "framework-annotations-lib",
- srcs: [":framework-annotations"],
- sdk_version: "core_current",
- visibility: [
- "//visibility:public",
- ],
-}
-
-filegroup {
- name: "framework-api-annotations",
- srcs: [
- "android/annotation/SystemApi.java",
- "android/annotation/TestApi.java",
- ],
-
- visibility: [
- "//art",
- "//libcore",
- ],
-}
-
// TODO(b/183183152) This build rule should really be alongside the source in
// com/android/modules/utils/ but cannot be due to b/183183152
filegroup {
@@ -87,16 +31,3 @@ filegroup {
"//frameworks/libs/modules-utils/java/com/android/modules/utils",
],
}
-
-// This file group is deprecated; new users should use modules-utils-preconditions
-filegroup {
- name: "modules-utils-preconditions-srcs",
- srcs: [
- "com/android/internal/util/Preconditions.java",
- ],
- visibility: [
- // TODO: Prune this list
- "//frameworks/base",
- "//frameworks/base/core/java",
- ],
-}
diff --git a/java/android/annotation/AnimRes.java b/java/android/annotation/AnimRes.java
deleted file mode 100644
index 56f8acf..0000000
--- a/java/android/annotation/AnimRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be an anim resource reference (e.g. {@link android.R.anim#fade_in}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface AnimRes {
-}
diff --git a/java/android/annotation/AnimatorRes.java b/java/android/annotation/AnimatorRes.java
deleted file mode 100644
index cd4c189..0000000
--- a/java/android/annotation/AnimatorRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be an animator resource reference (e.g. {@link android.R.animator#fade_in}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface AnimatorRes {
-}
diff --git a/java/android/annotation/AnyRes.java b/java/android/annotation/AnyRes.java
deleted file mode 100644
index 44411a0..0000000
--- a/java/android/annotation/AnyRes.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a resource reference of any type. If the specific type is known, use
- * one of the more specific annotations instead, such as {@link StringRes} or
- * {@link DrawableRes}.
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface AnyRes {
-}
diff --git a/java/android/annotation/AnyThread.java b/java/android/annotation/AnyThread.java
deleted file mode 100644
index ee36a42..0000000
--- a/java/android/annotation/AnyThread.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2016 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.annotation;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that the annotated method can be called from any thread (e.g. it is
- * "thread safe".) If the annotated element is a class, then all methods in the
- * class can be called from any thread.
- * <p>
- * The main purpose of this method is to indicate that you believe a method can
- * be called from any thread; static tools can then check that nothing you call
- * from within this method or class have more strict threading requirements.
- * <p>
- * Example:
- *
- * <pre>
- * <code>
- * &#64;AnyThread
- * public void deliverResult(D data) { ... }
- * </code>
- * </pre>
- *
- * @memberDoc This method is safe to call from any thread.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD,CONSTRUCTOR,TYPE,PARAMETER})
-public @interface AnyThread {
-}
diff --git a/java/android/annotation/AppIdInt.java b/java/android/annotation/AppIdInt.java
deleted file mode 100644
index 29838dd..0000000
--- a/java/android/annotation/AppIdInt.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2016 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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that the annotated element is a multi-user application ID. This is
- * <em>not</em> the same as a UID.
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface AppIdInt {
-}
diff --git a/java/android/annotation/ArrayRes.java b/java/android/annotation/ArrayRes.java
deleted file mode 100644
index 1407af1..0000000
--- a/java/android/annotation/ArrayRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be an array resource reference (e.g. {@link android.R.array#phoneTypes}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface ArrayRes {
-}
diff --git a/java/android/annotation/AttrRes.java b/java/android/annotation/AttrRes.java
deleted file mode 100644
index 285b80c..0000000
--- a/java/android/annotation/AttrRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be an attribute reference (e.g. {@link android.R.attr#action}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface AttrRes {
-}
diff --git a/java/android/annotation/BinderThread.java b/java/android/annotation/BinderThread.java
deleted file mode 100644
index ca5e14c..0000000
--- a/java/android/annotation/BinderThread.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that the annotated method should only be called on the binder thread.
- * If the annotated element is a class, then all methods in the class should be called
- * on the binder thread.
- * <p>
- * Example:
- * <pre><code>
- * &#64;BinderThread
- * public BeamShareData createBeamShareData() { ... }
- * </code></pre>
- *
- * {@hide}
- */
-@Retention(SOURCE)
-@Target({METHOD,CONSTRUCTOR,TYPE,PARAMETER})
-public @interface BinderThread {
-} \ No newline at end of file
diff --git a/java/android/annotation/BoolRes.java b/java/android/annotation/BoolRes.java
deleted file mode 100644
index f50785b..0000000
--- a/java/android/annotation/BoolRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a boolean resource reference.
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface BoolRes {
-}
diff --git a/java/android/annotation/BroadcastBehavior.java b/java/android/annotation/BroadcastBehavior.java
deleted file mode 100644
index 87bf554..0000000
--- a/java/android/annotation/BroadcastBehavior.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (C) 2017 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.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Description of how the annotated broadcast action behaves.
- *
- * @hide
- */
-@Target({ ElementType.FIELD })
-@Retention(RetentionPolicy.SOURCE)
-public @interface BroadcastBehavior {
- /**
- * This broadcast will only be delivered to an explicit target.
- *
- * @see android.content.Intent#setPackage(String)
- * @see android.content.Intent#setComponent(android.content.ComponentName)
- */
- boolean explicitOnly() default false;
-
- /**
- * This broadcast will only be delivered to registered receivers.
- *
- * @see android.content.Intent#FLAG_RECEIVER_REGISTERED_ONLY
- */
- boolean registeredOnly() default false;
-
- /**
- * This broadcast will include all {@code AndroidManifest.xml} receivers
- * regardless of process state.
- *
- * @see android.content.Intent#FLAG_RECEIVER_INCLUDE_BACKGROUND
- */
- boolean includeBackground() default false;
-
- /**
- * This broadcast is protected and can only be sent by the OS.
- */
- boolean protectedBroadcast() default false;
-}
diff --git a/java/android/annotation/BytesLong.java b/java/android/annotation/BytesLong.java
deleted file mode 100644
index f5e1a9c..0000000
--- a/java/android/annotation/BytesLong.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2017 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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * @memberDoc Value is a non-negative number of bytes.
- * @paramDoc Value is a non-negative number of bytes.
- * @returnDoc Value is a non-negative number of bytes.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface BytesLong {
-}
diff --git a/java/android/annotation/CallSuper.java b/java/android/annotation/CallSuper.java
deleted file mode 100644
index c16b511..0000000
--- a/java/android/annotation/CallSuper.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that any overriding methods should invoke this method as well.
- * <p>
- * Example:
- *
- * <pre>
- * <code>
- * &#64;CallSuper
- * public abstract void onFocusLost();
- * </code>
- * </pre>
- *
- * @memberDoc If you override this method you <em>must</em> call through to the
- * superclass implementation.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD})
-public @interface CallSuper {
-}
diff --git a/java/android/annotation/CallbackExecutor.java b/java/android/annotation/CallbackExecutor.java
deleted file mode 100644
index 4258f73..0000000
--- a/java/android/annotation/CallbackExecutor.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2017 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.annotation;
-
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import java.util.concurrent.Executor;
-
-/**
- * @paramDoc Callback and listener events are dispatched through this
- * {@link Executor}, providing an easy way to control which thread is
- * used. To dispatch events through the main thread of your
- * application, you can use
- * {@link android.content.Context#getMainExecutor() Context.getMainExecutor()}.
- * To dispatch events through a shared thread pool, you can use
- * {@link android.os.AsyncTask#THREAD_POOL_EXECUTOR AsyncTask#THREAD_POOL_EXECUTOR}.
- * @hide
- */
-@Retention(SOURCE)
-@Target(PARAMETER)
-public @interface CallbackExecutor {
-}
diff --git a/java/android/annotation/CheckResult.java b/java/android/annotation/CheckResult.java
deleted file mode 100644
index 97d031a..0000000
--- a/java/android/annotation/CheckResult.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that the annotated method returns a result that it typically is
- * an error to ignore. This is usually used for methods that have no side effect,
- * so calling it without actually looking at the result usually means the developer
- * has misunderstood what the method does.
- * <p>
- * Example:
- * <pre>{@code
- * public @CheckResult String trim(String s) { return s.trim(); }
- * ...
- * s.trim(); // this is probably an error
- * s = s.trim(); // ok
- * }</pre>
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD})
-public @interface CheckResult {
- /** Defines the name of the suggested method to use instead, if applicable (using
- * the same signature format as javadoc.) If there is more than one possibility,
- * list them all separated by commas.
- * <p>
- * For example, ProcessBuilder has a method named {@code redirectErrorStream()}
- * which sounds like it might redirect the error stream. It does not. It's just
- * a getter which returns whether the process builder will redirect the error stream,
- * and to actually set it, you must call {@code redirectErrorStream(boolean)}.
- * In that case, the method should be defined like this:
- * <pre>
- * &#64;CheckResult(suggest="#redirectErrorStream(boolean)")
- * public boolean redirectErrorStream() { ... }
- * </pre>
- */
- String suggest() default "";
-} \ No newline at end of file
diff --git a/java/android/annotation/ColorInt.java b/java/android/annotation/ColorInt.java
deleted file mode 100644
index 4671b1b..0000000
--- a/java/android/annotation/ColorInt.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that the annotated element represents a packed color
- * int, {@code AARRGGBB}. If applied to an int array, every element
- * in the array represents a color integer.
- * <p>
- * Example:
- * <pre>{@code
- * public abstract void setTextColor(@ColorInt int color);
- * }</pre>
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({PARAMETER,METHOD,LOCAL_VARIABLE,FIELD})
-public @interface ColorInt {
-} \ No newline at end of file
diff --git a/java/android/annotation/ColorLong.java b/java/android/annotation/ColorLong.java
deleted file mode 100644
index 9b19c76..0000000
--- a/java/android/annotation/ColorLong.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2016 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * <p>Denotes that the annotated element represents a packed color
- * long. If applied to a long array, every element in the array
- * represents a color long. For more information on how colors
- * are packed in a long, please refer to the documentation of
- * the {@link android.graphics.Color} class.</p>
- *
- * <p>Example:</p>
- *
- * <pre>{@code
- * public void setFillColor(@ColorLong long color);
- * }</pre>
- *
- * @see android.graphics.Color
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({PARAMETER,METHOD,LOCAL_VARIABLE,FIELD})
-public @interface ColorLong {
-}
diff --git a/java/android/annotation/ColorRes.java b/java/android/annotation/ColorRes.java
deleted file mode 100644
index 061faa0..0000000
--- a/java/android/annotation/ColorRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a color resource reference (e.g. {@link android.R.color#black}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface ColorRes {
-}
diff --git a/java/android/annotation/Condemned.java b/java/android/annotation/Condemned.java
deleted file mode 100644
index 186409b..0000000
--- a/java/android/annotation/Condemned.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * Copyright (C) 2017 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.annotation;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PACKAGE;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * A program element annotated &#64;Condemned is one that programmers are
- * blocked from using, typically because it's about to be completely destroyed.
- * <p>
- * This is a stronger version of &#64;Deprecated, and it's typically used to
- * mark APIs that only existed temporarily in a preview SDK, and which only
- * continue to exist temporarily to support binary compatibility.
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target(value={CONSTRUCTOR, FIELD, LOCAL_VARIABLE, METHOD, PACKAGE, PARAMETER, TYPE})
-public @interface Condemned {
-}
diff --git a/java/android/annotation/CurrentTimeMillisLong.java b/java/android/annotation/CurrentTimeMillisLong.java
deleted file mode 100644
index 355bb5a..0000000
--- a/java/android/annotation/CurrentTimeMillisLong.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2017 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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * @memberDoc Value is a non-negative timestamp measured as the number of
- * milliseconds since 1970-01-01T00:00:00Z.
- * @paramDoc Value is a non-negative timestamp measured as the number of
- * milliseconds since 1970-01-01T00:00:00Z.
- * @returnDoc Value is a non-negative timestamp measured as the number of
- * milliseconds since 1970-01-01T00:00:00Z.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface CurrentTimeMillisLong {
-}
diff --git a/java/android/annotation/CurrentTimeSecondsLong.java b/java/android/annotation/CurrentTimeSecondsLong.java
deleted file mode 100644
index 2b4ffd7..0000000
--- a/java/android/annotation/CurrentTimeSecondsLong.java
+++ /dev/null
@@ -1,39 +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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * @memberDoc Value is a non-negative timestamp measured as the number of
- * seconds since 1970-01-01T00:00:00Z.
- * @paramDoc Value is a non-negative timestamp measured as the number of
- * seconds since 1970-01-01T00:00:00Z.
- * @returnDoc Value is a non-negative timestamp measured as the number of
- * seconds since 1970-01-01T00:00:00Z.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface CurrentTimeSecondsLong {
-}
diff --git a/java/android/annotation/DimenRes.java b/java/android/annotation/DimenRes.java
deleted file mode 100644
index 02ae00c..0000000
--- a/java/android/annotation/DimenRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a dimension resource reference (e.g. {@link android.R.dimen#app_icon_size}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface DimenRes {
-}
diff --git a/java/android/annotation/Dimension.java b/java/android/annotation/Dimension.java
deleted file mode 100644
index 5f705ad..0000000
--- a/java/android/annotation/Dimension.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2016 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that a numeric parameter, field or method return value is expected
- * to represent a dimension.
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD,PARAMETER,FIELD,LOCAL_VARIABLE,ANNOTATION_TYPE})
-public @interface Dimension {
- @Unit
- int unit() default PX;
-
- int DP = 0;
- int PX = 1;
- int SP = 2;
-
- @IntDef({PX, DP, SP})
- @Retention(SOURCE)
- @interface Unit {}
-}
diff --git a/java/android/annotation/Discouraged.java b/java/android/annotation/Discouraged.java
deleted file mode 100644
index d4e4dfc..0000000
--- a/java/android/annotation/Discouraged.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2021 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.annotation;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that the annotated element, while not disallowed or deprecated, is one that
- * programmers are generally discouraged from using.
- * <p>
- * Example:
- * <pre><code>
- * &#64;Discouraged(message = "It is much more efficient to retrieve "
- * + "resources by identifier than by name.")
- * public void getValue(String name) {
- * ...
- * }
- * </code></pre>
- * </p>
- * @hide
- */
-@Retention(SOURCE)
-@Target({CONSTRUCTOR, FIELD, METHOD, PARAMETER, TYPE})
-public @interface Discouraged {
- /**
- * Defines the message to display when an element marked with this annotation is used. An
- * alternative should be provided in the message.
- */
- String message();
-}
-
diff --git a/java/android/annotation/DisplayContext.java b/java/android/annotation/DisplayContext.java
deleted file mode 100644
index c2bfa7d..0000000
--- a/java/android/annotation/DisplayContext.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * Copyright (C) 2020 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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes a {@link android.content.Context} that is tied to a {@link android.view.Display} and can
- * be used to obtain one via {@link android.content.Context#getDisplay}, but <b>may not</b> be able
- * to obtain {@link android.view.WindowManager}, {@link android.view.LayoutInflater} or
- * {@link android.app.WallpaperManager} via
- * {@link android.content.Context#getSystemService(String)}. If the UI services mentioned above are
- * required, please use contexts which are marked as {@link UiContext}.
- * <p>
- * {@link android.app.Activity}, and the result of
- * {@link android.content.Context#createWindowContext(int, android.os.Bundle)} or
- * {@link android.content.Context#createDisplayContext(android.view.Display)} can be used where a
- * {@link DisplayContext} is required.
- * <p>
- * This is a marker annotation and has no specific attributes.
- *
- * @see android.content.Context#getDisplay()
- * @see android.content.Context#getSystemService(String)
- * @see android.content.Context#getSystemService(Class)
- * @see android.content.Context#createDisplayContext(Display)
- * @see android.content.Context#createWindowContext(int, Bundle)
- * @see UiContext
- * @hide
- */
-@Retention(SOURCE)
-@Target({TYPE, METHOD, PARAMETER, FIELD})
-public @interface DisplayContext {
-}
diff --git a/java/android/annotation/DrawableRes.java b/java/android/annotation/DrawableRes.java
deleted file mode 100644
index ebefa1d..0000000
--- a/java/android/annotation/DrawableRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a drawable resource reference (e.g. {@link android.R.attr#alertDialogIcon}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface DrawableRes {
-}
diff --git a/java/android/annotation/DurationMillisLong.java b/java/android/annotation/DurationMillisLong.java
deleted file mode 100644
index ce77532..0000000
--- a/java/android/annotation/DurationMillisLong.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2017 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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * @memberDoc Value is a non-negative duration in milliseconds.
- * @paramDoc Value is a non-negative duration in milliseconds.
- * @returnDoc Value is a non-negative duration in milliseconds.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface DurationMillisLong {
-}
diff --git a/java/android/annotation/ElapsedRealtimeLong.java b/java/android/annotation/ElapsedRealtimeLong.java
deleted file mode 100644
index 9492415..0000000
--- a/java/android/annotation/ElapsedRealtimeLong.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2017 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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * @memberDoc Value is a non-negative timestamp in the
- * {@link android.os.SystemClock#elapsedRealtime()} time base.
- * @paramDoc Value is a non-negative timestamp in the
- * {@link android.os.SystemClock#elapsedRealtime()} time base.
- * @returnDoc Value is a non-negative timestamp in the
- * {@link android.os.SystemClock#elapsedRealtime()} time base.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface ElapsedRealtimeLong {
-}
diff --git a/java/android/annotation/FloatRange.java b/java/android/annotation/FloatRange.java
deleted file mode 100644
index 05b5168..0000000
--- a/java/android/annotation/FloatRange.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that the annotated element should be a float or double in the given range
- * <p>
- * Example:
- * <pre><code>
- * &#64;FloatRange(from=0.0,to=1.0)
- * public float getAlpha() {
- * ...
- * }
- * </code></pre>
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD,PARAMETER,FIELD,LOCAL_VARIABLE})
-public @interface FloatRange {
- /** Smallest value. Whether it is inclusive or not is determined
- * by {@link #fromInclusive} */
- double from() default Double.NEGATIVE_INFINITY;
- /** Largest value. Whether it is inclusive or not is determined
- * by {@link #toInclusive} */
- double to() default Double.POSITIVE_INFINITY;
-
- /** Whether the from value is included in the range */
- boolean fromInclusive() default true;
-
- /** Whether the to value is included in the range */
- boolean toInclusive() default true;
-} \ No newline at end of file
diff --git a/java/android/annotation/FontRes.java b/java/android/annotation/FontRes.java
deleted file mode 100644
index dbacb58..0000000
--- a/java/android/annotation/FontRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2017 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a Font resource reference (e.g. R.font.myfont).
- *
- * @hide
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface FontRes {
-}
diff --git a/java/android/annotation/FractionRes.java b/java/android/annotation/FractionRes.java
deleted file mode 100644
index fd84d3e..0000000
--- a/java/android/annotation/FractionRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a fraction resource reference.
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface FractionRes {
-}
diff --git a/java/android/annotation/HalfFloat.java b/java/android/annotation/HalfFloat.java
deleted file mode 100644
index 256008c..0000000
--- a/java/android/annotation/HalfFloat.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2016 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * <p>Denotes that the annotated element represents a half-precision floating point
- * value. Such values are stored in short data types and can be manipulated with
- * the {@link android.util.Half} class. If applied to an array of short, every
- * element in the array represents a half-precision float.</p>
- *
- * <p>Example:</p>
- *
- * <pre>{@code
- * public abstract void setPosition(@HalfFloat short x, @HalfFloat short y, @HalfFloat short z);
- * }</pre>
- *
- * @see android.util.Half
- * @see android.util.Half#toHalf(float)
- * @see android.util.Half#toFloat(short)
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({PARAMETER, METHOD, LOCAL_VARIABLE, FIELD})
-public @interface HalfFloat {
-}
diff --git a/java/android/annotation/Hide.java b/java/android/annotation/Hide.java
deleted file mode 100644
index c8e5a4a..0000000
--- a/java/android/annotation/Hide.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.annotation;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PACKAGE;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Indicates that an API is hidden by default, in a similar fashion to the
- * <pre>@hide</pre> javadoc tag.
- *
- * <p>Note that, in order for this to work, metalava has to be invoked with
- * the flag {@code --hide-annotation android.annotation.Hide}.
- * @hide
- */
-@Target({TYPE, FIELD, METHOD, CONSTRUCTOR, ANNOTATION_TYPE, PACKAGE})
-@Retention(RetentionPolicy.CLASS)
-public @interface Hide {
-}
diff --git a/java/android/annotation/IdRes.java b/java/android/annotation/IdRes.java
deleted file mode 100644
index b286965..0000000
--- a/java/android/annotation/IdRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be an id resource reference (e.g. {@link android.R.id#copy}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface IdRes {
-}
diff --git a/java/android/annotation/IntDef.java b/java/android/annotation/IntDef.java
deleted file mode 100644
index f84a676..0000000
--- a/java/android/annotation/IntDef.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that the annotated element of integer type, represents
- * a logical type and that its value should be one of the explicitly
- * named constants. If the {@link #flag()} attribute is set to true,
- * multiple constants can be combined.
- * <p>
- * <pre><code>
- * &#64;Retention(SOURCE)
- * &#64;IntDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})
- * public @interface NavigationMode {}
- * public static final int NAVIGATION_MODE_STANDARD = 0;
- * public static final int NAVIGATION_MODE_LIST = 1;
- * public static final int NAVIGATION_MODE_TABS = 2;
- * ...
- * public abstract void setNavigationMode(@NavigationMode int mode);
- * &#64;NavigationMode
- * public abstract int getNavigationMode();
- * </code></pre>
- * For a flag, set the flag attribute:
- * <pre><code>
- * &#64;IntDef(
- * flag = true,
- * value = {NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})
- * </code></pre>
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({ANNOTATION_TYPE})
-public @interface IntDef {
- /** Defines the constant prefix for this element */
- String[] prefix() default {};
- /** Defines the constant suffix for this element */
- String[] suffix() default {};
-
- /** Defines the allowed constants for this element */
- int[] value() default {};
-
- /** Defines whether the constants can be used as a flag, or just as an enum (the default) */
- boolean flag() default false;
-}
diff --git a/java/android/annotation/IntRange.java b/java/android/annotation/IntRange.java
deleted file mode 100644
index c043e2d..0000000
--- a/java/android/annotation/IntRange.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that the annotated element should be an int or long in the given range
- * <p>
- * Example:
- * <pre><code>
- * &#64;IntRange(from=0,to=255)
- * public int getAlpha() {
- * ...
- * }
- * </code></pre>
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD,PARAMETER,FIELD,LOCAL_VARIABLE,ANNOTATION_TYPE})
-public @interface IntRange {
- /** Smallest value, inclusive */
- long from() default Long.MIN_VALUE;
- /** Largest value, inclusive */
- long to() default Long.MAX_VALUE;
-} \ No newline at end of file
diff --git a/java/android/annotation/IntegerRes.java b/java/android/annotation/IntegerRes.java
deleted file mode 100644
index 5313f4a..0000000
--- a/java/android/annotation/IntegerRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be an integer resource reference (e.g. {@link android.R.integer#config_shortAnimTime}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface IntegerRes {
-}
diff --git a/java/android/annotation/InterpolatorRes.java b/java/android/annotation/InterpolatorRes.java
deleted file mode 100644
index 8877a5f..0000000
--- a/java/android/annotation/InterpolatorRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be an interpolator resource reference (e.g. {@link android.R.interpolator#cycle}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface InterpolatorRes {
-}
diff --git a/java/android/annotation/LayoutRes.java b/java/android/annotation/LayoutRes.java
deleted file mode 100644
index 15ba86f..0000000
--- a/java/android/annotation/LayoutRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a layout resource reference (e.g. {@link android.R.layout#list_content}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface LayoutRes {
-}
diff --git a/java/android/annotation/LongDef.java b/java/android/annotation/LongDef.java
deleted file mode 100644
index 8723eef..0000000
--- a/java/android/annotation/LongDef.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2017 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that the annotated long element represents
- * a logical type and that its value should be one of the explicitly
- * named constants. If the {@link #flag()} attribute is set to true,
- * multiple constants can be combined.
- * <p>
- * <pre><code>
- * &#64;Retention(SOURCE)
- * &#64;LongDef({NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})
- * public @interface NavigationMode {}
- * public static final long NAVIGATION_MODE_STANDARD = 0;
- * public static final long NAVIGATION_MODE_LIST = 1;
- * public static final long NAVIGATION_MODE_TABS = 2;
- * ...
- * public abstract void setNavigationMode(@NavigationMode long mode);
- * &#64;NavigationMode
- * public abstract long getNavigationMode();
- * </code></pre>
- * For a flag, set the flag attribute:
- * <pre><code>
- * &#64;LongDef(
- * flag = true,
- * value = {NAVIGATION_MODE_STANDARD, NAVIGATION_MODE_LIST, NAVIGATION_MODE_TABS})
- * </code></pre>
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({ANNOTATION_TYPE})
-public @interface LongDef {
- /** Defines the constant prefix for this element */
- String[] prefix() default "";
-
- /** Defines the allowed constants for this element */
- long[] value() default {};
-
- /** Defines whether the constants can be used as a flag, or just as an enum (the default) */
- boolean flag() default false;
-}
diff --git a/java/android/annotation/MainThread.java b/java/android/annotation/MainThread.java
deleted file mode 100644
index a070246..0000000
--- a/java/android/annotation/MainThread.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that the annotated method should only be called on the main thread.
- * If the annotated element is a class, then all methods in the class should be
- * called on the main thread.
- * <p>
- * Example:
- *
- * <pre>
- * <code>
- * &#64;MainThread
- * public void deliverResult(D data) { ... }
- * </code>
- * </pre>
- *
- * @memberDoc This method must be called from the main thread of your app.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD,CONSTRUCTOR,TYPE,PARAMETER})
-public @interface MainThread {
-}
diff --git a/java/android/annotation/MenuRes.java b/java/android/annotation/MenuRes.java
deleted file mode 100644
index b6dcc46..0000000
--- a/java/android/annotation/MenuRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a menu resource reference.
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface MenuRes {
-}
diff --git a/java/android/annotation/NavigationRes.java b/java/android/annotation/NavigationRes.java
deleted file mode 100644
index 3af5ecf..0000000
--- a/java/android/annotation/NavigationRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2017 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a navigation resource reference (e.g. {@code R.navigation.flow}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface NavigationRes {
-}
diff --git a/java/android/annotation/NonNull.java b/java/android/annotation/NonNull.java
deleted file mode 100644
index 20472ba..0000000
--- a/java/android/annotation/NonNull.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that a parameter, field or method return value can never be null.
- * <p>
- * This is a marker annotation and it has no specific attributes.
- *
- * @paramDoc This value cannot be {@code null}.
- * @returnDoc This value cannot be {@code null}.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface NonNull {
-}
diff --git a/java/android/annotation/NonUiContext.java b/java/android/annotation/NonUiContext.java
deleted file mode 100644
index 5d26850..0000000
--- a/java/android/annotation/NonUiContext.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2020 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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes a {@link android.content.Context} that <b>can not</b> be used to obtain a
- * {@link android.view.Display} via {@link android.content.Context#getDisplay} nor to obtain a
- * {@link android.view.WindowManager}, {@link android.view.LayoutInflater} or
- * {@link android.app.WallpaperManager} via
- * {@link android.content.Context#getSystemService(String)}.
- * <p>
- * This is a marker annotation and has no specific attributes.
- *
- * @see android.content.Context#getDisplay()
- * @see android.content.Context#getSystemService(String)
- * @see android.content.Context#getSystemService(Class)
- * @hide
- */
-@Retention(SOURCE)
-@Target({TYPE, METHOD, PARAMETER, FIELD})
-public @interface NonUiContext {
-}
diff --git a/java/android/annotation/Nullable.java b/java/android/annotation/Nullable.java
deleted file mode 100644
index b8473e7..0000000
--- a/java/android/annotation/Nullable.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that a parameter, field or method return value can be null.
- * <p>
- * When decorating a method call parameter, this denotes that the parameter can
- * legitimately be null and the method will gracefully deal with it. Typically
- * used on optional parameters.
- * <p>
- * When decorating a method, this denotes the method might legitimately return
- * null.
- * <p>
- * This is a marker annotation and it has no specific attributes.
- *
- * @paramDoc This value may be {@code null}.
- * @returnDoc This value may be {@code null}.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface Nullable {
-}
diff --git a/java/android/annotation/OWNERS b/java/android/annotation/OWNERS
deleted file mode 100644
index 853c090..0000000
--- a/java/android/annotation/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-tnorbye@google.com
-aurimas@google.com
diff --git a/java/android/annotation/PluralsRes.java b/java/android/annotation/PluralsRes.java
deleted file mode 100644
index 31ac729..0000000
--- a/java/android/annotation/PluralsRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a plurals resource reference.
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface PluralsRes {
-}
diff --git a/java/android/annotation/Px.java b/java/android/annotation/Px.java
deleted file mode 100644
index cec7f80..0000000
--- a/java/android/annotation/Px.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2016 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that a numeric parameter, field or method return value is expected
- * to represent a pixel dimension.
- *
- * @memberDoc This units of this value are pixels.
- * @paramDoc This units of this value are pixels.
- * @returnDoc This units of this value are pixels.
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD, LOCAL_VARIABLE})
-@Dimension(unit = Dimension.PX)
-public @interface Px {
-}
diff --git a/java/android/annotation/RawRes.java b/java/android/annotation/RawRes.java
deleted file mode 100644
index 39970b3..0000000
--- a/java/android/annotation/RawRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a raw resource reference.
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface RawRes {
-}
diff --git a/java/android/annotation/RequiresFeature.java b/java/android/annotation/RequiresFeature.java
deleted file mode 100644
index 9236700..0000000
--- a/java/android/annotation/RequiresFeature.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2018 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.annotation;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that the annotated element requires one or more device features. This
- * is used to auto-generate documentation.
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({TYPE,FIELD,METHOD,CONSTRUCTOR})
-public @interface RequiresFeature {
- /**
- * The name of the device feature that is required.
- */
- String value();
-
- /**
- * Defines the name of the method that should be called to check whether the feature is
- * available, using the same signature format as javadoc. The feature checking method can have
- * multiple parameters, but the feature name parameter must be of type String and must also be
- * the first String-type parameter.
- * <p>
- * By default, the enforcement is
- * {@link android.content.pm.PackageManager#hasSystemFeature(String)}.
- */
- String enforcement() default("android.content.pm.PackageManager#hasSystemFeature");
-}
diff --git a/java/android/annotation/RequiresNoPermission.java b/java/android/annotation/RequiresNoPermission.java
deleted file mode 100644
index cdbf36e..0000000
--- a/java/android/annotation/RequiresNoPermission.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2021 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.annotation;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.CLASS;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that the annotated element requires no permissions.
- * <p>
- * This explicit annotation helps distinguish which of three states that an
- * element may exist in:
- * <ul>
- * <li>Annotated with {@link RequiresPermission}, indicating that an element
- * requires (or may require) one or more permissions.
- * <li>Annotated with {@link RequiresNoPermission}, indicating that an element
- * requires no permissions.
- * <li>Neither annotation, indicating that no explicit declaration about
- * permissions has been made for that element.
- * </ul>
- *
- * @see RequiresPermission
- * @hide
- */
-@Retention(CLASS)
-@Target({ANNOTATION_TYPE,METHOD,CONSTRUCTOR,FIELD,PARAMETER})
-public @interface RequiresNoPermission {
-}
diff --git a/java/android/annotation/RequiresPermission.java b/java/android/annotation/RequiresPermission.java
deleted file mode 100644
index 0379d30..0000000
--- a/java/android/annotation/RequiresPermission.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.CLASS;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that the annotated element requires (or may require) one or more permissions.
- * <p/>
- * Example of requiring a single permission:
- * <pre>{@code
- * {@literal @}RequiresPermission(Manifest.permission.SET_WALLPAPER)
- * public abstract void setWallpaper(Bitmap bitmap) throws IOException;
- *
- * {@literal @}RequiresPermission(ACCESS_COARSE_LOCATION)
- * public abstract Location getLastKnownLocation(String provider);
- * }</pre>
- * Example of requiring at least one permission from a set:
- * <pre>{@code
- * {@literal @}RequiresPermission(anyOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
- * public abstract Location getLastKnownLocation(String provider);
- * }</pre>
- * Example of requiring multiple permissions:
- * <pre>{@code
- * {@literal @}RequiresPermission(allOf = {ACCESS_COARSE_LOCATION, ACCESS_FINE_LOCATION})
- * public abstract Location getLastKnownLocation(String provider);
- * }</pre>
- * Example of requiring separate read and write permissions for a content provider:
- * <pre>{@code
- * {@literal @}RequiresPermission.Read(@RequiresPermission(READ_HISTORY_BOOKMARKS))
- * {@literal @}RequiresPermission.Write(@RequiresPermission(WRITE_HISTORY_BOOKMARKS))
- * public static final Uri BOOKMARKS_URI = Uri.parse("content://browser/bookmarks");
- * }</pre>
- * <p>
- * When specified on a parameter, the annotation indicates that the method requires
- * a permission which depends on the value of the parameter. For example, consider
- * {@link android.app.Activity#startActivity(android.content.Intent)
- * Activity#startActivity(Intent)}:
- * <pre>{@code
- * public void startActivity(@RequiresPermission Intent intent) { ... }
- * }</pre>
- * Notice how there are no actual permission names listed in the annotation. The actual
- * permissions required will depend on the particular intent passed in. For example,
- * the code may look like this:
- * <pre>{@code
- * Intent intent = new Intent(Intent.ACTION_CALL);
- * startActivity(intent);
- * }</pre>
- * and the actual permission requirement for this particular intent is described on
- * the Intent name itself:
- * <pre>{@code
- * {@literal @}RequiresPermission(Manifest.permission.CALL_PHONE)
- * public static final String ACTION_CALL = "android.intent.action.CALL";
- * }</pre>
- *
- * @see RequiresNoPermission
- * @hide
- */
-@Retention(CLASS)
-@Target({ANNOTATION_TYPE,METHOD,CONSTRUCTOR,FIELD,PARAMETER})
-public @interface RequiresPermission {
- /**
- * The name of the permission that is required, if precisely one permission
- * is required. If more than one permission is required, specify either
- * {@link #allOf()} or {@link #anyOf()} instead.
- * <p>
- * If specified, {@link #anyOf()} and {@link #allOf()} must both be null.
- */
- String value() default "";
-
- /**
- * Specifies a list of permission names that are all required.
- * <p>
- * If specified, {@link #anyOf()} and {@link #value()} must both be null.
- */
- String[] allOf() default {};
-
- /**
- * Specifies a list of permission names where at least one is required
- * <p>
- * If specified, {@link #allOf()} and {@link #value()} must both be null.
- */
- String[] anyOf() default {};
-
- /**
- * If true, the permission may not be required in all cases (e.g. it may only be
- * enforced on certain platforms, or for certain call parameters, etc.
- */
- boolean conditional() default false;
-
- /**
- * Specifies that the given permission is required for read operations.
- * <p>
- * When specified on a parameter, the annotation indicates that the method requires
- * a permission which depends on the value of the parameter (and typically
- * the corresponding field passed in will be one of a set of constants which have
- * been annotated with a <code>@RequiresPermission</code> annotation.)
- */
- @Target({FIELD, METHOD, PARAMETER})
- @interface Read {
- RequiresPermission value() default @RequiresPermission;
- }
-
- /**
- * Specifies that the given permission is required for write operations.
- * <p>
- * When specified on a parameter, the annotation indicates that the method requires
- * a permission which depends on the value of the parameter (and typically
- * the corresponding field passed in will be one of a set of constants which have
- * been annotated with a <code>@RequiresPermission</code> annotation.)
- */
- @Target({FIELD, METHOD, PARAMETER})
- @interface Write {
- RequiresPermission value() default @RequiresPermission;
- }
-}
diff --git a/java/android/annotation/SdkConstant.java b/java/android/annotation/SdkConstant.java
deleted file mode 100644
index 0a53186..0000000
--- a/java/android/annotation/SdkConstant.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2008 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.annotation;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Indicates a constant field value should be exported to be used in the SDK tools.
- * @hide
- */
-@Target({ ElementType.FIELD })
-@Retention(RetentionPolicy.SOURCE)
-public @interface SdkConstant {
- public static enum SdkConstantType {
- ACTIVITY_INTENT_ACTION, BROADCAST_INTENT_ACTION, SERVICE_ACTION, INTENT_CATEGORY, FEATURE;
- }
-
- SdkConstantType value();
-}
diff --git a/java/android/annotation/Size.java b/java/android/annotation/Size.java
deleted file mode 100644
index 7c3e70f..0000000
--- a/java/android/annotation/Size.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that the annotated element should have a given size or length.
- * Note that "-1" means "unset". Typically used with a parameter or
- * return value of type array or collection.
- * <p>
- * Example:
- * <pre>{@code
- * public void getLocationInWindow(@Size(2) int[] location) {
- * ...
- * }
- * }</pre>
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({PARAMETER,LOCAL_VARIABLE,METHOD,FIELD})
-public @interface Size {
- /** An exact size (or -1 if not specified) */
- long value() default -1;
- /** A minimum size, inclusive */
- long min() default Long.MIN_VALUE;
- /** A maximum size, inclusive */
- long max() default Long.MAX_VALUE;
- /** The size must be a multiple of this factor */
- long multiple() default 1;
-} \ No newline at end of file
diff --git a/java/android/annotation/StringDef.java b/java/android/annotation/StringDef.java
deleted file mode 100644
index a37535b..0000000
--- a/java/android/annotation/StringDef.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that the annotated String element, represents a logical
- * type and that its value should be one of the explicitly named constants.
- * <p>
- * Example:
- * <pre><code>
- * &#64;Retention(SOURCE)
- * &#64;StringDef({
- * POWER_SERVICE,
- * WINDOW_SERVICE,
- * LAYOUT_INFLATER_SERVICE
- * })
- * public @interface ServiceName {}
- * public static final String POWER_SERVICE = "power";
- * public static final String WINDOW_SERVICE = "window";
- * public static final String LAYOUT_INFLATER_SERVICE = "layout_inflater";
- * ...
- * public abstract Object getSystemService(@ServiceName String name);
- * </code></pre>
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({ANNOTATION_TYPE})
-public @interface StringDef {
- /** Defines the constant prefix for this element */
- String[] prefix() default {};
- /** Defines the constant suffix for this element */
- String[] suffix() default {};
-
- /** Defines the allowed constants for this element */
- String[] value() default {};
-}
diff --git a/java/android/annotation/StringRes.java b/java/android/annotation/StringRes.java
deleted file mode 100644
index 190b68a..0000000
--- a/java/android/annotation/StringRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a String resource reference (e.g. {@link android.R.string#ok}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface StringRes {
-}
diff --git a/java/android/annotation/StyleRes.java b/java/android/annotation/StyleRes.java
deleted file mode 100644
index 4453b8d..0000000
--- a/java/android/annotation/StyleRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that a integer parameter, field or method return value is expected
- * to be a style resource reference (e.g. {@link android.R.style#TextAppearance}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface StyleRes {
-}
diff --git a/java/android/annotation/StyleableRes.java b/java/android/annotation/StyleableRes.java
deleted file mode 100644
index 3c1895e..0000000
--- a/java/android/annotation/StyleableRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that a integer parameter, field or method return value is expected
- * to be a styleable resource reference (e.g. {@link android.R.styleable#TextView_text}).
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface StyleableRes {
-}
diff --git a/java/android/annotation/SuppressAutoDoc.java b/java/android/annotation/SuppressAutoDoc.java
deleted file mode 100644
index e34e03b..0000000
--- a/java/android/annotation/SuppressAutoDoc.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2017 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.annotation;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.LOCAL_VARIABLE;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that any automatically generated documentation should be suppressed
- * for the annotated method, parameter, or field.
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({TYPE, FIELD, METHOD, PARAMETER, CONSTRUCTOR, LOCAL_VARIABLE})
-public @interface SuppressAutoDoc {
-}
diff --git a/java/android/annotation/SystemApi.java b/java/android/annotation/SystemApi.java
deleted file mode 100644
index a468439..0000000
--- a/java/android/annotation/SystemApi.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright (C) 2014 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.annotation;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PACKAGE;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Indicates an API is exposed for use by bundled system applications.
- * <p>
- * These APIs are not guaranteed to remain consistent release-to-release,
- * and are not for use by apps linking against the Android SDK.
- * </p><p>
- * This annotation should only appear on API that is already marked <pre>@hide</pre>.
- * </p>
- *
- * @hide
- */
-@Target({TYPE, FIELD, METHOD, CONSTRUCTOR, ANNOTATION_TYPE, PACKAGE})
-@Retention(RetentionPolicy.RUNTIME)
-public @interface SystemApi {
- enum Client {
- /**
- * Specifies that the intended clients of a SystemApi are privileged apps.
- * This is the default value for {@link #client}.
- */
- PRIVILEGED_APPS,
-
- /**
- * Specifies that the intended clients of a SystemApi are used by classes in
- * <pre>BOOTCLASSPATH</pre> in mainline modules. Mainline modules can also expose
- * this type of system APIs too when they're used only by the non-updatable
- * platform code.
- */
- MODULE_LIBRARIES,
-
- /**
- * Specifies that the system API is available only in the system server process.
- * Use this to expose APIs from code loaded by the system server process <em>but</em>
- * not in <pre>BOOTCLASSPATH</pre>.
- */
- SYSTEM_SERVER
- }
-
- /**
- * The intended client of this SystemAPI.
- */
- Client client() default android.annotation.SystemApi.Client.PRIVILEGED_APPS;
-
- /**
- * Container for {@link SystemApi} that allows it to be applied repeatedly to types.
- */
- @Retention(RetentionPolicy.RUNTIME)
- @Target(TYPE)
- @interface Container {
- SystemApi[] value();
- }
-}
diff --git a/java/android/annotation/SystemService.java b/java/android/annotation/SystemService.java
deleted file mode 100644
index c05c1ba..0000000
--- a/java/android/annotation/SystemService.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2017 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.annotation;
-
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Description of a system service available through
- * {@link android.content.Context#getSystemService(Class)}. This is used to auto-generate
- * documentation explaining how to obtain a reference to the service.
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target(TYPE)
-public @interface SystemService {
- /**
- * The string name of the system service that can be passed to
- * {@link android.content.Context#getSystemService(String)}.
- *
- * @see android.content.Context#getSystemServiceName(Class)
- */
- String value();
-}
diff --git a/java/android/annotation/TestApi.java b/java/android/annotation/TestApi.java
deleted file mode 100644
index 0e9ed37..0000000
--- a/java/android/annotation/TestApi.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import static java.lang.annotation.ElementType.ANNOTATION_TYPE;
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PACKAGE;
-import static java.lang.annotation.ElementType.TYPE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Indicates an API is exposed for use by CTS.
- * <p>
- * These APIs are not guaranteed to remain consistent release-to-release,
- * and are not for use by apps linking against the Android SDK.
- * </p>
- *
- * @hide
- */
-@Target({TYPE, FIELD, METHOD, CONSTRUCTOR, ANNOTATION_TYPE, PACKAGE})
-@Retention(RetentionPolicy.SOURCE)
-public @interface TestApi {
-}
diff --git a/java/android/annotation/TransitionRes.java b/java/android/annotation/TransitionRes.java
deleted file mode 100644
index 06bac74..0000000
--- a/java/android/annotation/TransitionRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be a transition resource reference.
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface TransitionRes {
-}
diff --git a/java/android/annotation/UiContext.java b/java/android/annotation/UiContext.java
deleted file mode 100644
index 1bfec1d..0000000
--- a/java/android/annotation/UiContext.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright (C) 2020 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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes a {@link android.content.Context} that can be used to create UI, meaning that it can
- * provide a {@link android.view.Display} via {@link android.content.Context#getDisplay} and can be
- * used to obtain a {@link android.view.WindowManager}, {@link android.view.LayoutInflater} or
- * {@link android.app.WallpaperManager} via
- * {@link android.content.Context#getSystemService(String)}. A {@link android.content.Context}
- * which is marked as {@link UiContext} implies that the {@link android.content.Context} is also a
- * {@link android.view.DisplayContext}.
- * <p>
- * This kind of {@link android.content.Context} is usually an {@link android.app.Activity} or
- * created via {@link android.content.Context#createWindowContext(int, android.os.Bundle)}.
- * </p>
- * This is a marker annotation and has no specific attributes.
- *
- * @see android.content.Context#getDisplay()
- * @see android.content.Context#getSystemService(String)
- * @see android.content.Context#getSystemService(Class)
- * @see android.content.Context#createWindowContext(int, android.os.Bundle)
- * @see DisplayContext
- * @hide
- */
-@Retention(SOURCE)
-@Target({TYPE, METHOD, PARAMETER, FIELD})
-public @interface UiContext {
-}
diff --git a/java/android/annotation/UiThread.java b/java/android/annotation/UiThread.java
deleted file mode 100644
index 3f51254..0000000
--- a/java/android/annotation/UiThread.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that the annotated method or constructor should only be called on the
- * UI thread. If the annotated element is a class, then all methods in the class
- * should be called on the UI thread.
- * <p>
- * Example:
- *
- * <pre>
- * <code>
- * &#64;UiThread
- * public abstract void setText(@NonNull String text) { ... }
- * </code>
- * </pre>
- *
- * @memberDoc This method must be called on the thread that originally created
- * this UI element. This is typically the
- * {@linkplain android.os.Looper#getMainLooper() main thread} of your app.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD,CONSTRUCTOR,TYPE,PARAMETER})
-public @interface UiThread {
-}
diff --git a/java/android/annotation/UptimeMillisLong.java b/java/android/annotation/UptimeMillisLong.java
deleted file mode 100644
index e7a764b..0000000
--- a/java/android/annotation/UptimeMillisLong.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2020 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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * @memberDoc Value is a non-negative timestamp in the
- * {@link android.os.SystemClock#uptimeMillis()} time base.
- * @paramDoc Value is a non-negative timestamp in the
- * {@link android.os.SystemClock#uptimeMillis()} time base.
- * @returnDoc Value is a non-negative timestamp in the
- * {@link android.os.SystemClock#uptimeMillis()} time base.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface UptimeMillisLong {
-}
diff --git a/java/android/annotation/UserHandleAware.java b/java/android/annotation/UserHandleAware.java
deleted file mode 100644
index 60dcbd8..0000000
--- a/java/android/annotation/UserHandleAware.java
+++ /dev/null
@@ -1,96 +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.annotation;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PACKAGE;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Indicates an API that uses {@code context.getUser} or {@code context.getUserId}
- * to operate across users (as the user associated with the context)
- * <p>
- * To create a {@link android.content.Context} associated with a different user,
- * use {@link android.content.Context#createContextAsUser} or
- * {@link android.content.Context#createPackageContextAsUser}
- * <p>
- * Example:
- * <pre>{@code
- * {@literal @}UserHandleAware
- * public abstract PackageInfo getPackageInfo({@literal @}NonNull String packageName,
- * {@literal @}PackageInfoFlags int flags) throws NameNotFoundException;
- * }</pre>
- *
- * @memberDoc This method uses {@linkplain android.content.Context#getUser}
- * or {@linkplain android.content.Context#getUserId} to execute across users.
- * @hide
- */
-@Retention(SOURCE)
-@Target({TYPE, METHOD, CONSTRUCTOR, PACKAGE})
-public @interface UserHandleAware {
-
- /**
- * Specifies the SDK version at which this method became {@literal @}UserHandleAware,
- * if it was not always so.
- *
- * Prior to this level, the method is not considered {@literal @}UserHandleAware and therefore
- * uses the {@link android.os#myUserHandle() calling user},
- * not the {@link android.content.Context#getUser context user}.
- *
- * Note that when an API marked with this parameter is run on a device whose OS predates the
- * stated version, the calling user will be used, since on such a
- * device, the API is not {@literal @}UserHandleAware yet.
- */
- int enabledSinceTargetSdkVersion() default 0;
-
- /**
- * Specifies the permission name required
- * if the context user differs from the calling user.
- *
- * This requirement is in addition to any specified by
- * {@link android.annotation.RequiresPermission}.
- *
- * @see android.annotation.RequiresPermission#value()
- */
- String requiresPermissionIfNotCaller() default "";
-
- /**
- * Specifies a list of permission names where at least one is required
- * if the context user differs from the calling user.
- *
- * This requirement is in addition to any specified by
- * {@link android.annotation.RequiresPermission}.
- *
- * @see android.annotation.RequiresPermission#anyOf()
- */
- String[] requiresAnyOfPermissionsIfNotCaller() default {};
-
- /**
- * Specifies a list of permission names where at least one is required if the context
- * user is not in the same profile group as the calling user.
- *
- * This requirement is in addition to any specified by
- * {@link android.annotation.RequiresPermission}.
- *
- * @see android.annotation.RequiresPermission#anyOf()
- */
- String[] requiresAnyOfPermissionsIfNotCallerProfileGroup() default {};
-}
diff --git a/java/android/annotation/UserIdInt.java b/java/android/annotation/UserIdInt.java
deleted file mode 100644
index 7b9ce25..0000000
--- a/java/android/annotation/UserIdInt.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (C) 2016 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.annotation;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-/**
- * Denotes that the annotated element is a multi-user user ID. This is
- * <em>not</em> the same as a UID.
- *
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface UserIdInt {
-}
diff --git a/java/android/annotation/Widget.java b/java/android/annotation/Widget.java
deleted file mode 100644
index 6756cd7..0000000
--- a/java/android/annotation/Widget.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2008 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.annotation;
-
-import java.lang.annotation.Target;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Indicates a class is a widget usable by application developers to create UI.
- * <p>
- * This must be used in cases where:
- * <ul>
- * <li>The widget is not in the package <code>android.widget</code></li>
- * <li>The widget extends <code>android.view.ViewGroup</code></li>
- * </ul>
- * @hide
- */
-@Target({ ElementType.TYPE })
-@Retention(RetentionPolicy.SOURCE)
-public @interface Widget {
-}
diff --git a/java/android/annotation/WorkerThread.java b/java/android/annotation/WorkerThread.java
deleted file mode 100644
index 8c2a4d3..0000000
--- a/java/android/annotation/WorkerThread.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2015 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.annotation;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.CONSTRUCTOR;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that the annotated method should only be called on a worker thread.
- * If the annotated element is a class, then all methods in the class should be
- * called on a worker thread.
- * <p>
- * Example:
- *
- * <pre>
- * <code>
- * &#64;WorkerThread
- * protected abstract FilterResults performFiltering(CharSequence constraint);
- * </code>
- * </pre>
- *
- * @memberDoc This method may take several seconds to complete, so it should
- * only be called from a worker thread.
- * @hide
- */
-@Retention(SOURCE)
-@Target({METHOD,CONSTRUCTOR,TYPE,PARAMETER})
-public @interface WorkerThread {
-}
diff --git a/java/android/annotation/XmlRes.java b/java/android/annotation/XmlRes.java
deleted file mode 100644
index 5fb8a4a..0000000
--- a/java/android/annotation/XmlRes.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2013 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.annotation;
-
-import java.lang.annotation.Documented;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.PARAMETER;
-import static java.lang.annotation.RetentionPolicy.SOURCE;
-
-/**
- * Denotes that an integer parameter, field or method return value is expected
- * to be an XML resource reference.
- *
- * {@hide}
- */
-@Documented
-@Retention(SOURCE)
-@Target({METHOD, PARAMETER, FIELD})
-public @interface XmlRes {
-}
diff --git a/java/com/android/internal/annotations/CompositeRWLock.java b/java/com/android/internal/annotations/CompositeRWLock.java
deleted file mode 100644
index b6ddfc4..0000000
--- a/java/com/android/internal/annotations/CompositeRWLock.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2021 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 com.android.internal.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Specifies a list of locks which are required for read/write operations on a data field.
- *
- * <p>
- * To annotate methods accessing the data field with the annotation {@link CompositeRWLock},
- * use {@link GuardedBy#value} to annotate method w/ write and/or read access to the data field,
- * use {@link GuardedBy#anyOf} to annotate method w/ read only access to the data field.
- * </p>
- *
- * <p>
- * When its {@link #value()} consists of multiple locks:
- * <ul>
- * <li>To write to the protected data, acquire <b>all</b> of the locks
- * in the order of the appearance in the {@link #value}.</li>
- * <li>To read from the protected data, acquire any of the locks in the {@link #value}.</li>
- * </ul>
- * </p>
- */
-@Target({FIELD})
-@Retention(RetentionPolicy.CLASS)
-public @interface CompositeRWLock {
- String[] value() default {};
-}
diff --git a/java/com/android/internal/annotations/GuardedBy.java b/java/com/android/internal/annotations/GuardedBy.java
deleted file mode 100644
index c05c4ab..0000000
--- a/java/com/android/internal/annotations/GuardedBy.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2012 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 com.android.internal.annotations;
-
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.METHOD;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation type used to mark a method or field that can only be accessed when
- * holding the referenced locks.
- */
-@Target({FIELD, METHOD})
-@Retention(RetentionPolicy.CLASS)
-public @interface GuardedBy {
- /**
- * Specifies a list of locks to be held in order to access the field/method
- * annotated with this; when used in conjunction with the {@link CompositeRWLock}, locks
- * should be acquired in the order of the appearance in the {@link #value} here.
- *
- * <p>
- * If specified, {@link #anyOf()} must be null.
- * </p>
- *
- * @see CompositeRWLock
- */
- String[] value() default {};
-
- /**
- * Specifies a list of locks where at least one of them must be held in order to access
- * the field/method annotated with this; it should be <em>only</em> used in the conjunction
- * with the {@link CompositeRWLock}.
- *
- * <p>
- * If specified, {@link #allOf()} must be null.
- * </p>
- *
- * @see CompositeRWLock
- */
- String[] anyOf() default {};
-}
diff --git a/java/com/android/internal/annotations/Immutable.java b/java/com/android/internal/annotations/Immutable.java
deleted file mode 100644
index b424275..0000000
--- a/java/com/android/internal/annotations/Immutable.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (C) 2012 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 com.android.internal.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Annotation type used to mark a class which is immutable.
- */
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface Immutable {
-}
diff --git a/java/com/android/internal/annotations/VisibleForNative.java b/java/com/android/internal/annotations/VisibleForNative.java
deleted file mode 100644
index e6a3fc6..0000000
--- a/java/com/android/internal/annotations/VisibleForNative.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2018 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 com.android.internal.annotations;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Denotes that the class, method or field has its visibility relaxed so
- * that native code can access it.
- */
-@Retention(RetentionPolicy.CLASS)
-public @interface VisibleForNative {
-}
diff --git a/java/com/android/internal/annotations/VisibleForTesting.java b/java/com/android/internal/annotations/VisibleForTesting.java
deleted file mode 100644
index 99512ac..0000000
--- a/java/com/android/internal/annotations/VisibleForTesting.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2012 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 com.android.internal.annotations;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Denotes that the class, method or field has its visibility relaxed so
- * that unit tests can access it.
- * <p/>
- * The <code>visibility</code> argument can be used to specific what the original
- * visibility should have been if it had not been made public or package-private for testing.
- * The default is to consider the element private.
- */
-@Retention(RetentionPolicy.CLASS)
-public @interface VisibleForTesting {
- /**
- * Intended visibility if the element had not been made public or package-private for
- * testing.
- */
- enum Visibility {
- /** The element should be considered protected. */
- PROTECTED,
- /** The element should be considered package-private. */
- PACKAGE,
- /** The element should be considered private. */
- PRIVATE
- }
-
- /**
- * Intended visibility if the element had not been made public or package-private for testing.
- * If not specified, one should assume the element originally intended to be private.
- */
- Visibility visibility() default Visibility.PRIVATE;
-}
diff --git a/java/com/android/internal/util/Android.bp b/java/com/android/internal/util/Android.bp
deleted file mode 100644
index ed16de2..0000000
--- a/java/com/android/internal/util/Android.bp
+++ /dev/null
@@ -1,34 +0,0 @@
-//
-// Copyright (C) 2021 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 {
- default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-java_library {
- name: "modules-utils-preconditions",
- srcs: ["Preconditions.java"],
- libs: [
- "framework-annotations-lib",
- "unsupportedappusage",
- ],
- sdk_version: "module_current",
- min_sdk_version: "30",
- visibility: ["//visibility:public"],
- apex_available: [
- "//apex_available:anyapex",
- "//apex_available:platform",
- ],
-}
diff --git a/java/com/android/internal/util/Preconditions.java b/java/com/android/internal/util/Preconditions.java
deleted file mode 100644
index d2d8220..0000000
--- a/java/com/android/internal/util/Preconditions.java
+++ /dev/null
@@ -1,771 +0,0 @@
-/*
- * Copyright (C) 2011 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 com.android.internal.util;
-
-import android.annotation.IntRange;
-import android.annotation.NonNull;
-import android.compat.annotation.UnsupportedAppUsage;
-import android.os.Build;
-import android.text.TextUtils;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Objects;
-
-/**
- * Simple static methods to be called at the start of your own methods to verify
- * correct arguments and state.
- */
-public class Preconditions {
-
- /**
- * Ensures that an expression checking an argument is true.
- *
- * @param expression the expression to check
- * @throws IllegalArgumentException if {@code expression} is false
- */
- @UnsupportedAppUsage
- public static void checkArgument(boolean expression) {
- if (!expression) {
- throw new IllegalArgumentException();
- }
- }
-
- /**
- * Ensures that an expression checking an argument is true.
- *
- * @param expression the expression to check
- * @param errorMessage the exception message to use if the check fails; will
- * be converted to a string using {@link String#valueOf(Object)}
- * @throws IllegalArgumentException if {@code expression} is false
- */
- @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public static void checkArgument(boolean expression, final Object errorMessage) {
- if (!expression) {
- throw new IllegalArgumentException(String.valueOf(errorMessage));
- }
- }
-
- /**
- * Ensures that an expression checking an argument is true.
- *
- * @param expression the expression to check
- * @param messageTemplate a printf-style message template to use if the check fails; will
- * be converted to a string using {@link String#format(String, Object...)}
- * @param messageArgs arguments for {@code messageTemplate}
- * @throws IllegalArgumentException if {@code expression} is false
- */
- public static void checkArgument(
- final boolean expression,
- final @NonNull String messageTemplate,
- final Object... messageArgs) {
- if (!expression) {
- throw new IllegalArgumentException(String.format(messageTemplate, messageArgs));
- }
- }
-
- /**
- * Ensures that an string reference passed as a parameter to the calling
- * method is not empty.
- *
- * @param string an string reference
- * @return the string reference that was validated
- * @throws IllegalArgumentException if {@code string} is empty
- */
- public static @NonNull <T extends CharSequence> T checkStringNotEmpty(final T string) {
- if (TextUtils.isEmpty(string)) {
- throw new IllegalArgumentException();
- }
- return string;
- }
-
- /**
- * Ensures that an string reference passed as a parameter to the calling
- * method is not empty.
- *
- * @param string an string reference
- * @param errorMessage the exception message to use if the check fails; will
- * be converted to a string using {@link String#valueOf(Object)}
- * @return the string reference that was validated
- * @throws IllegalArgumentException if {@code string} is empty
- */
- public static @NonNull <T extends CharSequence> T checkStringNotEmpty(final T string,
- final Object errorMessage) {
- if (TextUtils.isEmpty(string)) {
- throw new IllegalArgumentException(String.valueOf(errorMessage));
- }
- return string;
- }
-
- /**
- * Ensures that an string reference passed as a parameter to the calling method is not empty.
- *
- * @param string an string reference
- * @param messageTemplate a printf-style message template to use if the check fails; will be
- * converted to a string using {@link String#format(String, Object...)}
- * @param messageArgs arguments for {@code messageTemplate}
- * @return the string reference that was validated
- * @throws IllegalArgumentException if {@code string} is empty
- */
- public static @NonNull <T extends CharSequence> T checkStringNotEmpty(
- final T string,
- final @NonNull String messageTemplate,
- final Object... messageArgs) {
- if (TextUtils.isEmpty(string)) {
- throw new IllegalArgumentException(String.format(messageTemplate, messageArgs));
- }
- return string;
- }
-
- /**
- * Ensures that an object reference passed as a parameter to the calling
- * method is not null.
- *
- * @param reference an object reference
- * @return the non-null reference that was validated
- * @throws NullPointerException if {@code reference} is null
- * @deprecated - use {@link java.util.Objects.requireNonNull} instead.
- */
- @Deprecated
- @UnsupportedAppUsage
- public static @NonNull <T> T checkNotNull(final T reference) {
- if (reference == null) {
- throw new NullPointerException();
- }
- return reference;
- }
-
- /**
- * Ensures that an object reference passed as a parameter to the calling
- * method is not null.
- *
- * @param reference an object reference
- * @param errorMessage the exception message to use if the check fails; will
- * be converted to a string using {@link String#valueOf(Object)}
- * @return the non-null reference that was validated
- * @throws NullPointerException if {@code reference} is null
- * @deprecated - use {@link java.util.Objects#requireNonNull} instead.
- */
- @Deprecated
- @UnsupportedAppUsage
- public static @NonNull <T> T checkNotNull(final T reference, final Object errorMessage) {
- if (reference == null) {
- throw new NullPointerException(String.valueOf(errorMessage));
- }
- return reference;
- }
-
- /**
- * Ensures that an object reference passed as a parameter to the calling
- * method is not null.
- *
- * @param messageTemplate a printf-style message template to use if the check fails; will
- * be converted to a string using {@link String#format(String, Object...)}
- * @param messageArgs arguments for {@code messageTemplate}
- * @throws NullPointerException if {@code reference} is null
- */
- public static @NonNull <T> T checkNotNull(
- final T reference,
- final @NonNull String messageTemplate,
- final Object... messageArgs) {
- if (reference == null) {
- throw new NullPointerException(String.format(messageTemplate, messageArgs));
- }
- return reference;
- }
-
- /**
- * Ensures the truth of an expression involving the state of the calling
- * instance, but not involving any parameters to the calling method.
- *
- * @param expression a boolean expression
- * @throws IllegalStateException if {@code expression} is false
- */
- @UnsupportedAppUsage
- public static void checkState(final boolean expression) {
- checkState(expression, null);
- }
-
- /**
- * Ensures the truth of an expression involving the state of the calling
- * instance, but not involving any parameters to the calling method.
- *
- * @param expression a boolean expression
- * @param errorMessage the exception message to use if the check fails; will
- * be converted to a string using {@link String#valueOf(Object)}
- * @throws IllegalStateException if {@code expression} is false
- */
- @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public static void checkState(final boolean expression, String errorMessage) {
- if (!expression) {
- throw new IllegalStateException(errorMessage);
- }
- }
-
- /**
- * Ensures the truth of an expression involving the state of the calling
- * instance, but not involving any parameters to the calling method.
- *
- * @param expression a boolean expression
- * @param messageTemplate a printf-style message template to use if the check fails; will
- * be converted to a string using {@link String#format(String, Object...)}
- * @param messageArgs arguments for {@code messageTemplate}
- * @throws IllegalStateException if {@code expression} is false
- */
- public static void checkState(
- final boolean expression,
- final @NonNull String messageTemplate,
- final Object... messageArgs) {
- if (!expression) {
- throw new IllegalStateException(String.format(messageTemplate, messageArgs));
- }
- }
-
- /**
- * Ensures the truth of an expression involving whether the calling identity is authorized to
- * call the calling method.
- *
- * @param expression a boolean expression
- * @throws SecurityException if {@code expression} is false
- */
- public static void checkCallAuthorization(final boolean expression) {
- if (!expression) {
- throw new SecurityException("Calling identity is not authorized");
- }
- }
-
- /**
- * Ensures the truth of an expression involving whether the calling identity is authorized to
- * call the calling method.
- *
- * @param expression a boolean expression
- * @param message the message of the security exception to be thrown
- * @throws SecurityException if {@code expression} is false
- */
- public static void checkCallAuthorization(final boolean expression, final String message) {
- if (!expression) {
- throw new SecurityException(message);
- }
- }
-
- /**
- * Ensures the truth of an expression involving whether the calling identity is authorized to
- * call the calling method.
- *
- * @param expression a boolean expression
- * @param messageTemplate a printf-style message template to use if the check fails; will
- * be converted to a string using {@link String#format(String, Object...)}
- * @param messageArgs arguments for {@code messageTemplate}
- * @throws SecurityException if {@code expression} is false
- */
- public static void checkCallAuthorization(
- final boolean expression,
- final @NonNull String messageTemplate,
- final Object... messageArgs) {
- if (!expression) {
- throw new SecurityException(String.format(messageTemplate, messageArgs));
- }
- }
-
- /**
- * Ensures the truth of an expression involving whether the calling user is authorized to
- * call the calling method.
- *
- * @param expression a boolean expression
- * @throws SecurityException if {@code expression} is false
- */
- public static void checkCallingUser(final boolean expression) {
- if (!expression) {
- throw new SecurityException("Calling user is not authorized");
- }
- }
-
- /**
- * Check the requested flags, throwing if any requested flags are outside
- * the allowed set.
- *
- * @return the validated requested flags.
- */
- public static int checkFlagsArgument(final int requestedFlags, final int allowedFlags) {
- if ((requestedFlags & allowedFlags) != requestedFlags) {
- throw new IllegalArgumentException("Requested flags 0x"
- + Integer.toHexString(requestedFlags) + ", but only 0x"
- + Integer.toHexString(allowedFlags) + " are allowed");
- }
-
- return requestedFlags;
- }
-
- /**
- * Ensures that that the argument numeric value is non-negative (greater than or equal to 0).
- *
- * @param value a numeric int value
- * @param errorMessage the exception message to use if the check fails
- * @return the validated numeric value
- * @throws IllegalArgumentException if {@code value} was negative
- */
- public static @IntRange(from = 0) int checkArgumentNonnegative(final int value,
- final String errorMessage) {
- if (value < 0) {
- throw new IllegalArgumentException(errorMessage);
- }
-
- return value;
- }
-
- /**
- * Ensures that that the argument numeric value is non-negative (greater than or equal to 0).
- *
- * @param value a numeric int value
- *
- * @return the validated numeric value
- * @throws IllegalArgumentException if {@code value} was negative
- */
- public static @IntRange(from = 0) int checkArgumentNonnegative(final int value) {
- if (value < 0) {
- throw new IllegalArgumentException();
- }
-
- return value;
- }
-
- /**
- * Ensures that that the argument numeric value is non-negative (greater than or equal to 0).
- *
- * @param value a numeric long value
- * @return the validated numeric value
- * @throws IllegalArgumentException if {@code value} was negative
- */
- public static long checkArgumentNonnegative(final long value) {
- if (value < 0) {
- throw new IllegalArgumentException();
- }
-
- return value;
- }
-
- /**
- * Ensures that that the argument numeric value is non-negative (greater than or equal to 0).
- *
- * @param value a numeric long value
- * @param errorMessage the exception message to use if the check fails
- * @return the validated numeric value
- * @throws IllegalArgumentException if {@code value} was negative
- */
- public static long checkArgumentNonnegative(final long value, final String errorMessage) {
- if (value < 0) {
- throw new IllegalArgumentException(errorMessage);
- }
-
- return value;
- }
-
- /**
- * Ensures that that the argument numeric value is positive (greater than 0).
- *
- * @param value a numeric int value
- * @param errorMessage the exception message to use if the check fails
- * @return the validated numeric value
- * @throws IllegalArgumentException if {@code value} was not positive
- */
- public static int checkArgumentPositive(final int value, final String errorMessage) {
- if (value <= 0) {
- throw new IllegalArgumentException(errorMessage);
- }
-
- return value;
- }
-
- /**
- * Ensures that the argument floating point value is non-negative (greater than or equal to 0).
- * @param value a floating point value
- * @param errorMessage the exteption message to use if the check fails
- * @return the validated numeric value
- * @throws IllegalArgumentException if {@code value} was negative
- */
- public static float checkArgumentNonNegative(final float value, final String errorMessage) {
- if (value < 0) {
- throw new IllegalArgumentException(errorMessage);
- }
-
- return value;
- }
-
- /**
- * Ensures that the argument floating point value is positive (greater than 0).
- * @param value a floating point value
- * @param errorMessage the exteption message to use if the check fails
- * @return the validated numeric value
- * @throws IllegalArgumentException if {@code value} was not positive
- */
- public static float checkArgumentPositive(final float value, final String errorMessage) {
- if (value <= 0) {
- throw new IllegalArgumentException(errorMessage);
- }
-
- return value;
- }
-
- /**
- * Ensures that the argument floating point value is a finite number.
- *
- * <p>A finite number is defined to be both representable (that is, not NaN) and
- * not infinite (that is neither positive or negative infinity).</p>
- *
- * @param value a floating point value
- * @param valueName the name of the argument to use if the check fails
- *
- * @return the validated floating point value
- *
- * @throws IllegalArgumentException if {@code value} was not finite
- */
- public static float checkArgumentFinite(final float value, final String valueName) {
- if (Float.isNaN(value)) {
- throw new IllegalArgumentException(valueName + " must not be NaN");
- } else if (Float.isInfinite(value)) {
- throw new IllegalArgumentException(valueName + " must not be infinite");
- }
-
- return value;
- }
-
- /**
- * Ensures that the argument floating point value is within the inclusive range.
- *
- * <p>While this can be used to range check against +/- infinity, note that all NaN numbers
- * will always be out of range.</p>
- *
- * @param value a floating point value
- * @param lower the lower endpoint of the inclusive range
- * @param upper the upper endpoint of the inclusive range
- * @param valueName the name of the argument to use if the check fails
- *
- * @return the validated floating point value
- *
- * @throws IllegalArgumentException if {@code value} was not within the range
- */
- public static float checkArgumentInRange(float value, float lower, float upper,
- String valueName) {
- if (Float.isNaN(value)) {
- throw new IllegalArgumentException(valueName + " must not be NaN");
- } else if (value < lower) {
- throw new IllegalArgumentException(
- String.format(
- "%s is out of range of [%f, %f] (too low)", valueName, lower, upper));
- } else if (value > upper) {
- throw new IllegalArgumentException(
- String.format(
- "%s is out of range of [%f, %f] (too high)", valueName, lower, upper));
- }
-
- return value;
- }
-
- /**
- * Ensures that the argument floating point value is within the inclusive range.
- *
- * <p>While this can be used to range check against +/- infinity, note that all NaN numbers
- * will always be out of range.</p>
- *
- * @param value a floating point value
- * @param lower the lower endpoint of the inclusive range
- * @param upper the upper endpoint of the inclusive range
- * @param valueName the name of the argument to use if the check fails
- *
- * @return the validated floating point value
- *
- * @throws IllegalArgumentException if {@code value} was not within the range
- */
- public static double checkArgumentInRange(double value, double lower, double upper,
- String valueName) {
- if (Double.isNaN(value)) {
- throw new IllegalArgumentException(valueName + " must not be NaN");
- } else if (value < lower) {
- throw new IllegalArgumentException(
- String.format(
- "%s is out of range of [%f, %f] (too low)", valueName, lower, upper));
- } else if (value > upper) {
- throw new IllegalArgumentException(
- String.format(
- "%s is out of range of [%f, %f] (too high)", valueName, lower, upper));
- }
-
- return value;
- }
-
- /**
- * Ensures that the argument int value is within the inclusive range.
- *
- * @param value a int value
- * @param lower the lower endpoint of the inclusive range
- * @param upper the upper endpoint of the inclusive range
- * @param valueName the name of the argument to use if the check fails
- *
- * @return the validated int value
- *
- * @throws IllegalArgumentException if {@code value} was not within the range
- */
- @UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
- public static int checkArgumentInRange(int value, int lower, int upper,
- String valueName) {
- if (value < lower) {
- throw new IllegalArgumentException(
- String.format(
- "%s is out of range of [%d, %d] (too low)", valueName, lower, upper));
- } else if (value > upper) {
- throw new IllegalArgumentException(
- String.format(
- "%s is out of range of [%d, %d] (too high)", valueName, lower, upper));
- }
-
- return value;
- }
-
- /**
- * Ensures that the argument long value is within the inclusive range.
- *
- * @param value a long value
- * @param lower the lower endpoint of the inclusive range
- * @param upper the upper endpoint of the inclusive range
- * @param valueName the name of the argument to use if the check fails
- *
- * @return the validated long value
- *
- * @throws IllegalArgumentException if {@code value} was not within the range
- */
- public static long checkArgumentInRange(long value, long lower, long upper,
- String valueName) {
- if (value < lower) {
- throw new IllegalArgumentException(
- String.format(
- "%s is out of range of [%d, %d] (too low)", valueName, lower, upper));
- } else if (value > upper) {
- throw new IllegalArgumentException(
- String.format(
- "%s is out of range of [%d, %d] (too high)", valueName, lower, upper));
- }
-
- return value;
- }
-
- /**
- * Ensures that the array is not {@code null}, and none of its elements are {@code null}.
- *
- * @param value an array of boxed objects
- * @param valueName the name of the argument to use if the check fails
- *
- * @return the validated array
- *
- * @throws NullPointerException if the {@code value} or any of its elements were {@code null}
- */
- public static <T> T[] checkArrayElementsNotNull(final T[] value, final String valueName) {
- if (value == null) {
- throw new NullPointerException(valueName + " must not be null");
- }
-
- for (int i = 0; i < value.length; ++i) {
- if (value[i] == null) {
- throw new NullPointerException(
- String.format("%s[%d] must not be null", valueName, i));
- }
- }
-
- return value;
- }
-
- /**
- * Ensures that the {@link Collection} is not {@code null}, and none of its elements are
- * {@code null}.
- *
- * @param value a {@link Collection} of boxed objects
- * @param valueName the name of the argument to use if the check fails
- *
- * @return the validated {@link Collection}
- *
- * @throws NullPointerException if the {@code value} or any of its elements were {@code null}
- */
- public static @NonNull <C extends Collection<T>, T> C checkCollectionElementsNotNull(
- final C value, final String valueName) {
- if (value == null) {
- throw new NullPointerException(valueName + " must not be null");
- }
-
- long ctr = 0;
- for (T elem : value) {
- if (elem == null) {
- throw new NullPointerException(
- String.format("%s[%d] must not be null", valueName, ctr));
- }
- ++ctr;
- }
-
- return value;
- }
-
- /**
- * Ensures that the {@link Collection} is not {@code null}, and contains at least one element.
- *
- * @param value a {@link Collection} of boxed elements.
- * @param valueName the name of the argument to use if the check fails.
-
- * @return the validated {@link Collection}
- *
- * @throws NullPointerException if the {@code value} was {@code null}
- * @throws IllegalArgumentException if the {@code value} was empty
- */
- public static <T> Collection<T> checkCollectionNotEmpty(final Collection<T> value,
- final String valueName) {
- if (value == null) {
- throw new NullPointerException(valueName + " must not be null");
- }
- if (value.isEmpty()) {
- throw new IllegalArgumentException(valueName + " is empty");
- }
- return value;
- }
-
- /**
- * Ensures that the given byte array is not {@code null}, and contains at least one element.
- *
- * @param value an array of elements.
- * @param valueName the name of the argument to use if the check fails.
-
- * @return the validated array
- *
- * @throws NullPointerException if the {@code value} was {@code null}
- * @throws IllegalArgumentException if the {@code value} was empty
- */
- @NonNull
- public static byte[] checkByteArrayNotEmpty(final byte[] value, final String valueName) {
- if (value == null) {
- throw new NullPointerException(valueName + " must not be null");
- }
- if (value.length == 0) {
- throw new IllegalArgumentException(valueName + " is empty");
- }
- return value;
- }
-
- /**
- * Ensures that argument {@code value} is one of {@code supportedValues}.
- *
- * @param supportedValues an array of string values
- * @param value a string value
- *
- * @return the validated value
- *
- * @throws NullPointerException if either {@code value} or {@code supportedValues} is null
- * @throws IllegalArgumentException if the {@code value} is not in {@code supportedValues}
- */
- @NonNull
- public static String checkArgumentIsSupported(final String[] supportedValues,
- final String value) {
- checkNotNull(value);
- checkNotNull(supportedValues);
-
- if (!contains(supportedValues, value)) {
- throw new IllegalArgumentException(value + "is not supported "
- + Arrays.toString(supportedValues));
- }
- return value;
- }
-
- private static boolean contains(String[] values, String value) {
- if (values == null) {
- return false;
- }
- for (int i = 0; i < values.length; ++i) {
- if (Objects.equals(value, values[i])) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Ensures that all elements in the argument floating point array are within the inclusive range
- *
- * <p>While this can be used to range check against +/- infinity, note that all NaN numbers
- * will always be out of range.</p>
- *
- * @param value a floating point array of values
- * @param lower the lower endpoint of the inclusive range
- * @param upper the upper endpoint of the inclusive range
- * @param valueName the name of the argument to use if the check fails
- *
- * @return the validated floating point value
- *
- * @throws IllegalArgumentException if any of the elements in {@code value} were out of range
- * @throws NullPointerException if the {@code value} was {@code null}
- */
- public static float[] checkArrayElementsInRange(float[] value, float lower, float upper,
- String valueName) {
- checkNotNull(value, "%s must not be null", valueName);
-
- for (int i = 0; i < value.length; ++i) {
- float v = value[i];
-
- if (Float.isNaN(v)) {
- throw new IllegalArgumentException(valueName + "[" + i + "] must not be NaN");
- } else if (v < lower) {
- throw new IllegalArgumentException(
- String.format("%s[%d] is out of range of [%f, %f] (too low)",
- valueName, i, lower, upper));
- } else if (v > upper) {
- throw new IllegalArgumentException(
- String.format("%s[%d] is out of range of [%f, %f] (too high)",
- valueName, i, lower, upper));
- }
- }
-
- return value;
- }
-
- /**
- * Ensures that all elements in the argument integer array are within the inclusive range
- *
- * @param value an integer array of values
- * @param lower the lower endpoint of the inclusive range
- * @param upper the upper endpoint of the inclusive range
- * @param valueName the name of the argument to use if the check fails
- *
- * @return the validated integer array
- *
- * @throws IllegalArgumentException if any of the elements in {@code value} were out of range
- * @throws NullPointerException if the {@code value} was {@code null}
- */
- public static int[] checkArrayElementsInRange(int[] value, int lower, int upper,
- String valueName) {
- checkNotNull(value, "%s must not be null", valueName);
-
- for (int i = 0; i < value.length; ++i) {
- int v = value[i];
-
- if (v < lower) {
- throw new IllegalArgumentException(
- String.format("%s[%d] is out of range of [%d, %d] (too low)",
- valueName, i, lower, upper));
- } else if (v > upper) {
- throw new IllegalArgumentException(
- String.format("%s[%d] is out of range of [%d, %d] (too high)",
- valueName, i, lower, upper));
- }
- }
-
- return value;
- }
-}
diff --git a/java/com/android/modules/utils/Android.bp b/java/com/android/modules/utils/Android.bp
index 268982f..3e5563d 100644
--- a/java/com/android/modules/utils/Android.bp
+++ b/java/com/android/modules/utils/Android.bp
@@ -17,75 +17,22 @@ package {
default_applicable_licenses: ["Android-Apache-2.0"],
}
-java_defaults {
- name: "modules-utils-defaults",
- sdk_version: "module_current",
- min_sdk_version: "29",
- libs: ["framework-annotations-lib"],
- visibility: ["//visibility:public"],
- apex_available: [
- "//apex_available:anyapex",
- "//apex_available:platform",
- ],
- defaults_visibility: [":__subpackages__"],
-}
-
java_library {
+ // TODO this rule should be split into smaller, more focused ones,
+ // ideally each would have its own java package too.
name: "modules-utils-os",
- defaults: ["modules-utils-defaults"],
- min_sdk_version: "30",
- static_libs: [
- "modules-utils-list-slice",
- "modules-utils-shell-command-handler",
- ],
- visibility: [
- // NOTE: Do not add new rules to this list. New users should use the separate libraries it
- // consists of.
- "//visibility:override",
- "//frameworks/base",
- "//packages/modules/Connectivity/service",
- "//packages/modules/Permission/service",
- "//packages/modules/Scheduling/service",
- "//packages/modules/Wifi/framework",
- "//packages/modules/Wifi/service",
- "//packages/services/Car/service",
- "//packages/services/Telephony",
- ],
-}
-
-java_library {
- name: "modules-utils-handlerexecutor",
- defaults: ["modules-utils-defaults"],
- srcs: ["HandlerExecutor.java"],
-}
-
-java_library {
- name: "modules-utils-backgroundthread",
- defaults: ["modules-utils-defaults"],
- srcs: ["BackgroundThread.java"],
- static_libs: ["modules-utils-handlerexecutor"],
-}
-
-java_library {
- name: "modules-utils-bytesmatcher",
- defaults: ["modules-utils-defaults"],
- srcs: ["BytesMatcher.java"],
-}
-
-java_library {
- name: "modules-utils-list-slice",
- defaults: ["modules-utils-defaults"],
srcs: [
":module-utils-os-aidls",
"BaseParceledListSlice.java",
+ "BasicShellCommandHandler.java",
"ParceledListSlice.java",
"StringParceledListSlice.java",
],
+ sdk_version: "module_current",
min_sdk_version: "30",
-}
-
-java_library {
- name: "modules-utils-shell-command-handler",
- defaults: ["modules-utils-defaults"],
- srcs: ["BasicShellCommandHandler.java"],
+ visibility: ["//visibility:public"],
+ apex_available: [
+ "//apex_available:anyapex",
+ "//apex_available:platform",
+ ],
}
diff --git a/java/com/android/modules/utils/BackgroundThread.java b/java/com/android/modules/utils/BackgroundThread.java
deleted file mode 100644
index 21d9910..0000000
--- a/java/com/android/modules/utils/BackgroundThread.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * * Copyright (C) 2021 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 com.android.modules.utils;
-
-import android.annotation.NonNull;
-import android.os.Handler;
-import android.os.HandlerThread;
-
-import com.android.internal.annotations.GuardedBy;
-
-import java.util.concurrent.Executor;
-
-/**
- * Thread for asynchronous event processing. This thread is configured as
- * {@link android.os.Process#THREAD_PRIORITY_BACKGROUND}, which means fewer CPU
- * resources will be dedicated to it, and it will "have less chance of impacting
- * the responsiveness of the user interface."
- * <p>
- * This thread is best suited for tasks that the user is not actively waiting
- * for, or for tasks that the user expects to be executed eventually.
- *
- * @see com.android.internal.os.BackgroundThread
- */
-public final class BackgroundThread extends HandlerThread {
- private static final Object sLock = new Object();
-
- @GuardedBy("sLock")
- private static BackgroundThread sInstance;
- @GuardedBy("sLock")
- private static Handler sHandler;
- @GuardedBy("sLock")
- private static HandlerExecutor sHandlerExecutor;
-
- private BackgroundThread() {
- super(BackgroundThread.class.getName(), android.os.Process.THREAD_PRIORITY_BACKGROUND);
- }
-
- @GuardedBy("sLock")
- private static void ensureThreadLocked() {
- if (sInstance == null) {
- sInstance = new BackgroundThread();
- sInstance.start();
- sHandler = new Handler(sInstance.getLooper());
- sHandlerExecutor = new HandlerExecutor(sHandler);
- }
- }
-
- /**
- * Get the singleton instance of this class.
- *
- * @return the singleton instance of this class
- */
- @NonNull
- public static BackgroundThread get() {
- synchronized (sLock) {
- ensureThreadLocked();
- return sInstance;
- }
- }
-
- /**
- * Get the singleton {@link Handler} for this class.
- *
- * @return the singleton {@link Handler} for this class.
- */
- @NonNull
- public static Handler getHandler() {
- synchronized (sLock) {
- ensureThreadLocked();
- return sHandler;
- }
- }
-
- /**
- * Get the singleton {@link Executor} for this class.
- *
- * @return the singleton {@link Executor} for this class.
- */
- @NonNull
- public static Executor getExecutor() {
- synchronized (sLock) {
- ensureThreadLocked();
- return sHandlerExecutor;
- }
- }
-}
diff --git a/java/com/android/modules/utils/BytesMatcher.java b/java/com/android/modules/utils/BytesMatcher.java
deleted file mode 100644
index ce597b6..0000000
--- a/java/com/android/modules/utils/BytesMatcher.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- * Copyright (C) 2021 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 com.android.modules.utils;
-
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-import android.bluetooth.BluetoothUuid;
-import android.text.TextUtils;
-import android.util.Log;
-
-import libcore.util.HexEncoding;
-
-import java.util.ArrayList;
-import java.util.function.Predicate;
-
-/**
- * Predicate that tests if a given {@code byte[]} value matches a set of
- * configured rules.
- * <p>
- * Rules are tested in the order in which they were originally added, which
- * means a narrow rule can reject a specific value before a later broader rule
- * might accept that same value, or vice versa.
- * <p>
- * Matchers can contain rules of varying lengths, and tested values will only be
- * matched against rules of the exact same length. This is designed to support
- * {@link BluetoothUuid} style values which can be variable length.
- *
- * @hide
- */
-public class BytesMatcher implements Predicate<byte[]> {
- private static final String TAG = "BytesMatcher";
-
- private static final char TYPE_EXACT_ACCEPT = '+';
- private static final char TYPE_EXACT_REJECT = '-';
- private static final char TYPE_PREFIX_ACCEPT = '⊆';
- private static final char TYPE_PREFIX_REJECT = '⊈';
-
- private final ArrayList<Rule> mRules = new ArrayList<>();
-
- private static class Rule {
- public final char type;
- public final @NonNull byte[] value;
- public final @Nullable byte[] mask;
-
- public Rule(char type, @NonNull byte[] value, @Nullable byte[] mask) {
- if (mask != null && value.length != mask.length) {
- throw new IllegalArgumentException(
- "Expected length " + value.length + " but found " + mask.length);
- }
- this.type = type;
- this.value = value;
- this.mask = mask;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- encode(builder);
- return builder.toString();
- }
-
- public void encode(@NonNull StringBuilder builder) {
- builder.append(this.type);
- builder.append(HexEncoding.encodeToString(this.value));
- if (this.mask != null) {
- builder.append('/');
- builder.append(HexEncoding.encodeToString(this.mask));
- }
- }
-
- public boolean test(@NonNull byte[] value) {
- switch (type) {
- case TYPE_EXACT_ACCEPT:
- case TYPE_EXACT_REJECT:
- if (value.length != this.value.length) {
- return false;
- }
- break;
- case TYPE_PREFIX_ACCEPT:
- case TYPE_PREFIX_REJECT:
- if (value.length < this.value.length) {
- return false;
- }
- break;
- }
- for (int i = 0; i < this.value.length; i++) {
- byte local = this.value[i];
- byte remote = value[i];
- if (this.mask != null) {
- local &= this.mask[i];
- remote &= this.mask[i];
- }
- if (local != remote) {
- return false;
- }
- }
- return true;
- }
- }
-
- /**
- * Add a rule that will result in {@link #test(byte[])} returning
- * {@code true} when a value being tested matches it. This rule will only
- * match values of the exact same length.
- * <p>
- * Rules are tested in the order in which they were originally added, which
- * means a narrow rule can reject a specific value before a later broader
- * rule might accept that same value, or vice versa.
- *
- * @param value to be matched
- * @param mask to be applied to both values before testing for equality; if
- * {@code null} then both values must match exactly
- */
- public void addExactAcceptRule(@NonNull byte[] value, @Nullable byte[] mask) {
- mRules.add(new Rule(TYPE_EXACT_ACCEPT, value, mask));
- }
-
- /**
- * Add a rule that will result in {@link #test(byte[])} returning
- * {@code false} when a value being tested matches it. This rule will only
- * match values of the exact same length.
- * <p>
- * Rules are tested in the order in which they were originally added, which
- * means a narrow rule can reject a specific value before a later broader
- * rule might accept that same value, or vice versa.
- *
- * @param value to be matched
- * @param mask to be applied to both values before testing for equality; if
- * {@code null} then both values must match exactly
- */
- public void addExactRejectRule(@NonNull byte[] value, @Nullable byte[] mask) {
- mRules.add(new Rule(TYPE_EXACT_REJECT, value, mask));
- }
-
- /**
- * Add a rule that will result in {@link #test(byte[])} returning
- * {@code true} when a value being tested matches it. This rule will match
- * values of the exact same length or longer.
- * <p>
- * Rules are tested in the order in which they were originally added, which
- * means a narrow rule can reject a specific value before a later broader
- * rule might accept that same value, or vice versa.
- *
- * @param value to be matched
- * @param mask to be applied to both values before testing for equality; if
- * {@code null} then both values must match exactly
- */
- public void addPrefixAcceptRule(@NonNull byte[] value, @Nullable byte[] mask) {
- mRules.add(new Rule(TYPE_PREFIX_ACCEPT, value, mask));
- }
-
- /**
- * Add a rule that will result in {@link #test(byte[])} returning
- * {@code false} when a value being tested matches it. This rule will match
- * values of the exact same length or longer.
- * <p>
- * Rules are tested in the order in which they were originally added, which
- * means a narrow rule can reject a specific value before a later broader
- * rule might accept that same value, or vice versa.
- *
- * @param value to be matched
- * @param mask to be applied to both values before testing for equality; if
- * {@code null} then both values must match exactly
- */
- public void addPrefixRejectRule(@NonNull byte[] value, @Nullable byte[] mask) {
- mRules.add(new Rule(TYPE_PREFIX_REJECT, value, mask));
- }
-
- /**
- * Test if the given {@code byte[]} value matches the set of rules
- * configured in this matcher.
- */
- @Override
- public boolean test(@NonNull byte[] value) {
- return test(value, false);
- }
-
- /**
- * Test if the given {@code byte[]} value matches the set of rules
- * configured in this matcher.
- */
- public boolean test(@NonNull byte[] value, boolean defaultValue) {
- final int size = mRules.size();
- for (int i = 0; i < size; i++) {
- final Rule rule = mRules.get(i);
- if (rule.test(value)) {
- switch (rule.type) {
- case TYPE_EXACT_ACCEPT:
- case TYPE_PREFIX_ACCEPT:
- return true;
- case TYPE_EXACT_REJECT:
- case TYPE_PREFIX_REJECT:
- return false;
- }
- }
- }
- return defaultValue;
- }
-
- /**
- * Encode the given matcher into a human-readable {@link String} which can
- * be used to transport matchers across device boundaries.
- * <p>
- * The human-readable format is an ordered list separated by commas, where
- * each rule is a {@code +} or {@code -} symbol indicating if the match
- * should be accepted or rejected, then followed by a hex value and an
- * optional hex mask. For example, {@code -caff,+cafe/ff00} is a valid
- * encoded matcher.
- *
- * @see #decode(String)
- */
- public static @NonNull String encode(@NonNull BytesMatcher matcher) {
- final StringBuilder builder = new StringBuilder();
- final int size = matcher.mRules.size();
- for (int i = 0; i < size; i++) {
- final Rule rule = matcher.mRules.get(i);
- rule.encode(builder);
- builder.append(',');
- }
- if (builder.length() > 0) {
- builder.deleteCharAt(builder.length() - 1);
- }
- return builder.toString();
- }
-
- /**
- * Decode the given human-readable {@link String} used to transport matchers
- * across device boundaries.
- * <p>
- * The human-readable format is an ordered list separated by commas, where
- * each rule is a {@code +} or {@code -} symbol indicating if the match
- * should be accepted or rejected, then followed by a hex value and an
- * optional hex mask. For example, {@code -caff,+cafe/ff00} is a valid
- * encoded matcher.
- *
- * @see #encode(BytesMatcher)
- */
- public static @NonNull BytesMatcher decode(@Nullable String value) {
- final BytesMatcher matcher = new BytesMatcher();
- if (TextUtils.isEmpty(value)) return matcher;
-
- final int length = value.length();
- for (int i = 0; i < length;) {
- final char type = value.charAt(i);
-
- int nextRule = value.indexOf(',', i);
- int nextMask = value.indexOf('/', i);
-
- if (nextRule == -1) nextRule = length;
- if (nextMask > nextRule) nextMask = -1;
-
- final byte[] ruleValue;
- final byte[] ruleMask;
- if (nextMask >= 0) {
- ruleValue = HexEncoding.decode(value.substring(i + 1, nextMask));
- ruleMask = HexEncoding.decode(value.substring(nextMask + 1, nextRule));
- } else {
- ruleValue = HexEncoding.decode(value.substring(i + 1, nextRule));
- ruleMask = null;
- }
-
- switch (type) {
- case TYPE_EXACT_ACCEPT:
- matcher.addExactAcceptRule(ruleValue, ruleMask);
- break;
- case TYPE_EXACT_REJECT:
- matcher.addExactRejectRule(ruleValue, ruleMask);
- break;
- case TYPE_PREFIX_ACCEPT:
- matcher.addPrefixAcceptRule(ruleValue, ruleMask);
- break;
- case TYPE_PREFIX_REJECT:
- matcher.addPrefixRejectRule(ruleValue, ruleMask);
- break;
- default:
- Log.w(TAG, "Ignoring unknown type " + type);
- break;
- }
-
- i = nextRule + 1;
- }
- return matcher;
- }
-}
diff --git a/java/com/android/modules/utils/HandlerExecutor.java b/java/com/android/modules/utils/HandlerExecutor.java
deleted file mode 100644
index 44bdfb3..0000000
--- a/java/com/android/modules/utils/HandlerExecutor.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2021 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 com.android.modules.utils;
-
-import android.annotation.NonNull;
-import android.os.Handler;
-
-import java.util.Objects;
-import java.util.concurrent.Executor;
-import java.util.concurrent.RejectedExecutionException;
-
-/**
- * An adapter {@link Executor} that posts all executed tasks onto the given
- * {@link Handler}.
- */
-public class HandlerExecutor implements Executor {
- private final Handler mHandler;
-
- public HandlerExecutor(@NonNull Handler handler) {
- mHandler = Objects.requireNonNull(handler);
- }
-
- @Override
- public void execute(Runnable command) {
- if (!mHandler.post(command)) {
- throw new RejectedExecutionException(mHandler + " is shutting down");
- }
- }
-}
diff --git a/java/com/android/modules/utils/build/Android.bp b/java/com/android/modules/utils/build/Android.bp
index 5e29579..6a2aec6 100644
--- a/java/com/android/modules/utils/build/Android.bp
+++ b/java/com/android/modules/utils/build/Android.bp
@@ -19,16 +19,27 @@ package {
java_library {
name: "modules-utils-build",
- defaults: ["modules-utils-defaults"],
srcs: ["SdkLevel.java"],
libs: ["androidx.annotation_annotation"],
+ sdk_version: "module_current",
+ min_sdk_version: "29",
+ visibility: ["//visibility:public"],
+ apex_available: [
+ "//apex_available:anyapex",
+ "//apex_available:platform",
+ ],
}
// For modules which use system sdk
java_library {
name: "modules-utils-build_system",
- defaults: ["modules-utils-defaults"],
srcs: ["SdkLevel.java"],
libs: ["androidx.annotation_annotation"],
sdk_version: "system_current",
+ min_sdk_version: "29",
+ visibility: ["//visibility:public"],
+ apex_available: [
+ "//apex_available:anyapex",
+ "//apex_available:platform",
+ ],
}
diff --git a/java/com/android/modules/utils/build/SdkLevel.java b/java/com/android/modules/utils/build/SdkLevel.java
index 49e02e0..115b9b9 100644
--- a/java/com/android/modules/utils/build/SdkLevel.java
+++ b/java/com/android/modules/utils/build/SdkLevel.java
@@ -16,53 +16,44 @@
package com.android.modules.utils.build;
-import static android.os.Build.VERSION.CODENAME;
-import static android.os.Build.VERSION.SDK_INT;
+import android.os.Build;
import androidx.annotation.ChecksSdkIntAtLeast;
-import androidx.annotation.NonNull;
/**
- * Utility class to check SDK level on a device.
+ * Utility class to check SDK level.
*
* @hide
*/
-public final class SdkLevel {
+public class SdkLevel {
private SdkLevel() {}
- /** Checks if the device is running on release version of Android R or newer. */
- @ChecksSdkIntAtLeast(api = 30 /* Build.VERSION_CODES.R */)
+ /** Return true iff the running Android SDK is at least "R". */
+ @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.R)
public static boolean isAtLeastR() {
- return SDK_INT >= 30;
+ return Build.VERSION.SDK_INT >= Build.VERSION_CODES.R;
}
/**
- * Checks if the device is running on a pre-release version of Android S or a release version of
- * Android S or newer.
+ * Returns true iff the running Android SDK is pre-release "S" or "T", built based on "R" SDK.
+ *
+ * If new SDK versions are added > R, then this method needs to be updated to recognise them
+ * (e.g. if we add SDK version for R-QPR, the current implementation will not recognise
+ * pre-release "S" versions built on that).
*/
- @ChecksSdkIntAtLeast(api = 31 /* Build.VERSION_CODES.S */, codename = "S")
+ @ChecksSdkIntAtLeast(api = Build.VERSION_CODES.CUR_DEVELOPMENT)
public static boolean isAtLeastS() {
- return SDK_INT >= 31;
- }
-
- /**
- * Checks if the device is running on a pre-release version of Android T or a release version of
- * Android T or newer.
- */
- @ChecksSdkIntAtLeast(codename = "T")
- public static boolean isAtLeastT() {
- return isAtLeastPreReleaseCodename("T");
- }
-
- private static boolean isAtLeastPreReleaseCodename(@NonNull String codename) {
- // Special case "REL", which means the build is not a pre-release build.
- if ("REL".equals(CODENAME)) {
- return false;
+ // TODO(b/170831689) This should check SDK_INT >= S once S sdk finalised. Note that removing the
+ // current conditions may lead to issues in mainlinefood (and possibly public beta?).
+
+ // While in development, builds will have R SDK_INT and "S" or "T" codename.
+ // We don't accept SDK_INT > R for now, since R and S may have non-consecutive values.
+ if (Build.VERSION.SDK_INT == Build.VERSION_CODES.R
+ && ("S".equals(Build.VERSION.CODENAME) || "T".equals(Build.VERSION.CODENAME))) {
+ return true;
}
- // Otherwise lexically compare them. Return true if the build codename is equal to or
- // greater than the requested codename.
- return CODENAME.compareTo(codename) >= 0;
+ return false;
}
}
diff --git a/java/com/android/modules/utils/build/testing/Android.bp b/java/com/android/modules/utils/build/testing/Android.bp
deleted file mode 100644
index ab80da4..0000000
--- a/java/com/android/modules/utils/build/testing/Android.bp
+++ /dev/null
@@ -1,28 +0,0 @@
-//
-// Copyright (C) 2020 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 {
- default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-java_library_host {
- name: "modules-utils-build-testing",
- srcs: ["DeviceSdkLevel.java"],
- visibility: ["//visibility:public"],
- libs: [
- "androidx.annotation_annotation",
- "tradefed",
- ],
-}
diff --git a/java/com/android/modules/utils/build/testing/DeviceSdkLevel.java b/java/com/android/modules/utils/build/testing/DeviceSdkLevel.java
deleted file mode 100644
index 3a09c9c..0000000
--- a/java/com/android/modules/utils/build/testing/DeviceSdkLevel.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2021 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 com.android.modules.utils.build.testing;
-
-import androidx.annotation.NonNull;
-
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.device.ITestDevice;
-
-/**
- * Utility class to check device SDK level from a host side test.
- */
-public final class DeviceSdkLevel {
-
- private final ITestDevice device;
-
- public DeviceSdkLevel(ITestDevice device) {
- this.device = device;
- }
-
- /** Checks if the device is running on release version of Android R or newer. */
- public boolean isDeviceAtLeastR() throws DeviceNotAvailableException {
- return device.getApiLevel() >= 30;
- }
-
- /**
- * Checks if the device is running on a pre-release version of Android S or a release version of
- * Android S or newer.
- */
- public boolean isDeviceAtLeastS() throws DeviceNotAvailableException {
- return device.getApiLevel() >= 31 || isDeviceAtLeastPreReleaseCodename("S");
- }
-
- /**
- * Checks if the device is running on a pre-release version of Android T or a release version of
- * Android T or newer.
- */
- public boolean isDeviceAtLeastT() throws DeviceNotAvailableException {
- return isDeviceAtLeastPreReleaseCodename("T");
- }
-
- private boolean isDeviceAtLeastPreReleaseCodename(@NonNull String codename)
- throws DeviceNotAvailableException {
- String deviceCodename = device.getProperty("ro.build.version.codename");
-
- // Special case "REL", which means the build is not a pre-release build.
- if ("REL".equals(deviceCodename)) {
- return false;
- }
-
- // Otherwise lexically compare them. Return true if the build codename is equal to or
- // greater than the requested codename.
- return deviceCodename.compareTo(codename) >= 0;
- }
-
-}
diff --git a/javatests/Android.bp b/javatests/Android.bp
deleted file mode 100644
index 5c1607f..0000000
--- a/javatests/Android.bp
+++ /dev/null
@@ -1,25 +0,0 @@
-package {
- default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-android_test {
- name: "ModulesUtilsTests",
-
- sdk_version: "module_current",
- min_sdk_version: "29",
-
- srcs: ["**/*.java"],
-
- static_libs: [
- "modules-utils-backgroundthread",
- "modules-utils-bytesmatcher",
- "modules-utils-list-slice",
- "modules-utils-shell-command-handler",
- "androidx.test.runner",
- "androidx.test.rules",
- ],
-
- libs: ["android.test.runner"],
-
- test_suites: ["general-tests"],
-}
diff --git a/javatests/com/android/modules/utils/Android.bp b/javatests/com/android/modules/utils/Android.bp
new file mode 100644
index 0000000..2d48dd4
--- /dev/null
+++ b/javatests/com/android/modules/utils/Android.bp
@@ -0,0 +1,24 @@
+package {
+ default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_test {
+ name: "modules-utils-os-tests",
+
+ sdk_version: "module_current",
+ min_sdk_version: "30",
+
+ srcs: [
+ "*.java",
+ ],
+
+ static_libs: [
+ "modules-utils-os",
+ "androidx.test.runner",
+ "androidx.test.rules",
+ ],
+
+ libs: [
+ "android.test.runner",
+ ],
+}
diff --git a/javatests/AndroidManifest.xml b/javatests/com/android/modules/utils/AndroidManifest.xml
index 8fdfba3..8fdfba3 100644
--- a/javatests/AndroidManifest.xml
+++ b/javatests/com/android/modules/utils/AndroidManifest.xml
diff --git a/javatests/com/android/modules/utils/BackgroundThreadTest.java b/javatests/com/android/modules/utils/BackgroundThreadTest.java
deleted file mode 100644
index 9f8552f..0000000
--- a/javatests/com/android/modules/utils/BackgroundThreadTest.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * Copyright (C) 2021 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 com.android.modules.utils;
-
-import static org.junit.Assert.assertNotNull;
-
-import androidx.test.runner.AndroidJUnit4;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(AndroidJUnit4.class)
-public class BackgroundThreadTest {
- @Test
- public void testSimple() {
- assertNotNull(BackgroundThread.get());
- assertNotNull(BackgroundThread.getExecutor());
- assertNotNull(BackgroundThread.getHandler());
- }
-}
diff --git a/javatests/com/android/modules/utils/BytesMatcherTest.java b/javatests/com/android/modules/utils/BytesMatcherTest.java
deleted file mode 100644
index d37ac05..0000000
--- a/javatests/com/android/modules/utils/BytesMatcherTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * Copyright (C) 2021 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 com.android.modules.utils;
-
-import androidx.test.filters.SmallTest;
-
-import libcore.util.HexEncoding;
-
-import junit.framework.TestCase;
-
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-@SmallTest
-public class BytesMatcherTest extends TestCase {
- @Test
- public void testEmpty() throws Exception {
- BytesMatcher matcher = BytesMatcher.decode("");
- assertFalse(matcher.test(HexEncoding.decode("cafe")));
- assertFalse(matcher.test(HexEncoding.decode("")));
- }
-
- @Test
- public void testExact() throws Exception {
- BytesMatcher matcher = BytesMatcher.decode("+cafe");
- assertTrue(matcher.test(HexEncoding.decode("cafe")));
- assertFalse(matcher.test(HexEncoding.decode("beef")));
- assertFalse(matcher.test(HexEncoding.decode("ca")));
- assertFalse(matcher.test(HexEncoding.decode("cafe00")));
- }
-
- @Test
- public void testMask() throws Exception {
- BytesMatcher matcher = BytesMatcher.decode("+cafe/ff00");
- assertTrue(matcher.test(HexEncoding.decode("cafe")));
- assertTrue(matcher.test(HexEncoding.decode("ca88")));
- assertFalse(matcher.test(HexEncoding.decode("beef")));
- assertFalse(matcher.test(HexEncoding.decode("ca")));
- assertFalse(matcher.test(HexEncoding.decode("cafe00")));
- }
-
- @Test
- public void testPrefix() throws Exception {
- BytesMatcher matcher = BytesMatcher.decode("⊆cafe,⊆beef/ff00");
- assertTrue(matcher.test(HexEncoding.decode("cafe")));
- assertFalse(matcher.test(HexEncoding.decode("caff")));
- assertTrue(matcher.test(HexEncoding.decode("cafecafe")));
- assertFalse(matcher.test(HexEncoding.decode("ca")));
- assertTrue(matcher.test(HexEncoding.decode("beef")));
- assertTrue(matcher.test(HexEncoding.decode("beff")));
- assertTrue(matcher.test(HexEncoding.decode("beffbeff")));
- assertFalse(matcher.test(HexEncoding.decode("be")));
- }
-
- @Test
- public void testSerialize_Empty() throws Exception {
- BytesMatcher matcher = new BytesMatcher();
- matcher = BytesMatcher.decode(BytesMatcher.encode(matcher));
-
- // Also very empty and null values
- BytesMatcher.decode("");
- BytesMatcher.decode(null);
- }
-
- @Test
- public void testSerialize_Exact() throws Exception {
- BytesMatcher matcher = new BytesMatcher();
- matcher.addExactRejectRule(HexEncoding.decode("cafe00112233"),
- HexEncoding.decode("ffffff000000"));
- matcher.addExactRejectRule(HexEncoding.decode("beef00112233"),
- null);
- matcher.addExactAcceptRule(HexEncoding.decode("000000000000"),
- HexEncoding.decode("000000000000"));
-
- assertFalse(matcher.test(HexEncoding.decode("cafe00ffffff")));
- assertFalse(matcher.test(HexEncoding.decode("beef00112233")));
- assertTrue(matcher.test(HexEncoding.decode("beef00ffffff")));
-
- // Bounce through serialization pass and confirm it still works
- matcher = BytesMatcher.decode(BytesMatcher.encode(matcher));
-
- assertFalse(matcher.test(HexEncoding.decode("cafe00ffffff")));
- assertFalse(matcher.test(HexEncoding.decode("beef00112233")));
- assertTrue(matcher.test(HexEncoding.decode("beef00ffffff")));
- }
-
- @Test
- public void testSerialize_Prefix() throws Exception {
- BytesMatcher matcher = new BytesMatcher();
- matcher.addExactRejectRule(HexEncoding.decode("aa"), null);
- matcher.addExactAcceptRule(HexEncoding.decode("bb"), null);
- matcher.addPrefixAcceptRule(HexEncoding.decode("aa"), null);
- matcher.addPrefixRejectRule(HexEncoding.decode("bb"), null);
-
- assertFalse(matcher.test(HexEncoding.decode("aa")));
- assertTrue(matcher.test(HexEncoding.decode("bb")));
- assertTrue(matcher.test(HexEncoding.decode("aaaa")));
- assertFalse(matcher.test(HexEncoding.decode("bbbb")));
-
- // Bounce through serialization pass and confirm it still works
- matcher = BytesMatcher.decode(BytesMatcher.encode(matcher));
-
- assertFalse(matcher.test(HexEncoding.decode("aa")));
- assertTrue(matcher.test(HexEncoding.decode("bb")));
- assertTrue(matcher.test(HexEncoding.decode("aaaa")));
- assertFalse(matcher.test(HexEncoding.decode("bbbb")));
- }
-
- @Test
- public void testOrdering_RejectFirst() throws Exception {
- BytesMatcher matcher = BytesMatcher.decode("-ff/0f,+ff/f0");
- assertFalse(matcher.test(HexEncoding.decode("ff")));
- assertTrue(matcher.test(HexEncoding.decode("f0")));
- assertFalse(matcher.test(HexEncoding.decode("0f")));
- }
-
- @Test
- public void testOrdering_AcceptFirst() throws Exception {
- BytesMatcher matcher = BytesMatcher.decode("+ff/f0,-ff/0f");
- assertTrue(matcher.test(HexEncoding.decode("ff")));
- assertTrue(matcher.test(HexEncoding.decode("f0")));
- assertFalse(matcher.test(HexEncoding.decode("0f")));
- }
-}