Merge "Link to Downloadable CTS Zip"
diff --git a/build/sdk.atree b/build/sdk.atree
index e87d841..e1629d4 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -91,6 +91,7 @@
 development/samples/NotePad                  samples/${PLATFORM_NAME}/NotePad
 development/samples/ApiDemos                 samples/${PLATFORM_NAME}/ApiDemos
 development/samples/BackupRestore            samples/${PLATFORM_NAME}/BackupRestore
+development/samples/HeavyWeight              samples/${PLATFORM_NAME}/HeavyWeight
 development/samples/SampleSyncAdapter        samples/${PLATFORM_NAME}/SampleSyncAdapter
 development/samples/SkeletonApp              samples/${PLATFORM_NAME}/SkeletonApp
 development/samples/Snake                    samples/${PLATFORM_NAME}/Snake
diff --git a/pdk/docs/source/download.jd b/pdk/docs/source/download.jd
index d972af6..ee0b3cd 100644
--- a/pdk/docs/source/download.jd
+++ b/pdk/docs/source/download.jd
@@ -135,7 +135,7 @@
 <li>volume format: case sensitive, journaled</li>
 </ul>
 </li>
-<li>This will create a .dmg file which, once mounted, acts as a drive with the required formatting for Android development. For a disk image named "android.dmg" stored in your home directory, you can add the following to your ~/.bash_profile to mount the image when you execute "mountAndroid":<br><br><div># command to mount the android file image <br>function mountAndroid{ hdiutil attach ~/android.dmg-mountpoint /Volumes/android; }<br></div>
+<li>This will create a .dmg file which, once mounted, acts as a drive with the required formatting for Android development. For a disk image named "android.dmg" stored in your home directory, you can add the following to your ~/.bash_profile to mount the image when you execute "mountAndroid":<br><br><div># command to mount the android file image <br>function mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }<br></div>
 <br>Once mounted, you'll do all your work in the "android" volume. You can eject it (unmount it) just like you would with an external drive.</li>
 </ul>
 </ul>
@@ -159,14 +159,15 @@
 <span>sudo port selfupdate</span>
 <br></li>
 </ol>
-<li>Get the following packages from port:<br>$<span>POSIXLY_CORRECT=1</span>
-sudo port install gmake libsdl git-core gnupg <br><span>If using Mac OS 10.4, also install:<br>$<span>POSIXLY_CORRECT=1</span>
+<li>Get the following packages from port:<br>$ <span>POSIXLY_CORRECT=1</span>
+sudo port install gmake libsdl git-core gnupg <br><span>If using Mac OS 10.4, also install:<br>$ <span>POSIXLY_CORRECT=1</span>
 sudo port install bison <br></span>
 </li>
