Resolve merge conflicts of a5060ee to nyc-dev

This undoes the automerger skip which occured in
commit e740c84dc32180214a7fd157105d6c18d30408ee and
replays it as a standard (NOT -s ours) merge.

Change-Id: If5a47be26f73d6a0735c425cd66310a3e2a89086
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java
index 7652766..725dfe8 100644
--- a/core/java/android/app/Activity.java
+++ b/core/java/android/app/Activity.java
@@ -200,7 +200,7 @@
  *
  * <p>An activity has essentially four states:</p>
  * <ul>
- *     <li> If an activity in the foreground of the screen (at the top of
+ *     <li> If an activity is in the foreground of the screen (at the top of
  *         the stack),
  *         it is <em>active</em> or  <em>running</em>. </li>
  *     <li>If an activity has lost focus but is still visible (that is, a new non-full-sized
@@ -674,7 +674,7 @@
  * independently of the activity lifecycle itself.  An example may be a camera
  * application that allows you to upload a picture to a web site.  The upload
  * may take a long time, and the application should allow the user to leave
- * the application will it is executing.  To accomplish this, your Activity
+ * the application while it is executing.  To accomplish this, your Activity
  * should start a {@link Service} in which the upload takes place.  This allows
  * the system to properly prioritize your process (considering it to be more
  * important than other non-visible applications) for the duration of the
@@ -4069,28 +4069,10 @@
      * result callbacks including {@link #onRequestPermissionsResult(int, String[], int[])}.
      * </p>
      * <p>
-     * A sample permissions request looks like this:
+     * The <a href="http://developer.android.com/samples/RuntimePermissions/index.html">
+     * RuntimePermissions</a> sample app demonstrates how to use this method to
+     * request permissions at run time.
      * </p>
-     * <code><pre><p>
-     * private void showContacts() {
-     *     if (checkSelfPermission(Manifest.permission.READ_CONTACTS)
-     *             != PackageManager.PERMISSION_GRANTED) {
-     *         requestPermissions(new String[]{Manifest.permission.READ_CONTACTS},
-     *                 PERMISSIONS_REQUEST_READ_CONTACTS);
-     *     } else {
-     *         doShowContacts();
-     *     }
-     * }
-     *
-     * {@literal @}Override
-     * public void onRequestPermissionsResult(int requestCode, String[] permissions,
-     *         int[] grantResults) {
-     *     if (requestCode == PERMISSIONS_REQUEST_READ_CONTACTS
-     *             && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
-     *         showContacts();
-     *     }
-     * }
-     * </code></pre></p>
      *
      * @param permissions The requested permissions. Must me non-null and not empty.
      * @param requestCode Application specific request code to match with a result
diff --git a/core/java/android/appwidget/package.html b/core/java/android/appwidget/package.html
index d4c0db0..29f2e2b 100644
--- a/core/java/android/appwidget/package.html
+++ b/core/java/android/appwidget/package.html
@@ -16,7 +16,7 @@
 android.appwidget.AppWidgetManager#ACTION_APPWIDGET_UPDATE} intent
 and provide some metadata about the app widget.  Android provides the
 {@link android.appwidget.AppWidgetProvider} class, which extends {@link
-android.content.BroadcastReceiver}, as a convenience class to define the app widget behavrio and aid
+android.content.BroadcastReceiver}, as a convenience class to define the app widget behavior and aid
 in handling the broadcasts.</p>
 
 <p>App widget hosts are the containers in which widgets can be placed.  Most of the look and feel
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index 7e67e8d..49447106 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -115,7 +115,7 @@
  *   </li>
  *   <li> <p><b>{@link #ACTION_VIEW} <i>tel:123</i></b> -- Display
  *     the phone dialer with the given number filled in.  Note how the
- *     VIEW action does what what is considered the most reasonable thing for
+ *     VIEW action does what is considered the most reasonable thing for
  *     a particular URI.</p>
  *   </li>
  *   <li> <p><b>{@link #ACTION_DIAL} <i>tel:123</i></b> -- Display
@@ -186,7 +186,7 @@
  *
  * <p>There are a variety of standard Intent action and category constants
  * defined in the Intent class, but applications can also define their own.
- * These strings use java style scoping, to ensure they are unique -- for
+ * These strings use Java-style scoping, to ensure they are unique -- for
  * example, the standard {@link #ACTION_VIEW} is called
  * "android.intent.action.VIEW".</p>
  *
@@ -339,7 +339,7 @@
  *     &lt;action android:name="{@link #ACTION_EDIT android.intent.action.EDIT}" /&gt;
  *     &lt;action android:name="{@link #ACTION_PICK android.intent.action.PICK}" /&gt;
  *     &lt;category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /&gt;
- *     &lt;data mimeType:name="vnd.android.cursor.dir/<i>vnd.google.note</i>" /&gt;
+ *     &lt;data android:mimeType="vnd.android.cursor.dir/<i>vnd.google.note</i>" /&gt;
  * &lt;/intent-filter&gt;</pre>
  * <p>This declares the things that the activity can do on a directory of
  * notes.  The type being supported is given with the &lt;type&gt; tag, where
@@ -358,7 +358,7 @@
  *     &lt;category android:name="{@link #CATEGORY_DEFAULT android.intent.category.DEFAULT}" /&gt;
  *     &lt;data android:mimeType="vnd.android.cursor.item/<i>vnd.google.note</i>" /&gt;
  * &lt;/intent-filter&gt;</pre>
- * <p>This filter describes the ability return to the caller a note selected by
+ * <p>This filter describes the ability to return to the caller a note selected by
  * the user without needing to know where it came from.  The data type
  * <code>vnd.android.cursor.item/vnd.google.note</code> is a URI from which
  * a Cursor of exactly one (<code>vnd.android.cursor.item</code>) item can
@@ -1311,14 +1311,14 @@
             "android.intent.extra.ASSIST_INPUT_DEVICE_ID";
 
     /**
-     * Activity Action: List all available applications
+     * Activity Action: List all available applications.
      * <p>Input: Nothing.
      * <p>Output: nothing.
      */
     @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
     public static final String ACTION_ALL_APPS = "android.intent.action.ALL_APPS";
     /**
-     * Activity Action: Show settings for choosing wallpaper
+     * Activity Action: Show settings for choosing wallpaper.
      * <p>Input: Nothing.
      * <p>Output: Nothing.
      */
@@ -2059,7 +2059,7 @@
     /**
      * Broadcast Action: An existing application package has been removed from
      * the device.  The data contains the name of the package.  The package
-     * that is being installed does <em>not</em> receive this Intent.
+     * that is being removed does <em>not</em> receive this Intent.
      * <ul>
      * <li> {@link #EXTRA_UID} containing the integer uid previously assigned
      * to the package.
@@ -2093,9 +2093,9 @@
     public static final String ACTION_PACKAGE_FULLY_REMOVED
             = "android.intent.action.PACKAGE_FULLY_REMOVED";
     /**
-     * Broadcast Action: An existing application package has been changed (e.g.
-     * a component has been enabled or disabled).  The data contains the name of
-     * the package.
+     * Broadcast Action: An existing application package has been changed (for
+     * example, a component has been enabled or disabled).  The data contains
+     * the name of the package.
      * <ul>
      * <li> {@link #EXTRA_UID} containing the integer uid assigned to the package.
      * <li> {@link #EXTRA_CHANGED_COMPONENT_NAME_LIST} containing the class name
@@ -2191,9 +2191,9 @@
     public static final String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED";
 
     /**
-     * Broadcast Action: Sent to the installer package of an application
-     * when that application is first launched (that is the first time it
-     * is moved out of the stopped state).  The data contains the name of the package.
+     * Broadcast Action: Sent to the installer package of an application when
+     * that application is first launched (that is the first time it is moved
+     * out of the stopped state).  The data contains the name of the package.
      *
      * <p class="note">This is a protected intent that can only be sent
      * by the system.
@@ -2221,8 +2221,9 @@
     public static final String ACTION_PACKAGE_VERIFIED = "android.intent.action.PACKAGE_VERIFIED";
 
     /**
-     * Broadcast Action: Sent to the system intent filter verifier when an intent filter
-     * needs to be verified. The data contains the filter data hosts to be verified against.
+     * Broadcast Action: Sent to the system intent filter verifier when an
+     * intent filter needs to be verified. The data contains the filter data
+     * hosts to be verified against.
      * <p class="note">
      * This is a protected intent that can only be sent by the system.
      * </p>
diff --git a/core/java/android/content/pm/PackageManager.java b/core/java/android/content/pm/PackageManager.java
index 39bc783..0ba7bf7 100644
--- a/core/java/android/content/pm/PackageManager.java
+++ b/core/java/android/content/pm/PackageManager.java
@@ -1736,7 +1736,7 @@
 
     /**
      * Feature for {@link #getSystemAvailableFeatures} and
-     * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocargiogram.
+     * {@link #hasSystemFeature}: The heart rate sensor on this device is an Electrocardiogram.
      */
     @SdkConstant(SdkConstantType.FEATURE)
     public static final String FEATURE_SENSOR_HEART_RATE_ECG =
diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java
index 47440de..f810fec 100644
--- a/core/java/android/hardware/input/InputManager.java
+++ b/core/java/android/hardware/input/InputManager.java
@@ -121,7 +121,7 @@
      * </p><p>
      * The <code>android:name</code> attribute specifies an identifier by which
      * the keyboard layout will be known in the package.
-     * The <code>android:label</code> attributes specifies a human-readable descriptive
+     * The <code>android:label</code> attribute specifies a human-readable descriptive
      * label to describe the keyboard layout in the user interface, such as "English (US)".
      * The <code>android:keyboardLayout</code> attribute refers to a
      * <a href="http://source.android.com/tech/input/key-character-map-files.html">
diff --git a/core/java/android/nfc/cardemulation/HostApduService.java b/core/java/android/nfc/cardemulation/HostApduService.java
index a299479..9208d63 100644
--- a/core/java/android/nfc/cardemulation/HostApduService.java
+++ b/core/java/android/nfc/cardemulation/HostApduService.java
@@ -36,9 +36,9 @@
  *
  * <div class="special reference">
  * <h3>Developer Guide</h3>
- * For a general introduction into the topic of card emulation,
- * please read the <a href="{@docRoot}guide/topics/nfc/ce.html">
- * NFC card emulation developer guide.</a></p>
+ * For a general introduction to card emulation, see
+ * <a href="{@docRoot}guide/topics/connectivity/nfc/hce.html">
+ * Host-based Card Emulation</a>.</p>
  * </div>
  *
  * <h3>NFC Protocols</h3>
diff --git a/core/java/android/nfc/tech/NfcBarcode.java b/core/java/android/nfc/tech/NfcBarcode.java
index 8901f28..421ba78 100644
--- a/core/java/android/nfc/tech/NfcBarcode.java
+++ b/core/java/android/nfc/tech/NfcBarcode.java
@@ -113,10 +113,10 @@
      * <p>Does not cause any RF activity and does not block.
      *
      * @return a byte array containing the barcode
-     * @see <a href="http://www.kovio.com/docs/kovionfcbarcode.pdf">
-     *      Kovio 128-bit NFC barcode datasheet</a>
-     * @see <a href="http://kovio.com/docs/kovio-128-nfc-barcode-data-format.pdf">
-     *      Kovio 128-bit NFC barcode data format</a>
+     * @see <a href="http://www.thinfilm.no/docs/thinfilm-nfc-barcode-datasheet.pdf">
+     *      Thinfilm NFC Barcode tag specification (previously Kovio NFC Barcode)</a>
+     * @see <a href="http://www.thinfilm.no/docs/thinfilm-nfc-barcode-data-format.pdf">
+     *      Thinfilm NFC Barcode data format (previously Kovio NFC Barcode)</a>
      */
     public byte[] getBarcode() {
         switch (mType) {
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java
index fdb1cef..e782689 100755
--- a/core/java/android/provider/Settings.java
+++ b/core/java/android/provider/Settings.java
@@ -1558,15 +1558,17 @@
     }
 
     /**
-     * An app can use this method to check if it is currently allowed to draw on top of other
-     * apps. In order to be allowed to do so, an app must first declare the
-     * {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission in its manifest. If it
-     * is currently disallowed, it can prompt the user to grant it this capability through a
-     * management UI by sending an Intent with action
-     * {@link android.provider.Settings#ACTION_MANAGE_OVERLAY_PERMISSION}.
+     * Checks if the specified context can draw on top of other apps. As of API
+     * level 23, an app cannot draw on top of other apps unless it declares the
+     * {@link android.Manifest.permission#SYSTEM_ALERT_WINDOW} permission in its
+     * manifest, <em>and</em> the user specifically grants the app this
+     * capability. To prompt the user to grant this approval, the app must send an
+     * intent with the action
+     * {@link android.provider.Settings#ACTION_MANAGE_OVERLAY_PERMISSION}, which
+     * causes the system to display a permission management screen.
      *
-     * @param context A context
-     * @return true if the calling app can draw on top of other apps, false otherwise.
+     * @param context App context.
+     * @return true if the specified context can draw on top of other apps, false otherwise
      */
     public static boolean canDrawOverlays(Context context) {
         return Settings.isCallingPackageAllowedToDrawOverlays(context, Process.myUid(),
@@ -3875,14 +3877,16 @@
             Secure.WIFI_WATCHDOG_PING_TIMEOUT_MS;
 
         /**
-         * An app can use this method to check if it is currently allowed to write or modify system
-         * settings. In order to gain write access to the system settings, an app must declare the
-         * {@link android.Manifest.permission#WRITE_SETTINGS} permission in its manifest. If it is
-         * currently disallowed, it can prompt the user to grant it this capability through a
-         * management UI by sending an Intent with action
-         * {@link android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}.
+         * Checks if the specified app can modify system settings. As of API
+         * level 23, an app cannot modify system settings unless it declares the
+         * {@link android.Manifest.permission#WRITE_SETTINGS}
+         * permission in its manifest, <em>and</em> the user specifically grants
+         * the app this capability. To prompt the user to grant this approval,
+         * the app must send an intent with the action {@link
+         * android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}, which causes
+         * the system to display a permission management screen.
          *
-         * @param context A context
+         * @param context App context.
          * @return true if the calling app can write to system settings, false otherwise
          */
         public static boolean canWrite(Context context) {
diff --git a/core/java/android/text/NoCopySpan.java b/core/java/android/text/NoCopySpan.java
index 0855c0b..e754d76 100644
--- a/core/java/android/text/NoCopySpan.java
+++ b/core/java/android/text/NoCopySpan.java
@@ -18,7 +18,7 @@
 
 /**
  * This interface should be added to a span object that should not be copied
- * into a new Spenned when performing a slice or copy operation on the original
+ * into a new Spanned when performing a slice or copy operation on the original
  * Spanned it was placed in.
  */
 public interface NoCopySpan {
diff --git a/core/java/android/text/format/Time.java b/core/java/android/text/format/Time.java
index 66e2ec3..69c2cff 100644
--- a/core/java/android/text/format/Time.java
+++ b/core/java/android/text/format/Time.java
@@ -331,7 +331,7 @@
      * @throws IllegalArgumentException if {@link #allDay} is true but {@code
      *             hour}, {@code minute}, and {@code second} are not 0.
      * @return a negative result if {@code a} is earlier, a positive result if
-     *         {@code a} is earlier, or 0 if they are equal.
+     *         {@code b} is earlier, or 0 if they are equal.
      */
     public static int compare(Time a, Time b) {
         if (a == null) {
diff --git a/core/java/android/view/MotionEvent.java b/core/java/android/view/MotionEvent.java
index a0f5142..85fa1fa 100644
--- a/core/java/android/view/MotionEvent.java
+++ b/core/java/android/view/MotionEvent.java
@@ -2052,7 +2052,7 @@
     
     /**
      * Return the pointer identifier associated with a particular pointer
-     * data index is this event.  The identifier tells you the actual pointer
+     * data index in this event.  The identifier tells you the actual pointer
      * number associated with the data, accounting for individual pointers
      * going up and down since the start of the current gesture.
      * @param pointerIndex Raw index of pointer to retrieve.  Value may be from 0
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 307e700..58ce6b1 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -161,7 +161,7 @@
  * that set them will vary among the different subclasses of views. Note that
  * properties that are known at build time can be set in the XML layout
  * files.</li>
- * <li><strong>Set focus:</strong> The framework will handled moving focus in
+ * <li><strong>Set focus:</strong> The framework will handle moving focus in
  * response to user input. To force focus to a specific view, call
  * {@link #requestFocus}.</li>
  * <li><strong>Set up listeners:</strong> Views allow clients to set listeners
diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml
index 778f797..bce5a7f 100644
--- a/core/res/AndroidManifest.xml
+++ b/core/res/AndroidManifest.xml
@@ -481,7 +481,8 @@
     <!-- ====================================================================== -->
     <eat-comment />
 
-    <!-- Used for runtime permissions related to user's contacts and profile. -->
+    <!-- Used for runtime permissions related to contacts and profiles on this
+        device. -->
     <permission-group android:name="android.permission-group.CONTACTS"
         android:icon="@drawable/perm_group_contacts"
         android:label="@string/permgrouplab_contacts"
@@ -1070,7 +1071,7 @@
     <!-- =============================================================== -->
     <eat-comment />
 
-    <!-- Allows an application to modify and remove existing voicemails in the system
+    <!-- Allows an application to modify and remove existing voicemails in the system.
         <p>Protection level: signature|privileged
     -->
     <permission android:name="com.android.voicemail.permission.WRITE_VOICEMAIL"
@@ -1087,7 +1088,7 @@
     <!-- ======================================= -->
     <eat-comment />
 
-    <!-- Allows an application to access extra location provider commands
+    <!-- Allows an application to access extra location provider commands.
          <p>Protection level: normal
     -->
     <permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"
@@ -1133,7 +1134,7 @@
         android:label="@string/permlab_createNetworkSockets"
         android:protectionLevel="normal" />
 
-    <!-- Allows applications to access information about networks
+    <!-- Allows applications to access information about networks.
          <p>Protection level: normal
     -->
     <permission android:name="android.permission.ACCESS_NETWORK_STATE"
@@ -1275,7 +1276,15 @@
     <eat-comment />
 
     <!-- Allows access to the list of accounts in the Accounts Service.
-        <p>Protection level: normal
+
+    <p class="note"><strong>Note:</strong> Beginning with Android 6.0 (API level
+    23), if an app shares the signature of the authenticator that manages an
+    account, it does not need <code>"GET_ACCOUNTS"</code> permission to read
+    information about that account. On Android 5.1 and lower, all apps need
+    <code>"GET_ACCOUNTS"</code> permission to read information about any
+    account.</p>
+
+    <p>Protection level: dangerous
     -->
     <permission android:name="android.permission.GET_ACCOUNTS"
         android:permissionGroup="android.permission-group.CONTACTS"
@@ -1666,11 +1675,21 @@
     <!-- ================================== -->
     <eat-comment />
 
-    <!-- Allows an application to open windows using the type
+    <!-- Allows an app to create windows using the type
          {@link android.view.WindowManager.LayoutParams#TYPE_SYSTEM_ALERT},
-         shown on top of all other applications.  Very few applications
+         shown on top of all other apps.  Very few apps
          should use this permission; these windows are intended for
-         system-level interaction with the user. -->
+         system-level interaction with the user.
+
+         <p class="note"><strong>Note:</strong> If the app
+         targets API level 23 or higher, the app user must explicitly grant
+         this permission to the app through a permission management screen. The app requests
+         the user's approval by sending an intent with action
+         {@link android.provider.Settings#ACTION_MANAGE_OVERLAY_PERMISSION}.
+         The app can check whether it has this authorization by calling
+         {@link android.provider.Settings#canDrawOverlays
+         Settings.canDrawOverlays()}.
+         <p>Protection level: signature -->
     <permission android:name="android.permission.SYSTEM_ALERT_WINDOW"
         android:label="@string/permlab_systemAlertWindow"
         android:description="@string/permdesc_systemAlertWindow"
@@ -1793,7 +1812,16 @@
         android:protectionLevel="signature|privileged|development" />
 
     <!-- Allows an application to read or write the system settings.
-         <p>Protection level: signature
+
+        <p class="note"><strong>Note:</strong> If the app targets API level 23
+        or higher, the app user
+        must explicitly grant this permission to the app through a permission management screen.
+        The app requests the user's approval by sending an intent with action
+        {@link android.provider.Settings#ACTION_MANAGE_WRITE_SETTINGS}. The app
+        can check whether it has this authorization by calling {@link
+        android.provider.Settings.System#canWrite Settings.System.canWrite()}.
+
+        <p>Protection level: signature
     -->
     <permission android:name="android.permission.WRITE_SETTINGS"
         android:label="@string/permlab_writeSettings"
@@ -2208,7 +2236,7 @@
     <permission android:name="android.permission.BIND_PRINT_SPOOLER_SERVICE"
         android:protectionLevel="signature" />
 
-    <!-- Must be required by a TextService (e.g. SpellCheckerService)
+    <!-- Must be required by a TextService (eg SpellCheckerService)
          to ensure that only the system can bind to it.
          <p>Protection level: signature
     -->
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index a320ef6..d309f94 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -3499,7 +3499,7 @@
              property is set to true by default but should be set to false if your adapter
              will display items of varying heights. When this property is set to true and
              your adapter displays items of varying heights, the scrollbar thumb will
-             change size as the user scrolls through the list. When set to fale, the list
+             change size as the user scrolls through the list. When set to false, the list
              will use only the number of items in the adapter and the number of items visible
              on screen to determine the scrollbar's properties. -->
         <attr name="smoothScrollbar" format="boolean" />
diff --git a/core/res/res/values/attrs_manifest.xml b/core/res/res/values/attrs_manifest.xml
index 5b4364d..e040bea 100644
--- a/core/res/res/values/attrs_manifest.xml
+++ b/core/res/res/values/attrs_manifest.xml
@@ -2248,7 +2248,7 @@
         <attr name="name" />
     </declare-styleable>
 
-    <!-- Associate declared KeySets with upgrading capability -->
+    <!-- Associate declared KeySets with upgrading capability. -->
     <declare-styleable name="AndroidManifestUpgradeKeySet" parent="AndroidManifest">
       <attr name="name" />
     </declare-styleable>