Merge "Rename LOG_ASSERT to ALOG_ASSERT  DO NOT MERGE"
diff --git a/api/15.txt b/api/15.txt
index ddf5baf..68fb4bc 100644
--- a/api/15.txt
+++ b/api/15.txt
@@ -6611,6 +6611,7 @@
     method public int getDimensionPixelSize(int) throws android.content.res.Resources.NotFoundException;
     method public android.util.DisplayMetrics getDisplayMetrics();
     method public android.graphics.drawable.Drawable getDrawable(int) throws android.content.res.Resources.NotFoundException;
+    method public android.graphics.drawable.Drawable getDrawableForDensity(int, int) throws android.content.res.Resources.NotFoundException;
     method public float getFraction(int, int, int);
     method public int getIdentifier(java.lang.String, java.lang.String, java.lang.String);
     method public int[] getIntArray(int) throws android.content.res.Resources.NotFoundException;
@@ -6633,6 +6634,7 @@
     method public java.lang.CharSequence[] getTextArray(int) throws android.content.res.Resources.NotFoundException;
     method public void getValue(int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
     method public void getValue(java.lang.String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
+    method public void getValueForDensity(int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
     method public android.content.res.XmlResourceParser getXml(int) throws android.content.res.Resources.NotFoundException;
     method public final android.content.res.Resources.Theme newTheme();
     method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, int[]);
diff --git a/api/current.txt b/api/current.txt
index 1f6ba1b..9285a15 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -6613,6 +6613,7 @@
     method public int getDimensionPixelSize(int) throws android.content.res.Resources.NotFoundException;
     method public android.util.DisplayMetrics getDisplayMetrics();
     method public android.graphics.drawable.Drawable getDrawable(int) throws android.content.res.Resources.NotFoundException;
+    method public android.graphics.drawable.Drawable getDrawableForDensity(int, int) throws android.content.res.Resources.NotFoundException;
     method public float getFraction(int, int, int);
     method public int getIdentifier(java.lang.String, java.lang.String, java.lang.String);
     method public int[] getIntArray(int) throws android.content.res.Resources.NotFoundException;
@@ -6635,6 +6636,7 @@
     method public java.lang.CharSequence[] getTextArray(int) throws android.content.res.Resources.NotFoundException;
     method public void getValue(int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
     method public void getValue(java.lang.String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
+    method public void getValueForDensity(int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
     method public android.content.res.XmlResourceParser getXml(int) throws android.content.res.Resources.NotFoundException;
     method public final android.content.res.Resources.Theme newTheme();
     method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, int[]);
diff --git a/core/java/android/content/res/Resources.java b/core/java/android/content/res/Resources.java
index d38b8da..2af58be 100755
--- a/core/java/android/content/res/Resources.java
+++ b/core/java/android/content/res/Resources.java
@@ -683,7 +683,6 @@
      * @throws NotFoundException Throws NotFoundException if the given ID does
      *             not exist.
      * @return Drawable An object that can be used to draw this resource.
-     * @hide
      */
     public Drawable getDrawableForDensity(int id, int density) throws NotFoundException {
         synchronized (mTmpValue) {
@@ -1032,7 +1031,6 @@
      * @throws NotFoundException Throws NotFoundException if the given ID does
      *             not exist.
      * @see #getValue(String, TypedValue, boolean)
-     * @hide
      */
     public void getValueForDensity(int id, int density, TypedValue outValue, boolean resolveRefs)
             throws NotFoundException {
diff --git a/core/java/android/webkit/WebViewCore.java b/core/java/android/webkit/WebViewCore.java
index 70b92b2..95533c6 100644
--- a/core/java/android/webkit/WebViewCore.java
+++ b/core/java/android/webkit/WebViewCore.java
@@ -2396,11 +2396,7 @@
         // adjust the default scale to match the densityDpi
         float adjust = 1.0f;
         if (mViewportDensityDpi == -1) {
-            // convert default zoom scale to a integer (percentage) to avoid any
-            // issues with floating point comparisons
-            if (mWebView != null && (int)(mWebView.getDefaultZoomScale() * 100) != 100) {
-                adjust = mWebView.getDefaultZoomScale();
-            }
+            adjust = mContext.getResources().getDisplayMetrics().density;
         } else if (mViewportDensityDpi > 0) {
             adjust = (float) mContext.getResources().getDisplayMetrics().densityDpi
                     / mViewportDensityDpi;
diff --git a/core/java/com/android/internal/widget/ActionBarView.java b/core/java/com/android/internal/widget/ActionBarView.java
index b689f53..517ce4e 100644
--- a/core/java/com/android/internal/widget/ActionBarView.java
+++ b/core/java/com/android/internal/widget/ActionBarView.java
@@ -300,6 +300,7 @@
         mProgressView = new ProgressBar(mContext, null, 0, mProgressStyle);
         mProgressView.setId(R.id.progress_horizontal);
         mProgressView.setMax(10000);
+        mProgressView.setVisibility(GONE);
         addView(mProgressView);
     }
 
@@ -307,6 +308,7 @@
         mIndeterminateProgressView = new ProgressBar(mContext, null, 0,
                 mIndeterminateProgressStyle);
         mIndeterminateProgressView.setId(R.id.progress_circular);
+        mIndeterminateProgressView.setVisibility(GONE);
         addView(mIndeterminateProgressView);
     }
 
diff --git a/core/java/com/android/internal/widget/LockPatternUtils.java b/core/java/com/android/internal/widget/LockPatternUtils.java
index adb0ac9..905a171 100644
--- a/core/java/com/android/internal/widget/LockPatternUtils.java
+++ b/core/java/com/android/internal/widget/LockPatternUtils.java
@@ -117,6 +117,8 @@
             = "lockscreen.biometric_weak_fallback";
     public final static String BIOMETRIC_WEAK_EVER_CHOSEN_KEY
             = "lockscreen.biometricweakeverchosen";
+    public final static String LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS
+            = "lockscreen.power_button_instantly_locks";
 
     private final static String PASSWORD_HISTORY_KEY = "lockscreen.passwordhistory";
 
@@ -335,7 +337,7 @@
      * @return True if the user has ever chosen a pattern.
      */
     public boolean isPatternEverChosen() {
-        return getBoolean(PATTERN_EVER_CHOSEN_KEY);
+        return getBoolean(PATTERN_EVER_CHOSEN_KEY, false);
     }
 
     /**
@@ -345,7 +347,7 @@
      * @return True if the user has ever chosen biometric weak.
      */
     public boolean isBiometricWeakEverChosen() {
-        return getBoolean(BIOMETRIC_WEAK_EVER_CHOSEN_KEY);
+        return getBoolean(BIOMETRIC_WEAK_EVER_CHOSEN_KEY, false);
     }
 
     /**
@@ -845,7 +847,7 @@
                 getLong(PASSWORD_TYPE_ALTERNATE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
                 == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
 
-        return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED)
+        return getBoolean(Settings.Secure.LOCK_PATTERN_ENABLED, false)
                 && (getLong(PASSWORD_TYPE_KEY, DevicePolicyManager.PASSWORD_QUALITY_SOMETHING)
                         == DevicePolicyManager.PASSWORD_QUALITY_SOMETHING ||
                         (usingBiometricWeak() && backupEnabled));
@@ -891,7 +893,7 @@
      * @return Whether the visible pattern is enabled.
      */
     public boolean isVisiblePatternEnabled() {
-        return getBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE);
+        return getBoolean(Settings.Secure.LOCK_PATTERN_VISIBLE, false);
     }
 
     /**
@@ -905,7 +907,7 @@
      * @return Whether tactile feedback for the pattern is enabled.
      */
     public boolean isTactileFeedbackEnabled() {
-        return getBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED);
+        return getBoolean(Settings.Secure.LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED, false);
     }
 
     /**
@@ -946,7 +948,7 @@
      *   attempts.
      */
     public boolean isPermanentlyLocked() {
-        return getBoolean(LOCKOUT_PERMANENT_KEY);
+        return getBoolean(LOCKOUT_PERMANENT_KEY, false);
     }
 
     /**
@@ -989,9 +991,10 @@
         return nextAlarm;
     }
 
-    private boolean getBoolean(String secureSettingKey) {
+    private boolean getBoolean(String secureSettingKey, boolean defaultValue) {
         return 1 ==
-                android.provider.Settings.Secure.getInt(mContentResolver, secureSettingKey, 0);
+                android.provider.Settings.Secure.getInt(mContentResolver, secureSettingKey,
+                        defaultValue ? 1 : 0);
     }
 
     private void setBoolean(String secureSettingKey, boolean enabled) {
@@ -1092,4 +1095,12 @@
         mContext.startActivity(intent);
     }
 
+    public void setPowerButtonInstantlyLocks(boolean enabled) {
+        setBoolean(LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, enabled);
+    }
+
+    public boolean getPowerButtonInstantlyLocks() {
+        return getBoolean(LOCKSCREEN_POWER_BUTTON_INSTANTLY_LOCKS, true);
+    }
+
 }
diff --git a/docs/html/guide/appendix/api-levels.jd b/docs/html/guide/appendix/api-levels.jd
index 7d119ca..cc98f8f 100644
--- a/docs/html/guide/appendix/api-levels.jd
+++ b/docs/html/guide/appendix/api-levels.jd
@@ -154,7 +154,7 @@
     <td>2</td>
     <td>{@link android.os.Build.VERSION_CODES#BASE_1_1}</td><td></td></tr>
     
-  <tr><td><a href="{@docRoot}sdk/android-1.0.html">Android 1.0</td>
+  <tr><td>Android 1.0</td>
     <td>1</td>
     <td>{@link android.os.Build.VERSION_CODES#BASE}</td>
     <td></td></tr>
diff --git a/docs/html/guide/developing/device.jd b/docs/html/guide/developing/device.jd
index 62ebfee..c4d08ed 100644
--- a/docs/html/guide/developing/device.jd
+++ b/docs/html/guide/developing/device.jd
@@ -79,10 +79,8 @@
   <a href="{@docRoot}sdk/oem-usb.html">OEM USB Drivers</a> document.</li>
       <li>If you're developing on Mac OS X, it just works. Skip this step.</li>
       
-      <li>If you're developing on Ubuntu Linux, you need to add a <a
-href="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html">
-<code>udev</code></a> 
-rules file that contains a USB configuration for each type of device
+      <li>If you're developing on Ubuntu Linux, you need to add a
+<code>udev</code> rules file that contains a USB configuration for each type of device
 you want to use for development. In the rules file, each device manufacturer
 is identified by a unique vendor ID, as specified by the
 <code>ATTR{idVendor}</code> property. For a list of vendor IDs, see  <a
diff --git a/docs/html/guide/developing/devices/emulator.jd b/docs/html/guide/developing/devices/emulator.jd
index 8211275..02dcb68 100644
--- a/docs/html/guide/developing/devices/emulator.jd
+++ b/docs/html/guide/developing/devices/emulator.jd
@@ -480,7 +480,7 @@
   <td>Enable the root shell (as in <code>-shell</code> and specify the QEMU character 
   device to use for communication with the shell.</td>
   <td>&lt;device&gt; must be a QEMU device type. See the documentation for '-serial <em>dev</em>' at 
-  <a href="http://www.nongnu.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a> 
+  <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a> 
   for a list of device types.
 
 <p>Here are some examples: </p>
@@ -619,7 +619,7 @@
   <td>Use this command to emulate an NMEA-compatible GPS unit connected to
   an external character device or socket. The format of <code>&lt;device&gt;</code> must be QEMU-specific 
   serial device specification. See the documentation for 'serial -dev' at 
-  <a href="http://www.bellard.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a>.
+  <a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>.
 </td>
 </tr>
 <tr>
@@ -638,7 +638,7 @@
   <td>Redirect radio mode to the specified character device.</td>
   <td>The format of <code>&lt;device&gt;</code> must be QEMU-specific 
   serial device specification. See the documentation for 'serial -dev' at 
-<a href="http://www.bellard.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a>.
+<a href="http://wiki.qemu.org/download/qemu-doc.html">http://wiki.qemu.org/download/qemu-doc.html</a>.
 </td>
 </tr>
 <tr>
diff --git a/docs/html/guide/practices/screens-support-1.5.jd b/docs/html/guide/practices/screens-support-1.5.jd
index 9f033b4..4c6fb99 100644
--- a/docs/html/guide/practices/screens-support-1.5.jd
+++ b/docs/html/guide/practices/screens-support-1.5.jd
@@ -46,7 +46,7 @@
 default, an application written for Android 1.5 or below that does not set the <a
 href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#target">{@code
 android:targetSdkVersion}</a> set to {@code "4"} or higher runs in <a
-href="screen-compat-mode">screen compatibility mode</a> when on a device with a screen larger than
+href="screen-compat-mode.html">screen compatibility mode</a> when on a device with a screen larger than
 the
 <em>normal</em> screen size (basically, the system displays the application in a small window
 that is roughly the size of the normal screen size).</p>
diff --git a/docs/html/guide/practices/security.jd b/docs/html/guide/practices/security.jd
index 476c301..eeaac44 100644
--- a/docs/html/guide/practices/security.jd
+++ b/docs/html/guide/practices/security.jd
@@ -126,8 +126,8 @@
 <p>Use of <a
 href="{@docRoot}reference/android/content/Context.html#MODE_WORLD_WRITEABLE">
 world writable</a> or <a
-href="{@docRoot}reference/android/content/Context.html#MODE_WORLD_READABLE
-">world readable</a> files for IPC is discouraged because it does not provide
+href="{@docRoot}reference/android/content/Context.html#MODE_WORLD_READABLE">world
+readable</a> files for IPC is discouraged because it does not provide
 the ability to limit data access to particular applications, nor does it
 provide any control on data format. As an alternative, you might consider using
 a ContentProvider which provides read and write permissions, and can make
@@ -199,10 +199,10 @@
 <p>ContentProviders can also provide more granular access by declaring the <a
 href="{@docRoot}guide/topics/manifest/provider-element.html#gprmsn">
 grantUriPermissions</a> element and using the <code><a
-href="{@docRoot}reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMIS
-SION">FLAG_GRANT_READ_URI_PERMISSION</a></code> and <code><a
-href="{@docRoot}reference/android/content/Intent.html#FLAG_GRANT_WRITE_URI_PERMI
-SSION">FLAG_GRANT_WRITE_URI_PERMISSION</a></code> flags in the Intent object
+href="{@docRoot}reference/android/content/Intent.html#FLAG_GRANT_READ_URI_PERMISSION">FLAG_GRANT_READ_URI_PERMISSION</a></code>
+and <code><a
+href="{@docRoot}reference/android/content/Intent.html#FLAG_GRANT_WRITE_URI_PERMISSION">FLAG_GRANT_WRITE_URI_PERMISSION</a></code>
+flags in the Intent object
 that activates the component.  The scope of these permissions can be further
 limited by the <code><a
 href="{@docRoot}guide/topics/manifest/grant-uri-permission-element.html">
@@ -211,14 +211,9 @@
 <p>When accessing a <code>
 <a href="{@docRoot}reference/android/content/ContentProvider.html">
 ContentProvider</a></code>, use parameterized query methods such as <code>
-<a href="{@docRoot}reference/android/content/ContentProvider.html#query(android.net
-.Uri,%20java.lang.String[],%20java.lang.String,%20java.lang.String[],%20java.lan
-g.String)">query()</a></code>, <code><a
-href="{@docRoot}reference/android/content/ContentProvider.html#update(android.ne
-t.Uri,%20android.content.ContentValues,%20java.lang.String,%20java.lang.String[]
-)">update()</a></code>, and <code><a
-href="{@docRoot}reference/android/content/ContentProvider.html#delete(android.ne
-t.Uri,%20java.lang.String,%20java.lang.String[])">delete()</a></code> to avoid
+<a href="{@docRoot}reference/android/content/ContentProvider.html#query(android.net.Uri,%20java.lang.String[],%20java.lang.String,%20java.lang.String[],%20java.lang.String)">query()</a></code>, <code><a
+href="{@docRoot}reference/android/content/ContentProvider.html#update(android.net.Uri,%20android.content.ContentValues,%20java.lang.String,%20java.lang.String[])">update()</a></code>, and <code><a
+href="{@docRoot}reference/android/content/ContentProvider.html#delete(android.net.Uri,%20java.lang.String,%20java.lang.String[])">delete()</a></code> to avoid
 potential <a href="http://en.wikipedia.org/wiki/SQL_injection">SQL
 Injection</a> from untrusted data. Note that using parameterized methods is not
 sufficient if the <code>selection</code> is built by concatenating user data
@@ -249,8 +244,9 @@
 Activities</a>, and <a
 href="{@docRoot}reference/android/R.styleable.html#AndroidManifestService">
 Services</a> are all declared in the application manifest.  If your IPC mechanism is
-not intended for use by other applications, set the android:exported property
-to false.  This is useful for applications that consist of multiple processes
+not intended for use by other applications, set the <a
+href="{@docRoot}guide/topics/manifest/service-element.html#exported">{@code android:exported}</a>
+property to false.  This is useful for applications that consist of multiple processes
 within the same UID, or if you decide late in development that you do not
 actually want to expose functionality as IPC but you don’t want to rewrite
 the code.</p>
@@ -276,11 +272,10 @@
 
 <p>Intents are the preferred mechanism for asynchronous IPC in Android.
 Depending on your application requirements, you might use <code><a
-href="{@docRoot}reference/android/content/Context.html#sendBroadcast(android.con
-tent.Intent)">sendBroadcast()</a></code>, <code><a
-href="{@docRoot}reference/android/content/Context.html#sendOrderedBroadcast(andr
-oid.content.Intent,%20java.lang.String)">sendOrderedBroadcast()</a></code>, or
-direct an intent to a specific application component.</p>
+href="{@docRoot}reference/android/content/Context.html#sendBroadcast(android.content.Intent)">sendBroadcast()</a></code>, 
+<code><a
+href="{@docRoot}reference/android/content/Context.html#sendOrderedBroadcast(android.content.Intent,%20java.lang.String)">sendOrderedBroadcast()</a></code>,
+or direct an intent to a specific application component.</p>
 
 <p>Note that ordered broadcasts can be “consumed” by a recipient, so they
 may not be delivered to all applications.  If you are sending an Intent where
@@ -311,14 +306,13 @@
 explicitly added as code in the interface.</p>
 
 <p>If providing an interface that does require access controls, use <code><a
-href="{@docRoot}reference/android/content/Context.html#checkCallingPermission(ja
-va.lang.String)">checkCallingPermission()</a></code> to verify whether the
+href="{@docRoot}reference/android/content/Context.html#checkCallingPermission(java.lang.String)">checkCallingPermission()</a></code>
+to verify whether the
 caller of the Binder has a required permission. This is especially important
 before accessing a Service on behalf of the caller, as the identify of your
 application is passed to other interfaces.  If invoking an interface provided
 by a Service, the <code><a
-href="{@docRoot}reference/android/content/Context.html#bindService(android.conte
-nt.Intent,%20android.content.ServiceConnection,%20int)">bindService()</a></code>
+href="{@docRoot}reference/android/content/Context.html#bindService(android.content.Intent,%20android.content.ServiceConnection,%20int)">bindService()</a></code>
  invocation may fail if you do not have permission to access the given Service.
  If calling an interface provided locally by your own application, it may be
 useful to use the <code><a
@@ -332,14 +326,14 @@
 
 <p>By default, receivers are exported and can be invoked by any other
 application. If your <code><a
-href={@docRoot}reference/android/content/BroadcastReceiver.html">
+href="{@docRoot}reference/android/content/BroadcastReceiver.html">
 BroadcastReceivers</a></code> is intended for use by other applications, you
 may want to apply security permissions to receivers using the <code><a
-href="{@docRoot}reference/android/R.styleable.html#AndroidManifestReceiver">
+href="{@docRoot}guide/topics/manifest/receiver-element.html">
 &lt;receiver&gt;</a></code> element within the application manifest.  This will
 prevent applications without appropriate permissions from sending an intent to
 the <code><a
-href={@docRoot}reference/android/content/BroadcastReceiver.html">
+href="{@docRoot}reference/android/content/BroadcastReceiver.html">
 BroadcastReceivers</a></code>.</p>
 
 <h3>Using Services</h3>
@@ -349,19 +343,21 @@
 package's AndroidManifest.xml.</p>
 
 <p>By default, Services are exported and can be invoked by any other
-application.  Services can be protected using the android:permission attribute
+application.  Services can be protected using the <a
+href="{@docRoot}guide/topics/manifest/service-element.html#prmsn">{@code android:permission}</a>
+attribute
 within the manifest’s <code><a
-href="{@docRoot}reference/android/R.styleable.html#AndroidManifestService">
+href="{@docRoot}guide/topics/manifest/service-element.html">
 &lt;service&gt;</a></code> tag. By doing so, other applications will need to declare
 a corresponding <code><a
-href="{@docRoot}reference/android/R.styleable.html#AndroidManifestService_permis
-sion">&lt;uses-permission&gt;</a></code> element in their own manifest to be
+href="{@docRoot}guide/topics/manifest/uses-permission-element.html">&lt;uses-permission&gt;</a>
+</code> element in their own manifest to be
 able to start, stop, or bind to the service.</p>
 
 <p>A Service can protect individual IPC calls into it with permissions, by
 calling <code><a
-href="{@docRoot}reference/android/content/Context.html#checkCallingPermission(ja
-va.lang.String)">checkCallingPermission()</a></code>before executing
+href="{@docRoot}reference/android/content/Context.html#checkCallingPermission(java.lang.String)">checkCallingPermission()</a></code>
+before executing
 the implementation of that call.  We generally recommend using the
 declarative permissions in the manifest, since those are less prone to
 oversight.</p>
@@ -376,9 +372,9 @@
 functionality that is not intended for use by other applications.</p>
 
 <p>If you do expose an Activity for purposes of IPC, the  <code><a
-href="{@docRoot}reference/android/R.styleable.html#AndroidManifestActivity_permi
-ssion">android:permission</a></code> attribute in the  <code><a
-href="{@docRoot}reference/android/R.styleable.html#AndroidManifestActivity">
+href="{@docRoot}guide/topics/manifest/activity-element.html#prmsn">android:permission</a></code>
+attribute in the  <code><a
+href="{@docRoot}guide/topics/manifest/activity-element.html">
 &lt;activity&gt;</a></code> declaration in the application manifest can be used to
 restrict access to only those applications which have the stated
 permissions.</p>
@@ -432,8 +428,8 @@
 <p>Generally, you should strive to create as few permissions as possible while
 satisfying your security requirements.  Creating a new permission is relatively
 uncommon for most applications, since <a
-href="{@docRoot}reference/android/Manifest.permission.html">
-system-defined permissions</a> cover many situations.  Where appropriate,
+href="{@docRoot}reference/android/Manifest.permission.html">system-defined
+permissions</a> cover many situations.  Where appropriate,
 perform access checks using existing permissions.</p>
 
 <p>If you must create a new permission, consider whether you can accomplish
@@ -560,17 +556,14 @@
 not execute JavaScript so cross-site-scripting is not possible.</p>
 
 <p>Use <code><a
-href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(jav
-a.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> with
+href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> with
 particular care because it allows JavaScript to invoke operations that are
 normally reserved for Android applications.  Only expose <code><a
-href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(jav
-a.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> to
+href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> to
 sources from which all input is trustworthy.  If untrusted input is allowed,
 untrusted JavaScript may be able to invoke Android methods.  In general, we
 recommend only exposing <code><a
-href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(jav
-a.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> to
+href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> to
 JavaScript that is contained within your application APK.</p>
 
 <p>Do not trust information downloaded over HTTP, use HTTPS instead.  Even if
@@ -578,13 +571,11 @@
 subject to <a
 href="http://en.wikipedia.org/wiki/Man-in-the-middle_attack">MiTM</a> attacks
 and interception of data.  Sensitive capabilities using <code><a
-href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(jav
-a.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> should
+href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code> should
 not ever be exposed to unverified script downloaded over HTTP. Note that even
 with the use of HTTPS,
 <code><a
-href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(jav
-a.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code>
+href="{@docRoot}reference/android/webkit/WebView.html#addJavascriptInterface(java.lang.Object,%20java.lang.String)">addJavaScriptInterface()</a></code>
 increases the attack surface of your application to include the server
 infrastructure and all CAs trusted by the Android-powered device.</p>
 
@@ -683,8 +674,7 @@
 <p>If a GUID is required, create a large, unique number and store it.  Do not
 use phone identifiers such as the phone number or IMEI which may be associated
 with personal information.  This topic is discussed in more detail in the <a
-href="http://android-developers.blogspot.com/2011/03/identifying-app-installatio
-ns.html">Android Developer Blog</a>.</p>
+href="http://android-developers.blogspot.com/2011/03/identifying-app-installations.html">Android Developer Blog</a>.</p>
 
 <p>Application developers should be careful writing to on-device logs.
 In Android, logs are a shared resource, and are available
@@ -724,9 +714,8 @@
 <p>If credentials are to be used only by applications that you create, then you
 can verify the application which accesses the <code><a
 href="{@docRoot}reference/android/accounts/AccountManager.html">
-AccountManager</a></code> using <code><a href="<code><a
-href="{@docRoot}h/reference/android/content/pm/PackageManager.html#checkSignatur
-es(java.lang.String,%20java.lang.String)">checkSignature()</a></code>.
+AccountManager</a></code> using <code><a
+href="{@docRoot}reference/android/content/pm/PackageManager.html#checkSignatures(java.lang.String,%20java.lang.String)">checkSignature()</a></code>.
 Alternatively, if only one application will use the credential, you might use a
 <code><a
 href={@docRoot}reference/java/security/KeyStore.html">KeyStore</a></code> for
@@ -756,15 +745,15 @@
 href="{@docRoot}reference/javax/crypto/Cipher.html">Cipher</a></code> class.</p>
 
 <p>Use a secure random number generator (
-<a href="http://developer.android.com/reference/java/security/SecureRandom.html">
+<a href="{@docRoot}reference/java/security/SecureRandom.html">
 <code>SecureRandom</code></a>) to initialize any cryptographic keys (<a
-href="http://developer.android.com/reference/javax/crypto/KeyGenerator.html">
+href="{@docRoot}reference/javax/crypto/KeyGenerator.html">
 <code>KeyGenerator</code></a>). Use of a key that is not generated with a secure random
 number generator significantly weakens the strength of the algorithm, and may
 allow offline attacks.</p>
 
 <p>If you need to store a key for repeated use, use a mechanism like <code><a
-href={@docRoot}reference/java/security/KeyStore.html">KeyStore</a></code> that
+href="{@docRoot}reference/java/security/KeyStore.html">KeyStore</a></code> that
 provides a mechanism for long term storage and retrieval of cryptographic
 keys.</p>
 
diff --git a/docs/html/guide/practices/tablets-and-handsets.jd b/docs/html/guide/practices/tablets-and-handsets.jd
index dc35801..3f4aaa9 100644
--- a/docs/html/guide/practices/tablets-and-handsets.jd
+++ b/docs/html/guide/practices/tablets-and-handsets.jd
@@ -481,7 +481,7 @@
 information in each list item based on the available space. That is, you can create alternative
 layouts to be used by the items in your list adapter such that a large screen might display more
 detail for each item.</li>
-  <li>Create <a href="{@docRoot}guide/topics/resources/more-resources.html ">alternative resource
+  <li>Create <a href="{@docRoot}guide/topics/resources/more-resources.html">alternative resource
 files</a> for values such as integers, dimensions, and even booleans. Using size qualifiers for
 these resources, you can easily apply different layout sizes, font sizes, or enable/disable features
 based on the current screen size.</li>
diff --git a/docs/html/guide/publishing/preparing.jd b/docs/html/guide/publishing/preparing.jd
index 5ed55fe..4d3bffa 100644
--- a/docs/html/guide/publishing/preparing.jd
+++ b/docs/html/guide/publishing/preparing.jd
@@ -120,8 +120,8 @@
 <p>You may also have to obtain other release keys if your application accesses a service or uses a
 third-party library that requires you to use a key that is based on your private key. For example,
 if your application uses the <a
-href="http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/ MapView.
-html">MapView</a> class, which is part of the <a
+href="http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/MapView.html">MapView</a>
+class, which is part of the <a
 href="http://code.google.com/android/add-ons/google-apis/maps-overview.html">Google Maps external
 library</a>, you will need to register your application with the Google Maps service and obtain
 a Maps API key. For information about getting a Maps API key, see <a
diff --git a/docs/html/guide/publishing/publishing_overview.jd b/docs/html/guide/publishing/publishing_overview.jd
index a0f6ae3..e30360b 100755
--- a/docs/html/guide/publishing/publishing_overview.jd
+++ b/docs/html/guide/publishing/publishing_overview.jd
@@ -21,7 +21,7 @@
   </ol>
   <h2>See also</h2>
   <ol>
-    <li><a href="{@docRoot}guide/publishing/publishing_preparing.html">Preparing for
+    <li><a href="{@docRoot}guide/publishing/preparing.html">Preparing for
     Release</a></li>
     <li><a href="{@docRoot}guide/publishing/publishing.html">Publishing on Android Market</a></li>
   </ol>
diff --git a/docs/html/guide/topics/appwidgets/index.jd b/docs/html/guide/topics/appwidgets/index.jd
index 7b869a0..ba7b67c 100644
--- a/docs/html/guide/topics/appwidgets/index.jd
+++ b/docs/html/guide/topics/appwidgets/index.jd
@@ -518,15 +518,12 @@
 to the App Widget without worrying about the AppWidgetProvider closing down due
 to an <a href="{@docRoot}guide/practices/design/responsiveness.html">Application
 Not Responding</a> (ANR) error. See the <a
-href="http://code.google.com/p/wiktionary-android/source/browse/trunk/Wiktionary
-/src/com/example/android/wiktionary/WordWidget.java">Wiktionary sample's
-AppWidgetProvider</a> for an example of an App Widget running a {@link
+href="http://code.google.com/p/wiktionary-android/source/browse/trunk/Wiktionary/src/com/example/android/wiktionary/WordWidget.java">Wiktionary sample's AppWidgetProvider</a> for an example of an App Widget running a {@link
 android.app.Service}.</p>
 
 <p>Also see the <a 
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/
-appwidget/ExampleAppWidgetProvider.html">
-ExampleAppWidgetProvider.java</a> sample class.</p>
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/appwidget/ExampleAppWidgetProvider.html">ExampleAppWidgetProvider.java</a>
+sample class.</p>
 
 
 <h3 id="ProviderBroadcasts">Receiving App Widget broadcast Intents</h3>
@@ -683,9 +680,8 @@
 App Widget will not be added.</p>
 
 <p>See the <a 
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/
-appwidget/ExampleAppWidgetConfigure.html">
-ExampleAppWidgetConfigure.java</a> sample class in ApiDemos for an example.</p>
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/appwidget/ExampleAppWidgetConfigure.html">ExampleAppWidgetConfigure.java</a>
+sample class in ApiDemos for an example.</p>
 
 <h2 id="preview">Setting a Preview Image</h2>
 
diff --git a/docs/html/guide/topics/manifest/activity-element.jd b/docs/html/guide/topics/manifest/activity-element.jd
index e23fb0ec..e76a6be 100644
--- a/docs/html/guide/topics/manifest/activity-element.jd
+++ b/docs/html/guide/topics/manifest/activity-element.jd
@@ -59,7 +59,7 @@
 
 <dt>attributes:</dt>
 <dd><dl class="attr">
-<dt><a href name="reparent"></a>{@code android:allowTaskReparenting}</dt>
+<dt><a name="reparent"></a>{@code android:allowTaskReparenting}</dt>
 <dd>Whether or not the activity can move from the task that started it to 
 the task it has an affinity for when that task is next brought to the 
 front &mdash; "{@code true}" if it can move, and "{@code false}" if it 
diff --git a/docs/html/guide/topics/manifest/application-element.jd b/docs/html/guide/topics/manifest/application-element.jd
index 4f1964c..df6f61a 100644
--- a/docs/html/guide/topics/manifest/application-element.jd
+++ b/docs/html/guide/topics/manifest/application-element.jd
@@ -249,7 +249,7 @@
 applications, reducing resource usage.
 </p></dd>
 
-<dt><a href name="restoreany"></a>{@code android:restoreAnyVersion}</dt>
+<dt><a name="restoreany"></a>{@code android:restoreAnyVersion}</dt>
 <dd>Indicate that the application is prepared to attempt a restore of any
 backed-up data set, even if the backup was stored by a newer version
 of the application than is currently installed on the device.  Setting
@@ -260,7 +260,7 @@
 <p>The default value of this attribute is {@code false}.
 </p></dd>
 
-<dt><a href name="aff"></a>{@code android:taskAffinity}</dt>
+<dt><a name="aff"></a>{@code android:taskAffinity}</dt>
 <dd>An affinity name that applies to all activities within the application,
 except for those that set a different affinity with their own
 <code><a href="{@docRoot}guide/topics/manifest/activity-element.html#aff">taskAffinity</a></code> 
diff --git a/docs/html/guide/topics/media/mediaplayer.jd b/docs/html/guide/topics/media/mediaplayer.jd
index b3ca7dd..002d113 100644
--- a/docs/html/guide/topics/media/mediaplayer.jd
+++ b/docs/html/guide/topics/media/mediaplayer.jd
@@ -251,7 +251,7 @@
 "background media" even when the user leaves your activity, much in the same
 way that the built-in Music application behaves. In this case, what you need is
 a {@link android.media.MediaPlayer MediaPlayer} controlled by a {@link android.app.Service}, as
-discussed in <a href="mpandservices">Using a Service with MediaPlayer</a>.</p>
+discussed in <a href="#mpandservices">Using a Service with MediaPlayer</a>.</p>
 
 <h2 id="mpandservices">Using a Service with MediaPlayer</h2>
 
diff --git a/docs/html/guide/topics/nfc/nfc.jd b/docs/html/guide/topics/nfc/nfc.jd
index 175bc7cc..83873c3 100644
--- a/docs/html/guide/topics/nfc/nfc.jd
+++ b/docs/html/guide/topics/nfc/nfc.jd
@@ -666,7 +666,7 @@
 potentially handling specific tags that you have deployed. AARs are only supported at the
 application level, because of the package name constraint, and not at the Activity level as with
 intent filtering. If you want to handle an intent at the Activity level, <a
-href="filtering-intents">use intent filters</a>.
+href="#filtering-intents">use intent filters</a>.
 </p>
 
 
@@ -795,8 +795,8 @@
 
 <p>The following sample shows how a simple activity calls {@link
 android.nfc.NfcAdapter.CreateNdefMessageCallback} in the <code>onCreate()</code> method of an
-activity (see <a href="{@docRoot}resources/samples/AndroidBeam/index.html"></a> for the
-complete sample). This example also has methods to help you create a MIME record:</p>
+activity (see <a href="{@docRoot}resources/samples/AndroidBeamDemo/index.html">AndroidBeamDemo</a>
+for the complete sample). This example also has methods to help you create a MIME record:</p>
 
 <pre id="code-example">
 package com.example.android.beam;
diff --git a/docs/html/guide/topics/renderscript/index.jd b/docs/html/guide/topics/renderscript/index.jd
index 148705c..63f341a 100644
--- a/docs/html/guide/topics/renderscript/index.jd
+++ b/docs/html/guide/topics/renderscript/index.jd
@@ -376,7 +376,7 @@
   you call the constructor for the {@link android.renderscript.Script.FieldBase} class and specify
   the amount of structures that you want to allocate memory for. To allocate memory for a primitive
   type pointer, you must build an allocation manually, using the memory management classes
-  described in <a href="mem-mgmt-table">Table 1</a>. The example below allocates memory for both
+  described in <a href="#mem-mgmt-table">Table 1</a>. The example below allocates memory for both
   the <code>intPointer</code> and <code>touchPoints</code> pointer and binds it to the
   RenderScript:</p>
   <pre>
diff --git a/docs/html/guide/topics/resources/animation-resource.jd b/docs/html/guide/topics/resources/animation-resource.jd
index eaa698f..6473155 100644
--- a/docs/html/guide/topics/resources/animation-resource.jd
+++ b/docs/html/guide/topics/resources/animation-resource.jd
@@ -335,7 +335,7 @@
 <dd>
 <ul>
   <li><a href="{@docRoot}guide/topics/graphics/animation.html">Property Animation</a></li>
-  <li><a href="http://zoso:8080/resources/samples/ApiDemos/src/com/example/android/apis/animation/index.html">API Demos</a> for examples
+  <li><a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/animation/index.html">API Demos</a> for examples
   on how to use the property animation system.</li>
 </ul>
 </dd>
diff --git a/docs/html/guide/topics/sensors/sensors_motion.jd b/docs/html/guide/topics/sensors/sensors_motion.jd
index 3f712b2..b6c3cb4 100644
--- a/docs/html/guide/topics/sensors/sensors_motion.jd
+++ b/docs/html/guide/topics/sensors/sensors_motion.jd
@@ -28,7 +28,7 @@
 href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/os/RotationVectorDemo.html">
 API Demos (OS - RotationVectorDemo)</a></li>
       <li><a
-href="{@docRoot}/resources/samples/ApiDemos/src/com/example/android/apis/os/RotationVectorDemo.html"
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/os/RotationVectorDemo.html"
 >API Demos (OS - Sensors)</a></li>
     </ol>
     <h2>See also</h2>
diff --git a/docs/html/guide/topics/testing/testing_android.jd b/docs/html/guide/topics/testing/testing_android.jd
index c8a3f6e..adbc59d 100755
--- a/docs/html/guide/topics/testing/testing_android.jd
+++ b/docs/html/guide/topics/testing/testing_android.jd
@@ -318,7 +318,7 @@
     A useful general test case class, especially if you are
     just starting out with Android testing, is {@link android.test.AndroidTestCase}. It extends
     both {@link junit.framework.TestCase} and {@link junit.framework.Assert}. It provides the
-    JUnit-standard <code>setUp()</code> and <code>tearDown()</code> methods, as well as well as
+    JUnit-standard <code>setUp()</code> and <code>tearDown()</code> methods, as well as
     all of JUnit's Assert methods. In addition, it provides methods for testing permissions, and a
     method that guards against memory leaks by clearing out certain class references.
 </p>
@@ -401,7 +401,7 @@
     Mock objects isolate tests from a running system by stubbing out or overriding
     normal operations. For example, a {@link android.test.mock.MockContentResolver}
     replaces the normal resolver framework with its own local framework, which is isolated
-    from the rest of the system. MockContentResolver also also stubs out the
+    from the rest of the system. MockContentResolver also stubs out the
     {@link android.content.ContentResolver#notifyChange(Uri, ContentObserver, boolean)} method
     so that observer objects outside the test environment are not accidentally triggered.
 </p>
diff --git a/docs/html/guide/topics/ui/actionbar.jd b/docs/html/guide/topics/ui/actionbar.jd
index 3c0ef26..1bb4fa4 100644
--- a/docs/html/guide/topics/ui/actionbar.jd
+++ b/docs/html/guide/topics/ui/actionbar.jd
@@ -642,7 +642,7 @@
   <p>Adding this value requires that you set your build target to Android 4.0 or higher in order to
 compile. Older versions of Android ignore the {@code "collapseActionView"} value because they don't
 understand it. Just be sure not to use other APIs in your source code that are not supported in the
-version declared by your <a href="{@docRoot}guide/topics/manifest/uses-sdk-elementl.html#min">{@code
+version declared by your <a href="{@docRoot}guide/topics/manifest/uses-sdk-element.html#min">{@code
 minSdkVersion}</a>, unless you add the appropriate version check at runtime.</p>
 </div>
 </div>
@@ -843,8 +843,8 @@
 android.app.Activity#onOptionsItemSelected onOptionsItemSelected()} callback method.</p>
 
 <p>For a sample using the share action provider, see
-<a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/ActionBarActionProviderActivity.html"
->ActionBarActionProviderActivity</a>.
+<a href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/ActionBarShareActionProviderActivity.html"
+>ActionBarShareActionProviderActivity</a>.
 
 
 
diff --git a/docs/html/guide/topics/usb/accessory.jd b/docs/html/guide/topics/usb/accessory.jd
index b0f4881..8b74bc0 100644
--- a/docs/html/guide/topics/usb/accessory.jd
+++ b/docs/html/guide/topics/usb/accessory.jd
@@ -169,8 +169,9 @@
     include a <code>&lt;uses-feature&gt;</code> element that declares that your application uses
     the <code>android.hardware.usb.accessory</code> feature.</li>
 
-    <li>If you are using the <a href="addon">add-on library</a>, add the
-    <code>&lt;uses-library&gt;</code> element specifying
+    <li>If you are using the 
+    <a href="http://code.google.com/android/add-ons/google-apis/index.html">add-on library</a>,
+    add the <code>&lt;uses-library&gt;</code> element specifying
     <code>com.android.future.usb.accessory</code> for the library.</li>
 
     <li>Set the minimum SDK of the application to API Level 10 if you are using the add-on library
diff --git a/docs/html/guide/topics/usb/adk.jd b/docs/html/guide/topics/usb/adk.jd
index 6c7ab0d..99c5f92 100644
--- a/docs/html/guide/topics/usb/adk.jd
+++ b/docs/html/guide/topics/usb/adk.jd
@@ -699,7 +699,7 @@
 </pre>If this method returns false, the board waits until a new device is connected. If it is
 successful, the device displays itself on the USB bus as being in accessory mode when the ADK board
 re-enumerates the bus. When the device is in accessory mode, the accessory then <a href=
-"establish-adk">establishes communication with the device</a>.
+"#establish-adk">establishes communication with the device</a>.
 
   <h3 id="establish-adk">Establish communication with the device</h3>
 
diff --git a/docs/html/guide/topics/wireless/bluetooth.jd b/docs/html/guide/topics/wireless/bluetooth.jd
index 0af1d2c..e4c6e1b 100644
--- a/docs/html/guide/topics/wireless/bluetooth.jd
+++ b/docs/html/guide/topics/wireless/bluetooth.jd
@@ -902,8 +902,9 @@
 <p>Here are the basic steps for working with a profile:</p> 
 <ol> 
 
-  <li>Get the default adapter, as described in <a href="{@docRoot}guide/topics/wireless/bluetooth.
-html#SettingUp">Setting Up Bluetooth</a>.</li> 
+  <li>Get the default adapter, as described in
+    <a href="{@docRoot}guide/topics/wireless/bluetooth.html#SettingUp">Setting Up
+      Bluetooth</a>.</li> 
 
   <li>Use {@link
 android.bluetooth.BluetoothAdapter#getProfileProxy(android.content.Context,
diff --git a/docs/html/sdk/RELEASENOTES.jd b/docs/html/sdk/RELEASENOTES.jd
index bf091e9..91eb57f4 100644
--- a/docs/html/sdk/RELEASENOTES.jd
+++ b/docs/html/sdk/RELEASENOTES.jd
@@ -657,8 +657,8 @@
 <p><strong>T-Mobile G1 Compatibility</strong></p>
 
 <p>This version of the SDK has been tested for compatibility with the first 
-Android-powered mobile device, the <a href="http://www.t-mobileg1.com">T-Mobile
-G1</a>. </p>
+Android-powered mobile device, the T-Mobile
+G1. </p>
 
 <p><strong>MapView API Key</strong></p>
 
diff --git a/docs/html/sdk/android-1.1.jd b/docs/html/sdk/android-1.1.jd
index 8123fa8..b61f186 100644
--- a/docs/html/sdk/android-1.1.jd
+++ b/docs/html/sdk/android-1.1.jd
@@ -106,7 +106,7 @@
 <p>The Android 1.1 system image was tested for compatability with the
 Android-powered devices listed below:</p>
 	<ul>
-	<li><a href="http://www.t-mobileg1.com">T-Mobile G1</a></li>
+	<li>T-Mobile G1</li>
 	</ul>
 
 <h2 id="apps">Built-in Applications</h2>
diff --git a/docs/html/sdk/android-3.0.jd b/docs/html/sdk/android-3.0.jd
index 7b04446..96b92d9 100644
--- a/docs/html/sdk/android-3.0.jd
+++ b/docs/html/sdk/android-3.0.jd
@@ -262,8 +262,8 @@
 
 <p>For more information, read the <a href="{@docRoot}guide/topics/clipboard/copy-paste.html">Copy
 and Paste</a> documentation. You can also see a simple implementation of copy and paste in the <a
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.
-html">API Demos</a> and a more complete implementation in the <a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/content/ClipboardSample.html">API Demos</a>
+and a more complete implementation in the <a
 href="{@docRoot}resources/samples/NotePad/index.html">Note Pad</a> application.</p>
 
 
@@ -386,7 +386,7 @@
 <p>For more information, read the <a
 href="{@docRoot}guide/topics/fundamentals/loaders.html">Loaders</a> documentation. You can also see
 example code using loaders in the <a
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/FragmentListCursorLoader.html">FragmentListCursorLoader</a>
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/LoaderCursor.html">LoaderCursor</a>
 and <a
 href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/LoaderThrottle.html">
 LoaderThrottle</a> samples.</p>
diff --git a/docs/html/sdk/android-3.1.jd b/docs/html/sdk/android-3.1.jd
index 0d2d7f8..78f265d 100644
--- a/docs/html/sdk/android-3.1.jd
+++ b/docs/html/sdk/android-3.1.jd
@@ -422,10 +422,9 @@
 
 <p class="note">To look at a sample application that uses joystick motion
 events, see <a
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/
-GameControllerInput.html">GameControllerInput</a> and <a
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/
-GameView.html">GameView</a>.</p>
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/GameControllerInput.html">GameControllerInput</a> 
+and <a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/view/GameView.html">GameView</a>.</p>
 
 <h3>RTP API</h3>
 
@@ -931,7 +930,7 @@
 href="{@docRoot}guide/topics/manifest/uses-feature-element.html">{@code
 &lt;uses-feature&gt;}</a> manifest elements. For more information about
 declaring features in an application manifest, read <a
-href="{docRoot}guide/appendix/market-filters.html">Android Market
+href="{@docRoot}guide/appendix/market-filters.html">Android Market
 Filters</a>.</p>
 
 
diff --git a/docs/html/sdk/android-4.0.jd b/docs/html/sdk/android-4.0.jd
index 7161b03..5f55947 100644
--- a/docs/html/sdk/android-4.0.jd
+++ b/docs/html/sdk/android-4.0.jd
@@ -1292,9 +1292,9 @@
 }
 </pre>
 
-<p>For an example using the {@link android.widget.ShareActionProvider}, see the <a
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/ActionBarActionProviderActivity.html"
->ActionBarActionProviderActivity</a> class in ApiDemos.</p>
+<p>For an example using the {@link android.widget.ShareActionProvider}, see <a
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/ActionBarShareActionProviderActivity.html"
+>ActionBarShareActionProviderActivity</a> in ApiDemos.</p>
 
 
 <h4>Collapsible action views</h4>
diff --git a/docs/html/training/id-auth/authenticate.jd b/docs/html/training/id-auth/authenticate.jd
index 4eba87b..592fe1c 100644
--- a/docs/html/training/id-auth/authenticate.jd
+++ b/docs/html/training/id-auth/authenticate.jd
@@ -63,8 +63,8 @@
 strings that identify your app to the service. You need to obtain these strings
 directly from the service owner. Google has a self-service system for obtaining
 client ids and secrets. The article <a
-href="http://code.google.com/apis/tasks/articles/oauth-and-tasks-on-android.
-html">Getting Started with the Tasks API and OAuth 2.0 on Android</a> explains
+href="http://code.google.com/apis/tasks/articles/oauth-and-tasks-on-android.html">Getting
+Started with the Tasks API and OAuth 2.0 on Android</a> explains
 how to use this system to obtain these values for use with the Google Tasks
 API.</li>
 </ul>
diff --git a/docs/html/training/monitoring-device-state/manifest-receivers.jd b/docs/html/training/monitoring-device-state/manifest-receivers.jd
index 556a733..0b79ce6 100644
--- a/docs/html/training/monitoring-device-state/manifest-receivers.jd
+++ b/docs/html/training/monitoring-device-state/manifest-receivers.jd
@@ -14,7 +14,7 @@
 
 <h2>This lesson teaches you to</h2>
 <ol>
-  <li><a href="ToggleReceivers">Toggle and Cascade State Change Receivers to Improve
+  <li><a href="#ToggleReceivers">Toggle and Cascade State Change Receivers to Improve
 Efficiency</a></li>
 </ol>
 
diff --git a/graphics/java/android/graphics/PathMeasure.java b/graphics/java/android/graphics/PathMeasure.java
index 98f7821..7062824 100644
--- a/graphics/java/android/graphics/PathMeasure.java
+++ b/graphics/java/android/graphics/PathMeasure.java
@@ -17,6 +17,7 @@
 package android.graphics;
 
 public class PathMeasure {
+    private Path mPath;
 
     /**
      * Create an empty PathMeasure object. To uses this to measure the length
@@ -28,6 +29,7 @@
      * is used. If the path is modified, you must call setPath with the path.
      */
     public PathMeasure() {
+        mPath = null;
         native_instance = native_create(0, false);
     }
     
@@ -46,8 +48,8 @@
      *        even if its contour was not explicitly closed.
      */
     public PathMeasure(Path path, boolean forceClosed) {
-        // note: the native side makes a copy of path, so we don't need a java
-        // reference to it here, since it's fine if it gets GC'd
+        // The native implementation does not copy the path, prevent it from being GC'd
+        mPath = path;
         native_instance = native_create(path != null ? path.ni() : 0,
                                         forceClosed);
     }
@@ -56,8 +58,7 @@
      * Assign a new path, or null to have none.
      */
     public void setPath(Path path, boolean forceClosed) {
-        // note: the native side makes a copy of path, so we don't need a java
-        // reference to it here, since it's fine if it gets GC'd
+        mPath = path;
         native_setPath(native_instance,
                        path != null ? path.ni() : 0,
                        forceClosed);
diff --git a/media/java/android/media/AudioTrack.java b/media/java/android/media/AudioTrack.java
index 21f462b..7b2f1b7 100644
--- a/media/java/android/media/AudioTrack.java
+++ b/media/java/android/media/AudioTrack.java
@@ -195,8 +195,8 @@
      * The type of the audio stream to play. See
      *   {@link AudioManager#STREAM_VOICE_CALL}, {@link AudioManager#STREAM_SYSTEM},
      *   {@link AudioManager#STREAM_RING}, {@link AudioManager#STREAM_MUSIC},
-     *   {@link AudioManager#STREAM_ALARM}, {@link AudioManager#STREAM_NOTIFICATION},
-     *   {@link AudioManager#STREAM_DTMF}, and {@link AudioManager#STREAM_BLUETOOTH_SCO}.
+     *   {@link AudioManager#STREAM_ALARM}, {@link AudioManager#STREAM_NOTIFICATION}, and
+     *   {@link AudioManager#STREAM_DTMF}.
      */
     private int mStreamType = AudioManager.STREAM_MUSIC;
     /**
@@ -511,8 +511,7 @@
      * Compare the result against {@link AudioManager#STREAM_VOICE_CALL},
      * {@link AudioManager#STREAM_SYSTEM}, {@link AudioManager#STREAM_RING},
      * {@link AudioManager#STREAM_MUSIC}, {@link AudioManager#STREAM_ALARM},
-     * {@link AudioManager#STREAM_NOTIFICATION}, {@link AudioManager#STREAM_DTMF},
-     * or {@link AudioManager#STREAM_BLUETOOTH_SCO}.
+     * {@link AudioManager#STREAM_NOTIFICATION}, or {@link AudioManager#STREAM_DTMF}.
      */
     public int getStreamType() {
         return mStreamType;
diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
index b514689..52d6d24 100644
--- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
+++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java
@@ -350,6 +350,12 @@
             mScreenOn = false;
             if (DEBUG) Log.d(TAG, "onScreenTurnedOff(" + why + ")");
 
+            // Lock immediately based on setting if secure (user has a pin/pattern/password).
+            // This also "locks" the device when not secure to provide easy access to the
+            // camera while preventing unwanted input.
+            final boolean lockImmediately =
+                mLockPatternUtils.getPowerButtonInstantlyLocks() || !mLockPatternUtils.isSecure();
+
             if (mExitSecureCallback != null) {
                 if (DEBUG) Log.d(TAG, "pending exit secure callback cancelled");
                 mExitSecureCallback.onKeyguardExitResult(false);
@@ -360,8 +366,10 @@
             } else if (mShowing) {
                 notifyScreenOffLocked();
                 resetStateLocked();
-            } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT) {
-                // if the screen turned off because of timeout, set an alarm
+            } else if (why == WindowManagerPolicy.OFF_BECAUSE_OF_TIMEOUT
+                   || (why == WindowManagerPolicy.OFF_BECAUSE_OF_USER && !lockImmediately)) {
+                // if the screen turned off because of timeout or the user hit the power button
+                // and we don't need to lock immediately, set an alarm
                 // to enable it a little bit later (i.e, give the user a chance
                 // to turn the screen back on within a certain window without
                 // having to unlock the screen)
@@ -400,8 +408,7 @@
                     intent.putExtra("seq", mDelayedShowingSequence);
                     PendingIntent sender = PendingIntent.getBroadcast(mContext,
                             0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
-                    mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, when,
-                            sender);
+                    mAlarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, when, sender);
                     if (DEBUG) Log.d(TAG, "setting alarm to turn off keyguard, seq = "
                                      + mDelayedShowingSequence);
                 }