diff --git a/Android.mk b/Android.mk
index 849ec8c..d910d35 100644
--- a/Android.mk
+++ b/Android.mk
@@ -409,18 +409,22 @@
 	$(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
 
 framework_docs_LOCAL_INTERMEDIATE_SOURCES := \
-			$(framework_res_source_path)/android/R.java \
-			$(framework_res_source_path)/android/Manifest.java \
-			$(framework_res_source_path)/com/android/internal/R.java
+	$(framework_res_source_path)/android/R.java \
+	$(framework_res_source_path)/android/Manifest.java \
+	$(framework_res_source_path)/com/android/internal/R.java
+
+framework_docs_LOCAL_API_CHECK_JAVA_LIBRARIES := \
+	bouncycastle \
+	core \
+	ext \
+	framework \
+	mms-common \
+	telephony-common \
+	voip-common
 
 framework_docs_LOCAL_JAVA_LIBRARIES := \
-			bouncycastle \
-			core \
-			ext \
-			framework \
-			mms-common \
-			telephony-common \
-			voip-common \
+	$(framework_docs_LOCAL_API_CHECK_JAVA_LIBRARIES) \
+	$(FRAMEWORKS_SUPPORT_JAVA_LIBRARIES)
 
 framework_docs_LOCAL_MODULE_CLASS := JAVA_LIBRARIES
 framework_docs_LOCAL_DROIDDOC_HTML_DIR := docs/html
@@ -449,7 +453,12 @@
 		-werror -hide 113 \
 		-overview $(LOCAL_PATH)/core/java/overview.html
 
-framework_docs_LOCAL_ADDITIONAL_JAVA_DIR:= $(call intermediates-dir-for,JAVA_LIBRARIES,framework,,COMMON)
+framework_docs_LOCAL_API_CHECK_ADDITIONAL_JAVA_DIR:= \
+	$(call intermediates-dir-for,JAVA_LIBRARIES,framework,,COMMON)
+
+framework_docs_LOCAL_ADDITIONAL_JAVA_DIR:= \
+	$(framework_docs_LOCAL_API_CHECK_ADDITIONAL_JAVA_DIR) \
+	$(foreach lib,$(FRAMEWORKS_SUPPORT_JAVA_LIBRARIES),$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON))
 
 framework_docs_LOCAL_ADDITIONAL_DEPENDENCIES := \
     frameworks/base/docs/knowntags.txt
@@ -571,11 +580,11 @@
 
 LOCAL_SRC_FILES:=$(framework_docs_LOCAL_API_CHECK_SRC_FILES)
 LOCAL_INTERMEDIATE_SOURCES:=$(framework_docs_LOCAL_INTERMEDIATE_SOURCES)
-LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_JAVA_LIBRARIES)
+LOCAL_JAVA_LIBRARIES:=$(framework_docs_LOCAL_API_CHECK_JAVA_LIBRARIES)
 LOCAL_MODULE_CLASS:=$(framework_docs_LOCAL_MODULE_CLASS)
 LOCAL_DROIDDOC_SOURCE_PATH:=$(framework_docs_LOCAL_DROIDDOC_SOURCE_PATH)
 LOCAL_DROIDDOC_HTML_DIR:=$(framework_docs_LOCAL_DROIDDOC_HTML_DIR)
-LOCAL_ADDITIONAL_JAVA_DIR:=$(framework_docs_LOCAL_ADDITIONAL_JAVA_DIR)
+LOCAL_ADDITIONAL_JAVA_DIR:=$(framework_docs_LOCAL_API_CHECK_ADDITIONAL_JAVA_DIR)
 LOCAL_ADDITIONAL_DEPENDENCIES:=$(framework_docs_LOCAL_ADDITIONAL_DEPENDENCIES)
 
 LOCAL_MODULE := api-stubs
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 60f3f32..4dcbaec 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -3548,7 +3548,7 @@
         <attr name="dropDownWidth" />
         <!-- Reference to a layout to use for displaying a prompt in the dropdown for
              spinnerMode="dropdown". This layout must contain a TextView with the id
-             @android:id/text1 to be populated with the prompt text. -->
+             {@code @android:id/text1} to be populated with the prompt text. -->
         <attr name="popupPromptView" format="reference" />
         <!-- Gravity setting for positioning the currently selected item. -->
         <attr name="gravity" />
diff --git a/tools/aapt/Resource.cpp b/tools/aapt/Resource.cpp
index 77168f9..6168bbd 100644
--- a/tools/aapt/Resource.cpp
+++ b/tools/aapt/Resource.cpp
@@ -1568,11 +1568,37 @@
     return whitespace + sizeof(whitespace) - 1 - indent*4;
 }
 
