Remove org.apache.http.legacy for declared shared lib lists.

We currently unconditionally include this shared library in the
boot classpath, so attempts to compile it will fail resulting in
unnecessary logspam.

Change-Id: Iafe9b2e725e10d939cd39dd4a816a146a6031baf
diff --git a/core/java/android/content/pm/PackageParser.java b/core/java/android/content/pm/PackageParser.java
index e20057d..4b81fd4 100644
--- a/core/java/android/content/pm/PackageParser.java
+++ b/core/java/android/content/pm/PackageParser.java
@@ -2750,15 +2750,21 @@
             }
         }
 
-        addSharedLibrariesForBackwardCompatibility(owner);
+        modifySharedLibrariesForBackwardCompatibility(owner);
 
         return true;
     }
 
-    private static void addSharedLibrariesForBackwardCompatibility(Package owner) {
-        if (owner.applicationInfo.targetSdkVersion <= Build.VERSION_CODES.LOLLIPOP_MR1) {
-            owner.usesLibraries = ArrayUtils.add(owner.usesLibraries, "org.apache.http.legacy");
-        }
+    private static void modifySharedLibrariesForBackwardCompatibility(Package owner) {
+        // "org.apache.http.legacy" is now a part of the boot classpath so it doesn't need
+        // to be an explicit dependency.
+        //
+        // A future change will remove this library from the boot classpath, at which point
+        // all apps that target SDK 21 and earlier will have it automatically added to their
+        // dependency lists.
+        owner.usesLibraries = ArrayUtils.remove(owner.usesLibraries, "org.apache.http.legacy");
+        owner.usesOptionalLibraries = ArrayUtils.remove(owner.usesOptionalLibraries,
+                "org.apache.http.legacy");
     }
 
     /**