cherrypick Change-Id: I653e91a47979b24e7ecfcbce013c4ffaaa3c55ee
docs: edit manifest samples to indicate <application> element is always last

Change-Id: I993d130c26efd87147913d5607a2e7f15bd12fe8
diff --git a/docs/html/guide/appendix/api-levels.jd b/docs/html/guide/appendix/api-levels.jd
index 50e5149..5898fe5 100644
--- a/docs/html/guide/appendix/api-levels.jd
+++ b/docs/html/guide/appendix/api-levels.jd
@@ -160,7 +160,6 @@
 element might look like this: </p>
 
 <pre>&lt;manifest&gt;
-  ...
   &lt;uses-sdk android:minSdkVersion="5" /&gt;
   ...
 &lt;/manifest&gt;</pre>
diff --git a/docs/html/guide/developing/eclipse-adt.jd b/docs/html/guide/developing/eclipse-adt.jd
index 1594159..e8d2416 100644
--- a/docs/html/guide/developing/eclipse-adt.jd
+++ b/docs/html/guide/developing/eclipse-adt.jd
@@ -541,7 +541,6 @@
     &lt;activity android:name="GameActivity" /&gt;
     ...
   &lt;/application&gt;
-  ...
 &lt;/manifest&gt;</pre>
 
 
@@ -611,7 +610,6 @@
     &lt;activity android:name="com.example.android.tictactoe.library.GameActivity" /&gt;
     ...
   &lt;/application&gt;
-  ...
 &lt;/manifest&gt;</pre>
 
 <p>For more information about the manifest file, see the documentation for <a
diff --git a/docs/html/guide/developing/other-ide.jd b/docs/html/guide/developing/other-ide.jd
index 8c61771a..95b3680 100644
--- a/docs/html/guide/developing/other-ide.jd
+++ b/docs/html/guide/developing/other-ide.jd
@@ -700,7 +700,6 @@
     &lt;activity android:name="GameActivity" /&gt;
     ...
   &lt;/application&gt;
-  ...
 &lt;/manifest&gt;</pre>
 
 <h4>Updating a library project</h4>
@@ -796,7 +795,6 @@
     &lt;activity android:name="com.example.android.tictactoe.library.GameActivity" /&gt;
     ...
   &lt;/application&gt;
-  ...
 &lt;/manifest&gt;</pre>
 
 <p>For more information about the manifest file, see the documentation for <a
diff --git a/docs/html/guide/practices/screens_support.jd b/docs/html/guide/practices/screens_support.jd
index 7811d90..b70be07 100644
--- a/docs/html/guide/practices/screens_support.jd
+++ b/docs/html/guide/practices/screens_support.jd
@@ -693,13 +693,13 @@
 
 <pre>
 &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"&gt;
-    ...
     &lt;supports-screens
         android:smallScreens="true"
         android:normalScreens="true"
         android:largeScreens="true"
         android:xlargeScreens="true"
         android:anyDensity="true" /&gt;
+    ...
 &lt;/manifest&gt;
 </pre>
 <!--  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; android:resizeable="true" -->
diff --git a/docs/html/guide/publishing/licensing.jd b/docs/html/guide/publishing/licensing.jd
index fc83ec0..40439f0 100644
--- a/docs/html/guide/publishing/licensing.jd
+++ b/docs/html/guide/publishing/licensing.jd
@@ -784,7 +784,6 @@
 <pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
 
 &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" ..."&gt;
-    ...
     &lt;!-- Devices &gt;= 3 have version of Android Market that supports licensing. --&gt;
     &lt;uses-sdk android:minSdkVersion="3" /&gt;
     &lt;!-- Required permission to check licensing. --&gt;
diff --git a/docs/html/guide/topics/data/backup.jd b/docs/html/guide/topics/data/backup.jd
index 623ee22..7661a0e 100644
--- a/docs/html/guide/topics/data/backup.jd
+++ b/docs/html/guide/topics/data/backup.jd
@@ -166,6 +166,7 @@
 
 <pre>
 &lt;manifest ... &gt;
+    ...
     &lt;application android:label="MyApplication"
                  <b>android:backupAgent="MyBackupAgent"</b>&gt;
         &lt;activity ... &gt;
diff --git a/docs/html/guide/topics/manifest/manifest-intro.jd b/docs/html/guide/topics/manifest/manifest-intro.jd
index efbfa5a..d7a3e3e 100644
--- a/docs/html/guide/topics/manifest/manifest-intro.jd
+++ b/docs/html/guide/topics/manifest/manifest-intro.jd
@@ -441,6 +441,7 @@
 <pre>
 &lt;manifest . . . &gt;
     &lt;permission android:name="com.example.project.DEBIT_ACCT" . . . /&gt;
+    &lt;uses-permission android:name="com.example.project.DEBIT_ACCT" /&gt;
     . . .
     &lt;application . . .&gt;
         &lt;activity android:name="com.example.project.FreneticActivity"
@@ -449,9 +450,6 @@
             . . .
         &lt;/activity&gt;
     &lt;/application&gt;
-    . . .
-    &lt;uses-permission android:name="com.example.project.DEBIT_ACCT" /&gt;
-    . . .
 &lt;/manifest&gt;
 </pre>
 
