Merge "TextLayoutCache - more code refactoring"
diff --git a/core/java/android/server/BluetoothAdapterProperties.java b/core/java/android/server/BluetoothAdapterProperties.java
index ae8104b..9723f60 100644
--- a/core/java/android/server/BluetoothAdapterProperties.java
+++ b/core/java/android/server/BluetoothAdapterProperties.java
@@ -76,14 +76,13 @@
         for (int i = 0; i < properties.length; i++) {
             String name = properties[i];
             String newValue = null;
-            int len;
             if (name == null) {
                 Log.e(TAG, "Error:Adapter Property at index " + i + " is null");
                 continue;
             }
             if (name.equals("Devices") || name.equals("UUIDs")) {
                 StringBuilder str = new StringBuilder();
-                len = Integer.valueOf(properties[++i]);
+                int len = Integer.valueOf(properties[++i]);
                 for (int j = 0; j < len; j++) {
                     str.append(properties[++i]);
                     str.append(",");
diff --git a/core/jni/android_server_BluetoothService.cpp b/core/jni/android_server_BluetoothService.cpp
index 158e475..5c6958a 100644
--- a/core/jni/android_server_BluetoothService.cpp
+++ b/core/jni/android_server_BluetoothService.cpp
@@ -695,9 +695,7 @@
            str_array =  parse_remote_device_properties(env, &iter);
         dbus_message_unref(reply);
 
-        env->PopLocalFrame(NULL);
-
-        return str_array;
+        return (jobjectArray) env->PopLocalFrame(str_array);
     }
 #endif
     return NULL;
@@ -731,8 +729,7 @@
             str_array = parse_adapter_properties(env, &iter);
         dbus_message_unref(reply);
 
-        env->PopLocalFrame(NULL);
-        return str_array;
+        return (jobjectArray) env->PopLocalFrame(str_array);
     }
 #endif
     return NULL;
diff --git a/docs/html/guide/topics/data/data-storage.jd b/docs/html/guide/topics/data/data-storage.jd
index e20d1ed..d31afa5 100644
--- a/docs/html/guide/topics/data/data-storage.jd
+++ b/docs/html/guide/topics/data/data-storage.jd
@@ -16,9 +16,22 @@
   <h2>In this document</h2>
   <ol>
     <li><a href="#pref">Using Shared Preferences</a></li>
-    <li><a href="#filesInternal">Using the Internal Storage</a></li>
-    <li><a href="#filesExternal">Using the External Storage</a></li>
-    <li><a href="#db">Using Databases</a></li>
+    <li><a href="#filesInternal">Using the Internal Storage</a>
+      <ol>
+        <li><a href="#InternalCache">Saving cache files</a></li>
+        <li><a href="#InternalMethods">Other useful methods</a></li>
+      </ol></li>
+    <li><a href="#filesExternal">Using the External Storage</a>
+      <ol>
+        <li><a href="#MediaAvail">Checking media availability</a></li>
+        <li><a href="#AccessingExtFiles">Accessing files on external storage</a></li>
+        <li><a href="#SavingSharedFiles">Saving files that should be shared</a></li>
+        <li><a href="#ExternalCache">Saving cache files</a></li>
+      </ol></li>
+    <li><a href="#db">Using Databases</a>
+      <ol>
+        <li><a href="#dbDebugging">Database debugging</a></li>
+      </ol></li>
     <li><a href="#netw">Using a Network Connection</a></li>
   </ol>
 
@@ -238,7 +251,7 @@
 storage and the user can remove them.</p>
 
 
-<h3>Checking media availability</h3>
+<h3 id="MediaAvail">Checking media availability</h3>
 
 <p>Before you do any work with the external storage, you should always call {@link
 android.os.Environment#getExternalStorageState()} to check whether the media is available. The
@@ -271,7 +284,7 @@
 when your application needs to access the media.</p>
 
 
-<h3>Accessing files on external storage</h3>
+<h3 id="AccessingExtFiles">Accessing files on external storage</h3>
 
 <p>If you're using API Level 8 or greater, use {@link
 android.content.Context#getExternalFilesDir(String) getExternalFilesDir()} to open a {@link
@@ -310,7 +323,7 @@
 </div>
 
 
-<h3>Saving files that should be shared</h3>
+<h3 id="SavingSharedFiles">Saving files that should be shared</h3>
 
 <p>If you want to save files that are not specific to your application and that should <em>not</em>
 be deleted when your application is uninstalled, save them to one of the public directories on the
diff --git a/docs/html/guide/topics/fundamentals/fragments.jd b/docs/html/guide/topics/fundamentals/fragments.jd
index f780960..3908a7c 100644
--- a/docs/html/guide/topics/fundamentals/fragments.jd
+++ b/docs/html/guide/topics/fundamentals/fragments.jd
@@ -515,7 +515,7 @@
 </pre>
 
 
-<h4 id="EventCallbacks">Creating event callbacks to the activity</h4>
+<h3 id="EventCallbacks">Creating event callbacks to the activity</h3>
 
 <p>In some cases, you might need a fragment to share events with the activity. A good way to do that
 is to define a callback interface inside the fragment and require that the host activity implement
diff --git a/docs/html/guide/topics/nfc/index.jd b/docs/html/guide/topics/nfc/index.jd
index f907b70..b486d3b 100644
--- a/docs/html/guide/topics/nfc/index.jd
+++ b/docs/html/guide/topics/nfc/index.jd
@@ -1,35 +1,24 @@
 page.title=Near Field Communication
 @jd:body
 
-  <div id="qv-wrapper">
-    <div id="qv">
-      <h2>Near Field Communication quickview</h2>
-
+<div id="qv-wrapper">
+<div id="qv">
+  <h2>In this document</h2>
+  <ol>
+    <li><a href="#api">API Overview</a></li>
+    <li><a href="#manifest">Declaring Android Manifest elements</a></li>
+    <li><a href="#dispatch">The Tag Dispatch System</a>
       <ol>
-        <li><a href="#api">API Overview</a></li>
-
-        <li><a href="#manifest">Declaring Android Manifest Elements</a></li>
-
-        <li>
-          <a href="#dispatch">The Tag Dispatch System</a>
-
-          <ol>
-            <li><a href="#intent-dispatch">Using the intent dispatch system</a></li>
-            
-            <li><a href="#foreground-dispatch">Using the foreground dispatch system</a></li>
-          </ol>
-        </li>
-
-        <li><a href="#ndef">NDEF Messages</a></li>
-
-        <li><a href="#read">Reading an NFC Tag</a></li>
-
-        <li><a href="#write">Writing to an NFC Tag</a></li>
-
-        <li><a href="#p2p">Peer to Peer Data Exchange</a></li>
-      </ol>
-    </div>
-  </div>
+        <li><a href="#intent-dispatch">Using the intent dispatch system</a></li>
+        <li><a href="#foreground-dispatch">Using the foreground dispatch system</a></li>
+      </ol></li>
+    <li><a href="#ndef">Working with Data on NFC Tags</a></li>
+    <li><a href="#read">Reading an NFC Tag</a></li>
+    <li><a href="#write">Writing to an NFC Tag</a></li>
+    <li><a href="#p2p">Peer-to-Peer Data Exchange</a></li>
+  </ol>
+</div>
+</div>
 
   <p>Near Field Communication (NFC) is a set of short-range wireless technologies, typically
   requiring a distance of 4cm or less. NFC operates at 13.56mhz, and at rates ranging from 106
diff --git a/docs/html/guide/topics/wireless/bluetooth.jd b/docs/html/guide/topics/wireless/bluetooth.jd
index ae078b9..48632ea 100644
--- a/docs/html/guide/topics/wireless/bluetooth.jd
+++ b/docs/html/guide/topics/wireless/bluetooth.jd
@@ -18,18 +18,13 @@
     <li><a href="#FindingDevices">Finding Devices</a>
       <ol>
         <li><a href="#QueryingPairedDevices">Querying paired devices</a></li>
-        <li><a href="#DiscoveringDevices">Discovering devices</a>
-          <ol><li><a href="#EnablingDiscoverability">Enabling
-                  discoverability</a></li></ol>
-        </li>
-      </ol>
-    </li>
+        <li><a href="#DiscoveringDevices">Discovering devices</a></li>
+      </ol></li>
     <li><a href="#ConnectingDevices">Connecting Devices</a>
       <ol>
         <li><a href="#ConnectingAsAServer">Connecting as a server</a></li>
         <li><a href="#ConnectingAsAClient">Connecting as a client</a></li>
-      </ol>
-    </li>
+      </ol></li>
     <li><a href="#ManagingAConnection">Managing a Connection</a></li>
   </ol>