-static status_t fixupSymbol(String16* inoutSymbol)
-{
-    inoutSymbol->replaceAll('.', '_');
-    inoutSymbol->replaceAll(':', '_');
-    return NO_ERROR;
+static String8 flattenSymbol(const String8& symbol) {
+    String8 result(symbol);
+    ssize_t first;
+    if ((first = symbol.find(":", 0)) >= 0
+            || (first = symbol.find(".", 0)) >= 0) {
+        size_t size = symbol.size();
+        char* buf = result.lockBuffer(size);
+        for (size_t i = first; i < size; i++) {
+            if (buf[i] == ':' || buf[i] == '.') {
+                buf[i] = '_';
+            }
+        }
+        result.unlockBuffer(size);
+    }
+    return result;
+}
+
+static String8 getSymbolPackage(const String8& symbol, const sp<AaptAssets>& assets, bool pub) {
+    ssize_t colon = symbol.find(":", 0);
+    if (colon >= 0) {
+        return String8(symbol.string(), colon);
+    }
+    return pub ? assets->getPackage() : assets->getSymbolsPrivatePackage();
+}
+
+static String8 getSymbolName(const String8& symbol) {
+    ssize_t colon = symbol.find(":", 0);
+    if (colon >= 0) {
+        return String8(symbol.string() + colon + 1);
+    }
+    return symbol;
 }
 
 static String16 getAttributeComment(const sp<AaptAssets>& assets,
@@ -1616,12 +1642,8 @@
     size_t N = symbols->getNestedSymbols().size();
     for (i=0; i<N; i++) {
         sp<AaptSymbols> nsymbols = symbols->getNestedSymbols().valueAt(i);
-        String16 nclassName16(symbols->getNestedSymbols().keyAt(i));
-        String8 realClassName(nclassName16);
-        if (fixupSymbol(&nclassName16) != NO_ERROR) {
-            hasErrors = true;
-        }
-        String8 nclassName(nclassName16);
+        String8 realClassName(symbols->getNestedSymbols().keyAt(i));
+        String8 nclassName(flattenSymbol(realClassName));
 
         SortedVector<uint32_t> idents;
         Vector<uint32_t> origOrder;
@@ -1711,13 +1733,11 @@
                     }
                     comment = String16(comment.string(), p-comment.string());
                 }
-                String16 name(name8);
-                fixupSymbol(&name);
                 fprintf(fp, "%s   <tr><td><code>{@link #%s_%s %s:%s}</code></td><td>%s</td></tr>\n",
                         indentStr, nclassName.string(),
-                        String8(name).string(),
-                        assets->getPackage().string(),
-                        String8(name).string(),
+                        flattenSymbol(name8).string(),
+                        getSymbolPackage(name8, assets, true).string(),
+                        getSymbolName(name8).string(),
                         String8(comment).string());
             }
         }
@@ -1731,11 +1751,9 @@
                 if (!publicFlags.itemAt(a) && !includePrivate) {
                     continue;
                 }
-                String16 name(sym.name);
-                fixupSymbol(&name);
                 fprintf(fp, "%s   @see #%s_%s\n",
                         indentStr, nclassName.string(),
-                        String8(name).string());
+                        flattenSymbol(sym.name).string());
             }
         }
         fprintf(fp, "%s */\n", getIndentSpace(indent));
@@ -1778,11 +1796,7 @@
                 } else {
                     getAttributeComment(assets, name8, &typeComment);
                 }
