Package: workaround for applications relying on toString output.

*** THIS CHANGE WILL BE REVERTED IN A FUTURE ANDROID RELEASE ***

bug: 28057303
Change-Id: I7e0cebd3a6660ae922f0e8c380147efce91c4d0e
diff --git a/luni/src/test/java/libcore/java/lang/PackageTest.java b/luni/src/test/java/libcore/java/lang/PackageTest.java
index c004e23..269831f 100644
--- a/luni/src/test/java/libcore/java/lang/PackageTest.java
+++ b/luni/src/test/java/libcore/java/lang/PackageTest.java
@@ -37,6 +37,12 @@
         assertEquals(getClass().getPackage(), libcoreJavaLang);
     }
 
+    // http://b/28057303
+    public void test_toString() throws Exception {
+        Package libcoreJavaLang = Package.getPackage("libcore.java.lang");
+        assertEquals("package libcore.java.lang", libcoreJavaLang.toString());
+    }
+
     // http://b/5171136
     public void testGetPackages() {
         assertTrue(packages.contains(getClass().getPackage()));
diff --git a/ojluni/src/main/java/java/lang/Package.java b/ojluni/src/main/java/java/lang/Package.java
index 984317b..7157f9c 100755
--- a/ojluni/src/main/java/java/lang/Package.java
+++ b/ojluni/src/main/java/java/lang/Package.java
@@ -357,17 +357,25 @@
      * @return the string representation of the package.
      */
     public String toString() {
-        String spec = specTitle;
-        String ver =  specVersion;
-        if (spec != null && spec.length() > 0)
-            spec = ", " + spec;
-        else
-            spec = "";
-        if (ver != null && ver.length() > 0)
-            ver = ", version " + ver;
-        else
-            ver = "";
-        return "package " + pkgName + spec + ver;
+        // Android changed: Several apps try to parse the output of toString(). This is a really
+        // bad idea - especially when there's a Package.getName() function as well as a
+        // Class.getName() function that can be used instead.
+        //
+        // *** THIS CHANGE WILL BE REVERTED IN A FUTURE ANDROID RELEASE ***
+        //
+        // String spec = specTitle;
+        // String ver =  specVersion;
+        // if (spec != null && spec.length() > 0)
+        //     spec = ", " + spec;
+        // else
+        //     spec = "";
+        // if (ver != null && ver.length() > 0)
+        //     ver = ", version " + ver;
+        // else
+        //     ver = "";
+        // return "package " + pkgName + spec + ver;
+
+        return "package " + pkgName;
     }
 
     private Class<?> getPackageInfo() {