Support conditional removal of oahl from bootclasspath
This makes the runtime handling of the org.apache.http.legacy library
conditional based on a build flag REMOVE_OAHL_FROM_BCP.
When REMOVE_OAHL_FROM_BCP=true:
* The framework-oahl-backward-compatibility is added to the
bootclasspath instead of org.apache.http.legacy.
* Any APK that targets pre-P has org.apache.http.legacy added to their
library list.
Otherwise:
* The org.apache.http.legacy library is added to the bootclasspath.
* Any APK that explicitly specifies that it depends on the
org.apache.http.legacy library has the library removed as the classes
are available at runtime.
Tested both cases by building with or without the build flag, flashing,
setting up, adding an account, adding a trusted place. Adding an account
failed when REMOVE_OAHL_FROM_BCP=true.
adb install -r -g out/target/product/marlin/testcases/FrameworksCoreTests/FrameworksCoreTests.apk
adb shell am instrument -w -e class android.content.pm.PackageBackwardCompatibilityTest com.android.frameworks.coretests/android.support.test.runner.AndroidJUnitRunner
Bug: 18027885
Bug: 72375096
Test: as above
Change-Id: Ie88fb79da76d3cbbd27eaf820c872191ecba2b17
diff --git a/Android.bp b/Android.bp
index 9e9faf2..c775d15 100644
--- a/Android.bp
+++ b/Android.bp
@@ -630,6 +630,11 @@
],
},
+ // See comment on framework-oahl-backward-compatibility module below
+ exclude_srcs: [
+ "core/java/android/content/pm/OrgApacheHttpLegacyUpdater.java",
+ ],
+
no_framework_libs: true,
libs: [
"conscrypt",
@@ -665,6 +670,18 @@
],
}
+// A temporary build target that is conditionally included on the bootclasspath if
+// org.apache.http.legacy library has been removed and which provides support for
+// maintaining backwards compatibility for APKs that target pre-P and depend on
+// org.apache.http.legacy classes. This is used iff REMOVE_OAHL_FROM_BCP=true is
+// specified on the build command line.
+java_library {
+ name: "framework-oahl-backward-compatibility",
+ srcs: [
+ "core/java/android/content/pm/OrgApacheHttpLegacyUpdater.java",
+ ],
+}
+
genrule {
name: "framework-statslog-gen",
tools: ["stats-log-api-gen"],