Loading Android.bp +0 −2 Original line number Diff line number Diff line Loading @@ -719,8 +719,6 @@ java_defaults { 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", ], no_framework_libs: true, Loading core/java/android/content/pm/OrgApacheHttpLegacyUpdater.java +0 −6 Original line number Diff line number Diff line Loading @@ -25,12 +25,6 @@ import com.android.internal.annotations.VisibleForTesting; * Updates a package to ensure that if it targets < P that the org.apache.http.legacy library is * included by default. * * <p>This is separated out so that it can be conditionally included at build time depending on * whether org.apache.http.legacy is on the bootclasspath or not. In order to include this at * build time, and remove org.apache.http.legacy from the bootclasspath pass * REMOVE_OAHL_FROM_BCP=true on the build command line, otherwise this class will not be included * and the * * @hide */ @VisibleForTesting Loading core/java/android/content/pm/PackageBackwardCompatibility.java +5 −20 Original line number Diff line number Diff line Loading @@ -45,13 +45,9 @@ public class PackageBackwardCompatibility extends PackageSharedLibraryUpdater { static { final List<PackageSharedLibraryUpdater> packageUpdaters = new ArrayList<>(); // Attempt to load and add the optional updater that will only be available when // REMOVE_OAHL_FROM_BCP=true. If that could not be found then add the default updater that // will remove any references to org.apache.http.library from the package so that it does // not try and load the library when it is on the bootclasspath. boolean bootClassPathContainsOAHL = !addOptionalUpdater(packageUpdaters, "android.content.pm.OrgApacheHttpLegacyUpdater", RemoveUnnecessaryOrgApacheHttpLegacyLibrary::new); // Automatically add the org.apache.http.legacy library to the app classpath if the app // targets < P. packageUpdaters.add(new OrgApacheHttpLegacyUpdater()); packageUpdaters.add(new AndroidHidlUpdater()); Loading @@ -70,7 +66,7 @@ public class PackageBackwardCompatibility extends PackageSharedLibraryUpdater { PackageSharedLibraryUpdater[] updaterArray = packageUpdaters .toArray(new PackageSharedLibraryUpdater[0]); INSTANCE = new PackageBackwardCompatibility( bootClassPathContainsOAHL, bootClassPathContainsATB, updaterArray); bootClassPathContainsATB, updaterArray); } /** Loading Loading @@ -116,15 +112,12 @@ public class PackageBackwardCompatibility extends PackageSharedLibraryUpdater { return INSTANCE; } private final boolean mBootClassPathContainsOAHL; private final boolean mBootClassPathContainsATB; private final PackageSharedLibraryUpdater[] mPackageUpdaters; public PackageBackwardCompatibility(boolean bootClassPathContainsOAHL, public PackageBackwardCompatibility( boolean bootClassPathContainsATB, PackageSharedLibraryUpdater[] packageUpdaters) { this.mBootClassPathContainsOAHL = bootClassPathContainsOAHL; this.mBootClassPathContainsATB = bootClassPathContainsATB; this.mPackageUpdaters = packageUpdaters; } Loading @@ -147,14 +140,6 @@ public class PackageBackwardCompatibility extends PackageSharedLibraryUpdater { } } /** * True if the org.apache.http.legacy is on the bootclasspath, false otherwise. */ @VisibleForTesting public static boolean bootClassPathContainsOAHL() { return INSTANCE.mBootClassPathContainsOAHL; } /** * True if the android.test.base is on the bootclasspath, false otherwise. */ Loading core/tests/coretests/src/android/content/pm/PackageBackwardCompatibilityTest.java +3 −39 Original line number Diff line number Diff line Loading @@ -47,22 +47,12 @@ public class PackageBackwardCompatibilityTest extends PackageSharedLibraryUpdate checkBackwardsCompatibility(before, after); } /** * Detect when the org.apache.http.legacy is not on the bootclasspath. * * <p>This test will be ignored when org.apache.http.legacy is not on the bootclasspath and * succeed otherwise. This allows a developer to ensure that the tests are being */ @Test public void detectWhenOAHLisOnBCP() { Assume.assumeTrue(PackageBackwardCompatibility.bootClassPathContainsOAHL()); } /** * Detect when the android.test.base is not on the bootclasspath. * * <p>This test will be ignored when org.apache.http.legacy is not on the bootclasspath and * succeed otherwise. This allows a developer to ensure that the tests are being * succeed otherwise. This allows a developer to ensure that the tests are being run in the * correct environment. */ @Test public void detectWhenATBisOnBCP() { Loading @@ -85,9 +75,7 @@ public class PackageBackwardCompatibilityTest extends PackageSharedLibraryUpdate if (!PackageBackwardCompatibility.bootClassPathContainsATB()) { expected.add(ANDROID_TEST_BASE); } if (!PackageBackwardCompatibility.bootClassPathContainsOAHL()) { expected.add(ORG_APACHE_HTTP_LEGACY); } PackageBuilder after = builder() .targetSdkVersion(Build.VERSION_CODES.O) Loading @@ -96,30 +84,6 @@ public class PackageBackwardCompatibilityTest extends PackageSharedLibraryUpdate checkBackwardsCompatibility(before, after); } /** * Ensures that the {@link PackageBackwardCompatibility} uses * {@link RemoveUnnecessaryOrgApacheHttpLegacyLibraryTest} * when necessary. * * <p>More comprehensive tests for that class can be found in * {@link RemoveUnnecessaryOrgApacheHttpLegacyLibraryTest}. */ @Test public void org_apache_http_legacy_in_usesLibraries() { Assume.assumeTrue("Test requires that " + ORG_APACHE_HTTP_LEGACY + " is on the bootclasspath", PackageBackwardCompatibility.bootClassPathContainsOAHL()); PackageBuilder before = builder() .requiredLibraries(ORG_APACHE_HTTP_LEGACY); // org.apache.http.legacy should be removed from the libraries because it is provided // on the bootclasspath and providing both increases start up cost unnecessarily. PackageBuilder after = builder(); checkBackwardsCompatibility(before, after); } /** * Ensures that the {@link PackageBackwardCompatibility} uses * {@link RemoveUnnecessaryAndroidTestBaseLibrary} Loading Loading
Android.bp +0 −2 Original line number Diff line number Diff line Loading @@ -719,8 +719,6 @@ java_defaults { 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", ], no_framework_libs: true, Loading
core/java/android/content/pm/OrgApacheHttpLegacyUpdater.java +0 −6 Original line number Diff line number Diff line Loading @@ -25,12 +25,6 @@ import com.android.internal.annotations.VisibleForTesting; * Updates a package to ensure that if it targets < P that the org.apache.http.legacy library is * included by default. * * <p>This is separated out so that it can be conditionally included at build time depending on * whether org.apache.http.legacy is on the bootclasspath or not. In order to include this at * build time, and remove org.apache.http.legacy from the bootclasspath pass * REMOVE_OAHL_FROM_BCP=true on the build command line, otherwise this class will not be included * and the * * @hide */ @VisibleForTesting Loading
core/java/android/content/pm/PackageBackwardCompatibility.java +5 −20 Original line number Diff line number Diff line Loading @@ -45,13 +45,9 @@ public class PackageBackwardCompatibility extends PackageSharedLibraryUpdater { static { final List<PackageSharedLibraryUpdater> packageUpdaters = new ArrayList<>(); // Attempt to load and add the optional updater that will only be available when // REMOVE_OAHL_FROM_BCP=true. If that could not be found then add the default updater that // will remove any references to org.apache.http.library from the package so that it does // not try and load the library when it is on the bootclasspath. boolean bootClassPathContainsOAHL = !addOptionalUpdater(packageUpdaters, "android.content.pm.OrgApacheHttpLegacyUpdater", RemoveUnnecessaryOrgApacheHttpLegacyLibrary::new); // Automatically add the org.apache.http.legacy library to the app classpath if the app // targets < P. packageUpdaters.add(new OrgApacheHttpLegacyUpdater()); packageUpdaters.add(new AndroidHidlUpdater()); Loading @@ -70,7 +66,7 @@ public class PackageBackwardCompatibility extends PackageSharedLibraryUpdater { PackageSharedLibraryUpdater[] updaterArray = packageUpdaters .toArray(new PackageSharedLibraryUpdater[0]); INSTANCE = new PackageBackwardCompatibility( bootClassPathContainsOAHL, bootClassPathContainsATB, updaterArray); bootClassPathContainsATB, updaterArray); } /** Loading Loading @@ -116,15 +112,12 @@ public class PackageBackwardCompatibility extends PackageSharedLibraryUpdater { return INSTANCE; } private final boolean mBootClassPathContainsOAHL; private final boolean mBootClassPathContainsATB; private final PackageSharedLibraryUpdater[] mPackageUpdaters; public PackageBackwardCompatibility(boolean bootClassPathContainsOAHL, public PackageBackwardCompatibility( boolean bootClassPathContainsATB, PackageSharedLibraryUpdater[] packageUpdaters) { this.mBootClassPathContainsOAHL = bootClassPathContainsOAHL; this.mBootClassPathContainsATB = bootClassPathContainsATB; this.mPackageUpdaters = packageUpdaters; } Loading @@ -147,14 +140,6 @@ public class PackageBackwardCompatibility extends PackageSharedLibraryUpdater { } } /** * True if the org.apache.http.legacy is on the bootclasspath, false otherwise. */ @VisibleForTesting public static boolean bootClassPathContainsOAHL() { return INSTANCE.mBootClassPathContainsOAHL; } /** * True if the android.test.base is on the bootclasspath, false otherwise. */ Loading
core/tests/coretests/src/android/content/pm/PackageBackwardCompatibilityTest.java +3 −39 Original line number Diff line number Diff line Loading @@ -47,22 +47,12 @@ public class PackageBackwardCompatibilityTest extends PackageSharedLibraryUpdate checkBackwardsCompatibility(before, after); } /** * Detect when the org.apache.http.legacy is not on the bootclasspath. * * <p>This test will be ignored when org.apache.http.legacy is not on the bootclasspath and * succeed otherwise. This allows a developer to ensure that the tests are being */ @Test public void detectWhenOAHLisOnBCP() { Assume.assumeTrue(PackageBackwardCompatibility.bootClassPathContainsOAHL()); } /** * Detect when the android.test.base is not on the bootclasspath. * * <p>This test will be ignored when org.apache.http.legacy is not on the bootclasspath and * succeed otherwise. This allows a developer to ensure that the tests are being * succeed otherwise. This allows a developer to ensure that the tests are being run in the * correct environment. */ @Test public void detectWhenATBisOnBCP() { Loading @@ -85,9 +75,7 @@ public class PackageBackwardCompatibilityTest extends PackageSharedLibraryUpdate if (!PackageBackwardCompatibility.bootClassPathContainsATB()) { expected.add(ANDROID_TEST_BASE); } if (!PackageBackwardCompatibility.bootClassPathContainsOAHL()) { expected.add(ORG_APACHE_HTTP_LEGACY); } PackageBuilder after = builder() .targetSdkVersion(Build.VERSION_CODES.O) Loading @@ -96,30 +84,6 @@ public class PackageBackwardCompatibilityTest extends PackageSharedLibraryUpdate checkBackwardsCompatibility(before, after); } /** * Ensures that the {@link PackageBackwardCompatibility} uses * {@link RemoveUnnecessaryOrgApacheHttpLegacyLibraryTest} * when necessary. * * <p>More comprehensive tests for that class can be found in * {@link RemoveUnnecessaryOrgApacheHttpLegacyLibraryTest}. */ @Test public void org_apache_http_legacy_in_usesLibraries() { Assume.assumeTrue("Test requires that " + ORG_APACHE_HTTP_LEGACY + " is on the bootclasspath", PackageBackwardCompatibility.bootClassPathContainsOAHL()); PackageBuilder before = builder() .requiredLibraries(ORG_APACHE_HTTP_LEGACY); // org.apache.http.legacy should be removed from the libraries because it is provided // on the bootclasspath and providing both increases start up cost unnecessarily. PackageBuilder after = builder(); checkBackwardsCompatibility(before, after); } /** * Ensures that the {@link PackageBackwardCompatibility} uses * {@link RemoveUnnecessaryAndroidTestBaseLibrary} Loading