Migrate VirtualMachine API to @SystemApi
Mark all the public members of the existing internal platform API as
@SystemApi (except for some @TestApi methods).
Update system-current.txt & test-current.txt to match.
Modify the demo app and the test APK and dependencies to build against
system / test SDK (respectively), instead of the implementation JAR /
platform APIs. (We still use platform APIs for the native payload code
though.)
Bug: 243512115
Test: atest MicrodroidTests MicrodroidHostTestCases
Test: Install & run demo app
CTS-Coverage-Bug: 244561836
Change-Id: Ibfffbb221f3ac37e03d5cfdbc9208428eeadbb9f
diff --git a/tests/helper/Android.bp b/tests/helper/Android.bp
index 7473dab..61c5dcd 100644
--- a/tests/helper/Android.bp
+++ b/tests/helper/Android.bp
@@ -6,9 +6,7 @@
name: "MicrodroidTestHelper",
srcs: ["src/java/com/android/microdroid/test/common/*.java"],
host_supported: true,
- libs: [
- "framework-annotations-lib",
- ],
+ sdk_version: "system_current",
}
java_library_static {
@@ -20,8 +18,5 @@
"MicrodroidTestHelper",
"truth-prebuilt",
],
- // We need to compile against the .impl library which includes the hidden
- // APIs. Once the APIs are promoted to @SystemApi we can switch to
- // framework-virtualization, which contains API stubs.
- libs: ["framework-virtualization.impl"],
+ sdk_version: "system_current",
}
diff --git a/tests/helper/src/java/com/android/microdroid/test/common/DeviceProperties.java b/tests/helper/src/java/com/android/microdroid/test/common/DeviceProperties.java
index 1fc163b..94f7e99 100644
--- a/tests/helper/src/java/com/android/microdroid/test/common/DeviceProperties.java
+++ b/tests/helper/src/java/com/android/microdroid/test/common/DeviceProperties.java
@@ -18,15 +18,11 @@
import static java.util.Objects.requireNonNull;
-import android.annotation.NonNull;
-import android.annotation.Nullable;
-
/** This class can be used in both host tests and device tests to get the device properties. */
public final class DeviceProperties {
/** PropertyGetter is used to get the property associated to a given key. */
public interface PropertyGetter {
- @Nullable
- String getProperty(@NonNull String key) throws Exception;
+ String getProperty(String key) throws Exception;
}
private static final String KEY_VENDOR_DEVICE = "ro.product.vendor.device";
@@ -34,15 +30,14 @@
private static final String CUTTLEFISH_DEVICE_PREFIX = "vsoc_";
- @NonNull private final PropertyGetter mPropertyGetter;
+ private final PropertyGetter mPropertyGetter;
- private DeviceProperties(@NonNull PropertyGetter propertyGetter) {
+ private DeviceProperties(PropertyGetter propertyGetter) {
mPropertyGetter = requireNonNull(propertyGetter);
}
/** Creates a new instance of {@link DeviceProperties}. */
- @NonNull
- public static DeviceProperties create(@NonNull PropertyGetter propertyGetter) {
+ public static DeviceProperties create(PropertyGetter propertyGetter) {
return new DeviceProperties(propertyGetter);
}
@@ -54,7 +49,6 @@
return vendorDeviceName != null && vendorDeviceName.startsWith(CUTTLEFISH_DEVICE_PREFIX);
}
- @Nullable
public String getMetricsTag() {
return getProperty(KEY_METRICS_TAG);
}