Conditionally remove android.test.base from bootclasspath

This makes the runtime handling of the android.test.base library
conditional based on a build flag REMOVE_ATB_FROM_BCP.

When REMOVE_ATB_FROM_BCP=true:
* The framework-atb-backward-compatibility is added to the
  bootclasspath instead of android.test.base.
* Any APK that targets pre-P (or has a dependency on android.test.runner)
  has android.test.base added to their library list.

Otherwise:
* The android.test.base library is added to the bootclasspath.
* Any APK that explicitly specifies that it depends on the
  android.test.base library has the library removed as the classes
  are available at runtime.

Added android.test.base to platform libraries so it can be used when
not on the bootclasspath.

Tested both cases by building with or without the build flag, flashing,
setting up, adding an account, adding a trusted place.

Also, tested that all combinations of REMOVE_ATB_FROM_BCP and
REMOVE_OAHL_FROM_BCP work.

adb install -r -g out/target/product/marlin/testcases/FrameworksCoreTests/FrameworksCoreTests.apk
adb shell am instrument -w -e class android.content.pm.PackageBackwardCompatibilityTest,android.content.pm.AndroidTestRunnerSplitUpdaterTest,android.content.pm.OrgApacheHttpLegacyUpdaterTest,android.content.pm.RemoveUnnecessaryOrgApacheHttpLegacyLibraryTest,android.content.pm.RemoveUnnecessaryAndroidTestBaseLibraryTest,android.content.pm.AndroidTestBaseUpdaterTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner

Bug: 30188076
Test: as above
Change-Id: I4b9d8a5bed6787cd334c2b13a458bbc0efc3f3b6
diff --git a/Android.bp b/Android.bp
index 28e51e7..26e3b91 100644
--- a/Android.bp
+++ b/Android.bp
@@ -645,8 +645,10 @@
         ],
     },
 
-    // See comment on framework-oahl-backward-compatibility module below
     exclude_srcs: [
+        // See comment on framework-atb-backward-compatibility module below
+        "core/java/android/content/pm/AndroidTestBaseUpdater.java",
+        // See comment on framework-oahl-backward-compatibility module below
         "core/java/android/content/pm/OrgApacheHttpLegacyUpdater.java",
     ],
 
@@ -699,6 +701,18 @@
     ],
 }
 
+// A temporary build target that is conditionally included on the bootclasspath if
+// android.test.base library has been removed and which provides support for
+// maintaining backwards compatibility for APKs that target pre-P and depend on
+// android.test.base classes. This is used iff REMOVE_ATB_FROM_BCP=true is
+// specified on the build command line.
+java_library {
+    name: "framework-atb-backward-compatibility",
+    srcs: [
+        "core/java/android/content/pm/AndroidTestBaseUpdater.java",
+    ],
+}
+
 genrule {
     name: "framework-statslog-gen",
     tools: ["stats-log-api-gen"],