Merge "Reintroduce android.test.base for Android R apps targeting Android Q."
diff --git a/core/java/android/content/pm/AndroidTestBaseUpdater.java b/core/java/android/content/pm/AndroidTestBaseUpdater.java
index 6a1778c..da1a693 100644
--- a/core/java/android/content/pm/AndroidTestBaseUpdater.java
+++ b/core/java/android/content/pm/AndroidTestBaseUpdater.java
@@ -24,7 +24,7 @@
import com.android.internal.annotations.VisibleForTesting;
/**
- * Updates a package to ensure that if it targets <= P that the android.test.base library is
+ * Updates a package to ensure that if it targets <= Q that the android.test.base library is
* included by default.
*
* <p>This is separated out so that it can be conditionally included at build time depending on
@@ -38,17 +38,17 @@
@VisibleForTesting
public class AndroidTestBaseUpdater extends PackageSharedLibraryUpdater {
- private static boolean apkTargetsApiLevelLessThanOrEqualToP(Package pkg) {
+ private static boolean apkTargetsApiLevelLessThanOrEqualToQ(Package pkg) {
int targetSdkVersion = pkg.applicationInfo.targetSdkVersion;
- return targetSdkVersion <= Build.VERSION_CODES.P;
+ return targetSdkVersion <= Build.VERSION_CODES.Q;
}
@Override
public void updatePackage(Package pkg) {
- // Packages targeted at <= P expect the classes in the android.test.base library
+ // Packages targeted at <= Q expect the classes in the android.test.base library
// to be accessible so this maintains backward compatibility by adding the
// android.test.base library to those packages.
- if (apkTargetsApiLevelLessThanOrEqualToP(pkg)) {
+ if (apkTargetsApiLevelLessThanOrEqualToQ(pkg)) {
prefixRequiredLibrary(pkg, ANDROID_TEST_BASE);
} else {
// If a package already depends on android.test.runner then add a dependency on
diff --git a/core/tests/coretests/src/android/content/pm/AndroidTestBaseUpdaterTest.java b/core/tests/coretests/src/android/content/pm/AndroidTestBaseUpdaterTest.java
index 125b9ff..03108ce 100644
--- a/core/tests/coretests/src/android/content/pm/AndroidTestBaseUpdaterTest.java
+++ b/core/tests/coretests/src/android/content/pm/AndroidTestBaseUpdaterTest.java
@@ -37,37 +37,37 @@
private static final String OTHER_LIBRARY = "other.library";
@Test
- public void targeted_at_P() {
+ public void targeted_at_Q() {
PackageBuilder before = builder()
- .targetSdkVersion(Build.VERSION_CODES.P);
+ .targetSdkVersion(Build.VERSION_CODES.Q);
// Should add org.apache.http.legacy.
PackageBuilder after = builder()
- .targetSdkVersion(Build.VERSION_CODES.P)
+ .targetSdkVersion(Build.VERSION_CODES.Q)
.requiredLibraries(ANDROID_TEST_BASE);
checkBackwardsCompatibility(before, after);
}
@Test
- public void targeted_at_P_not_empty_usesLibraries() {
+ public void targeted_at_Q_not_empty_usesLibraries() {
PackageBuilder before = builder()
- .targetSdkVersion(Build.VERSION_CODES.P)
+ .targetSdkVersion(Build.VERSION_CODES.Q)
.requiredLibraries(OTHER_LIBRARY);
// The org.apache.http.legacy jar should be added at the start of the list because it
- // is not on the bootclasspath and the package targets pre-P.
+ // is not on the bootclasspath and the package targets pre-Q.
PackageBuilder after = builder()
- .targetSdkVersion(Build.VERSION_CODES.P)
+ .targetSdkVersion(Build.VERSION_CODES.Q)
.requiredLibraries(ANDROID_TEST_BASE, OTHER_LIBRARY);
checkBackwardsCompatibility(before, after);
}
@Test
- public void targeted_at_P_in_usesLibraries() {
+ public void targeted_at_Q_in_usesLibraries() {
PackageBuilder before = builder()
- .targetSdkVersion(Build.VERSION_CODES.P)
+ .targetSdkVersion(Build.VERSION_CODES.Q)
.requiredLibraries(ANDROID_TEST_BASE);
// No change is required because although org.apache.http.legacy has been removed from
@@ -76,9 +76,9 @@
}
@Test
- public void targeted_at_P_in_usesOptionalLibraries() {
+ public void targeted_at_Q_in_usesOptionalLibraries() {
PackageBuilder before = builder()
- .targetSdkVersion(Build.VERSION_CODES.P)
+ .targetSdkVersion(Build.VERSION_CODES.Q)
.optionalLibraries(ANDROID_TEST_BASE);
// No change is required because although org.apache.http.legacy has been removed from