diff --git a/docs/html/guide/topics/manifest/permission-tree-element.jd b/docs/html/guide/topics/manifest/permission-tree-element.jd
index aecc930..6d6cd0a 100644
--- a/docs/html/guide/topics/manifest/permission-tree-element.jd
+++ b/docs/html/guide/topics/manifest/permission-tree-element.jd
@@ -42,7 +42,7 @@
 reference to a string resource, so that it can be localized like other 
 strings in the user interface.</dd>
 
-<dt><a name="nm"</a>{@code android:name}</dt>
+<dt><a name="nm"></a>{@code android:name}</dt>
 <dd>The name that's at the base of the permission tree.  It serves as 
 a prefix to all permission names in the tree.  Java-style scoping should 
 be used to ensure that the name is unique.  The name must have more than 
diff --git a/docs/html/guide/topics/manifest/uses-feature-element.jd b/docs/html/guide/topics/manifest/uses-feature-element.jd
index 6652aff..2e43c30 100644
--- a/docs/html/guide/topics/manifest/uses-feature-element.jd
+++ b/docs/html/guide/topics/manifest/uses-feature-element.jd
@@ -403,10 +403,9 @@
 </dl>
 
 <pre>&lt;manifest ...>
-...
     &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
     &lt;uses-sdk android:minSdkVersion="3" />
-...
+    ...
 &lt;/manifest></pre>
 
 <dl>
@@ -418,10 +417,9 @@
 </dl>
 
 <pre>&lt;manifest ...>
-...
     &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
     &lt;uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5" />
-...
+    ...
 &lt;/manifest></pre>
 
 <dl>
@@ -430,11 +428,10 @@
 </dl>
 
 <pre>&lt;manifest ...>
-...
     &lt;uses-feature android:name="android.hardware.bluetooth" />
     &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
     &lt;uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5" />
-...
+    ...
 &lt;/manifest></pre>
 
 <dl>
@@ -445,11 +442,10 @@
 </dl>
 
 <pre>&lt;manifest ...>
-...
     &lt;uses-feature android:name="android.hardware.bluetooth" android:required="false" />
     &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
     &lt;uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5" />
-...
+    ...
 &lt;/manifest></pre>
 
 
diff --git a/docs/html/guide/topics/security/security.jd b/docs/html/guide/topics/security/security.jd
index de0c6e5..2e31940 100644
--- a/docs/html/guide/topics/security/security.jd
+++ b/docs/html/guide/topics/security/security.jd
@@ -120,9 +120,8 @@
 
 <pre>&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
     package=&quot;com.android.app.myapp&quot; &gt;
-
     &lt;uses-permission android:name=&quot;android.permission.RECEIVE_SMS&quot; /&gt;
-
+    ...
 &lt;/manifest&gt;</pre>
 
 <p>At application install time, permissions requested by the application are
@@ -175,13 +174,12 @@
 
 <pre>&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
     package=&quot;com.me.app.myapp&quot; &gt;
-
     &lt;permission android:name=&quot;com.me.app.myapp.permission.DEADLY_ACTIVITY&quot;
         android:label=&quot;&#64;string/permlab_deadlyActivity&quot;
         android:description=&quot;&#64;string/permdesc_deadlyActivity&quot;
         android:permissionGroup=&quot;android.permission-group.COST_MONEY&quot;
         android:protectionLevel=&quot;dangerous&quot; /&gt;
-
+    ...
 &lt;/manifest&gt;</pre>
 
 <p>The {@link android.R.styleable#AndroidManifestPermission_protectionLevel
diff --git a/docs/html/resources/tutorials/testing/activity_test.jd b/docs/html/resources/tutorials/testing/activity_test.jd
index 87dd183..ec878d2 100644
--- a/docs/html/resources/tutorials/testing/activity_test.jd
+++ b/docs/html/resources/tutorials/testing/activity_test.jd
@@ -368,14 +368,14 @@
       package="com.android.example.spinner.test"
       android:versionCode="1"
       android:versionName="1.0"&gt;
-    &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
-
-    &lt;uses-library android:name="android.test.runner" /&gt;
-    &lt;/application&gt;
     &lt;uses-sdk android:minSdkVersion="3" /&gt;
     &lt;instrumentation
         android:targetPackage="com.android.example.spinner"
         android:name="android.test.InstrumentationTestRunner" /&gt;
+    &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
+        &lt;uses-library android:name="android.test.runner" /&gt;
+        ...
+    &lt;/application&gt;
 &lt;/manifest&gt;
 </pre>
 <p>
diff --git a/docs/html/sdk/ndk/overview.jd b/docs/html/sdk/ndk/overview.jd
index f6d148a..56b9201 100644
--- a/docs/html/sdk/ndk/overview.jd
+++ b/docs/html/sdk/ndk/overview.jd
@@ -489,7 +489,6 @@
       <code>android:minSdkVersion</code> attribute value of "3" or higher. For example:
       <pre style="margin:1em;">
 &lt;manifest&gt;
-  ...
   &lt;uses-sdk android:minSdkVersion="3" /&gt;
   ...
 &lt;/manifest&gt;
@@ -540,7 +539,6 @@
     to users whose devices are capable of supporting your application. For example:
       <pre style="margin:1em;">
 &lt;manifest&gt;
-  ... 
 <!-- Declare that the application uses the OpenGL ES 2.0 API and is designed
      to run only on devices that support OpenGL ES 2.0 or higher. -->
   &lt;uses-feature android:glEsVersion="0x00020000" /&gt;