-                String16 name(name8);
-                if (fixupSymbol(&name) != NO_ERROR) {
-                    hasErrors = true;
-                }
-                
+
                 uint32_t typeSpecFlags = 0;
                 String16 name16(sym.name);
                 assets->getIncludedResources().identifierForName(
@@ -1808,9 +1822,8 @@
                             "%s  <p>This symbol is the offset where the {@link %s.R.attr#%s}\n"
                             "%s  attribute's value can be found in the {@link #%s} array.\n",
                             indentStr,
-                            pub ? assets->getPackage().string()
-                                : assets->getSymbolsPrivatePackage().string(),
-                            String8(name).string(),
+                            getSymbolPackage(name8, assets, pub).string(),
+                            getSymbolName(name8).string(),
                             indentStr, nclassName.string());
                 }
                 if (typeComment.size() > 0) {
@@ -1823,18 +1836,19 @@
                 if (comment.size() > 0) {
                     if (pub) {
                         fprintf(fp,
-                                "%s  <p>This corresponds to the global attribute"
+                                "%s  <p>This corresponds to the global attribute\n"
                                 "%s  resource symbol {@link %s.R.attr#%s}.\n",
                                 indentStr, indentStr,
-                                assets->getPackage().string(),
-                                String8(name).string());
+                                getSymbolPackage(name8, assets, true).string(),
+                                getSymbolName(name8).string());
                     } else {
                         fprintf(fp,
                                 "%s  <p>This is a private symbol.\n", indentStr);
                     }
                 }
                 fprintf(fp, "%s  @attr name %s:%s\n", indentStr,
-                        "android", String8(name).string());
+                        getSymbolPackage(name8, assets, pub).string(),
+                        getSymbolName(name8).string());
                 fprintf(fp, "%s*/\n", indentStr);
                 if (deprecated) {
                     fprintf(fp, "%s@Deprecated\n", indentStr);
@@ -1842,7 +1856,7 @@
                 fprintf(fp,
                         "%spublic static final int %s_%s = %d;\n",
                         indentStr, nclassName.string(),
-                        String8(name).string(), (int)pos);
+                        flattenSymbol(name8).string(), (int)pos);
             }
         }
     }
@@ -1865,12 +1879,8 @@
     size_t N = symbols->getNestedSymbols().size();
     for (i=0; i<N; i++) {
         sp<AaptSymbols> nsymbols = symbols->getNestedSymbols().valueAt(i);
-        String16 nclassName16(symbols->getNestedSymbols().keyAt(i));
-        String8 realClassName(nclassName16);
-        if (fixupSymbol(&nclassName16) != NO_ERROR) {
-            hasErrors = true;
-        }
-        String8 nclassName(nclassName16);
+        String8 realClassName(symbols->getNestedSymbols().keyAt(i));
+        String8 nclassName(flattenSymbol(realClassName));
 
         SortedVector<uint32_t> idents;
         Vector<uint32_t> origOrder;
@@ -1930,10 +1940,6 @@
                 } else {
                     getAttributeComment(assets, name8, &typeComment);
                 }
-                String16 name(name8);
-                if (fixupSymbol(&name) != NO_ERROR) {
-                    hasErrors = true;
-                }
 
                 uint32_t typeSpecFlags = 0;
                 String16 name16(sym.name);
@@ -1948,7 +1954,7 @@
                 fprintf(fp,
                         "int styleable %s_%s %d\n",
                         nclassName.string(),
-                        String8(name).string(), (int)pos);
+                        flattenSymbol(name8).string(), (int)pos);
             }
         }
     }
@@ -1982,10 +1988,7 @@
         if (!assets->isJavaSymbol(sym, includePrivate)) {
             continue;
         }
-        String16 name(sym.name);
-        if (fixupSymbol(&name) != NO_ERROR) {
-            return UNKNOWN_ERROR;
-        }
+        String8 name8(sym.name);
         String16 comment(sym.comment);
         bool haveComment = false;
         bool deprecated = false;
@@ -2026,7 +2029,7 @@
         }
         fprintf(fp, id_format,
                 getIndentSpace(indent),
-                String8(name).string(), (int)sym.int32Val);
+                flattenSymbol(name8).string(), (int)sym.int32Val);
     }
 
     for (i=0; i<N; i++) {
@@ -2037,10 +2040,7 @@
         if (!assets->isJavaSymbol(sym, includePrivate)) {
             continue;
         }
-        String16 name(sym.name);
-        if (fixupSymbol(&name) != NO_ERROR) {
-            return UNKNOWN_ERROR;
-        }
+        String8 name8(sym.name);
         String16 comment(sym.comment);
         bool deprecated = false;
         if (comment.size() > 0) {
@@ -2063,7 +2063,7 @@
         }
         fprintf(fp, "%spublic static final String %s=\"%s\";\n",
                 getIndentSpace(indent),
-                String8(name).string(), sym.stringVal.string());
+                flattenSymbol(name8).string(), sym.stringVal.string());
     }
 
     sp<AaptSymbols> styleableSymbols;
@@ -2112,14 +2112,10 @@
             continue;
         }
 
-        String16 name(sym.name);
-        if (fixupSymbol(&name) != NO_ERROR) {
-            return UNKNOWN_ERROR;
-        }
-
+        String8 name8(sym.name);
         fprintf(fp, "int %s %s 0x%08x\n",
                 className.string(),
-                String8(name).string(), (int)sym.int32Val);
+                flattenSymbol(name8).string(), (int)sym.int32Val);
     }
 
     N = symbols->getNestedSymbols().size();