-<li>Upgrade GNU make to 3.81 or later by running.Mac OS doesn't come with a recent enough version.<br>$ sudo ln -s gmake /opt/local/bin/make <br></li>
+<li>Upgrade GNU make to 3.81 or later by running the following command. (Mac OS doesn't come with a recent enough version.)<br>$ sudo ln -s gmake /opt/local/bin/make <br></li>
 <li>Set an appropriate per-process file descriptor limit. To do this, add the following lines to your <i><span>.bash_profile</span>
 </i>
-file:<br># set the number of open files to be 1024<br>ulimit -S -n 1024</li>
+file:<br># set the number of open files to be 1024<br>$ <span>ulimit -S -n 1024</span><br>
+Note that this may not be necessary; on some systems, the output of "ulimit -S" will show "unlimited". In this case, there is no need to set the limit to 1024.</li>
 </ol>
 </div>
 </div>
@@ -180,7 +181,7 @@
 .<br></p>
 To install, initialize, and configure Repo, follow these steps:<br><br></div>
 <ol><li><span>Make sure you have a~/bindirectory in your home directory, and check to be sure that this bin directory is in your path:</span>
-<br>$ cd~<br><span><span>$ mkdir bin <br>$ echo $PATH <br></span>
+<br>$ cd ~<br><span><span>$ mkdir bin <br>$ echo $PATH <br></span>
 </span>
 </li>
 <li><span>Download thereposcript and make sure it is executable:</span>
@@ -197,7 +198,7 @@
 <span>$ mkdir mydroid</span>
 <br><span>$ cd mydroid</span>
 <br></li>
-<li><span>Runrepo initto bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest:</span>
+<li><span>Run "repo init" to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest:</span>
 <br><span>$ repo init</span>
 -u git://android.git.kernel.org/platform/manifest.git</li>
 <ul><li><span>If you would like to check out a branch other than "master", specify it with -b, like:</span>
@@ -238,7 +239,7 @@
 Getting the files</h2>
 <div><span><span>To pull down files to your working directory from the repositories as specified in the default manifest, run</span>
 <br><br>$ repo sync <i><br></i>
-<br><span>For more aboutrepo syncand other Repo commands, see</span>
+<br><span>For more about "repo sync" and other Repo commands, see</span>
 <a href="{@docRoot}source/git-repo.html">Using Repo and Git</a>
 <span>.</span>
 <br><br><span>The Android source files will be located in your working
diff --git a/samples/HeavyWeight/Android.mk b/samples/HeavyWeight/Android.mk
new file mode 100644
index 0000000..c85626c
--- /dev/null
+++ b/samples/HeavyWeight/Android.mk
@@ -0,0 +1,16 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := samples
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := HeavyWeight
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
+
+# Use the following include to make our test apk.
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/samples/HeavyWeight/AndroidManifest.xml b/samples/HeavyWeight/AndroidManifest.xml
new file mode 100644
index 0000000..c69befc
--- /dev/null
+++ b/samples/HeavyWeight/AndroidManifest.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<!-- Declare the contents of this Android application.  The namespace
+     attribute brings in the Android platform namespace, and the package
+     supplies a unique name for the application.  When writing your
+     own application, the package name must be changed from "com.example.*"
+     to come from a domain that you own or have control over. -->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.example.android.heavyweight">
+    <application android:label="Heavy Weight" android:heavyWeight="true">
+        <activity android:name="HeavyWeight">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
diff --git a/samples/HeavyWeight/res/layout/heavy_weight.xml b/samples/HeavyWeight/res/layout/heavy_weight.xml
new file mode 100644
index 0000000..345d75e
--- /dev/null
+++ b/samples/HeavyWeight/res/layout/heavy_weight.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:orientation="vertical" android:padding="4dip"
+    android:gravity="center_horizontal"
+    android:layout_width="match_parent" android:layout_height="match_parent">
+
+    <TextView
+        android:layout_width="match_parent" android:layout_height="wrap_content"
+        android:layout_weight="0"
+        android:paddingBottom="4dp"
+        android:text="@string/content_text"/>
+
+    <Button android:id="@+id/stop"
+        android:layout_width="wrap_content" android:layout_height="wrap_content" 
+        android:text="@string/stop">
+        <requestFocus />
+    </Button>
+
+</LinearLayout>
diff --git a/samples/HeavyWeight/res/values/strings.xml b/samples/HeavyWeight/res/values/strings.xml
new file mode 100644
index 0000000..88bc413
--- /dev/null
+++ b/samples/HeavyWeight/res/values/strings.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+  
+          http://www.apache.org/licenses/LICENSE-2.0
+  
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources>
+
+    <string name="content_text">A heavy-weight application will not be killed until explicitly stopped.</string>
+    <string name="stop">Stop</string>
+
+</resources>
diff --git a/samples/HeavyWeight/src/com/example/android/heavyweight/HeavyWeight.java b/samples/HeavyWeight/src/com/example/android/heavyweight/HeavyWeight.java
new file mode 100644
index 0000000..f6024e9
--- /dev/null
+++ b/samples/HeavyWeight/src/com/example/android/heavyweight/HeavyWeight.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.heavyweight;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+
+/**
+ * Basic "heavy-weight" application, which will not be killed by Android
+ * while it is in the background.
+ */
+public class HeavyWeight extends Activity {
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.heavy_weight);
+        
+        Button button = (Button)findViewById(R.id.stop);
+        button.setOnClickListener(mStopListener);
+    }
+    
+    private OnClickListener mStopListener = new OnClickListener() {
+        public void onClick(View v) {
+            finish();
+        }
+    };
+}
+
diff --git a/samples/HelloActivity/src/com/example/android/helloactivity/HelloActivity.java b/samples/HelloActivity/src/com/example/android/helloactivity/HelloActivity.java
index 62bf5ca..a5a5c96 100644
--- a/samples/HelloActivity/src/com/example/android/helloactivity/HelloActivity.java
+++ b/samples/HelloActivity/src/com/example/android/helloactivity/HelloActivity.java
@@ -24,9 +24,6 @@
  * A minimal "Hello, World!" application.
  */
 public class HelloActivity extends Activity {
-    public HelloActivity() {
-    }
-
     /**
      * Called with the activity is first created.
      */