am e52f44d9: am 3b712fda: Merge "Add \'cpufeatures\' library to perform runtime CPU family/features detection." into eclair

Merge commit 'e52f44d9506b56e610f81eecc4f6aaca390f7a8d'

* commit 'e52f44d9506b56e610f81eecc4f6aaca390f7a8d':
  Add 'cpufeatures' library to perform runtime CPU family/features detection.
diff --git a/apps/BugReportSender/Android.mk b/apps/BugReportSender/Android.mk
new file mode 100644
index 0000000..b94f802
--- /dev/null
+++ b/apps/BugReportSender/Android.mk
@@ -0,0 +1,23 @@
+# Copyright (C) 2009 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.
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+LOCAL_CERTIFICATE := platform
+LOCAL_MODULE_TAGS := eng
+LOCAL_PACKAGE_NAME := BugReportSender
+LOCAL_SDK_VERSION := current
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+include $(BUILD_PACKAGE)
diff --git a/apps/BugReportSender/AndroidManifest.xml b/apps/BugReportSender/AndroidManifest.xml
new file mode 100644
index 0000000..39c1d7e
--- /dev/null
+++ b/apps/BugReportSender/AndroidManifest.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+        package="com.android.bugreportsender" >
+
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
+
+    <application
+            android:icon="@drawable/icon"
+            android:label="Bug Report Sender"
+            android:versionCode="1" >
+
+        <uses-sdk android:minSdkVersion="4" />
+
+        <activity android:name="BugReportListActivity">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+    </application>
+
+</manifest>
diff --git a/apps/BugReportSender/res/drawable-hdpi/icon.png b/apps/BugReportSender/res/drawable-hdpi/icon.png
new file mode 100755
index 0000000..60fbdf5
--- /dev/null
+++ b/apps/BugReportSender/res/drawable-hdpi/icon.png
Binary files differ
diff --git a/apps/BugReportSender/res/drawable-mdpi/icon.png b/apps/BugReportSender/res/drawable-mdpi/icon.png
new file mode 100644
index 0000000..cb40a19
--- /dev/null
+++ b/apps/BugReportSender/res/drawable-mdpi/icon.png
Binary files differ
diff --git a/apps/BugReportSender/src/com/android/bugreportsender/BugReportListActivity.java b/apps/BugReportSender/src/com/android/bugreportsender/BugReportListActivity.java
new file mode 100644
index 0000000..56bc4d8
--- /dev/null
+++ b/apps/BugReportSender/src/com/android/bugreportsender/BugReportListActivity.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (C) 2009 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.android.bugreportsender;
+
+import android.app.ListActivity;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.FileObserver;
+import android.os.Handler;
+import android.util.Log;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+
+/**
+ * Shows a list of bug reports currently in /sdcard/bugreports
+ */
+public class BugReportListActivity extends ListActivity {
+    private static final String TAG = "BugReportListActivity";
+    private static final File REPORT_DIR = new File("/sdcard/bugreports");
+
+    private ArrayAdapter<String> mAdapter = null;
+    private ArrayList<File> mFiles = null;
+    private Handler mHandler = null;
+    private FileObserver mObserver = null;
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1);
+        mFiles = new ArrayList<File>();
+        mHandler = new Handler();
+
+        int flags = FileObserver.CREATE | FileObserver.MOVED_TO;
+        mObserver = new FileObserver(REPORT_DIR.getPath(), flags) {
+            public void onEvent(int event, String path) {
+                mHandler.post(new Runnable() { public void run() { scanDirectory(); } });
+            }
+        };
+
+        setListAdapter(mAdapter);
+    }
+
+    @Override
+    public void onStart() {
+        super.onStart();
+        mObserver.startWatching();
+        scanDirectory();
+    }
+
+    @Override
+    public void onStop() {
+        super.onStop();
+        mObserver.stopWatching();
+    }
+
+    @Override
+    protected void onListItemClick(ListView l, View v, int position, long id) {
+        super.onListItemClick(l, v, position, id);
+        if (position < mFiles.size()) {
+            File file = mFiles.get(position);
+            Intent intent = new Intent(Intent.ACTION_SEND);
+            intent.putExtra("subject", file.getName());
+            intent.putExtra("body", "Build: " + Build.DISPLAY + "\n(Sent by BugReportSender)");
+            intent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
+            if (file.getName().endsWith(".gz")) {
+                intent.setType("application/x-gzip");
+            } else if (file.getName().endsWith(".txt")) {
+                intent.setType("text/plain");
+            } else {
+                intent.setType("application/octet-stream");
+            }
+            startActivity(intent);
+        }
+    }
+
+    private void scanDirectory() {
+        mAdapter.clear();
+        mFiles.clear();
+
+        File[] files = REPORT_DIR.listFiles();
+        if (files == null) return;
+
+        // Sort in reverse order: newest bug reports first
+        Arrays.sort(files, Collections.reverseOrder());
+        for (int i = 0; i < files.length; i++) {
+            String name = files[i].getName();
+            if (name.endsWith(".gz")) name = name.substring(0, name.length() - 3);
+            if (!name.startsWith("bugreport-") || !name.endsWith(".txt")) {
+                Log.w(TAG, "Ignoring non-bugreport: " + files[i]);
+                continue;
+            }
+
+            // Make sure to keep the parallel arrays in sync
+            mAdapter.add(name.substring(10, name.length() - 4));
+            mFiles.add(files[i]);
+        }
+    }
+}
diff --git a/apps/BuildWidget/Android.mk b/apps/BuildWidget/Android.mk
new file mode 100644
index 0000000..22de423
--- /dev/null
+++ b/apps/BuildWidget/Android.mk
@@ -0,0 +1,16 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := samples tests
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := BuildWidget
+
+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/apps/BuildWidget/AndroidManifest.xml b/apps/BuildWidget/AndroidManifest.xml
new file mode 100644
index 0000000..07684e4
--- /dev/null
+++ b/apps/BuildWidget/AndroidManifest.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.buildwidget"
+    android:versionCode="1"
+    android:versionName="1.0">
+
+    <uses-sdk android:minSdkVersion="3" />
+    <application android:icon="@drawable/icon" android:label="@string/app_name">
+        <receiver android:name=".BuildWidget" android:label="@string/widget_name">
+            <intent-filter>
+                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
+            </intent-filter>
+            <meta-data android:name="android.appwidget.provider" android:resource="@xml/widget_build" />
+        </receiver>
+        <service android:name=".BuildWidget$UpdateService" />
+    </application>
+    
+</manifest>
diff --git a/apps/BuildWidget/res/drawable-hdpi/icon.png b/apps/BuildWidget/res/drawable-hdpi/icon.png
new file mode 100644
index 0000000..60fbdf5
--- /dev/null
+++ b/apps/BuildWidget/res/drawable-hdpi/icon.png
Binary files differ
diff --git a/apps/BuildWidget/res/drawable-mdpi/icon.png b/apps/BuildWidget/res/drawable-mdpi/icon.png
new file mode 100644
index 0000000..cb40a19
--- /dev/null
+++ b/apps/BuildWidget/res/drawable-mdpi/icon.png
Binary files differ
diff --git a/apps/BuildWidget/res/layout/widget.xml b/apps/BuildWidget/res/layout/widget.xml
new file mode 100644
index 0000000..81b3ae4
--- /dev/null
+++ b/apps/BuildWidget/res/layout/widget.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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:id="@+id/widget"
+    android:layout_width="fill_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:padding="6dip"
+    >
+
+    <TextView
+        android:id="@+id/build_info"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:gravity="left"
+        style="@style/Text.BuildInfo.Fancy"
+        android:textSize="18dip"
+        />
+
+    <TextView
+        android:id="@+id/build_changelist"
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:gravity="left"
+        android:layout_marginTop="4dip"
+        style="@style/Text.BuildInfo.Fancy"
+        android:textSize="9dip"
+        />
+
+</LinearLayout>
diff --git a/apps/BuildWidget/res/values/colors.xml b/apps/BuildWidget/res/values/colors.xml
new file mode 100644
index 0000000..e6d03c7
--- /dev/null
+++ b/apps/BuildWidget/res/values/colors.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <color name="droidgreen">#FFA4C639</color>
+</resources>
diff --git a/apps/BuildWidget/res/values/strings.xml b/apps/BuildWidget/res/values/strings.xml
new file mode 100644
index 0000000..14f7bb0
--- /dev/null
+++ b/apps/BuildWidget/res/values/strings.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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="app_name">Build Number</string>
+    <string name="widget_name">Build Number</string>
+</resources>
diff --git a/apps/BuildWidget/res/values/styles.xml b/apps/BuildWidget/res/values/styles.xml
new file mode 100644
index 0000000..7d67536
--- /dev/null
+++ b/apps/BuildWidget/res/values/styles.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <style name="Text" />
+
+    <style name="Text.BuildInfo">
+<!--        <item name="android:typeface">monospace</item>-->
+        <item name="android:textSize">12sp</item>
+        <item name="android:textStyle">bold</item>
+        <item name="android:textColor">@color/droidgreen</item>
+        <item name="android:shadowColor">@android:color/black</item>
+        <item name="android:shadowDx">0</item>
+        <item name="android:shadowDy">0</item>
+        <item name="android:shadowRadius">3.0</item>
+    </style>
+
+    <style name="Text.BuildInfo.Fancy">
+        <item name="android:textColor">@android:color/white</item>
+        <item name="android:shadowColor">@color/droidgreen</item>
+    </style>
+</resources>
diff --git a/apps/BuildWidget/res/xml/widget_build.xml b/apps/BuildWidget/res/xml/widget_build.xml
new file mode 100644
index 0000000..c7c443a
--- /dev/null
+++ b/apps/BuildWidget/res/xml/widget_build.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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.
+-->
+
+<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
+    android:minWidth="150dip"
+    android:minHeight="72dip"
+    android:updatePeriodMillis="0"
+    android:initialLayout="@layout/widget" />
diff --git a/apps/BuildWidget/src/com/android/buildwidget/BuildWidget.java b/apps/BuildWidget/src/com/android/buildwidget/BuildWidget.java
new file mode 100644
index 0000000..327a34b
--- /dev/null
+++ b/apps/BuildWidget/src/com/android/buildwidget/BuildWidget.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (C) 2009 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.android.buildwidget;
+
+import android.app.PendingIntent;
+import android.app.Service;
+import android.appwidget.AppWidgetManager;
+import android.appwidget.AppWidgetProvider;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.res.Resources;
+import android.net.Uri;
+import android.os.IBinder;
+import android.text.format.Time;
+import android.util.Log;
+import android.widget.RemoteViews;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Define a simple widget that shows the Wiktionary "Word of the day." To build
+ * an update we spawn a background {@link Service} to perform the API queries.
+ */
+public class BuildWidget extends AppWidgetProvider {
+    @Override
+    public void onUpdate(Context context, AppWidgetManager appWidgetManager,
+            int[] appWidgetIds) {
+        // To prevent any ANR timeouts, we perform the update in a service
+        context.startService(new Intent(context, UpdateService.class));
+    }
+
+    public static class UpdateService extends Service {
+        @Override
+        public void onStart(Intent intent, int startId) {
+            // Build the widget update
+            RemoteViews updateViews = buildUpdate(this);
+
+            // Push update for this widget to the home screen
+            ComponentName thisWidget = new ComponentName(this, BuildWidget.class);
+            AppWidgetManager manager = AppWidgetManager.getInstance(this);
+            manager.updateAppWidget(thisWidget, updateViews);
+        }
+
+        public RemoteViews buildUpdate(Context context) {
+            // Pick out month names from resources
+            Resources res = context.getResources();
+            RemoteViews updateViews = new RemoteViews(
+                context.getPackageName(), R.layout.widget);
+
+            PendingIntent pendingIntent = PendingIntent.getActivity(context,
+                    0 /* no requestCode */, 
+                    new Intent(android.provider.Settings.ACTION_DEVICE_INFO_SETTINGS),
+                    0 /* no flags */);
+            updateViews.setOnClickPendingIntent(R.id.widget, pendingIntent);
+
+            updateViews.setTextViewText(R.id.build_info, 
+                android.os.Build.VERSION.CODENAME + " " +
+                android.os.Build.ID);
+            updateViews.setTextViewText(R.id.build_changelist,
+                android.os.Build.FINGERPRINT
+                );
+            return updateViews;
+        }
+
+        @Override
+        public IBinder onBind(Intent intent) {
+            // We don't need to bind to this service
+            return null;
+        }
+    }
+}
diff --git a/apps/CustomLocale/Android.mk b/apps/CustomLocale/Android.mk
index 275207f..4b8badc 100644
--- a/apps/CustomLocale/Android.mk
+++ b/apps/CustomLocale/Android.mk
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
-LOCAL_MODULE_TAGS := user
+LOCAL_MODULE_TAGS := optional
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
diff --git a/apps/CustomLocale/res/layout/list_item.xml b/apps/CustomLocale/res/layout/list_item.xml
index 8c59f92..0ffb8b0 100644
--- a/apps/CustomLocale/res/layout/list_item.xml
+++ b/apps/CustomLocale/res/layout/list_item.xml
@@ -15,12 +15,12 @@
 -->
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:padding="5dip">
     <TextView
         android:id="@+id/locale_code"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:textAppearance="?android:textAppearanceLarge"
         android:layout_weight="1"
@@ -28,7 +28,7 @@
     <TextView
         xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@+id/locale_name"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:textAppearance="?android:textAppearance"
         android:layout_weight="1" />
diff --git a/apps/CustomLocale/res/layout/main.xml b/apps/CustomLocale/res/layout/main.xml
index b1eaa51..55bd90c 100644
--- a/apps/CustomLocale/res/layout/main.xml
+++ b/apps/CustomLocale/res/layout/main.xml
@@ -16,10 +16,10 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_weight="0"
         android:text="@string/header_current_locale"
@@ -28,12 +28,12 @@
         android:background="@color/header_background" />
     <TextView
         android:id="@+id/current_locale"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_weight="0"
         android:padding="5dip" />
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_weight="0"
         android:text="@string/header_locale_list"
@@ -42,18 +42,18 @@
         android:background="@color/header_background" />
     <ListView
         android:id="@id/android:list"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:layout_weight="1"
         android:padding="8dip" />
     <TextView
         android:id="@id/android:empty"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:text="@string/no_data_label" />
     <Button
         android:id="@+id/new_locale"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingLeft="8dip"
diff --git a/apps/CustomLocale/res/layout/new_locale.xml b/apps/CustomLocale/res/layout/new_locale.xml
index fafb16e..e5be408 100644
--- a/apps/CustomLocale/res/layout/new_locale.xml
+++ b/apps/CustomLocale/res/layout/new_locale.xml
@@ -16,32 +16,32 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:paddingLeft="8dip"
     android:paddingRight="8dip">
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/new_locale_label" />
     <EditText
         android:id="@+id/value"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:hint="@string/locale_default" android:inputType="text"/>
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
         <Button
             android:id="@+id/add"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:text="@string/add_button" android:layout_gravity="center_vertical"/>
         <Button
             android:id="@+id/add_and_select"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_weight="1"
             android:text="@string/add_select_button" android:layout_gravity="center_vertical"/>
diff --git a/apps/Development/Android.mk b/apps/Development/Android.mk
index a666d7f..1cef548 100644
--- a/apps/Development/Android.mk
+++ b/apps/Development/Android.mk
@@ -4,7 +4,6 @@
 LOCAL_MODULE_TAGS := eng
 
 LOCAL_JAVA_LIBRARIES := android.test.runner
-LOCAL_STATIC_JAVA_LIBRARIES := googlelogin-client
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files) \
                 src/com/android/development/IRemoteService.aidl \
diff --git a/apps/Development/AndroidManifest.xml b/apps/Development/AndroidManifest.xml
index 7f0f594..3c75a63 100644
--- a/apps/Development/AndroidManifest.xml
+++ b/apps/Development/AndroidManifest.xml
@@ -17,23 +17,29 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
         package="com.android.development"
         android:versionCode="1" android:versionName="1.0">
-    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
+    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
+    <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+    <uses-permission android:name="android.permission.DEVICE_POWER" />
     <uses-permission android:name="android.permission.DUMP" />
-    <uses-permission android:name="android.permission.SET_PREFERRED_APPLICATIONS" />
-    <uses-permission android:name="android.permission.RESTART_PACKAGES" />
-    <uses-permission android:name="android.permission.SET_ANIMATION_SCALE" />
-    <uses-permission android:name="android.permission.SET_PROCESS_LIMIT" />
-    <uses-permission android:name="android.permission.SET_ALWAYS_FINISH" />
-    <uses-permission android:name="android.permission.SET_DEBUG_APP" />
+    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
     <uses-permission android:name="android.permission.HARDWARE_TEST" />
     <uses-permission android:name="android.permission.INTERNET" />
+    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
+    <uses-permission android:name="android.permission.REBOOT" />
+    <uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES" />
+    <uses-permission android:name="android.permission.SET_ALWAYS_FINISH" />
+    <uses-permission android:name="android.permission.SET_ANIMATION_SCALE" />
+    <uses-permission android:name="android.permission.SET_DEBUG_APP" />
+    <uses-permission android:name="android.permission.SET_PREFERRED_APPLICATIONS" />
+    <uses-permission android:name="android.permission.SET_PROCESS_LIMIT" />
+    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
+    <uses-permission android:name="android.permission.WAKE_LOCK" />
+    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
+    <uses-permission android:name="com.google.android.googleapps.permission.ACCESS_GOOGLE_PASSWORD" />
     <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
     <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.ALL_SERVICES" />
     <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.YouTubeUser" />
-    <uses-permission android:name="com.google.android.googleapps.permission.ACCESS_GOOGLE_PASSWORD" />
-    <uses-permission android:name="android.permission.GET_ACCOUNTS" />
-    <uses-permission android:name="android.permission.USE_CREDENTIALS" />
-    <uses-permission android:name="android.permission.MANAGE_ACCOUNTS" />
 
     <application android:label="Dev Tools"
             android:icon="@drawable/ic_launcher_devtools">
@@ -53,13 +59,6 @@
                 <category android:name="android.intent.category.TEST" />
             </intent-filter>
         </activity>
-        <activity android:name="ExceptionBrowser" android:label="Exception Browser">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.TEST" />
-            </intent-filter>
-        </activity>
-        <activity android:name="StacktraceViewer" android:label="Stacktrace Viewer"/>
         <activity android:name="PackageSummary" android:label="Package Summary">
         </activity>
         <activity android:name="ShowActivity" android:label="Activity">
@@ -96,6 +95,12 @@
         </activity>
         <activity android:name="Details">
         </activity>
+        <activity android:name="Connectivity" android:label="Connectivity" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.TEST" />
+            </intent-filter>
+        </activity>
         <activity android:name="DevelopmentSettings" android:label="Development Settings" >
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -117,44 +122,57 @@
             </intent-filter>
         </activity>
 
-    <activity android:name="GLSTester" android:label="Google Login Service">
+        <activity android:name="GLSTester" android:label="Google Login Service">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.TEST" />
             </intent-filter>
         </activity>
 
-    <activity android:name="RunningProcesses" android:label="Running processes">
+        <activity android:name="RunningProcesses" android:label="Running processes">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.TEST" />
             </intent-filter>
         </activity>
-    <activity android:name="ProcessInfo" android:label="Process Information">
+        <activity android:name="ProcessInfo" android:label="Process Information">
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
-    </activity>
+        </activity>
     <!--
-    <activity android:name="AppHwConfigList" android:label="Applications Hw Configuration">
+        <activity android:name="AppHwConfigList" android:label="Applications Hw Configuration">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.TEST" />
             </intent-filter>
-    </activity>
+        </activity>
     -->
-    <activity android:name="AppHwPref" android:label="Applications Hardware Preferences">
+        <activity android:name="AppHwPref" android:label="Applications Hardware Preferences">
             <intent-filter>
                 <action android:name="android.intent.action.VIEW" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
-    </activity>
-    <activity android:name="PermissionDetails" android:label="Permission Info">
+        </activity>
+        <activity android:name="PermissionDetails" android:label="Permission Info">
             <intent-filter>
                 <action android:name="com.android.development.VIEW_PERMISSION" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
-    </activity>
+        </activity>
+
+        <activity android:name="BadBehaviorActivity" android:label="Bad Behavior">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.TEST" />
+            </intent-filter>
+        </activity>
+        <receiver android:name="BadBehaviorActivity$BadReceiver">
+            <intent-filter>
+                <action android:name="com.android.development.BAD_BEHAVIOR" />
+            </intent-filter>
+        </receiver>
+        <service android:name="BadBehaviorActivity$BadService" />
     </application>
 </manifest>
diff --git a/apps/Development/res/layout/account_list_context_menu.xml b/apps/Development/res/layout/account_list_context_menu.xml
index 50e7ca1..89f8241 100644
--- a/apps/Development/res/layout/account_list_context_menu.xml
+++ b/apps/Development/res/layout/account_list_context_menu.xml
@@ -22,6 +22,9 @@
     <item android:id="@+id/accounts_tester_get_auth_token"
         android:title="@string/accounts_tester_get_auth_token" />
 
+    <item android:id="@+id/accounts_tester_test_has_features"
+        android:title="@string/accounts_tester_test_has_features" />
+
     <item android:id="@+id/accounts_tester_invalidate_auth_token"
         android:title="@string/accounts_tester_invalidate_auth_token" />
 
diff --git a/apps/Development/res/layout/account_list_view.xml b/apps/Development/res/layout/account_list_view.xml
index d255672..47484ed 100644
--- a/apps/Development/res/layout/account_list_view.xml
+++ b/apps/Development/res/layout/account_list_view.xml
@@ -16,5 +16,5 @@
 
 <ListView
    xmlns:android="http://schemas.android.com/apk/res/android"
-   android:layout_width="fill_parent"
-   android:layout_height="fill_parent"/>
+   android:layout_width="match_parent"
+   android:layout_height="match_parent"/>
diff --git a/apps/Development/res/layout/accounts_tester.xml b/apps/Development/res/layout/accounts_tester.xml
index e69f505..e3dee53 100644
--- a/apps/Development/res/layout/accounts_tester.xml
+++ b/apps/Development/res/layout/accounts_tester.xml
@@ -17,20 +17,20 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <LinearLayout
        android:orientation="vertical"
-       android:layout_width="fill_parent"
+       android:layout_width="match_parent"
        android:layout_height="wrap_content">
 
         <ListView android:id="@+id/accounts_tester_authenticators_list"
-           android:layout_width="fill_parent" android:layout_height="fill_parent"/>
+           android:layout_width="match_parent" android:layout_height="match_parent"/>
 
       <LinearLayout
          android:orientation="horizontal"
-         android:layout_width="fill_parent"
+         android:layout_width="match_parent"
          android:layout_height="wrap_content">
 
           <TextView android:id="@+id/accounts_tester_account_types_spinner_label"
@@ -45,11 +45,11 @@
 
       <LinearLayout
          android:orientation="vertical"
-         android:layout_width="fill_parent"
+         android:layout_width="match_parent"
          android:layout_height="wrap_content">
           <LinearLayout
              android:orientation="horizontal"
-             android:layout_width="fill_parent"
+             android:layout_width="match_parent"
              android:layout_height="wrap_content">
          <Button
             android:id="@+id/accounts_tester_get_accounts_by_type"
@@ -75,7 +75,7 @@
 
           <LinearLayout
              android:orientation="horizontal"
-             android:layout_width="fill_parent"
+             android:layout_width="match_parent"
              android:layout_height="wrap_content">
               <TextView android:id="@+id/accounts_tester_desiredFeatures"
                        android:layout_width="wrap_content"
@@ -89,7 +89,7 @@
           </LinearLayout>
           <LinearLayout
              android:orientation="horizontal"
-             android:layout_width="fill_parent"
+             android:layout_width="match_parent"
              android:layout_height="wrap_content">
               <TextView android:id="@+id/accounts_tester_desiredFeatures"
                        android:layout_width="wrap_content"
@@ -106,11 +106,11 @@
 
     <LinearLayout
        android:orientation="horizontal"
-       android:layout_width="fill_parent"
+       android:layout_width="match_parent"
        android:layout_height="wrap_content">
 
        <ListView android:id="@+id/accounts_tester_accounts_list"
-           android:layout_width="fill_parent" android:layout_height="fill_parent"/>
+           android:layout_width="match_parent" android:layout_height="match_parent"/>
 
     </LinearLayout>
 
diff --git a/apps/Development/res/layout/application_hw_pref.xml b/apps/Development/res/layout/application_hw_pref.xml
index c38a0cb..c0011e5 100755
--- a/apps/Development/res/layout/application_hw_pref.xml
+++ b/apps/Development/res/layout/application_hw_pref.xml
@@ -15,75 +15,75 @@
 -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <LinearLayout
         android:orientation="vertical"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:padding="4dip" >
     
         <TextView android:id="@+id/attr_package_label"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/package_label"
             android:textStyle="bold" />
         <TextView android:id="@+id/attr_package"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
         <TextView android:id="@+id/attr_touchscreen_label"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/touchscreen_label"
             android:textStyle="bold" />
         <TextView android:id="@+id/attr_touchscreen"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
         <TextView android:id="@+id/attr_input_method_label"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/input_method_label"
             android:textStyle="bold" />
         <TextView android:id="@+id/attr_input_method"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
         <TextView android:id="@+id/attr_hard_keyboard_label"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/hard_keyboard_label"
             android:textStyle="bold" />
         <TextView android:id="@+id/attr_hard_keyboard"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
         <TextView android:id="@+id/attr_navigation_label"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/navigation_label"
             android:textStyle="bold" />
         <TextView android:id="@+id/attr_navigation"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
         <TextView android:id="@+id/attr_five_way_nav_label"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/five_way_nav_label"
             android:textStyle="bold" />
         <TextView android:id="@+id/attr_five_way_nav"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
         <TextView android:id="@+id/attr_gles_version_label"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/gles_version_label"
             android:textStyle="bold" />
         <TextView android:id="@+id/attr_gles_version"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
     </LinearLayout>
 </ScrollView>
diff --git a/apps/Development/res/layout/authenticators_list_item.xml b/apps/Development/res/layout/authenticators_list_item.xml
index 309a818..25e1dae 100644
--- a/apps/Development/res/layout/authenticators_list_item.xml
+++ b/apps/Development/res/layout/authenticators_list_item.xml
@@ -19,7 +19,7 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:minHeight="?android:attr/listPreferredItemHeight"
     android:paddingTop="1dip"
@@ -35,7 +35,7 @@
 
     <TextView android:id="@+id/accounts_tester_authenticator_label"
         android:layout_width="wrap_content"
-        android:layout_height="fill_parent"
+        android:layout_height="match_parent"
         android:gravity="center_vertical"
         android:textAppearance="?android:attr/textAppearanceLarge"
         android:layout_gravity="center_horizontal|center_vertical" />
diff --git a/apps/Development/res/layout/bad_behavior.xml b/apps/Development/res/layout/bad_behavior.xml
new file mode 100644
index 0000000..abd863f
--- /dev/null
+++ b/apps/Development/res/layout/bad_behavior.xml
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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:layout_width="match_parent"
+    android:layout_height="match_parent">
+
+    <Button android:id="@+id/bad_behavior_crash_system"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/bad_behavior_crash_system_label" />
+
+    <Button android:id="@+id/bad_behavior_crash_main"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/bad_behavior_crash_main_label" />
+
+    <Button android:id="@+id/bad_behavior_crash_thread"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/bad_behavior_crash_thread_label" />
+
+    <Button android:id="@+id/bad_behavior_crash_native"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/bad_behavior_crash_native_label" />
+
+    <Button android:id="@+id/bad_behavior_wtf"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/bad_behavior_wtf_label" />
+
+    <Button android:id="@+id/bad_behavior_anr"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/bad_behavior_anr_label" />
+
+    <Button android:id="@+id/bad_behavior_anr_activity"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/bad_behavior_anr_activity_label" />
+
+    <Button android:id="@+id/bad_behavior_anr_broadcast"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/bad_behavior_anr_broadcast_label" />
+
+    <Button android:id="@+id/bad_behavior_anr_service"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/bad_behavior_anr_service_label" />
+
+</LinearLayout>
diff --git a/apps/Development/res/layout/connectivity.xml b/apps/Development/res/layout/connectivity.xml
new file mode 100644
index 0000000..612304f
--- /dev/null
+++ b/apps/Development/res/layout/connectivity.xml
@@ -0,0 +1,206 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/Settings/assets/res/any/layout/keyboard_version.xml
+**
+** Copyright 2006, 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:layout_width="match_parent"
+  android:layout_height="match_parent">
+
+    <LinearLayout
+      android:orientation="horizontal"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+        <Button android:id="@+id/enableWifi"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/enable_wifi" />
+        <Button android:id="@+id/disableWifi"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/disable_wifi" />
+    </LinearLayout>
+
+    <!-- divider line -->
+    <View android:background="#FFFFFFFF"
+      android:layout_width="match_parent"
+      android:layout_height="3dip" />
+
+    <LinearLayout
+      android:orientation="horizontal"
+      android:paddingTop="4dip"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+        <Button android:id="@+id/startDelayedCycle"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/start_toggling" />
+        <Button android:id="@+id/stopDelayedCycle"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/stop_toggling" />
+    </LinearLayout>
+
+    <LinearLayout
+      android:orientation="horizontal"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+        <TextView
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/wifi_on_duration" />
+        <EditText android:id="@+id/dc_wifi_on_duration"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:minEms="15" />
+    </LinearLayout>
+
+    <LinearLayout
+      android:orientation="horizontal"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+        <TextView
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/wifi_off_duration" />
+        <EditText android:id="@+id/dc_wifi_off_duration"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:minEms="15"/>
+    </LinearLayout>
+
+    <LinearLayout
+      android:orientation="horizontal"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+        <TextView
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/wifi_cycles_done" />
+        <TextView android:id="@+id/dc_wifi_cycles_done"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:minEms="15"/>
+    </LinearLayout>
+
+    <!-- divider line -->
+    <View android:background="#FFFFFFFF"
+      android:layout_width="match_parent"
+      android:layout_height="3dip" />
+
+    <LinearLayout
+      android:orientation="horizontal"
+      android:paddingTop="4dip"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+        <Button android:id="@+id/startScreenCycle"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/start_screen_toggling" />
+        <Button android:id="@+id/stopScreenCycle"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/stop_screen_toggling" />
+    </LinearLayout>
+
+    <LinearLayout
+      android:orientation="horizontal"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+        <TextView
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/wifi_on_duration" />
+        <EditText android:id="@+id/sc_wifi_on_duration"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:minEms="15" />
+    </LinearLayout>
+
+    <LinearLayout
+      android:orientation="horizontal"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+        <TextView
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/wifi_off_duration" />
+        <EditText android:id="@+id/sc_wifi_off_duration"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:minEms="15"/>
+    </LinearLayout>
+
+    <LinearLayout
+      android:orientation="horizontal"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+        <TextView
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/wifi_cycles_done" />
+        <TextView android:id="@+id/sc_wifi_cycles_done"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:minEms="15"/>
+    </LinearLayout>
+
+    <!-- divider line -->
+    <View android:background="#FFFFFFFF"
+      android:layout_width="match_parent"
+      android:layout_height="3dip" />
+
+    <LinearLayout
+      android:orientation="horizontal"
+      android:paddingTop="4dip"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+        <Button android:id="@+id/start_mms"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/start_mms" />
+        <Button android:id="@+id/stop_mms"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/stop_mms" />
+    </LinearLayout>
+    <LinearLayout
+      android:orientation="horizontal"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+        <Button android:id="@+id/start_hipri"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/start_hipri" />
+        <Button android:id="@+id/stop_hipri"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/stop_hipri" />
+    </LinearLayout>
+    <LinearLayout
+      android:orientation="horizontal"
+      android:layout_width="match_parent"
+      android:layout_height="wrap_content">
+        <Button android:id="@+id/crash"
+          android:layout_width="wrap_content"
+          android:layout_height="wrap_content"
+          android:text="@string/crash" />
+    </LinearLayout>
+</LinearLayout>
+
diff --git a/apps/Development/res/layout/development_settings.xml b/apps/Development/res/layout/development_settings.xml
index 7bad3bb..9c04f5d 100644
--- a/apps/Development/res/layout/development_settings.xml
+++ b/apps/Development/res/layout/development_settings.xml
@@ -18,12 +18,12 @@
 */
 -->
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <RelativeLayout 
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
 
         <TextView android:id="@+id/debug_app_label"
             android:layout_width="wrap_content"
@@ -76,7 +76,7 @@
             android:text="@string/development_settings_compatibility_mode_text" />
 
         <Spinner android:id="@+id/max_procs"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_below="@id/compatibility_mode"
             android:layout_alignParentLeft="true" />
@@ -123,21 +123,21 @@
             android:text="@string/development_settings_show_sleep_text" />
             
         <Spinner android:id="@+id/window_animation_scale"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_below="@id/show_sleep"
             android:layout_alignParentLeft="true">
         </Spinner>
 
         <Spinner android:id="@+id/transition_animation_scale"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_below="@id/window_animation_scale"
             android:layout_alignParentLeft="true">
         </Spinner>
 
         <Spinner android:id="@+id/font_hinting"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_below="@id/transition_animation_scale"
             android:layout_alignParentLeft="true">
diff --git a/apps/Development/res/layout/enter_url.xml b/apps/Development/res/layout/enter_url.xml
index 062c67e..5868006 100644
--- a/apps/Development/res/layout/enter_url.xml
+++ b/apps/Development/res/layout/enter_url.xml
@@ -15,19 +15,19 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">          	
+    android:layout_width="match_parent" android:layout_height="match_parent">          	
     <com.android.development.UrlEditText android:id="@+id/url_edit_text"
         android:textSize="13sp"
         android:autoText="false"
         android:capitalize="none"
-        android:layout_width="fill_parent" android:layout_height="wrap_content"/>
+        android:layout_width="match_parent" android:layout_height="wrap_content"/>
     <com.android.development.DisplayEditText android:id="@+id/display_edit_text"
         android:textSize="13sp"
         android:autoText="false"
         android:capitalize="none"
-        android:layout_width="fill_parent" android:layout_height="wrap_content"/>
+        android:layout_width="match_parent" android:layout_height="wrap_content"/>
     <ListView android:id="@android:id/list"
-        android:layout_width="fill_parent" android:layout_height="fill_parent"/>
+        android:layout_width="match_parent" android:layout_height="match_parent"/>
 </LinearLayout>
 
 
diff --git a/apps/Development/res/layout/get_auth_token_view.xml b/apps/Development/res/layout/get_auth_token_view.xml
index f371523..c014cad 100644
--- a/apps/Development/res/layout/get_auth_token_view.xml
+++ b/apps/Development/res/layout/get_auth_token_view.xml
@@ -17,16 +17,16 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView android:id="@+id/accounts_tester_get_auth_token_dialog_message"
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:text="@string/accounts_tester_enter_auth_token_type" />
 
     <EditText android:id="@+id/accounts_tester_auth_token_type"
               android:singleLine="true"
-              android:layout_width="fill_parent"
+              android:layout_width="match_parent"
               android:layout_height="wrap_content"
               android:minWidth="250dip"
               android:scrollHorizontally="true"
diff --git a/apps/Development/res/layout/gls_tester.xml b/apps/Development/res/layout/gls_tester.xml
deleted file mode 100644
index fbd4549..0000000
--- a/apps/Development/res/layout/gls_tester.xml
+++ /dev/null
@@ -1,111 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 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:layout_width="fill_parent"
-    android:layout_height="fill_parent">
-
-    <LinearLayout
-       android:orientation="horizontal"
-       android:layout_width="fill_parent"
-       android:layout_height="wrap_content">
-
-      <Button
-         android:id="@+id/prefer_hosted"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/gls_tester_prefer_hosted"/>
-
-      <Button
-         android:id="@+id/require_google"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/gls_tester_require_google"/>
-
-      <Button
-         android:id="@+id/get_accounts"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/gls_tester_get_accounts"/>
-
-      <Button
-         android:id="@+id/clear"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/gls_tester_clear"/>
-
-      <Button android:id="@+id/go"
-              android:layout_width="wrap_content"
-              android:layout_height="wrap_content"
-              android:text="@string/gls_tester_go"/>
-
-    </LinearLayout>
-
-    <EditText android:id="@+id/username_edit"
-              android:singleLine="true"
-              android:layout_width="fill_parent"
-              android:layout_height="wrap_content"
-              android:minWidth="250dip"
-              android:scrollHorizontally="true"
-              android:capitalize="none"
-              android:autoText="false"/>
-
-    <LinearLayout android:orientation="horizontal"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content">
-
-      <CheckBox android:id="@+id/do_notification"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/gls_tester_do_notification"/>
-
-      <CheckBox android:id="@+id/run_intent"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:text="@string/gls_tester_run_intent"/>
-
-    </LinearLayout>
-
-    <LinearLayout
-       android:orientation="horizontal"
-       android:layout_width="fill_parent"
-       android:layout_height="wrap_content">
-
-      <Spinner android:id="@+id/service_spinner"
-               android:layout_width="wrap_content"
-               android:layout_height="wrap_content"
-               android:entries="@array/glstester_services"/>
-
-      <Button
-         android:id="@+id/wipe_passwords"
-         android:layout_width="wrap_content"
-         android:layout_height="wrap_content"
-         android:text="@string/gls_tester_wipe_passwords"/>
-    </LinearLayout>
-
-    <com.android.development.LogTextBox
-        android:id="@+id/text"
-        android:background="@drawable/box"
-        android:layout_width="fill_parent"
-        android:layout_height="0dip"
-        android:layout_weight="1"
-        android:scrollbars="vertical"
-        android:textSize="10dip"
-       />
-
-</LinearLayout>
diff --git a/apps/Development/res/layout/log_viewer.xml b/apps/Development/res/layout/log_viewer.xml
index 98fe14e..7075d5f 100644
--- a/apps/Development/res/layout/log_viewer.xml
+++ b/apps/Development/res/layout/log_viewer.xml
@@ -15,6 +15,6 @@
 -->
 
 <com.android.development.LogTextBox xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     />
diff --git a/apps/Development/res/layout/media_scanner_activity.xml b/apps/Development/res/layout/media_scanner_activity.xml
index 53f2b15..974f683 100644
--- a/apps/Development/res/layout/media_scanner_activity.xml
+++ b/apps/Development/res/layout/media_scanner_activity.xml
@@ -15,11 +15,11 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 	 	
-	android:layout_width="fill_parent" 
-	android:layout_height="fill_parent"
+	android:layout_width="match_parent" 
+	android:layout_height="match_parent"
 	android:orientation="horizontal">
 
     <TextView android:id="@+id/title" android:textSize="16sp" android:textStyle="bold"
-        android:layout_width="fill_parent" android:layout_height="wrap_content" />
+        android:layout_width="match_parent" android:layout_height="wrap_content" />
 
 </LinearLayout>
diff --git a/apps/Development/res/layout/monkey_screen.xml b/apps/Development/res/layout/monkey_screen.xml
index c508338..fc4a9d0 100644
--- a/apps/Development/res/layout/monkey_screen.xml
+++ b/apps/Development/res/layout/monkey_screen.xml
@@ -16,12 +16,12 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:paddingTop="10dip" >
 
@@ -32,14 +32,14 @@
             android:text="@string/monkey_screen_initial_activity_label" />
 
         <Button android:id="@+id/initialActivity"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/monkey_screen_initialActivity_text" />
     </LinearLayout>
 
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:paddingTop="5dip" >
 
@@ -51,7 +51,7 @@
 
         <EditText android:id="@+id/numberOfEvents"
             android:layout_marginLeft="2dip"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:background="@android:drawable/editbox_background"
             android:numeric="integer"
diff --git a/apps/Development/res/layout/package_item.xml b/apps/Development/res/layout/package_item.xml
index 7860f9b..5a26496 100644
--- a/apps/Development/res/layout/package_item.xml
+++ b/apps/Development/res/layout/package_item.xml
@@ -15,6 +15,6 @@
 -->
 
 <Button xmlns:android="http://schemas.android.com/apk/res/android"
-	android:layout_width="fill_parent"
+	android:layout_width="match_parent"
 	android:layout_height="wrap_content" />
     <!--android:background="@android:drawable/list_highlight"-->
diff --git a/apps/Development/res/layout/package_list_item.xml b/apps/Development/res/layout/package_list_item.xml
index 6a0faee..3041bcc 100644
--- a/apps/Development/res/layout/package_list_item.xml
+++ b/apps/Development/res/layout/package_list_item.xml
@@ -18,14 +18,14 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:minHeight="?android:attr/listPreferredItemHeight"
     android:orientation="vertical"
     android:gravity="fill" >
 
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_weight="1"
         android:orientation="horizontal"
@@ -43,7 +43,7 @@
     
         <LinearLayout
             android:orientation="vertical"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content" >
             <TextView android:id="@+id/name"
                 android:layout_width="wrap_content"
diff --git a/apps/Development/res/layout/package_summary.xml b/apps/Development/res/layout/package_summary.xml
index 99717e6..e02ab3c 100644
--- a/apps/Development/res/layout/package_summary.xml
+++ b/apps/Development/res/layout/package_summary.xml
@@ -15,21 +15,21 @@
 -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <LinearLayout
         android:orientation="vertical"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:padding="4dip" >
     
         <TextView android:id="@+id/packageView"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" />
 
         <LinearLayout
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:orientation="horizontal"
             android:paddingTop="4dip"
             android:paddingBottom="6dip"
@@ -44,29 +44,29 @@
                 android:orientation="vertical">
 
                 <TextView android:id="@+id/classView"
-                    android:layout_width="fill_parent" android:layout_height="wrap_content" />
+                    android:layout_width="match_parent" android:layout_height="wrap_content" />
 
                 <TextView android:id="@+id/label"
-                    android:layout_width="fill_parent" android:layout_height="wrap_content" />
+                    android:layout_width="match_parent" android:layout_height="wrap_content" />
 
                 <TextView android:id="@+id/disabled"
-                    android:layout_width="fill_parent" android:layout_height="wrap_content"
+                    android:layout_width="match_parent" android:layout_height="wrap_content"
                     android:text="@string/disabled" />
 
                 <TextView android:id="@+id/system"
-                    android:layout_width="fill_parent" android:layout_height="wrap_content"
+                    android:layout_width="match_parent" android:layout_height="wrap_content"
                     android:text="@string/system" />
 
                 <TextView android:id="@+id/debuggable"
-                    android:layout_width="fill_parent" android:layout_height="wrap_content"
+                    android:layout_width="match_parent" android:layout_height="wrap_content"
                     android:text="@string/debuggable" />
 
                 <TextView android:id="@+id/nocode"
-                    android:layout_width="fill_parent" android:layout_height="wrap_content"
+                    android:layout_width="match_parent" android:layout_height="wrap_content"
                     android:text="@string/nocode" />
 
                 <TextView android:id="@+id/persistent"
-                    android:layout_width="fill_parent" android:layout_height="wrap_content"
+                    android:layout_width="match_parent" android:layout_height="wrap_content"
                     android:text="@string/persistent" />
 
             </LinearLayout>
@@ -80,46 +80,46 @@
         </LinearLayout>
 
         <TextView style="@style/SummaryCategoryLayout"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" android:text="@string/package_summary_process_label" />
 
         <TextView android:id="@+id/process"
-            android:layout_width="fill_parent" android:layout_height="wrap_content" />
+            android:layout_width="match_parent" android:layout_height="wrap_content" />
 
         <TextView style="@style/SummaryCategoryLayout"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" android:text="@string/package_summary_uid_label" />
 
         <TextView android:id="@+id/uid"
-            android:layout_width="fill_parent" android:layout_height="wrap_content" />
+            android:layout_width="match_parent" android:layout_height="wrap_content" />
 
         <TextView style="@style/SummaryCategoryLayout"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" android:text="@string/package_summary_task_label" />
 
         <TextView android:id="@+id/task"
-            android:layout_width="fill_parent" android:layout_height="wrap_content" />
+            android:layout_width="match_parent" android:layout_height="wrap_content" />
 
         <TextView style="@style/SummaryCategoryLayout"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" android:text="@string/package_summary_version_label" />
 
         <TextView android:id="@+id/version"
-            android:layout_width="fill_parent" android:layout_height="wrap_content" />
+            android:layout_width="match_parent" android:layout_height="wrap_content" />
 
         <TextView style="@style/SummaryCategoryLayout"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" android:text="@string/package_summary_source_label" />
 
         <TextView android:id="@+id/source"
-            android:layout_width="fill_parent" android:layout_height="wrap_content" />
+            android:layout_width="match_parent" android:layout_height="wrap_content" />
 
         <TextView style="@style/SummaryCategoryLayout"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" android:text="@string/package_summary_data_label" />
 
         <TextView android:id="@+id/data"
-            android:layout_width="fill_parent" android:layout_height="wrap_content" />
+            android:layout_width="match_parent" android:layout_height="wrap_content" />
 
         <LinearLayout android:id="@+id/activities" style="@style/SummaryCategoryLayout">
             <TextView style="@style/SummaryCategoryHeader"
diff --git a/apps/Development/res/layout/permission_details.xml b/apps/Development/res/layout/permission_details.xml
index d6635f8..b19ee0b 100755
--- a/apps/Development/res/layout/permission_details.xml
+++ b/apps/Development/res/layout/permission_details.xml
@@ -16,16 +16,16 @@
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     android:fillViewport="true"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <LinearLayout android:orientation="vertical"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:padding="4dip" >
 
         <LinearLayout android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:padding="4dip" >
             <TextView android:id="@+id/perm_name_label"
@@ -39,7 +39,7 @@
         </LinearLayout>
 
         <LinearLayout android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:padding="4dip" >
             <TextView android:id="@+id/perm_desc_label"
@@ -53,7 +53,7 @@
         </LinearLayout>
 
         <LinearLayout android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:padding="4dip" >
             <TextView android:id="@+id/perm_group_label"
@@ -67,7 +67,7 @@
         </LinearLayout>
 
         <LinearLayout android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:padding="4dip" >
             <TextView android:id="@+id/perm_protection_label"
@@ -81,7 +81,7 @@
         </LinearLayout>
 
         <LinearLayout android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:padding="4dip" >
             <TextView android:id="@+id/perm_source_label"
@@ -95,7 +95,7 @@
         </LinearLayout>
 
         <LinearLayout android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:padding="4dip" >
             <TextView android:id="@+id/source_uid_label"
@@ -109,7 +109,7 @@
         </LinearLayout>
         <LinearLayout android:id="@+id/shared_pkgs_panel"
             android:orientation="vertical"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:padding="4dip" >
             <TextView android:id="@+id/shared_pkgs_label"
@@ -128,7 +128,7 @@
             android:text="@string/perm_list_header_text"
             android:textStyle="bold" />
         <ListView android:id="@android:id/list"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
         </LinearLayout>
 </ScrollView>
diff --git a/apps/Development/res/layout/pkg_list_item.xml b/apps/Development/res/layout/pkg_list_item.xml
index 29de423..585e2f1 100755
--- a/apps/Development/res/layout/pkg_list_item.xml
+++ b/apps/Development/res/layout/pkg_list_item.xml
@@ -18,7 +18,7 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:minHeight="?android:attr/listPreferredItemHeight"
     android:orientation="horizontal"
diff --git a/apps/Development/res/layout/process_info.xml b/apps/Development/res/layout/process_info.xml
index b25f223..311e81b 100755
--- a/apps/Development/res/layout/process_info.xml
+++ b/apps/Development/res/layout/process_info.xml
@@ -15,31 +15,31 @@
 -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <LinearLayout
         android:orientation="vertical"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:padding="4dip" >
     
         <TextView android:id="@+id/process_name_header"
-            android:layout_width="fill_parent" 
+            android:layout_width="match_parent" 
             android:layout_height="wrap_content"
             android:text="@string/process_name_header"
             android:textStyle="bold" />
         <TextView android:id="@+id/process_name"
-            android:layout_width="fill_parent" 
+            android:layout_width="match_parent" 
             android:layout_height="wrap_content" />
         <TextView android:id="@+id/package_list_header"
-            android:layout_width="fill_parent" 
+            android:layout_width="match_parent" 
             android:layout_height="wrap_content"
             android:text="@string/package_list_header"
             android:textStyle="bold" />
 
         <LinearLayout android:id="@+id/package_list"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical"
             android:paddingTop="4dip"
diff --git a/apps/Development/res/layout/show_activity.xml b/apps/Development/res/layout/show_activity.xml
index 6a7617c..c09ac45 100644
--- a/apps/Development/res/layout/show_activity.xml
+++ b/apps/Development/res/layout/show_activity.xml
@@ -19,20 +19,20 @@
 -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <LinearLayout
-        android:layout_width="fill_parent" android:layout_height="fill_parent"
+        android:layout_width="match_parent" android:layout_height="match_parent"
         android:orientation="vertical"
         android:paddingTop="8dip" android:paddingLeft="2dip" android:paddingRight="2dip" >
     
         <TextView android:id="@+id/packageView"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" />
     
         <LinearLayout
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:orientation="horizontal"
             android:paddingTop="4dip"
             android:paddingBottom="6dip" >
@@ -42,63 +42,63 @@
                 android:paddingRight="8dip" />
                  
             <LinearLayout
-                android:layout_width="fill_parent" android:layout_height="wrap_content"
+                android:layout_width="match_parent" android:layout_height="wrap_content"
                 android:orientation="vertical">
     
                 <TextView android:id="@+id/classView"
-                    android:layout_width="fill_parent" android:layout_height="wrap_content" />
+                    android:layout_width="match_parent" android:layout_height="wrap_content" />
     
                 <TextView android:id="@+id/label"
-                    android:layout_width="fill_parent" android:layout_height="wrap_content" />
+                    android:layout_width="match_parent" android:layout_height="wrap_content" />
     
                 <TextView android:id="@+id/launch"
-                    android:layout_width="fill_parent" android:layout_height="wrap_content" />
+                    android:layout_width="match_parent" android:layout_height="wrap_content" />
 
             </LinearLayout>
     
         </LinearLayout>
     
         <TextView style="@style/SummaryCategoryLayout"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" android:text="@string/show_activity_process_label" />
     
         <TextView android:id="@+id/process"
-            android:layout_width="fill_parent" android:layout_height="wrap_content" />
+            android:layout_width="match_parent" android:layout_height="wrap_content" />
     
         <TextView style="@style/SummaryCategoryLayout"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" android:text="@string/show_activity_task_affinity_label" />
     
         <TextView android:id="@+id/taskAffinity"
-            android:layout_width="fill_parent" android:layout_height="wrap_content" />
+            android:layout_width="match_parent" android:layout_height="wrap_content" />
     
         <TextView style="@style/SummaryCategoryLayout"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" android:text="@string/show_activity_required_permission_label" />
     
         <TextView android:id="@+id/permission"
-            android:layout_width="fill_parent" android:layout_height="wrap_content" />
+            android:layout_width="match_parent" android:layout_height="wrap_content" />
     
         <TextView style="@style/SummaryCategoryLayout"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" android:text="@string/show_activity_multiprocess_label" />
     
         <TextView android:id="@+id/multiprocess"
-            android:layout_width="fill_parent" android:layout_height="wrap_content" />
+            android:layout_width="match_parent" android:layout_height="wrap_content" />
     
         <TextView style="@style/SummaryCategoryLayout"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" android:text="@string/show_activity_clear_on_background_label" />
     
         <TextView android:id="@+id/clearOnBackground"
-            android:layout_width="fill_parent" android:layout_height="wrap_content" />
+            android:layout_width="match_parent" android:layout_height="wrap_content" />
     
         <TextView style="@style/SummaryCategoryLayout"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:textStyle="bold" android:text="@string/show_activity_state_not_needed_label" />
     
         <TextView android:id="@+id/stateNotNeeded"
-            android:layout_width="fill_parent" android:layout_height="wrap_content" />
+            android:layout_width="match_parent" android:layout_height="wrap_content" />
     
     </LinearLayout>
 
diff --git a/apps/Development/res/layout/sync_adapter_driver.xml b/apps/Development/res/layout/sync_adapter_driver.xml
index 58c0ebb..9e99e99 100644
--- a/apps/Development/res/layout/sync_adapter_driver.xml
+++ b/apps/Development/res/layout/sync_adapter_driver.xml
@@ -17,11 +17,11 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <LinearLayout android:orientation="vertical"
-		  android:layout_width="fill_parent"
+		  android:layout_width="match_parent"
 		  android:layout_height="wrap_content">
         <TextView android:id="@+id/sync_adapters_spinner_label"
 		android:layout_width="wrap_content"
@@ -34,7 +34,7 @@
                  android:layout_height="wrap_content"/>
         <LinearLayout
 	   android:orientation="horizontal"
-           android:layout_width="fill_parent"
+           android:layout_width="match_parent"
            android:layout_height="52dip">
             <Button
 	       android:id="@+id/bind_button"
@@ -60,7 +60,7 @@
 
         <LinearLayout
            android:orientation="horizontal"
-           android:layout_width="fill_parent"
+           android:layout_width="match_parent"
            android:layout_height="52dip">
             <Button
                android:id="@+id/start_sync_button"
diff --git a/apps/Development/res/layout/sync_adapter_item.xml b/apps/Development/res/layout/sync_adapter_item.xml
index d818c78..15a25e0 100644
--- a/apps/Development/res/layout/sync_adapter_item.xml
+++ b/apps/Development/res/layout/sync_adapter_item.xml
@@ -21,6 +21,6 @@
     android:id="@android:id/text1"
 	style="?android:attr/spinnerItemStyle"
     android:singleLine="true"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="52dip"
     android:ellipsize="marquee" />
diff --git a/apps/Development/res/layout/url_list.xml b/apps/Development/res/layout/url_list.xml
index f004eff..5364d61 100644
--- a/apps/Development/res/layout/url_list.xml
+++ b/apps/Development/res/layout/url_list.xml
@@ -15,7 +15,7 @@
 -->
 
 <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@android:id/text1" 
-	android:layout_width="fill_parent"
+	android:layout_width="match_parent"
 	android:layout_height="wrap_content"
 	android:textColor="#FF000000"
 	android:textSize="13sp"
diff --git a/apps/Development/res/values/strings.xml b/apps/Development/res/values/strings.xml
index c8a3f8b..b1310f4 100644
--- a/apps/Development/res/values/strings.xml
+++ b/apps/Development/res/values/strings.xml
@@ -21,6 +21,23 @@
     <string name="menu_upload_exceptions">Upload Exceptions</string>
     <string name="menu_clear_exceptions">Clear Exceptions</string>
 
+    <string name="enable_wifi">Enable Wifi</string>
+    <string name="disable_wifi">Disable Wifi</string>
+    <string name="wifi_on_duration">Wifi on (ms): </string>
+    <string name="wifi_off_duration">Wifi off (ms): </string>
+    <string name="wifi_cycles_done">Cycles done: </string>
+    <string name="start_toggling">Start Wifi Toggle</string>
+    <string name="stop_toggling">Stop Wifi Toggle</string>
+    <string name="start_screen_toggling">Start Screen Toggle</string>
+    <string name="stop_screen_toggling">Stop Screen Toggle</string>
+
+    <string name="start_mms">Start MMS</string>
+    <string name="stop_mms">Stop MMS</string>
+    <string name="start_hipri">Start HiPri</string>
+    <string name="stop_hipri">Stop HiPri</string>
+    <string name="crash">CRASH</string>
+
+
         <string name="device_info_default">unknown</string>
         <string name="device_info_uptime">Uptime</string>
         <string name="device_info_awaketime">Awake Time</string>
@@ -145,7 +162,8 @@
     <string name="accounts_tester_select_account_type">Select Account Type</string>
     <string name="accounts_tester_process_name_header">Process Name:</string>
     <string name="accounts_tester_remove_account">remove</string>
-    <string name="accounts_tester_get_auth_token">authenticate</string>
+    <string name="accounts_tester_get_auth_token">get authtoken</string>
+    <string name="accounts_tester_test_has_features">test has features</string>
     <string name="accounts_tester_invalidate_auth_token">invalidate token</string>
     <string name="accounts_tester_account_context_menu_title">account operations</string>
     <string name="accounts_tester_do_get_auth_token">Ok</string>
@@ -176,4 +194,15 @@
     <string name="binding_bind_failed">Bind failed</string>
     <string name="binding_waiting_for_connection">Waiting for service to be connected...</string>
     <string name="select_account_to_sync">Select account to sync</string>
+
+    <!-- BadBehaviorActivity -->
+    <string name="bad_behavior_crash_system_label">Crash the system server</string>
+    <string name="bad_behavior_crash_main_label">Crash the main app thread</string>
+    <string name="bad_behavior_crash_thread_label">Crash an auxiliary app thread</string>
+    <string name="bad_behavior_crash_native_label">Crash the native process</string>
+    <string name="bad_behavior_wtf_label">Report a WTF condition</string>
+    <string name="bad_behavior_anr_label">ANR (Stop responding for 20 seconds)</string>
+    <string name="bad_behavior_anr_activity_label">ANR launching a new Activity</string>
+    <string name="bad_behavior_anr_broadcast_label">ANR receiving a broadcast Intent</string>
+    <string name="bad_behavior_anr_service_label">ANR starting a Service</string>
 </resources>
diff --git a/apps/Development/res/values/styles.xml b/apps/Development/res/values/styles.xml
index 591eed8..0af882c 100644
--- a/apps/Development/res/values/styles.xml
+++ b/apps/Development/res/values/styles.xml
@@ -16,7 +16,7 @@
 
 <resources>
     <style name="SummaryCategoryLayout">
-        <item name="android:layout_width">fill_parent</item>
+        <item name="android:layout_width">match_parent</item>
         <item name="android:layout_height">wrap_content</item>
         <item name="android:orientation">vertical</item>
     </style>
@@ -34,8 +34,8 @@
         <item name="android:paddingTop">10dip</item>
         <item name="android:paddingRight">10dip</item>
         <item name="android:paddingBottom">10dip</item>
-        <item name="android:layout_width">fill_parent</item>
-        <item name="android:layout_height">fill_parent</item>
+        <item name="android:layout_width">match_parent</item>
+        <item name="android:layout_height">match_parent</item>
     </style>
     <style name="entry_layout">
         <item name="android:orientation">horizontal</item>
diff --git a/apps/Development/src/com/android/development/AccountsTester.java b/apps/Development/src/com/android/development/AccountsTester.java
index 8e09c3d..8e087e3 100644
--- a/apps/Development/src/com/android/development/AccountsTester.java
+++ b/apps/Development/src/com/android/development/AccountsTester.java
@@ -46,8 +46,11 @@
     private static final int GET_AUTH_TOKEN_DIALOG_ID = 1;
     private static final int UPDATE_CREDENTIALS_DIALOG_ID = 2;
     private static final int INVALIDATE_AUTH_TOKEN_DIALOG_ID = 3;
+    private static final int TEST_HAS_FEATURES_DIALOG_ID = 4;
+    private static final int MESSAGE_DIALOG_ID = 5;
     private EditText mDesiredAuthTokenTypeEditText;
     private EditText mDesiredFeaturesEditText;
+    private volatile CharSequence mDialogMessage;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -268,6 +271,8 @@
             }, null /* handler */);
         } else if (item.getItemId() == R.id.accounts_tester_get_auth_token) {
             showDialog(GET_AUTH_TOKEN_DIALOG_ID);
+        } else if (item.getItemId() == R.id.accounts_tester_test_has_features) {
+            showDialog(TEST_HAS_FEATURES_DIALOG_ID);
         } else if (item.getItemId() == R.id.accounts_tester_invalidate_auth_token) {
             showDialog(INVALIDATE_AUTH_TOKEN_DIALOG_ID);
         } else if (item.getItemId() == R.id.accounts_tester_update_credentials) {
@@ -282,7 +287,7 @@
     @Override
     protected Dialog onCreateDialog(final int id) {
         if (id == GET_AUTH_TOKEN_DIALOG_ID || id == INVALIDATE_AUTH_TOKEN_DIALOG_ID
-                || id == UPDATE_CREDENTIALS_DIALOG_ID) {
+                || id == UPDATE_CREDENTIALS_DIALOG_ID || id == TEST_HAS_FEATURES_DIALOG_ID) {
             final View view = LayoutInflater.from(this).inflate(R.layout.get_auth_token_view, null);
             AlertDialog.Builder builder = new AlertDialog.Builder(this);
             builder.setPositiveButton(R.string.accounts_tester_do_get_auth_token,
@@ -316,6 +321,10 @@
                             } else if (id == INVALIDATE_AUTH_TOKEN_DIALOG_ID) {
                                 mAccountManager.getAuthToken(account, authTokenType, false,
                                         new GetAndInvalidateAuthTokenCallback(), null);
+                            } else if (id == TEST_HAS_FEATURES_DIALOG_ID) {
+                                String[] features = TextUtils.split(authTokenType, ",");
+                                mAccountManager.hasFeatures(account, features,
+                                        new TestHasFeaturesCallback(), null);
                             } else {
                                 mAccountManager.updateCredentials(
                                         account,
@@ -327,6 +336,11 @@
             builder.setView(view);
             return builder.create();
         }
+        if (id == MESSAGE_DIALOG_ID) {
+            AlertDialog.Builder builder = new AlertDialog.Builder(this);
+            builder.setMessage(mDialogMessage);
+            return builder.create();
+        }
         return super.onCreateDialog(id);
     }
 
@@ -413,6 +427,31 @@
         }
     }
 
+    private void showMessageDialog(String message) {
+        mDialogMessage = message;
+        removeDialog(MESSAGE_DIALOG_ID);
+        showDialog(MESSAGE_DIALOG_ID);
+    }
+
+    private class TestHasFeaturesCallback implements AccountManagerCallback<Boolean> {
+        public void run(AccountManagerFuture<Boolean> future) {
+            try {
+                Boolean hasFeatures = future.getResult();
+                Log.d(TAG, "hasFeatures: " + hasFeatures);
+                showMessageDialog("hasFeatures: " + hasFeatures);
+            } catch (OperationCanceledException e) {
+                Log.d(TAG, "interrupted");
+                showMessageDialog("operation was canceled");
+            } catch (IOException e) {
+                Log.d(TAG, "error", e);
+                showMessageDialog("operation got an IOException");
+            } catch (AuthenticatorException e) {
+                Log.d(TAG, "error", e);
+                showMessageDialog("operation got an AuthenticationException");
+            }
+        }
+    }
+
     private static class ConfirmCredentialsCallback implements AccountManagerCallback<Bundle> {
         public void run(AccountManagerFuture<Bundle> future) {
             try {
diff --git a/apps/Development/src/com/android/development/BadBehaviorActivity.java b/apps/Development/src/com/android/development/BadBehaviorActivity.java
new file mode 100644
index 0000000..d559fbc
--- /dev/null
+++ b/apps/Development/src/com/android/development/BadBehaviorActivity.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (C) 2009 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.android.development;
+
+import android.app.Activity;
+import android.app.Service;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.os.IPowerManager;
+import android.os.Process;
+import android.os.RemoteException;
+import android.os.ServiceManager;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+
+public class BadBehaviorActivity extends Activity {
+    private static final String TAG = "BadBehaviorActivity";
+
+    private static class BadBehaviorException extends RuntimeException {
+        BadBehaviorException() {
+            super("Whatcha gonna do, whatcha gonna do",
+                    new IllegalStateException("When they come for you"));
+        }
+    }
+
+    public static class BadReceiver extends BroadcastReceiver {
+        @Override
+        public void onReceive(Context context, Intent intent) {
+            Log.i(TAG, "in BadReceiver.onReceive() -- about to hang");
+            try { Thread.sleep(20000); } catch (InterruptedException e) { Log.wtf(TAG, e); }
+        }
+    };
+
+    public static class BadService extends Service {
+        @Override
+        public IBinder onBind(Intent intent) {
+            return null;
+        }
+
+        @Override
+        public int onStartCommand(Intent intent, int flags, int id) {
+            Log.i(TAG, "in BadService.onStartCommand() -- about to hang");
+            try { Thread.sleep(30000); } catch (InterruptedException e) { Log.wtf(TAG, e); }
+            stopSelf();
+            return START_NOT_STICKY;
+        }
+    }
+
+    @Override
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+
+        if (getIntent().getBooleanExtra("anr", false)) {
+            Log.i(TAG, "in ANR activity -- about to hang");
+            try { Thread.sleep(20000); } catch (InterruptedException e) { Log.wtf(TAG, e); }
+            finish();
+            return;
+        }
+
+        setContentView(R.layout.bad_behavior);
+
+        Button crash_system = (Button) findViewById(R.id.bad_behavior_crash_system);
+        crash_system.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                try {
+                    IBinder b = ServiceManager.getService(POWER_SERVICE);
+                    IPowerManager pm = IPowerManager.Stub.asInterface(b);
+                    pm.crash("Crashed by BadBehaviorActivity");
+                } catch (RemoteException e) {
+                    Log.e(TAG, "Can't call IPowerManager.crash()", e);
+                }
+            }
+        });
+
+        Button crash_main = (Button) findViewById(R.id.bad_behavior_crash_main);
+        crash_main.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) { throw new BadBehaviorException(); }
+        });
+
+        Button crash_thread = (Button) findViewById(R.id.bad_behavior_crash_thread);
+        crash_thread.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                new Thread() {
+                    @Override
+                    public void run() { throw new BadBehaviorException(); }
+                }.start();
+            }
+        });
+
+        Button crash_native = (Button) findViewById(R.id.bad_behavior_crash_native);
+        crash_native.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                // For some reason, the JVM needs two of these to get the hint
+                Log.i(TAG, "Native crash pressed -- about to kill -11 self");
+                Process.sendSignal(Process.myPid(), 11);
+                Process.sendSignal(Process.myPid(), 11);
+                Log.i(TAG, "Finished kill -11, should be dead or dying");
+            }
+        });
+
+        Button wtf = (Button) findViewById(R.id.bad_behavior_wtf);
+        wtf.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) { Log.wtf(TAG, "Apps Behaving Badly"); }
+        });
+
+        Button anr = (Button) findViewById(R.id.bad_behavior_anr);
+        anr.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                Log.i(TAG, "ANR pressed -- about to hang");
+                try { Thread.sleep(20000); } catch (InterruptedException e) { Log.wtf(TAG, e); }
+            }
+        });
+
+        Button anr_activity = (Button) findViewById(R.id.bad_behavior_anr_activity);
+        anr_activity.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                Intent intent = new Intent(BadBehaviorActivity.this, BadBehaviorActivity.class);
+                Log.i(TAG, "ANR activity pressed -- about to launch");
+                startActivity(intent.putExtra("anr", true));
+            }
+        });
+
+        Button anr_broadcast = (Button) findViewById(R.id.bad_behavior_anr_broadcast);
+        anr_broadcast.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                Log.i(TAG, "ANR broadcast pressed -- about to send");
+                sendOrderedBroadcast(new Intent("com.android.development.BAD_BEHAVIOR"), null);
+            }
+        });
+
+        Button anr_service = (Button) findViewById(R.id.bad_behavior_anr_service);
+        anr_service.setOnClickListener(new View.OnClickListener() {
+            public void onClick(View v) {
+                Log.i(TAG, "ANR service pressed -- about to start");
+                startService(new Intent(BadBehaviorActivity.this, BadService.class));
+            }
+        });
+    }
+}
diff --git a/apps/Development/src/com/android/development/Connectivity.java b/apps/Development/src/com/android/development/Connectivity.java
new file mode 100644
index 0000000..59157bf
--- /dev/null
+++ b/apps/Development/src/com/android/development/Connectivity.java
@@ -0,0 +1,351 @@
+/* //device/apps/Settings/src/com/android/settings/Keyguard.java
+**
+** Copyright 2006, 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.android.development;
+
+import android.app.Activity;
+import android.app.ActivityManagerNative;
+import android.app.AlarmManager;
+import android.app.PendingIntent;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.SharedPreferences;
+import android.content.pm.PackageManager.NameNotFoundException;
+import android.net.ConnectivityManager;
+import android.net.wifi.WifiManager;
+import android.os.RemoteException;
+import android.os.Handler;
+import android.os.Message;
+import android.os.IBinder;
+import android.os.Parcel;
+import android.os.PowerManager;
+import android.os.PowerManager.WakeLock;
+import android.os.ServiceManager;
+import android.os.ServiceManagerNative;
+import android.os.SystemClock;
+import android.provider.Settings;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.IWindowManager;
+import android.view.View;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.EditText;
+import android.widget.Spinner;
+import android.widget.TextView;
+import android.widget.Toast;
+import android.widget.AdapterView.OnItemSelectedListener;
+
+import com.android.internal.telephony.Phone;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.util.Map;
+
+public class Connectivity extends Activity {
+    private static final String TAG = "Connectivity";
+
+    private static final int EVENT_TOGGLE_WIFI = 1;
+    private static final int EVENT_TOGGLE_SCREEN = 2;
+
+    private Button mEnableWifiButton;
+    private Button mDisableWifiButton;
+
+    private Button mStartDelayedCycleButton;
+    private Button mStopDelayedCycleButton;
+    private EditText mDCOnDurationEdit;
+    private EditText mDCOffDurationEdit;
+    private TextView mDCCycleCountView;
+    private long mDCOnDuration = 120000;
+    private long mDCOffDuration = 120000;
+    private int mDCCycleCount = 0;
+
+    private Button mStartScreenCycleButton;
+    private Button mStopScreenCycleButton;
+    private EditText mSCOnDurationEdit;
+    private EditText mSCOffDurationEdit;
+    private TextView mSCCycleCountView;
+    private long mSCOnDuration = 120000;
+    private long mSCOffDuration = 12000;
+    private int mSCCycleCount = 0;
+
+    private Button mStartMmsButton;
+    private Button mStopMmsButton;
+    private Button mStartHiPriButton;
+    private Button mStopHiPriButton;
+    private Button mCrashButton;
+
+    private boolean mDelayedCycleStarted = false;
+
+    private WifiManager mWm;
+    private PowerManager mPm;
+    private ConnectivityManager mCm;
+
+    private WakeLock mWakeLock = null;
+    private WakeLock mScreenonWakeLock = null;
+
+    private boolean mScreenOffToggleRunning = false;
+    private boolean mScreenOff = false;
+
+    private static final String CONNECTIVITY_TEST_ALARM =
+            "com.android.development.CONNECTIVITY_TEST_ALARM";
+    private static final String TEST_ALARM_EXTRA = "CONNECTIVITY_TEST_EXTRA";
+    private static final String TEST_ALARM_ON_EXTRA = "CONNECTIVITY_TEST_ON_EXTRA";
+    private static final String TEST_ALARM_OFF_EXTRA = "CONNECTIVITY_TEST_OFF_EXTRA";
+    private static final String TEST_ALARM_CYCLE_EXTRA = "CONNECTIVITY_TEST_CYCLE_EXTRA";
+    private static final String SCREEN_ON = "SCREEN_ON";
+    private static final String SCREEN_OFF = "SCREEN_OFF";
+    public BroadcastReceiver mReceiver = new BroadcastReceiver() {
+        public void onReceive(Context context, Intent intent) {
+            if (intent.getAction().equals(CONNECTIVITY_TEST_ALARM)) {
+                String extra = (String)intent.getExtra(TEST_ALARM_EXTRA);
+                PowerManager pm = (PowerManager)context.getSystemService(Context.POWER_SERVICE);
+                Long on = new Long(120000);
+                Long off = new Long(120000);
+                int cycle = 0;
+                try {
+                    on = Long.parseLong((String)intent.getExtra(TEST_ALARM_ON_EXTRA));
+                    off = Long.parseLong((String)intent.getExtra(TEST_ALARM_OFF_EXTRA));
+                    cycle = Integer.parseInt((String)intent.getExtra(TEST_ALARM_CYCLE_EXTRA));
+                } catch (Exception e) {}
+
+                if (extra.equals(SCREEN_ON)) {
+                    mScreenonWakeLock = mPm.newWakeLock(PowerManager.FULL_WAKE_LOCK |
+                            PowerManager.ACQUIRE_CAUSES_WAKEUP,
+                            "ConnectivityTest");
+                    mScreenonWakeLock.acquire();
+
+                    mSCCycleCount = cycle+1;
+                    mSCOnDuration = on;
+                    mSCOffDuration = off;
+                    mSCCycleCountView.setText(Integer.toString(mSCCycleCount));
+
+                    scheduleAlarm(mSCOnDuration, SCREEN_OFF);
+                } else if (extra.equals(SCREEN_OFF)) {
+
+                    mSCCycleCount = cycle;
+                    mSCOnDuration = on;
+                    mSCOffDuration = off;
+
+                    mScreenonWakeLock.release();
+                    mScreenonWakeLock = null;
+                    scheduleAlarm(mSCOffDuration, SCREEN_ON);
+                    pm.goToSleep(SystemClock.uptimeMillis());
+                }
+            }
+        }
+    };
+
+    public Handler mHandler2 = new Handler() {
+        public void handleMessage(Message msg) {
+            switch(msg.what) {
+                case EVENT_TOGGLE_WIFI:
+                    Log.e(TAG, "EVENT_TOGGLE_WIFI");
+                    if (mDelayedCycleStarted && mWm != null) {
+                        long delay;
+                        switch (mWm.getWifiState()) {
+                            case WifiManager.WIFI_STATE_ENABLED:
+                            case WifiManager.WIFI_STATE_ENABLING:
+                                mWm.setWifiEnabled(false);
+                                delay = mDCOffDuration;
+                                break;
+                            default:
+                                mWm.setWifiEnabled(true);
+                                delay = mDCOnDuration;
+                                mDCCycleCount++;
+                                mDCCycleCountView.setText(Integer.toString(mDCCycleCount));
+                        }
+                        sendMessageDelayed(obtainMessage(EVENT_TOGGLE_WIFI),
+                                delay);
+                    }
+                    break;
+            }
+        }
+    };
+
+    @Override
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+
+        setContentView(R.layout.connectivity);
+
+        mWm = (WifiManager)getSystemService(Context.WIFI_SERVICE);
+        mPm = (PowerManager)getSystemService(Context.POWER_SERVICE);
+        mCm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
+
+        mEnableWifiButton = (Button)findViewById(R.id.enableWifi);
+        mEnableWifiButton.setOnClickListener(mEnableWifiClicked);
+        mDisableWifiButton = (Button)findViewById(R.id.disableWifi);
+        mDisableWifiButton.setOnClickListener(mDisableWifiClicked);
+
+        mStartDelayedCycleButton = (Button)findViewById(R.id.startDelayedCycle);
+        mStartDelayedCycleButton.setOnClickListener(mStartDelayedCycleClicked);
+        mStopDelayedCycleButton = (Button)findViewById(R.id.stopDelayedCycle);
+        mStopDelayedCycleButton.setOnClickListener(mStopDelayedCycleClicked);
+        mDCOnDurationEdit = (EditText)findViewById(R.id.dc_wifi_on_duration);
+        mDCOnDurationEdit.setText(Long.toString(mDCOnDuration));
+        mDCOffDurationEdit = (EditText)findViewById(R.id.dc_wifi_off_duration);
+        mDCOffDurationEdit.setText(Long.toString(mDCOffDuration));
+        mDCCycleCountView = (TextView)findViewById(R.id.dc_wifi_cycles_done);
+        mDCCycleCountView.setText(Integer.toString(mDCCycleCount));
+
+        mStartScreenCycleButton = (Button)findViewById(R.id.startScreenCycle);
+        mStartScreenCycleButton.setOnClickListener(mStartScreenCycleClicked);
+        mStopScreenCycleButton = (Button)findViewById(R.id.stopScreenCycle);
+        mStopScreenCycleButton.setOnClickListener(mStopScreenCycleClicked);
+        mSCOnDurationEdit = (EditText)findViewById(R.id.sc_wifi_on_duration);
+        mSCOnDurationEdit.setText(Long.toString(mSCOnDuration));
+        mSCOffDurationEdit = (EditText)findViewById(R.id.sc_wifi_off_duration);
+        mSCOffDurationEdit.setText(Long.toString(mSCOffDuration));
+        mSCCycleCountView = (TextView)findViewById(R.id.sc_wifi_cycles_done);
+        mSCCycleCountView.setText(Integer.toString(mSCCycleCount));
+
+        mStartMmsButton = (Button)findViewById(R.id.start_mms);
+        mStartMmsButton.setOnClickListener(mStartMmsClicked);
+        mStopMmsButton = (Button)findViewById(R.id.stop_mms);
+        mStopMmsButton.setOnClickListener(mStopMmsClicked);
+        mStartHiPriButton = (Button)findViewById(R.id.start_hipri);
+        mStartHiPriButton.setOnClickListener(mStartHiPriClicked);
+        mStopHiPriButton = (Button)findViewById(R.id.stop_hipri);
+        mStopHiPriButton.setOnClickListener(mStopHiPriClicked);
+        mCrashButton = (Button)findViewById(R.id.crash);
+        mCrashButton.setOnClickListener(mCrashClicked);
+
+        registerReceiver(mReceiver, new IntentFilter(CONNECTIVITY_TEST_ALARM));
+    }
+
+
+
+    @Override
+    public void onResume() {
+        super.onResume();
+    }
+
+    private View.OnClickListener mStartDelayedCycleClicked = new View.OnClickListener() {
+        public void onClick(View v) {
+            if (!mDelayedCycleStarted) {
+                mDelayedCycleStarted = true;
+                try {
+                    mDCOnDuration = Long.parseLong(mDCOnDurationEdit.getText().toString());
+                    mDCOffDuration = Long.parseLong(mDCOffDurationEdit.getText().toString());
+                } catch (Exception e) { };
+                mDCCycleCount = 0;
+
+                mWakeLock = mPm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "ConnectivityTest");
+                mWakeLock.acquire();
+                mHandler2.sendMessage(mHandler2.obtainMessage(EVENT_TOGGLE_WIFI));
+            }
+        }
+    };
+    private View.OnClickListener mStopDelayedCycleClicked = new View.OnClickListener() {
+        public void onClick(View v) {
+            if (mDelayedCycleStarted) {
+                mDelayedCycleStarted = false;
+                mWakeLock.release();
+                mWakeLock = null;
+                if(mHandler2.hasMessages(EVENT_TOGGLE_WIFI)) {
+                    mHandler2.removeMessages(EVENT_TOGGLE_WIFI);
+                }
+            }
+        }
+    };
+
+    private View.OnClickListener mEnableWifiClicked = new View.OnClickListener() {
+        public void onClick(View v) {
+            mWm.setWifiEnabled(true);
+        }
+    };
+    private View.OnClickListener mDisableWifiClicked = new View.OnClickListener() {
+        public void onClick(View v) {
+            mWm.setWifiEnabled(false);
+        }
+    };
+
+    private View.OnClickListener mStartScreenCycleClicked = new View.OnClickListener() {
+        public void onClick(View v) {
+
+            try {
+                mSCOnDuration = Long.parseLong(mSCOnDurationEdit.getText().toString());
+                mSCOffDuration = Long.parseLong(mSCOffDurationEdit.getText().toString());
+            } catch (Exception e) { };
+            mSCCycleCount = 0;
+
+            mScreenonWakeLock = mPm.newWakeLock(PowerManager.FULL_WAKE_LOCK,
+                    "ConnectivityTest");
+            mScreenonWakeLock.acquire();
+
+            scheduleAlarm(10, SCREEN_OFF);
+        }
+    };
+
+    private void scheduleAlarm(long delayMs, String eventType) {
+        AlarmManager am = (AlarmManager)getSystemService(Context.ALARM_SERVICE);
+        Intent i = new Intent(CONNECTIVITY_TEST_ALARM);
+
+        i.putExtra(TEST_ALARM_EXTRA, eventType);
+        i.putExtra(TEST_ALARM_ON_EXTRA, Long.toString(mSCOnDuration));
+        i.putExtra(TEST_ALARM_OFF_EXTRA, Long.toString(mSCOffDuration));
+        i.putExtra(TEST_ALARM_CYCLE_EXTRA, Integer.toString(mSCCycleCount));
+
+        PendingIntent p = PendingIntent.getBroadcast(this, 0, i, PendingIntent.FLAG_UPDATE_CURRENT);
+
+        am.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + delayMs, p);
+    }
+
+    private View.OnClickListener mStopScreenCycleClicked = new View.OnClickListener() {
+        public void onClick(View v) {
+        }
+    };
+
+    private View.OnClickListener mStartMmsClicked = new View.OnClickListener() {
+        public void onClick(View v) {
+            mCm.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, Phone.FEATURE_ENABLE_MMS);
+        }
+    };
+
+    private View.OnClickListener mStopMmsClicked = new View.OnClickListener() {
+        public void onClick(View v) {
+            mCm.stopUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, Phone.FEATURE_ENABLE_MMS);
+        }
+    };
+
+    private View.OnClickListener mStartHiPriClicked = new View.OnClickListener() {
+        public void onClick(View v) {
+            mCm.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,
+                    Phone.FEATURE_ENABLE_HIPRI);
+        }
+    };
+
+    private View.OnClickListener mStopHiPriClicked = new View.OnClickListener() {
+        public void onClick(View v) {
+            mCm.stopUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,
+                    Phone.FEATURE_ENABLE_HIPRI);
+        }
+    };
+
+    private View.OnClickListener mCrashClicked = new View.OnClickListener() {
+        public void onClick(View v) {
+            ConnectivityManager foo = null;
+            foo.startUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE,
+                    Phone.FEATURE_ENABLE_MMS);
+        }
+    };
+}
diff --git a/apps/Development/src/com/android/development/Details.java b/apps/Development/src/com/android/development/Details.java
index 16722a3..e0da961 100644
--- a/apps/Development/src/com/android/development/Details.java
+++ b/apps/Development/src/com/android/development/Details.java
@@ -27,7 +27,6 @@
 import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuItem;
-import android.view.View;
 import android.view.ViewGroup;
 import android.widget.TextView;
 
@@ -75,8 +74,8 @@
         }
         mLinearLayout = new LinearLayout(this);
         mScrollView.addView(mLinearLayout, new ViewGroup.LayoutParams(
-                                        ViewGroup.LayoutParams.FILL_PARENT,
-                                        ViewGroup.LayoutParams.FILL_PARENT));
+                                        ViewGroup.LayoutParams.MATCH_PARENT,
+                                        ViewGroup.LayoutParams.MATCH_PARENT));
         mLinearLayout.setOrientation(LinearLayout.VERTICAL);
 
         // Here in onStart, we're given data.  We use that because some
@@ -109,7 +108,7 @@
     
     LinearLayout.LayoutParams lazy()
     {
-        return new LinearLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
+        return new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                                  ViewGroup.LayoutParams.WRAP_CONTENT, 0);
     }
 
diff --git a/apps/Development/src/com/android/development/ExceptionBrowser.java b/apps/Development/src/com/android/development/ExceptionBrowser.java
deleted file mode 100644
index 63270aa..0000000
--- a/apps/Development/src/com/android/development/ExceptionBrowser.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
-** Copyright 2007, 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.android.development;
-
-import android.app.ListActivity;
-import android.content.Context;
-import android.content.Intent;
-import android.database.Cursor;
-import android.database.ContentObserver;
-import android.database.DataSetObserver;
-import android.graphics.Typeface;
-import android.os.RemoteException;
-import android.os.ServiceManager;
-import android.provider.Checkin;
-import android.server.data.CrashData;
-import android.server.data.ThrowableData;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.KeyEvent;
-import android.widget.*;
-
-import org.apache.commons.codec.binary.Base64;
-
-import java.io.ByteArrayInputStream;
-import java.io.DataInputStream;
-import java.io.IOException;
-
-/**
- *
- *
- */
-public class ExceptionBrowser extends ListActivity {
-    /** Logging identifier. */
-    private static final String TAG = "ExceptionBrowser";
-
-    @Override
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        Cursor cursor = getContentResolver().query(
-                Checkin.Crashes.CONTENT_URI,
-                new String[] { Checkin.Crashes._ID, Checkin.Crashes.DATA },
-                null, null, null);
-
-        if (cursor != null) {
-            startManagingCursor(cursor);
-
-            setListAdapter(new CursorAdapter(this, cursor, true) {
-                public View newView(Context context, Cursor c, ViewGroup v) {
-                    return new CrashListItem(context);
-                }
-
-                public void bindView(View view, Context c, Cursor cursor) {
-                    CrashListItem item = (CrashListItem) view;
-                    try {
-                        String data = cursor.getString(1);
-                        CrashData crash = new CrashData(
-                            new DataInputStream(
-                                new ByteArrayInputStream(
-                                    Base64.decodeBase64(data.getBytes()))));
-
-                        ThrowableData exc = crash.getThrowableData();
-                        item.setText(exc.getType() + ": " + exc.getMessage());
-                        item.setCrashData(crash);
-                    } catch (IOException e) {
-                        item.setText("Invalid crash: " + e);
-                        Log.e(TAG, "Invalid crash", e);
-                    }
-                }
-            });
-        } else {
-            // No database, no exceptions, empty list.
-            setListAdapter(new BaseAdapter() {
-                public int getCount() {
-                    return 0;
-                }
-
-                public Object getItem(int position) {
-                    throw new AssertionError();
-                }
-
-                public long getItemId(int position) {
-                    throw new AssertionError();
-                }
-
-                public View getView(int position, View convertView,
-                        ViewGroup parent) {
-                    throw new AssertionError();
-                }
-            });
-        }
-    }
-
-    private static final int UPLOAD_ID = Menu.FIRST;
-    private static final int CLEAR_ID = Menu.FIRST + 1;
-
-    public boolean onCreateOptionsMenu(Menu menu) {
-        super.onCreateOptionsMenu(menu);
-
-        menu.add(0, UPLOAD_ID, 0, R.string.menu_upload_exceptions);
-        menu.add(0, CLEAR_ID, 0, R.string.menu_clear_exceptions);
-
-        return true;
-    }
-
-
-    @Override
-    public boolean onOptionsItemSelected(MenuItem item) {
-        // Handle all of the possible menu actions.
-        switch (item.getItemId()) {
-            case UPLOAD_ID:
-                sendBroadcast(new Intent(Checkin.TriggerIntent.ACTION));
-                break;
-            case CLEAR_ID:
-                getContentResolver().delete(
-                        Checkin.Crashes.CONTENT_URI, null, null);
-                break;
-        }
-        return super.onOptionsItemSelected(item);
-    }
-
-    static class CrashListItem extends TextView {
-        CrashData crashData = null;
-
-        public CrashListItem(Context context) {
-            super(context);
-            setTextSize(10);
-            setTypeface(Typeface.MONOSPACE);
-        }
-
-        public CrashData getCrashData() {
-            return crashData;
-        }
-
-        public void setCrashData(CrashData crashData) {
-            this.crashData = crashData;
-        }
-    }
-
-    @Override
-    protected void onListItemClick(ListView l, View view, int pos, long id) {
-        // TODO: Use a generic VIEW action on the crash's content URI.
-        CrashData crash = ((CrashListItem) view).getCrashData();
-        if (crash != null) {
-            Intent intent = new Intent();
-            intent.setClass(this, StacktraceViewer.class);
-            intent.putExtra(
-                    CrashData.class.getName(),
-                    crash.getThrowableData().toString());
-            startActivity(intent);
-        }
-    }
-}
diff --git a/apps/Development/src/com/android/development/GLSTester.java b/apps/Development/src/com/android/development/GLSTester.java
deleted file mode 100644
index 4995b4d..0000000
--- a/apps/Development/src/com/android/development/GLSTester.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- * Copyright (C) 2007 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.android.development;
-
-import com.google.android.googleapps.GoogleLoginCredentialsResult;
-import com.google.android.googlelogin.GoogleLoginServiceConstants;
-import com.google.android.googleapps.IGoogleLoginService;
-import com.google.android.googleapps.LoginData;
-
-import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.os.RemoteException;
-import android.util.Log;
-import android.view.View;
-import android.widget.Button;
-import android.widget.CheckBox;
-import android.widget.EditText;
-import android.widget.Spinner;
-
-/**
- * Using a LogTextBox to display a scrollable text area
- * to which text is appended.
- *
- */
-public class GLSTester extends Activity {
-
-    private static final String TAG = "GLSTester";
-
-    private LogTextBox mText;
-
-    private IGoogleLoginService mGls = null;
-    private ServiceConnection mConnection = null;
-
-    CheckBox mDoNotify = null;
-    CheckBox mRunIntent = null;
-    Spinner mService = null;
-    EditText mUsernameEdit = null;
-
-    private class Listener implements View.OnClickListener {
-        public Listener() {
-        }
-
-        public void onClick(View v) {
-            if (mGls == null) {
-                mText.append("mGls is null\n");
-                return;
-            }
-            try {
-                String service = (String) mService.getSelectedItem();
-                mText.append("service: " + service + "\n");
-
-                String account = mUsernameEdit.getText().toString();
-                if (account.length() == 0) {
-                    account = null;
-                }
-                mText.append("account: " + account + "\n");
-                GoogleLoginCredentialsResult result =
-                    mGls.blockingGetCredentials(account, service, mDoNotify.isChecked());
-                mText.append("result account: " + result.getAccount() + "\n");
-                mText.append("result string: " + result.getCredentialsString() + "\n");
-                Intent intent = result.getCredentialsIntent();
-                mText.append("result intent: " + intent + "\n");
-
-                if (intent != null && mRunIntent.isChecked()) {
-                    startActivityForResult(intent, 0);
-                }
-            } catch (RemoteException e) {
-                mText.append("caught exception " + e + "\n");
-            }
-        }
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        mText.append("resultCode: " + resultCode + "\n");
-        if (data != null) {
-            mText.append("account: " +
-                         data.getStringExtra(GoogleLoginServiceConstants.AUTH_ACCOUNT_KEY) + "\n");
-            mText.append("authtoken: " +
-                         data.getStringExtra(GoogleLoginServiceConstants.AUTHTOKEN_KEY) + "\n");
-        } else {
-            mText.append("intent is null");
-        }
-    }
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        // Open a connection to the Google Login Service.  Return the account.
-        mConnection = new ServiceConnection() {
-                public void onServiceConnected(ComponentName className, IBinder service) {
-                    mGls = IGoogleLoginService.Stub.asInterface(service);
-                }
-                public void onServiceDisconnected(ComponentName className) {
-                    mGls = null;
-                }
-            };
-
-        bindService(GoogleLoginServiceConstants.SERVICE_INTENT,
-                    mConnection, Context.BIND_AUTO_CREATE);
-
-        setContentView(R.layout.gls_tester);
-
-        mText = (LogTextBox) findViewById(R.id.text);
-        mText.append("Hello, world!\n");
-        Log.v(TAG, "hello, world!");
-
-        mDoNotify = (CheckBox) findViewById(R.id.do_notification);
-        mRunIntent = (CheckBox) findViewById(R.id.run_intent);
-        mRunIntent.setChecked(true);
-
-        mService = (Spinner) findViewById(R.id.service_spinner);
-
-        mUsernameEdit = (EditText) findViewById(R.id.username_edit);
-
-        Button b;
-        b = (Button) findViewById(R.id.require_google);
-        b.setOnClickListener(new View.OnClickListener() {
-            public void onClick(View v) {
-                try {
-                    String account = mGls.getAccount(GoogleLoginServiceConstants.REQUIRE_GOOGLE);
-                    mText.append("REQUIRE_GOOGLE gave: " + account + "\n");
-                    mUsernameEdit.setText(account == null ? "" : account);
-                } catch (RemoteException e) {
-                    mText.append("exception: " + e + "\n");
-                }
-            } });
-
-        b = (Button) findViewById(R.id.prefer_hosted);
-        b.setOnClickListener(new View.OnClickListener() {
-            public void onClick(View v) {
-                try {
-                    String account = mGls.getAccount(GoogleLoginServiceConstants.PREFER_HOSTED);
-                    mText.append("PREFER_HOSTED gave: " + account + "\n");
-                    mUsernameEdit.setText(account == null ? "" : account);
-                } catch (RemoteException e) {
-                    mText.append("exception: " + e + "\n");
-                }
-            } });
-
-
-        b = (Button) findViewById(R.id.get_accounts);
-        b.setOnClickListener(new View.OnClickListener() {
-            public void onClick(View v) {
-                try {
-                    String[] accounts = mGls.getAccounts();
-                    mText.append("account list: (" + accounts.length + " entries)\n");
-                    for (String username: accounts) {
-                        mText.append("  " + username + "\n");
-                    }
-                } catch (RemoteException e) {
-                    mText.append("exception: " + e + "\n");
-                }
-            } });
-
-        b = (Button) findViewById(R.id.clear);
-        b.setOnClickListener(new View.OnClickListener() {
-            public void onClick(View v) {
-                mText.setText("");
-            } });
-
-        b = (Button) findViewById(R.id.go);
-        b.setOnClickListener(new Listener());
-
-        b = (Button) findViewById(R.id.wipe_passwords);
-        b.setOnClickListener(new View.OnClickListener() {
-            public void onClick(View v) {
-                mText.setText("wiping passwords:\n");
-                try {
-                    String[] accounts = mGls.getAccounts();
-                    LoginData ld = new LoginData();
-                    for (String username: accounts) {
-                        ld.mUsername = username;
-                        mGls.updatePassword(ld);
-                        mText.append("  " + username + "\n");
-                    }
-                    mText.append("done.\n");
-                } catch (RemoteException e) {
-                    mText.append("caught exception " + e + "\n");
-                }
-            } });
-
-    }
-
-    @Override
-    protected void onDestroy() {
-        super.onDestroy();
-        unbindService(mConnection);
-    }
-}
diff --git a/apps/Development/src/com/android/development/PackageSummary.java b/apps/Development/src/com/android/development/PackageSummary.java
index 5610559..58ab0f7 100644
--- a/apps/Development/src/com/android/development/PackageSummary.java
+++ b/apps/Development/src/com/android/development/PackageSummary.java
@@ -152,7 +152,7 @@
             mRestart.setOnClickListener(new View.OnClickListener() {
                 public void onClick(View v) {
                     try {
-                        ActivityManagerNative.getDefault().restartPackage(mPackageName);
+                        ActivityManagerNative.getDefault().killBackgroundProcesses(mPackageName);
                     } catch (RemoteException e) {
                     }
                 }
diff --git a/apps/Development/src/com/android/development/StacktraceViewer.java b/apps/Development/src/com/android/development/StacktraceViewer.java
deleted file mode 100644
index 96b0521..0000000
--- a/apps/Development/src/com/android/development/StacktraceViewer.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-** Copyright 2007, 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.android.development;
-
-
-import android.app.Activity;
-import android.widget.EditText;
-import android.widget.TextView;
-import android.text.method.ScrollingMovementMethod;
-import android.os.Bundle;
-import android.server.data.CrashData;
-import android.server.data.ThrowableData;
-import android.server.data.StackTraceElementData;
-import android.graphics.Typeface;
-
-/**
- * Views a single stack trace.
- */
-public class StacktraceViewer extends Activity {
-
-    protected void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-        setContentView(R.layout.log_viewer);
-
-        TextView text = (TextView) findViewById(R.id.text);
-        text.setTextSize(10);
-        text.setHorizontallyScrolling(true);
-        text.setTypeface(Typeface.MONOSPACE);
-        text.setMovementMethod(ScrollingMovementMethod.getInstance());
-        
-        String stacktrace = getIntent().getExtras().getString(
-                CrashData.class.getName());
-
-        text.setText(stacktrace);
-    }
-}
diff --git a/apps/Fallback/Android.mk b/apps/Fallback/Android.mk
index 0a7f5cf..cb4ffc4 100644
--- a/apps/Fallback/Android.mk
+++ b/apps/Fallback/Android.mk
@@ -1,7 +1,7 @@
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
-LOCAL_MODULE_TAGS := user
+LOCAL_MODULE_TAGS := optional
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
diff --git a/apps/FontLab/res/layout/font_lab.xml b/apps/FontLab/res/layout/font_lab.xml
index 1a79add..ff9db31 100644
--- a/apps/FontLab/res/layout/font_lab.xml
+++ b/apps/FontLab/res/layout/font_lab.xml
@@ -16,14 +16,14 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/content"
-    android:layout_width="fill_parent" android:layout_height="fill_parent"
+    android:layout_width="match_parent" android:layout_height="match_parent"
     android:orientation="vertical"
     android:paddingLeft="4dip" android:paddingRight="4dip"
     android:paddingTop="4dip" android:paddingBottom="4dip">
         
-    <TextView android:id="@+id/column1" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1"
+    <TextView android:id="@+id/column1" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1"
         android:layout_marginBottom="8dip" />
-    <TextView android:id="@+id/column2" android:layout_width="fill_parent" android:layout_height="0dip" android:layout_weight="1" />
+    <TextView android:id="@+id/column2" android:layout_width="match_parent" android:layout_height="0dip" android:layout_weight="1" />
         
 </LinearLayout>
 
diff --git a/apps/GestureBuilder/res/layout/create_gesture.xml b/apps/GestureBuilder/res/layout/create_gesture.xml
index ad58ab3..89e64c6 100644
--- a/apps/GestureBuilder/res/layout/create_gesture.xml
+++ b/apps/GestureBuilder/res/layout/create_gesture.xml
@@ -17,13 +17,13 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     
     android:orientation="vertical">
 
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
 
         android:orientation="horizontal">
@@ -49,7 +49,7 @@
     
     <android.gesture.GestureOverlayView
         android:id="@+id/gestures_overlay"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="0dip"
         android:layout_weight="1.0"
 
@@ -58,7 +58,7 @@
     <LinearLayout
         style="@android:style/ButtonBar"
 
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
 
         android:orientation="horizontal">
diff --git a/apps/GestureBuilder/res/layout/dialog_rename.xml b/apps/GestureBuilder/res/layout/dialog_rename.xml
index 4968944..49df806 100644
--- a/apps/GestureBuilder/res/layout/dialog_rename.xml
+++ b/apps/GestureBuilder/res/layout/dialog_rename.xml
@@ -15,7 +15,7 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:padding="20dip"
     android:orientation="vertical">
@@ -31,7 +31,7 @@
     <EditText
         android:id="@+id/name"
         android:layout_height="wrap_content"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:scrollHorizontally="true"
         android:autoText="false"
         android:capitalize="none"
diff --git a/apps/GestureBuilder/res/layout/gestures_item.xml b/apps/GestureBuilder/res/layout/gestures_item.xml
index 1563dfe..36c93b8 100644
--- a/apps/GestureBuilder/res/layout/gestures_item.xml
+++ b/apps/GestureBuilder/res/layout/gestures_item.xml
@@ -16,7 +16,7 @@
 
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@android:id/text1"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
 
     android:gravity="center_vertical"
diff --git a/apps/GestureBuilder/res/layout/gestures_list.xml b/apps/GestureBuilder/res/layout/gestures_list.xml
index 7e5b94a..d0b5e3d 100644
--- a/apps/GestureBuilder/res/layout/gestures_list.xml
+++ b/apps/GestureBuilder/res/layout/gestures_list.xml
@@ -16,21 +16,21 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
 
     android:orientation="vertical">
 
     <ListView
         android:id="@android:id/list"
 
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="0dip"
         android:layout_weight="1.0" />
 
     <TextView
         android:id="@android:id/empty"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="0dip"
         android:layout_weight="1.0"
 
@@ -42,7 +42,7 @@
     <LinearLayout
         style="@android:style/ButtonBar"
 
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
 
         android:orientation="horizontal">
diff --git a/apps/GraphicsLab/Android.mk b/apps/GraphicsLab/Android.mk
new file mode 100644
index 0000000..e8dd114
--- /dev/null
+++ b/apps/GraphicsLab/Android.mk
@@ -0,0 +1,10 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := tests
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := GraphicsLab
+
+include $(BUILD_PACKAGE)
diff --git a/apps/GraphicsLab/AndroidManifest.xml b/apps/GraphicsLab/AndroidManifest.xml
new file mode 100644
index 0000000..a91c4fa
--- /dev/null
+++ b/apps/GraphicsLab/AndroidManifest.xml
@@ -0,0 +1,11 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.graphicslab">
+    <application android:label="Graphics Lab">
+		<activity android:name="GraphicsLab">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.DEFAULT" />
+                <category android:name="android.intent.category.TEST" />
+            </intent-filter>
+		</activity>
+    </application>
+</manifest>
diff --git a/apps/GraphicsLab/MODULE_LICENSE_APACHE2 b/apps/GraphicsLab/MODULE_LICENSE_APACHE2
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/apps/GraphicsLab/MODULE_LICENSE_APACHE2
diff --git a/apps/GraphicsLab/NOTICE b/apps/GraphicsLab/NOTICE
new file mode 100644
index 0000000..c5b1efa
--- /dev/null
+++ b/apps/GraphicsLab/NOTICE
@@ -0,0 +1,190 @@
+
+   Copyright (c) 2005-2008, 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.
+
+   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.
+
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
diff --git a/apps/GraphicsLab/res/drawable/beach.jpg b/apps/GraphicsLab/res/drawable/beach.jpg
new file mode 100644
index 0000000..ae9794f
--- /dev/null
+++ b/apps/GraphicsLab/res/drawable/beach.jpg
Binary files differ
diff --git a/apps/GraphicsLab/res/drawable/news_img.jpg b/apps/GraphicsLab/res/drawable/news_img.jpg
new file mode 100644
index 0000000..16a5ecb
--- /dev/null
+++ b/apps/GraphicsLab/res/drawable/news_img.jpg
Binary files differ
diff --git a/apps/GraphicsLab/res/layout/graphics_lab.xml b/apps/GraphicsLab/res/layout/graphics_lab.xml
new file mode 100644
index 0000000..7c0e5d9
--- /dev/null
+++ b/apps/GraphicsLab/res/layout/graphics_lab.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 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:id="@+id/content"
+    android:layout_width="match_parent" android:layout_height="match_parent"
+    android:orientation="vertical"
+    android:paddingLeft="4dip" android:paddingRight="4dip"
+    android:paddingTop="4dip" android:paddingBottom="4dip">        
+</LinearLayout>
+
+
diff --git a/apps/GraphicsLab/src/com/android/graphicslab/GraphicsLab.java b/apps/GraphicsLab/src/com/android/graphicslab/GraphicsLab.java
new file mode 100644
index 0000000..dd5ac5b
--- /dev/null
+++ b/apps/GraphicsLab/src/com/android/graphicslab/GraphicsLab.java
@@ -0,0 +1,299 @@
+/*
+ * Copyright (C) 2007 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.android.graphicslab;
+
+import java.util.Map;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.*;
+import android.graphics.utils.*;
+import android.os.Bundle;
+import android.os.SystemClock;
+import android.view.*;
+
+public class GraphicsLab extends Activity {
+    public GraphicsLab() {}
+
+    private int mCurrView = 1;
+
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        setContentView(new SampleView(this));
+//        setTitle("Graphics Lab");
+    }
+
+    @Override
+    public boolean onKeyDown(int keyCode, KeyEvent event) {
+        switch(keyCode) {
+            case KeyEvent.KEYCODE_DPAD_CENTER:
+                if (mCurrView == 1) {
+                    setContentView(new SampleView2(this));
+                    mCurrView = 2;
+                } else {
+                    setContentView(new SampleView(this));
+                    mCurrView = 1;
+                }
+        }
+        return super.onKeyDown(keyCode, event);
+    }
+
+    private static class SampleView2 extends View {
+        private static final int ROWS = 16;
+        private static final int COLS = 16;
+        private static final int UNSTRETCH_MSEC = 250;
+        
+        private Interpolator mInterp;
+        private BoundaryPatch mPatch;
+        private float[] mCubics;
+        private float[] mOrig = new float[24];
+        private Paint mPaint0;
+        private Paint mPaint1;
+        private int mCurrIndex = -1;
+        private float mPrevX;
+        private float mPrevY;
+        
+        public SampleView2(Context context) {
+            super(context);
+            setFocusable(true);
+            
+            Bitmap bm = BitmapFactory.decodeResource(getResources(),
+                                                     R.drawable.news_img);
+            
+            mPatch = new BoundaryPatch();
+            mPatch.setTexture(bm);
+            
+            float unit = 90;
+            mCubics = new float[] {
+                0, 0, 1, 0, 2, 0,
+                3, 0, 3, 1, 3, 2,
+                3, 3, 2, 3, 1, 3,
+                0, 3, 0, 2, 0, 1
+            };
+            for (int i = 0; i < 24; i++) {
+                mCubics[i] *= 90;
+                mCubics[i] += 20;
+            }
+            rebuildPatch();
+            
+            mPaint0 = new Paint();
+            mPaint0.setAntiAlias(true);
+            mPaint0.setStrokeWidth(12);
+            mPaint0.setStrokeCap(Paint.Cap.ROUND);
+            mPaint1 = new Paint(mPaint0);
+            mPaint1.setColor(0xFFFFFFFF);
+            mPaint1.setStrokeWidth(10);
+        }
+        
+        @Override
+        protected void onSizeChanged(int nw, int nh, int ow, int oh) {
+            float[] pts = mCubics;
+            float x1 = nw*0.3333f;
+            float y1 = nh*0.3333f;
+            float x2 = nw*0.6667f;
+            float y2 = nh*0.6667f;
+            pts[0*2+0] = 0;  pts[0*2+1] = 0;
+            pts[1*2+0] = x1; pts[1*2+1] = 0;
+            pts[2*2+0] = x2; pts[2*2+1] = 0;
+
+            pts[3*2+0] = nw; pts[3*2+1] = 0;
+            pts[4*2+0] = nw; pts[4*2+1] = y1;
+            pts[5*2+0] = nw; pts[5*2+1] = y2;
+
+            pts[6*2+0] = nw; pts[6*2+1] = nh;
+            pts[7*2+0] = x2; pts[7*2+1] = nh;
+            pts[8*2+0] = x1; pts[8*2+1] = nh;
+
+            pts[9*2+0] = 0;  pts[9*2+1] = nh;
+            pts[10*2+0] = 0; pts[10*2+1] = y2;
+            pts[11*2+0] = 0; pts[11*2+1] = y1;
+            
+            System.arraycopy(pts, 0, mOrig, 0, 24);
+            rebuildPatch();
+        }
+
+        @Override protected void onDraw(Canvas canvas) {
+            if (mInterp != null) {
+                int now = (int)SystemClock.uptimeMillis();
+                Interpolator.Result result = mInterp.timeToValues(now, mCubics);
+                if (result != Interpolator.Result.NORMAL) {
+                    mInterp = null;
+                } else {
+                    invalidate();
+                }
+                rebuildPatch();
+            }
+            mPatch.draw(canvas);
+        }
+
+        private void rebuildPatch() {
+            mPatch.setCubicBoundary(mCubics, 0, ROWS, COLS);
+        }
+
+        @Override public boolean onTouchEvent(MotionEvent event) {
+            float x = event.getX();
+            float y = event.getY();
+            switch (event.getAction()) {
+                case MotionEvent.ACTION_DOWN:
+                    System.arraycopy(mOrig, 0, mCubics, 0, 24);
+                    mPrevX = x;
+                    mPrevY = y;
+                    break;
+                case MotionEvent.ACTION_MOVE: {
+                    float scale = 1.5f;
+                    float dx = (x - mPrevX) * scale;
+                    float dy = (y - mPrevY) * scale;
+                    int index;
+
+                    if (dx < 0) {
+                        index = 10;
+                    } else {
+                        index = 4;
+                    }
+                    mCubics[index*2 + 0] = mOrig[index*2 + 0] + dx;
+                    mCubics[index*2 + 2] = mOrig[index*2 + 2] + dx;
+                    
+                    if (dy < 0) {
+                        index = 1;
+                    } else {
+                        index = 7;
+                    }
+                    mCubics[index*2 + 1] = mOrig[index*2 + 1] + dy;
+                    mCubics[index*2 + 3] = mOrig[index*2 + 3] + dy;
+        
+                    rebuildPatch();
+                    invalidate();
+                } break;
+                case MotionEvent.ACTION_UP:
+                case MotionEvent.ACTION_CANCEL: {
+                    int start = (int)SystemClock.uptimeMillis();
+                    mInterp = new Interpolator(24);
+                    mInterp.setKeyFrame(0, start, mCubics,
+                                        new float[] { 0, 0.5f, 0.5f, 1 });
+                    mInterp.setKeyFrame(1, start + UNSTRETCH_MSEC, mOrig
+                                        );
+                    invalidate();
+                } break;
+            }
+            return true;
+        }
+    }
+
+    private static class SampleView extends View {
+        private static final int ROWS = 16;
+        private static final int COLS = 16;
+        
+        private BoundaryPatch mPatch;
+        private float[] mCubics;
+        private float[] mOrig = new float[24];
+        private Paint mPaint0;
+        private Paint mPaint1;
+        private int mCurrIndex = -1;
+        private float mPrevX;
+        private float mPrevY;
+        
+        public SampleView(Context context) {
+        super(context);
+        setFocusable(true);
+        
+        Bitmap bm = BitmapFactory.decodeResource(getResources(),
+                                                 R.drawable.beach);
+        
+        mPatch = new BoundaryPatch();
+        mPatch.setTexture(bm);
+        
+        float unit = 90;
+        mCubics = new float[] {
+            0, 0, 1, 0, 2, 0,
+            3, 0, 3, 1, 3, 2,
+            3, 3, 2, 3, 1, 3,
+            0, 3, 0, 2, 0, 1
+        };
+        for (int i = 0; i < 24; i++) {
+            mCubics[i] *= 90;
+            mCubics[i] += 20;
+        }
+        rebuildPatch();
+        
+        mPaint0 = new Paint();
+        mPaint0.setAntiAlias(true);
+        mPaint0.setStrokeWidth(12);
+        mPaint0.setStrokeCap(Paint.Cap.ROUND);
+        mPaint1 = new Paint(mPaint0);
+        mPaint1.setColor(0xFFFFFFFF);
+        mPaint1.setStrokeWidth(10);
+    }
+    
+    @Override protected void onDraw(Canvas canvas) {
+        canvas.drawColor(0xFFCCCCCC);
+        mPatch.draw(canvas);
+        canvas.drawPoints(mCubics, mPaint0);
+        canvas.drawPoints(mCubics, mPaint1);
+    }
+    
+    private void rebuildPatch() {
+        mPatch.setCubicBoundary(mCubics, 0, ROWS, COLS);
+    }
+    
+    private int findPtIndex(float x, float y) {
+        final float tolerance = 25;
+        final float[] pts = mCubics;
+        for (int i = 0; i < (pts.length >> 1); i++) {
+            if (Math.abs(pts[i*2 + 0] - x) <= tolerance &&
+                Math.abs(pts[i*2 + 1] - y) <= tolerance) {
+                return i*2;
+            }
+        }
+        return -1;
+    }
+    
+    private void offsetPts(float dx, float dy) {
+        final float[] pts = mCubics;
+        for (int i = 0; i < (pts.length >> 1); i++) {
+            pts[i*2 + 0] += dx;
+            pts[i*2 + 1] += dy;
+        }
+        rebuildPatch();
+    }
+    
+    @Override public boolean onTouchEvent(MotionEvent event) {
+        float x = event.getX();
+        float y = event.getY();
+        switch (event.getAction()) {
+            case MotionEvent.ACTION_DOWN:
+                mCurrIndex = findPtIndex(x, y);
+                mPrevX = x;
+                mPrevY = y;
+                break;
+            case MotionEvent.ACTION_MOVE:
+                if (mCurrIndex >= 0) {
+                    mCubics[mCurrIndex + 0] = x;
+                    mCubics[mCurrIndex + 1] = y;
+                    mPatch.setCubicBoundary(mCubics, 0, ROWS, COLS);
+                } else {
+                    offsetPts(x - mPrevX, y - mPrevY);
+                    mPrevX = x;
+                    mPrevY = y;
+                }
+                invalidate();
+                break;
+        }
+        return true;
+    }
+}
+}
+
diff --git a/apps/SdkSetup/Android.mk b/apps/SdkSetup/Android.mk
index 7647f15..f2face1 100644
--- a/apps/SdkSetup/Android.mk
+++ b/apps/SdkSetup/Android.mk
@@ -1,6 +1,8 @@
 LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
+LOCAL_MODULE_TAGS := optional
+
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
 LOCAL_PACKAGE_NAME := SdkSetup
diff --git a/apps/SpareParts/res/layout/spare_parts.xml b/apps/SpareParts/res/layout/spare_parts.xml
index f39298b..c1cd3c8 100644
--- a/apps/SpareParts/res/layout/spare_parts.xml
+++ b/apps/SpareParts/res/layout/spare_parts.xml
@@ -18,33 +18,26 @@
 */
 -->
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <RelativeLayout 
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
 
         <Spinner android:id="@+id/window_animation_scale"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_alignParentLeft="true">
         </Spinner>
 
         <Spinner android:id="@+id/transition_animation_scale"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_below="@id/window_animation_scale"
             android:layout_alignParentLeft="true">
         </Spinner>
 
-        <CheckBox android:id="@+id/show_maps_compass"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_below="@+id/transition_animation_scale"
-            android:layout_alignParentLeft="true"
-            android:text="@string/development_settings_show_maps_compass_text" />
-            
     </RelativeLayout>
 
 </ScrollView>
diff --git a/apps/SpareParts/res/values/strings.xml b/apps/SpareParts/res/values/strings.xml
index cd12fb3..e157730 100644
--- a/apps/SpareParts/res/values/strings.xml
+++ b/apps/SpareParts/res/values/strings.xml
@@ -59,12 +59,6 @@
     
     <string name="applications_title">Applications</string>
     
-    <string name="title_maps_compass">Show compass in Maps</string>
-    <string name="summary_on_maps_compass">Compass is displayed in Maps</string>
-    <string name="summary_off_maps_compass">Compass is not displayed in Maps</string>
-    
-    <string name="development_settings_show_maps_compass_text">Show compass in Maps</string>
-
     <!-- Sound & display settings screen, compatibility mode check box label -->
     <string name="compatibility_mode_title">Compatibility Mode</string>
     <!-- Sound & display settings screen, compatibility mode option summary text when check box is selected -->
diff --git a/apps/SpareParts/res/xml/spare_parts.xml b/apps/SpareParts/res/xml/spare_parts.xml
index cbc3864..524092e 100644
--- a/apps/SpareParts/res/xml/spare_parts.xml
+++ b/apps/SpareParts/res/xml/spare_parts.xml
@@ -101,16 +101,5 @@
                 android:summaryOn="@string/compatibility_mode_summary_on"
                 android:summaryOff="@string/compatibility_mode_summary_off" />
     </PreferenceCategory>
-            
-    <PreferenceCategory
-        android:title="@string/applications_title">
-                
-        <CheckBoxPreference 
-            android:key="maps_compass" 
-            android:title="@string/title_maps_compass" 
-            android:summaryOn="@string/summary_on_maps_compass"
-            android:summaryOff="@string/summary_off_maps_compass"/>
-        
-    </PreferenceCategory>
-        
+
 </PreferenceScreen>
diff --git a/apps/SpareParts/src/com/android/spare_parts/SpareParts.java b/apps/SpareParts/src/com/android/spare_parts/SpareParts.java
index 77022ad..099f27a 100644
--- a/apps/SpareParts/src/com/android/spare_parts/SpareParts.java
+++ b/apps/SpareParts/src/com/android/spare_parts/SpareParts.java
@@ -57,7 +57,6 @@
     private static final String HAPTIC_FEEDBACK_PREF = "haptic_feedback";
     private static final String FONT_SIZE_PREF = "font_size";
     private static final String END_BUTTON_PREF = "end_button";
-    private static final String MAPS_COMPASS_PREF = "maps_compass";
     private static final String KEY_COMPATIBILITY_MODE = "compatibility_mode";
 
     private final Configuration mCurConfig = new Configuration();
@@ -68,7 +67,6 @@
     private CheckBoxPreference mHapticFeedbackPref;
     private ListPreference mFontSizePref;
     private ListPreference mEndButtonPref;
-    private CheckBoxPreference mShowMapsCompassPref;
     private CheckBoxPreference mCompatibilityMode;
 
     private IWindowManager mWindowManager;
@@ -125,7 +123,6 @@
         mFontSizePref.setOnPreferenceChangeListener(this);
         mEndButtonPref = (ListPreference) prefSet.findPreference(END_BUTTON_PREF);
         mEndButtonPref.setOnPreferenceChangeListener(this);
-        mShowMapsCompassPref = (CheckBoxPreference) prefSet.findPreference(MAPS_COMPASS_PREF);
         mCompatibilityMode = (CheckBoxPreference) findPreference(KEY_COMPATIBILITY_MODE);
         mCompatibilityMode.setPersistent(false);
         mCompatibilityMode.setChecked(Settings.System.getInt(getContentResolver(),
@@ -145,20 +142,12 @@
     }
 
     private void updateToggles() {
-        try {
-            mFancyImeAnimationsPref.setChecked(Settings.System.getInt(
-                    getContentResolver(), 
-                    Settings.System.FANCY_IME_ANIMATIONS, 0) != 0);
-            mHapticFeedbackPref.setChecked(Settings.System.getInt(
-                    getContentResolver(), 
-                    Settings.System.HAPTIC_FEEDBACK_ENABLED, 0) != 0);
-            Context c = createPackageContext("com.google.android.apps.maps", 0);
-            mShowMapsCompassPref.setChecked(c.getSharedPreferences("extra-features", MODE_WORLD_READABLE)
-                .getBoolean("compass", false));
-        } catch (NameNotFoundException e) {
-            Log.w(TAG, "Failed reading maps compass");
-            e.printStackTrace();
-        }
+        mFancyImeAnimationsPref.setChecked(Settings.System.getInt(
+                getContentResolver(), 
+                Settings.System.FANCY_IME_ANIMATIONS, 0) != 0);
+        mHapticFeedbackPref.setChecked(Settings.System.getInt(
+                getContentResolver(), 
+                Settings.System.HAPTIC_FEEDBACK_ENABLED, 0) != 0);
     }
     
     public boolean onPreferenceChange(Preference preference, Object objValue) {
@@ -261,17 +250,6 @@
             Settings.System.putInt(getContentResolver(),
                     Settings.System.HAPTIC_FEEDBACK_ENABLED,
                     mHapticFeedbackPref.isChecked() ? 1 : 0);
-        } else if (MAPS_COMPASS_PREF.equals(key)) {
-            try {
-                Context c = createPackageContext("com.google.android.apps.maps", 0);
-                c.getSharedPreferences("extra-features", MODE_WORLD_WRITEABLE)
-                    .edit()
-                    .putBoolean("compass", mShowMapsCompassPref.isChecked())
-                    .commit();
-            } catch (NameNotFoundException e) {
-                Log.w(TAG, "Failed setting maps compass");
-                e.printStackTrace();
-            }
         }
     }
     
diff --git a/apps/Term/res/layout/term_activity.xml b/apps/Term/res/layout/term_activity.xml
index 7d93d16..6ce7719 100644
--- a/apps/Term/res/layout/term_activity.xml
+++ b/apps/Term/res/layout/term_activity.xml
@@ -17,8 +17,8 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent" 
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent"
     android:orientation="vertical">
 
     <com.android.term.EmulatorView android:id="@+id/emulatorView"
diff --git a/apps/Term/res/values/strings.xml b/apps/Term/res/values/strings.xml
index e3f8fcf..b5d622b 100644
--- a/apps/Term/res/values/strings.xml
+++ b/apps/Term/res/values/strings.xml
@@ -25,7 +25,7 @@
    <string name="text_preferences">Text</string>
 
    <string name="title_fontsize_preference">Font size</string>
-   <string name="summary_fontsize_preference">Choose character height in pixels.</string>
+   <string name="summary_fontsize_preference">Choose character height in points.</string>
    <string name="dialog_title_fontsize_preference">Font size</string>
 
    <string name="title_color_preference">Colors</string>
diff --git a/apps/Term/src/com/android/term/Term.java b/apps/Term/src/com/android/term/Term.java
index 6041baf..cbf94cf 100644
--- a/apps/Term/src/com/android/term/Term.java
+++ b/apps/Term/src/com/android/term/Term.java
@@ -45,6 +45,7 @@
 import android.os.Message;
 import android.preference.PreferenceManager;
 import android.util.AttributeSet;
+import android.util.DisplayMetrics;
 import android.util.Log;
 import android.view.GestureDetector;
 import android.view.KeyEvent;
@@ -158,14 +159,6 @@
         super.onCreate(icicle);
         Log.e(Term.LOG_TAG, "onCreate");
         mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
-        mPrefs.registerOnSharedPreferenceChangeListener(
-                new SharedPreferences.OnSharedPreferenceChangeListener(){
-
-                    public void onSharedPreferenceChanged(
-                            SharedPreferences sharedPreferences, String key) {
-                        readPrefs();
-                        updatePrefs();
-                    }});
         readPrefs();
 
         setContentView(R.layout.term_activity);
@@ -227,7 +220,7 @@
 
     private void sendInitialCommand() {
         String initialCommand = mInitialCommand;
-        if (initialCommand == null) {
+        if (initialCommand == null || initialCommand.equals("")) {
             initialCommand = DEFAULT_INITIAL_COMMAND;
         }
         if (initialCommand.length() > 0) {
@@ -253,7 +246,7 @@
 
     private void createSubprocess(int[] processId) {
         String shell = mShell;
-        if (shell == null) {
+        if (shell == null || shell.equals("")) {
             shell = DEFAULT_SHELL;
         }
         ArrayList<String> args = parse(shell);
@@ -347,7 +340,9 @@
     }
 
     private void updatePrefs() {
-        mEmulatorView.setTextSize(mFontSize);
+        DisplayMetrics metrics = new DisplayMetrics();
+        getWindowManager().getDefaultDisplay().getMetrics(metrics);
+        mEmulatorView.setTextSize((int) (mFontSize * metrics.density));
         setColors();
         mControlKeyCode = CONTROL_KEY_SCHEMES[mControlKeyId];
     }
@@ -369,17 +364,10 @@
     }
 
     @Override
-    public void onPause() {
-        SharedPreferences.Editor e = mPrefs.edit();
-        e.clear();
-        e.putString(FONTSIZE_KEY, Integer.toString(mFontSize));
-        e.putString(COLOR_KEY, Integer.toString(mColorId));
-        e.putString(CONTROLKEY_KEY, Integer.toString(mControlKeyId));
-        e.putString(SHELL_KEY, mShell);
-        e.putString(INITIALCOMMAND_KEY, mInitialCommand);
-        e.commit();
-
-        super.onPause();
+    public void onResume() {
+        super.onResume();
+        readPrefs();
+        updatePrefs();
     }
 
     @Override
diff --git a/apps/launchperf/res/layout/complex_layout.xml b/apps/launchperf/res/layout/complex_layout.xml
index 4e585b9..291b2fe 100644
--- a/apps/launchperf/res/layout/complex_layout.xml
+++ b/apps/launchperf/res/layout/complex_layout.xml
@@ -23,36 +23,36 @@
  -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
 <!--    <TabHost
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="200dip">
     </TabHost>
 
     <GridView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="200dip"
         android:numColumns="5">
     </GridView> -->
 
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="200dip"
         android:orientation="vertical">
         
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/header_absolute"/>
 
         <AbsoluteLayout
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content">
 
             <TextView
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:layout_x="0dip"
                 android:layout_y="0dip"
@@ -175,12 +175,12 @@
         </AbsoluteLayout>
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/header_relative"/>
 
         <RelativeLayout
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content">
 
             <Button android:id="@+id/relative_button1"
@@ -238,17 +238,17 @@
         </RelativeLayout>
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/header_linear"/>
 
         <LinearLayout
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical">
 
             <LinearLayout
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:orientation="horizontal">
 
@@ -272,11 +272,11 @@
             </LinearLayout>
 
             <EditText
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"/>
 
             <TextView
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:background="@color/blue"
                 android:text="@string/test_long_paragraph"/>
diff --git a/apps/launchperf/res/layout/simple_layout.xml b/apps/launchperf/res/layout/simple_layout.xml
index 3a61724..46244ff 100644
--- a/apps/launchperf/res/layout/simple_layout.xml
+++ b/apps/launchperf/res/layout/simple_layout.xml
@@ -26,28 +26,28 @@
      a row, here set to be vertical (so the first is at the top) -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
     
     <RelativeLayout
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
 
 
         <RelativeLayout android:id="@+id/replay_pane"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_alignParentBottom="True"
             android:background="@color/replay_background">
 
             <TextView android:id="@+id/instructions"
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/response" />
 
             <EditText android:id="@+id/entry"
-                android:layout_width="fill_parent" 
+                android:layout_width="match_parent" 
                 android:layout_height="44dip" 
                 android:layout_below="@id/instructions"/>
   
@@ -68,13 +68,13 @@
         </RelativeLayout>
 
         <ScrollView android:id="@+id/scroll_pane"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
             android:layout_above="@id/replay_pane">
 
             <TextView android:id="@+id/text_field"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
                 android:text="@string/text"/>
             
             <requestFocus/>
diff --git a/cmds/monkey/src/com/android/commands/monkey/Monkey.java b/cmds/monkey/src/com/android/commands/monkey/Monkey.java
index 79548d4..b1c75f1 100644
--- a/cmds/monkey/src/com/android/commands/monkey/Monkey.java
+++ b/cmds/monkey/src/com/android/commands/monkey/Monkey.java
@@ -23,25 +23,28 @@
 import android.content.Intent;
 import android.content.pm.IPackageManager;
 import android.content.pm.ResolveInfo;
+import android.os.Build;
 import android.os.Debug;
 import android.os.Process;
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.SystemProperties;
-import android.server.data.CrashData;
 import android.view.IWindowManager;
 
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.DataInputStream;
 import java.io.File;
+import java.io.FileReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.security.SecureRandom;
 import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Random;
 
 /**
  * Application that injects random key events and other actions into the system.
@@ -118,9 +121,18 @@
     /** Generate hprof reports before/after monkey runs */
     private boolean mGenerateHprof;
 
+    /** Package blacklist file. */
+    private String mPkgBlacklistFile;
+
+    /** Package whitelist file. */
+    private String mPkgWhitelistFile;
+
     /** Packages we are allowed to run, or empty if no restriction. */
     private HashSet<String> mValidPackages = new HashSet<String>();
 
+    /** Packages we are not allowed to run. */
+    private HashSet<String> mInvalidPackages = new HashSet<String>();
+
     /** Categories we are allowed to launch **/
     private ArrayList<String> mMainCategories = new ArrayList<String>();
 
@@ -130,12 +142,18 @@
     /** The delay between event inputs **/
     long mThrottle = 0;
 
+    /** Whether to randomize each throttle (0-mThrottle ms) inserted between events. */
+    boolean mRandomizeThrottle = false;
+
     /** The number of iterations **/
     int mCount = 1000;
 
     /** The random number seed **/
     long mSeed = 0;
 
+    /** The random number generator **/
+    Random mRandom = null;
+
     /** Dropped-event statistics **/
     long mDroppedKeyEvents = 0;
 
@@ -170,6 +188,25 @@
     public static String currentPackage;
 
     /**
+     * Check whether we should run against the givn package.
+     *
+     * @param pkg The package name.
+     * @return Returns true if we should run against pkg.
+     */
+    private boolean checkEnteringPackage(String pkg) {
+        if (mInvalidPackages.size() > 0) {
+            if (mInvalidPackages.contains(pkg)) {
+                return false;
+            }
+        } else if (mValidPackages.size() > 0) {
+            if (!mValidPackages.contains(pkg)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    /**
      * Monitor operations happening in the system.
      */
     private class ActivityController extends IActivityController.Stub {
@@ -197,39 +234,16 @@
             return allow;
         }
 
-        private boolean checkEnteringPackage(String pkg) {
-            if (pkg == null) {
-                return true;
-            }
-            // preflight the hash lookup to avoid the cost of hash key
-            // generation
-            if (mValidPackages.size() == 0) {
-                return true;
-            } else {
-                return mValidPackages.contains(pkg);
-            }
-        }
-
-        public boolean appCrashed(String processName, int pid, String shortMsg, String longMsg,
-                byte[] crashData) {
+        public boolean appCrashed(String processName, int pid,
+                String shortMsg, String longMsg,
+                long timeMillis, String stackTrace) {
             System.err.println("// CRASH: " + processName + " (pid " + pid + ")");
             System.err.println("// Short Msg: " + shortMsg);
             System.err.println("// Long Msg: " + longMsg);
-            if (crashData != null) {
-                try {
-                    CrashData cd = new CrashData(new DataInputStream(new ByteArrayInputStream(
-                            crashData)));
-                    System.err.println("// Build Label: " + cd.getBuildData().getFingerprint());
-                    System.err.println("// Build Changelist: "
-                            + cd.getBuildData().getIncrementalVersion());
-                    System.err.println("// Build Time: " + cd.getBuildData().getTime());
-                    System.err.println("// ID: " + cd.getId());
-                    System.err.println("// Tag: " + cd.getActivity());
-                    System.err.println(cd.getThrowableData().toString("// "));
-                } catch (IOException e) {
-                    System.err.println("// BAD STACK CRAWL");
-                }
-            }
+            System.err.println("// Build Label: " + Build.FINGERPRINT);
+            System.err.println("// Build Changelist: " + Build.VERSION.INCREMENTAL);
+            System.err.println("// Build Time: " + Build.TIME);
+            System.err.println("// " + stackTrace.replace("\n", "\n// "));
 
             if (!mIgnoreCrashes) {
                 synchronized (Monkey.this) {
@@ -371,6 +385,10 @@
             return -1;
         }
 
+        if (!loadPackageLists()) {
+            return -1;
+        }
+
         // now set up additional data in preparation for launch
         if (mMainCategories.size() == 0) {
             mMainCategories.add(Intent.CATEGORY_LAUNCHER);
@@ -385,6 +403,12 @@
                     System.out.println(":AllowPackage: " + it.next());
                 }
             }
+            if (mInvalidPackages.size() > 0) {
+                Iterator<String> it = mInvalidPackages.iterator();
+                while (it.hasNext()) {
+                    System.out.println(":DisallowPackage: " + it.next());
+                }
+            }
             if (mMainCategories.size() != 0) {
                 Iterator<String> it = mMainCategories.iterator();
                 while (it.hasNext()) {
@@ -405,19 +429,24 @@
             return -4;
         }
 
+        mRandom = new SecureRandom();
+        mRandom.setSeed((mSeed == 0) ? -1 : mSeed);
+
         if (mScriptFileNames != null && mScriptFileNames.size() == 1) {
             // script mode, ignore other options
-            mEventSource = new MonkeySourceScript(mScriptFileNames.get(0), mThrottle);
+            mEventSource = new MonkeySourceScript(mRandom, mScriptFileNames.get(0), mThrottle,
+                    mRandomizeThrottle);
             mEventSource.setVerbose(mVerbose);
 
             mCountEvents = false;
         } else if (mScriptFileNames != null && mScriptFileNames.size() > 1) {
             if (mSetupFileName != null) {
                 mEventSource = new MonkeySourceRandomScript(mSetupFileName, mScriptFileNames,
-                        mThrottle, mSeed);
+                        mThrottle, mRandomizeThrottle, mRandom);
                 mCount++;
             } else {
-                mEventSource = new MonkeySourceRandomScript(mScriptFileNames, mThrottle, mSeed);
+                mEventSource = new MonkeySourceRandomScript(mScriptFileNames, mThrottle,
+                        mRandomizeThrottle, mRandom);
             }
             mEventSource.setVerbose(mVerbose);
             mCountEvents = false;
@@ -434,7 +463,7 @@
             if (mVerbose >= 2) { // check seeding performance
                 System.out.println("// Seeded: " + mSeed);
             }
-            mEventSource = new MonkeySourceRandom(mSeed, mMainApps, mThrottle);
+            mEventSource = new MonkeySourceRandom(mRandom, mMainApps, mThrottle, mRandomizeThrottle);
             mEventSource.setVerbose(mVerbose);
             // set any of the factors that has been set
             for (int i = 0; i < MonkeySourceRandom.FACTORZ_COUNT; i++) {
@@ -577,8 +606,14 @@
                 } else if (opt.equals("--pct-anyevent")) {
                     int i = MonkeySourceRandom.FACTOR_ANYTHING;
                     mFactors[i] = -nextOptionLong("any events percentage");
+                } else if (opt.equals("--pkg-blacklist-file")) {
+                    mPkgBlacklistFile = nextOptionData();
+                } else if (opt.equals("--pkg-whitelist-file")) {
+                    mPkgWhitelistFile = nextOptionData();
                 } else if (opt.equals("--throttle")) {
                     mThrottle = nextOptionLong("delay (in milliseconds) to wait between events");
+                } else if (opt.equals("--randomize-throttle")) {
+                    mRandomizeThrottle = true;
                 } else if (opt.equals("--wait-dbg")) {
                     // do nothing - it's caught at the very start of run()
                 } else if (opt.equals("--dbg-no-events")) {
@@ -627,6 +662,62 @@
     }
 
     /**
+     * Load a list of package names from a file.
+     *
+     * @param fileName The file name, with package names separated by new line.
+     * @param list The destination list.
+     * @return Returns false if any error occurs.
+     */
+    private static boolean loadPackageListFromFile(String fileName, HashSet<String> list) {
+        BufferedReader reader = null;
+        try {
+            reader = new BufferedReader(new FileReader(fileName));
+            String s;
+            while ((s = reader.readLine()) != null) {
+                s = s.trim();
+                if ((s.length() > 0) && (!s.startsWith("#"))) {
+                    list.add(s);
+                }
+            }
+        } catch (IOException ioe) {
+            System.err.println(ioe);
+            return false;
+        } finally {
+            if (reader != null) {
+                try {
+                    reader.close();
+                } catch (IOException ioe) {
+                    System.err.println(ioe);
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Load package blacklist or whitelist (if specified).
+     *
+     * @return Returns false if any error occurs.
+     */
+    private boolean loadPackageLists() {
+        if (((mPkgWhitelistFile != null) || (mValidPackages.size() > 0))
+                && (mPkgBlacklistFile != null)) {
+            System.err.println("** Error: you can not specify a package blacklist "
+                    + "together with a whitelist or individual packages (via -p).");
+            return false;
+        }
+        if ((mPkgWhitelistFile != null)
+                && (!loadPackageListFromFile(mPkgWhitelistFile, mValidPackages))) {
+            return false;
+        }
+        if ((mPkgBlacklistFile != null)
+                && (!loadPackageListFromFile(mPkgBlacklistFile, mInvalidPackages))) {
+            return false;
+        }
+        return true;
+    }
+
+    /**
      * Check for any internal configuration (primarily build-time) errors.
      *
      * @return Returns true if ready to rock.
@@ -712,20 +803,17 @@
                 final int NA = mainApps.size();
                 for (int a = 0; a < NA; a++) {
                     ResolveInfo r = mainApps.get(a);
-                    if (mValidPackages.size() == 0
-                            || mValidPackages.contains(r.activityInfo.applicationInfo.packageName)) {
+                    String packageName = r.activityInfo.applicationInfo.packageName;
+                    if (checkEnteringPackage(packageName)) {
                         if (mVerbose >= 2) { // very verbose
                             System.out.println("//   + Using main activity " + r.activityInfo.name
-                                    + " (from package "
-                                    + r.activityInfo.applicationInfo.packageName + ")");
+                                    + " (from package " + packageName + ")");
                         }
-                        mMainApps.add(new ComponentName(r.activityInfo.applicationInfo.packageName,
-                                r.activityInfo.name));
+                        mMainApps.add(new ComponentName(packageName, r.activityInfo.name));
                     } else {
                         if (mVerbose >= 3) { // very very verbose
                             System.out.println("//   - NOT USING main activity "
-                                    + r.activityInfo.name + " (from package "
-                                    + r.activityInfo.applicationInfo.packageName + ")");
+                                    + r.activityInfo.name + " (from package " + packageName + ")");
                         }
                     }
                 }
@@ -752,7 +840,6 @@
      *         errors detected.
      */
     private int runMonkeyCycles() {
-
         int eventCounter = 0;
         int cycleCounter = 0;
 
@@ -798,7 +885,6 @@
 
             MonkeyEvent ev = mEventSource.getNextEvent();
             if (ev != null) {
-
                 int injectCode = ev.injectEvent(mWm, mAm, mVerbose);
                 if (injectCode == MonkeyEvent.INJECT_FAIL) {
                     if (ev instanceof MonkeyKeyEvent) {
@@ -829,13 +915,11 @@
                 if (!mCountEvents) {
                     cycleCounter++;
                 } else {
-                    System.err.println("** Error: Event source exhausted.");
+                    // Event Source has signaled that we have no more events to process
                     break;
                 }
             }
         }
-
-        // If we got this far, we succeeded!
         System.out.println("Events injected: " + eventCounter);
         return eventCounter;
     }
@@ -994,10 +1078,13 @@
         usage.append("              [--pct-nav PERCENT] [--pct-majornav PERCENT]\n");
         usage.append("              [--pct-appswitch PERCENT] [--pct-flip PERCENT]\n");
         usage.append("              [--pct-anyevent PERCENT]\n");
+        usage.append("              [--pkg-blacklist-file PACKAGE_BLACKLIST_FILE]\n");
+        usage.append("              [--pkg-whitelist-file PACKAGE_WHITELIST_FILE]\n");
         usage.append("              [--wait-dbg] [--dbg-no-events]\n");
         usage.append("              [--setup scriptfile] [-f scriptfile [-f scriptfile] ...]\n");
         usage.append("              [--port port]\n");
-        usage.append("              [-s SEED] [-v [-v] ...] [--throttle MILLISEC]\n");
+        usage.append("              [-s SEED] [-v [-v] ...]\n");
+        usage.append("              [--throttle MILLISEC] [--randomize-throttle]\n");
         usage.append("              COUNT");
         System.err.println(usage.toString());
     }
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeyEventQueue.java b/cmds/monkey/src/com/android/commands/monkey/MonkeyEventQueue.java
index dfe389a..00e46b7 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeyEventQueue.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeyEventQueue.java
@@ -17,25 +17,39 @@
 package com.android.commands.monkey;
 
 import java.util.LinkedList;
+import java.util.Random;
 
 /**
  * class for keeping a monkey event queue
  */
 @SuppressWarnings("serial")
-public class MonkeyEventQueue extends LinkedList<MonkeyEvent> {   
+public class MonkeyEventQueue extends LinkedList<MonkeyEvent> {
 
+    private Random mRandom;
     private long mThrottle;
-    
-    public MonkeyEventQueue(long throttle) {
+    private boolean mRandomizeThrottle;
+
+    public MonkeyEventQueue(Random random, long throttle, boolean randomizeThrottle) {
         super();
+        mRandom = random;
         mThrottle = throttle;
+        mRandomizeThrottle = randomizeThrottle;
     }
-    
+
     @Override
     public void addLast(MonkeyEvent e) {
         super.add(e);
         if (e.isThrottlable()) {
-            super.add(new MonkeyThrottleEvent(mThrottle));
+            long throttle = mThrottle;
+            if (mRandomizeThrottle && (mThrottle > 0)) {
+                throttle = mRandom.nextLong();
+                if (throttle < 0) {
+                    throttle = -throttle;
+                }
+                throttle %= mThrottle;
+                ++throttle;
+            }
+            super.add(new MonkeyThrottleEvent(throttle));
         }
     }
 }
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java
index 5c7fdbc..6fa029e 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandom.java
@@ -23,9 +23,7 @@
 import android.view.MotionEvent;
 import android.view.WindowManagerImpl;
 
-import java.security.SecureRandom;
 import java.util.ArrayList;
-import java.util.LinkedList;
 import java.util.Random;
 
 /**
@@ -202,7 +200,8 @@
         return -1;
     }
 
-    public MonkeySourceRandom(long seed, ArrayList<ComponentName> MainApps, long throttle) {
+    public MonkeySourceRandom(Random random, ArrayList<ComponentName> MainApps,
+            long throttle, boolean randomizeThrottle) {
         // default values for random distributions
         // note, these are straight percentages, to match user input (cmd line args)
         // but they will be converted to 0..1 values before the main loop runs.
@@ -216,10 +215,9 @@
         mFactors[FACTOR_FLIP] = 1.0f;
         mFactors[FACTOR_ANYTHING] = 15.0f;
 
-        mRandom = new SecureRandom();
-        mRandom.setSeed((seed == 0) ? -1 : seed);
+        mRandom = random;
         mMainApps = MainApps;
-        mQ = new MonkeyEventQueue(throttle);
+        mQ = new MonkeyEventQueue(random, throttle, randomizeThrottle);
     }
 
     /**
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandomScript.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandomScript.java
index a937398..fb60c93 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandomScript.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceRandomScript.java
@@ -16,8 +16,8 @@
 
 package com.android.commands.monkey;
 
-import java.security.SecureRandom;
 import java.util.ArrayList;
+import java.util.Random;
 
 /**
  * Class for generating MonkeyEvents from multiple scripts.
@@ -36,7 +36,7 @@
     private MonkeySourceScript mCurrentSource = null;
 
     /** The random number generator */
-    private SecureRandom mRandom;
+    private Random mRandom;
 
     /**
      * Creates a MonkeySourceRandomScript instance with an additional setup script.
@@ -44,21 +44,23 @@
      * @param setupFileName The name of the setup script file on the device.
      * @param scriptFileNames An ArrayList of the names of the script files to be run randomly.
      * @param throttle The amount of time to sleep in ms between events.
-     * @param seed The seed of the random number generator.
+     * @param randomizeThrottle Whether to randomize throttle.
+     * @param random The random number generator.
      */
     public MonkeySourceRandomScript(String setupFileName, ArrayList<String> scriptFileNames,
-            long throttle, long seed) {
+            long throttle, boolean randomizeThrottle, Random random) {
         if (setupFileName != null) {
-            mSetupSource = new MonkeySourceScript(setupFileName, throttle);
+            mSetupSource = new MonkeySourceScript(random, setupFileName, throttle,
+                    randomizeThrottle);
             mCurrentSource = mSetupSource;
         }
 
         for (String fileName: scriptFileNames) {
-            mScriptSources.add(new MonkeySourceScript(fileName, throttle));
+            mScriptSources.add(new MonkeySourceScript(random, fileName, throttle,
+                      randomizeThrottle));
         }
 
-        mRandom = new SecureRandom();
-        mRandom.setSeed((seed == 0) ? -1 : seed);
+        mRandom = random;
     }
 
     /**
@@ -66,10 +68,12 @@
      *
      * @param scriptFileNames An ArrayList of the names of the script files to be run randomly.
      * @param throttle The amount of time to sleep in ms between events.
-     * @param seed The seed of the random number generator.
+     * @param randomizeThrottle Whether to randomize throttle.
+     * @param random The random number generator.
      */
-    public MonkeySourceRandomScript(ArrayList<String> scriptFileNames, long throttle, long seed) {
-        this(null, scriptFileNames, throttle, seed);
+    public MonkeySourceRandomScript(ArrayList<String> scriptFileNames, long throttle,
+            boolean randomizeThrottle, Random random) {
+        this(null, scriptFileNames, throttle, randomizeThrottle, random);
     }
 
     /**
diff --git a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
index e372385..731233c 100644
--- a/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
+++ b/cmds/monkey/src/com/android/commands/monkey/MonkeySourceScript.java
@@ -26,6 +26,7 @@
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.util.NoSuchElementException;
+import java.util.Random;
 
 /**
  * monkey event queue. It takes a script to produce events sample script format:
@@ -115,9 +116,10 @@
      * @param filename The filename of the script (on the device).
      * @param throttle The amount of time in ms to sleep between events.
      */
-    public MonkeySourceScript(String filename, long throttle) {
+    public MonkeySourceScript(Random random, String filename, long throttle,
+            boolean randomizeThrottle) {
         mScriptFileName = filename;
-        mQ = new MonkeyEventQueue(throttle);
+        mQ = new MonkeyEventQueue(random, throttle, randomizeThrottle);
     }
 
     /**
diff --git a/docs/copyright-templates/asm.txt b/docs/copyright-templates/asm.txt
index 95a9022..da03f47 100644
--- a/docs/copyright-templates/asm.txt
+++ b/docs/copyright-templates/asm.txt
@@ -1,4 +1,4 @@
-; Copyright (C) 2009 The Android Open Source Project
+; 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.
diff --git a/docs/copyright-templates/bash.txt b/docs/copyright-templates/bash.txt
index ecf510e..7a0cbd4 100644
--- a/docs/copyright-templates/bash.txt
+++ b/docs/copyright-templates/bash.txt
@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# Copyright (C) 2009 The Android Open Source Project
+# 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.
diff --git a/docs/copyright-templates/bsd/c.txt b/docs/copyright-templates/bsd/c.txt
index c574b4a..56e5294 100644
--- a/docs/copyright-templates/bsd/c.txt
+++ b/docs/copyright-templates/bsd/c.txt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 The Android Open Source Project
+ * Copyright (C) 2010 The Android Open Source Project
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
diff --git a/docs/copyright-templates/c.txt b/docs/copyright-templates/c.txt
index 7cd7083..e3dd5ee 100644
--- a/docs/copyright-templates/c.txt
+++ b/docs/copyright-templates/c.txt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 The Android Open Source Project
+ * 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.
diff --git a/docs/copyright-templates/java.txt b/docs/copyright-templates/java.txt
index 7cd7083..e3dd5ee 100644
--- a/docs/copyright-templates/java.txt
+++ b/docs/copyright-templates/java.txt
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2009 The Android Open Source Project
+ * 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.
diff --git a/docs/copyright-templates/make.txt b/docs/copyright-templates/make.txt
index e4b376e..01a0ff3 100644
--- a/docs/copyright-templates/make.txt
+++ b/docs/copyright-templates/make.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2009 The Android Open Source Project
+# 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.
diff --git a/docs/copyright-templates/plain.txt b/docs/copyright-templates/plain.txt
index 4549ecb..da97d29 100644
--- a/docs/copyright-templates/plain.txt
+++ b/docs/copyright-templates/plain.txt
@@ -1,4 +1,4 @@
-Copyright (C) 2009 The Android Open Source Project
+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.
diff --git a/docs/copyright-templates/sh.txt b/docs/copyright-templates/sh.txt
index e53137d..fbe9d5e 100644
--- a/docs/copyright-templates/sh.txt
+++ b/docs/copyright-templates/sh.txt
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (C) 2009 The Android Open Source Project
+# 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.
diff --git a/docs/copyright-templates/xml.txt b/docs/copyright-templates/xml.txt
index 2a9d2b6..b479654 100644
--- a/docs/copyright-templates/xml.txt
+++ b/docs/copyright-templates/xml.txt
@@ -1,12 +1,12 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 The Android Open Source Project
+<!-- 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.
diff --git a/host/windows/usb/android_winusb.inf b/host/windows/usb/android_winusb.inf
index c1ef3ef..b2daf89 100755
--- a/host/windows/usb/android_winusb.inf
+++ b/host/windows/usb/android_winusb.inf
@@ -42,6 +42,7 @@
 %CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_0D02&MI_01

 %SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E11
 %CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E12&MI_01
+%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E22&MI_01

 ;
 ; Dell's Mini5
 %CompositeAdbInterface%     = USB_Install, USB\VID_413C&PID_B007&MI_01
@@ -63,6 +64,7 @@
 %CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_0D02&MI_01
 %SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_4E11

 %CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E12&MI_01
+%CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_4E22&MI_01

 ;
 ; Dell's Mini5
 %CompositeAdbInterface%     = USB_Install, USB\VID_413C&PID_B007&MI_01
diff --git a/ide/eclipse/.classpath b/ide/eclipse/.classpath
index 16f5b44..e7a5a20 100644
--- a/ide/eclipse/.classpath
+++ b/ide/eclipse/.classpath
@@ -7,17 +7,17 @@
 	<classpathentry kind="src" path="packages/apps/Camera/src"/>
 	<classpathentry kind="src" path="packages/apps/Contacts/src"/>
 	<classpathentry kind="src" path="packages/apps/Email/src"/>
-	<classpathentry kind="src" path="packages/apps/GoogleSearch/src"/>
 	<classpathentry kind="src" path="packages/apps/HTMLViewer/src"/>
 	<classpathentry kind="src" path="packages/apps/Launcher/src"/>
+	<classpathentry kind="src" path="packages/apps/Launcher2/src"/>
 	<classpathentry kind="src" path="packages/apps/Music/src"/>
 	<classpathentry kind="src" path="packages/apps/Mms/src"/>
 	<classpathentry kind="src" path="packages/apps/PackageInstaller/src"/>
 	<classpathentry kind="src" path="packages/apps/Phone/src"/>
+	<classpathentry kind="src" path="packages/apps/QuickSearchBox/src"/>
 	<classpathentry kind="src" path="packages/apps/Settings/src"/>
 	<classpathentry kind="src" path="packages/apps/SoundRecorder/src"/>
 	<classpathentry kind="src" path="packages/apps/Stk/src"/>
-	<classpathentry kind="src" path="packages/apps/Updater/src"/>
 	<classpathentry kind="src" path="packages/apps/VoiceDialer/src"/>
 	<classpathentry kind="src" path="packages/providers/CalendarProvider/src"/>
 	<classpathentry kind="src" path="packages/providers/ContactsProvider/src"/>
@@ -30,24 +30,21 @@
 	<classpathentry kind="src" path="frameworks/base/cmds/input/src"/>
 	<classpathentry kind="src" path="frameworks/base/cmds/pm/src"/>
 	<classpathentry kind="src" path="frameworks/base/cmds/svc/src"/>
+	<classpathentry kind="src" path="frameworks/base/common/java"/>
 	<classpathentry kind="src" path="frameworks/base/core/java"/>
 	<classpathentry kind="src" path="frameworks/base/core/config/sdk"/>
 	<classpathentry kind="src" path="frameworks/base/graphics/java"/>
-	<classpathentry kind="src" path="frameworks/base/im/java"/>
 	<classpathentry kind="src" path="frameworks/base/keystore/java"/>
 	<classpathentry kind="src" path="frameworks/base/location/java"/>
 	<classpathentry kind="src" path="frameworks/base/media/java"/>
 	<classpathentry kind="src" path="frameworks/base/opengl/java"/>
 	<classpathentry kind="src" path="frameworks/base/packages/SettingsProvider/src"/>
-	<classpathentry kind="src" path="frameworks/base/packages/SubscribedFeedsProvider/src"/>
 	<classpathentry kind="src" path="frameworks/base/sax/java"/>
 	<classpathentry kind="src" path="frameworks/base/services/java"/>
 	<classpathentry kind="src" path="frameworks/base/telephony/java"/>
 	<classpathentry kind="src" path="frameworks/base/test-runner"/>
-	<classpathentry kind="src" path="frameworks/base/tts/java"/>
 	<classpathentry kind="src" path="frameworks/base/vpn/java"/>
 	<classpathentry kind="src" path="frameworks/base/wifi/java"/>
-	<classpathentry kind="src" path="frameworks/base/vpn/java"/>
 	<classpathentry kind="src" path="frameworks/policies/base/phone"/>
 	<classpathentry kind="src" path="development/samples/ApiDemos/src"/>
 	<classpathentry kind="src" path="development/samples/ApiDemos/tests/src"/>
@@ -92,25 +89,26 @@
 	<classpathentry kind="src" path="dalvik/libcore/x-net/src/main/java"/>
 	<classpathentry kind="src" path="dalvik/libcore/xml/src/main/java"/>
 	<classpathentry kind="src" path="out/target/common/obj/APPS/ApiDemos_intermediates/src/src"/>
+	<classpathentry kind="src" path="out/target/common/obj/APPS/Browser_intermediates/src/src"/>
 	<classpathentry kind="src" path="out/target/common/obj/APPS/Email_intermediates/src/src"/>
 	<classpathentry kind="src" path="out/target/common/obj/APPS/Music_intermediates/src/src"/>
 	<classpathentry kind="src" path="out/target/common/obj/APPS/Phone_intermediates/src/src"/>
-	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/com.android.im.plugin_intermediates/src"/>
+	<classpathentry kind="src" path="out/target/common/obj/APPS/QuickSearchBox_intermediates/src/src"/>
 	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java"/>
 	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/location/java"/>
 	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/media/java"/>
 	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony/java"/>
 	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/vpn/java"/>
 	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/wifi/java"/>
-	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/vpn/java"/>
+	<classpathentry kind="src" path="out/target/common/obj/JAVA_LIBRARIES/services_intermediates/src"/>
 	<classpathentry kind="src" path="out/target/common/R"/>
 	<classpathentry kind="src" path="external/tagsoup/src"/>
-	<classpathentry kind="src" path="external/protobuf/src"/>
-	<classpathentry kind="src" path="external/gdata/src"/>
 	<classpathentry kind="src" path="external/apache-http/src"/>
-	<classpathentry kind="lib" path="external/googleclient/googleclient-lib.jar"/>
+	<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/google-common_intermediates/javalib.jar"/>
 	<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/google-framework_intermediates/javalib.jar"/>
 	<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/googlelogin-client_intermediates/javalib.jar"/>
-	<classpathentry kind="lib" path="packages/apps/Calculator/arity-1.3.3.jar"/>
+	<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/gsf-client_intermediates/javalib.jar"/>
+	<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/mms-common_intermediates/javalib.jar"/>
+	<classpathentry kind="lib" path="packages/apps/Calculator/arity-2.0.2.jar"/>
 	<classpathentry kind="output" path="out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes"/>
 </classpath>
diff --git a/ide/emacs/android-common.el b/ide/emacs/android-common.el
new file mode 100644
index 0000000..cebd087
--- /dev/null
+++ b/ide/emacs/android-common.el
@@ -0,0 +1,181 @@
+;;; android-common.el --- Common functions/variables to dev Android in Emacs.
+;;
+;; Copyright (C) 2009 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.
+
+;;; Commentary:
+;;
+;; Variables to customize and common functions for the Android build
+;; support in Emacs.
+;; There should be no interactive function in this module.
+;;
+;; You need to have a proper buildspec.mk file in your root directory
+;; for this module to work (see $TOP/build/buildspec.mk.default).
+;; If the path the product's files/image uses an a product alias, you
+;; need to add a mapping in `android-product-alias-map'. For instance
+;; if TARGET_PRODUCT is foo but the build directory is out/target/product/bar,
+;; you need to add a mapping Target:foo -> Alias:bar
+;;
+
+;;; Code:
+
+(defgroup android nil
+  "Support for android development in Emacs."
+  :prefix "android-"                    ; Currently unused.
+  :tag    "Android"
+  :group  'tools)
+
+;;;###autoload
+(defcustom android-compilation-jobs 2
+  "Number of jobs used to do a compilation (-j option of make)."
+  :type 'integer
+  :group 'android)
+
+;;;###autoload
+(defcustom android-compilation-no-buildenv-warning t
+  "If not nil, suppress warnings from the build env (Makefile,
+bash) from the compilation output since they interfere with
+`next-error'."
+  :type 'boolean
+  :group 'android)
+
+;;;###autoload
+(defcustom android-product-alias-map nil
+  "Alist between product targets (declared in buildspec.mk) and actual
+ product build directory used by `android-product'.
+
+For instance if TARGET_PRODUCT is 'foo' but the build directory
+ is 'out/target/product/bar', you need to add a mapping Target:foo -> Alias:bar."
+  :type '(repeat (list (string :tag "Target")
+                       (string :tag "Alias")))
+  :group 'android)
+
+(defconst android-output-buffer-name "*Android Output*"
+  "Name of the default buffer for the output of the commands.
+There is only one instance of such a buffer.")
+
+(defun android-find-build-tree-root ()
+  "Ascend the current path until the root of the android build tree is found.
+Similarly to the shell functions in envsetup.sh, for the root both ./Makefile
+and ./build/core/envsetup.mk are exiting files.
+Return the root of the build tree.  Signal an error if not found."
+  (let ((default-directory default-directory))
+    (while (and (> (length default-directory) 2)
+                (not (file-exists-p (concat default-directory
+                                            "Makefile")))
+                (not (file-exists-p (concat default-directory
+                                            "build/core/envsetup.mk"))))
+      (setq default-directory
+            (substring default-directory 0
+                       (string-match "[^/]+/$" default-directory))))
+    (if (> (length default-directory) 2)
+        default-directory
+      (error "Not in a valid android tree"))))
+
+(defun android-project-p ()
+  "Return nil if not in an android build tree."
+  (condition-case nil
+      (android-find-build-tree-root)
+    (error nil)))
+
+(defun android-host ()
+  "Return the <system>-<arch> string (e.g linux-x86).
+Only linux and darwin on x86 architectures are supported."
+  (or (string-match "x86" system-configuration)
+      (string-match "i386" system-configuration)
+      (error "Unknown arch"))
+  (or (and (string-match "darwin" system-configuration) "darwin-x86")
+      (and (string-match "linux" system-configuration) "linux-x86")
+      (error "Unknown system")))
+
+(defun android-product ()
+  "Return the product built according to the buildspec.mk.
+You must have buildspec.mk file in the top directory.
+
+Additional product aliases can be listed in `android-product-alias-map'
+if the product actually built is different from the one listed
+in buildspec.mk"
+  (save-excursion
+    (let* ((buildspec (concat (android-find-build-tree-root) "buildspec.mk"))
+           (product (with-current-buffer (find-file-noselect buildspec)
+                      (goto-char (point-min))
+                      (search-forward "TARGET_PRODUCT:=")
+                      (buffer-substring-no-properties (point)
+                                                      (scan-sexps (point) 1))))
+           (alias (assoc product android-product-alias-map)))
+      ; Post processing, adjust the names.
+      (if (not alias)
+          product
+        (nth 1 alias)))))
+
+(defun android-product-path ()
+  "Return the full path to the product directory.
+
+Additional product aliases can be added in `android-product-alias-map'
+if the product actually built is different from the one listed
+in buildspec.mk"
+  (let ((path (concat (android-find-build-tree-root) "out/target/product/"
+                      (android-product))))
+    (when (not (file-exists-p path))
+      (error (format "%s does not exist. If product %s maps to another one,
+add an entry to android-product-map." path (android-product))))
+    path))
+
+(defun android-find-host-bin (binary)
+  "Return the full path to the host BINARY.
+Binaries don't depend on the device, just on the host type.
+Try first to locate BINARY in the out/host tree.  Fallback using
+the shell exec PATH setup."
+  (if (android-project-p)
+      (let ((path (concat (android-find-build-tree-root) "out/host/"
+                          (android-host) "/bin/" binary)))
+        (if (file-exists-p path)
+            path
+          (error (concat binary " is missing."))))
+    (executable-find binary)))
+
+(defun android-adb ()
+  "Return the path to the adb executable.
+If not in the build tree use the PATH env variable."
+  (android-find-host-bin "adb"))
+
+(defun android-fastboot ()
+  "Return the path to the fastboot executable.
+If not in the build tree use the PATH env variable."
+  ; For fastboot -p is the name of the product, *not* the full path to
+  ; its directory like adb requests sometimes.
+  (concat (android-find-host-bin "fastboot") " -p " (android-product)))
+
+(defun android-adb-command (command &optional product)
+  "Execute 'adb COMMAND'.
+If the optional PRODUCT is not nil, -p (android-product-path) is used
+when adb is invoked."
+  (when (get-buffer android-output-buffer-name)
+    (with-current-buffer android-output-buffer-name
+      (erase-buffer)))
+  (if product
+      (shell-command (concat (android-adb) " -p " (android-product-path)
+                             " " command)
+                     android-output-buffer-name)
+    (shell-command (concat (android-adb) " " command)
+                   android-output-buffer-name)))
+
+(defun android-adb-shell-command (command)
+  "Execute 'adb shell COMMAND'."
+  (android-adb-command (concat " shell " command)
+                       android-output-buffer-name))
+
+(provide 'android-common)
+
+;;; android-common.el ends here
diff --git a/ide/emacs/android-compile.el b/ide/emacs/android-compile.el
new file mode 100644
index 0000000..ef7bc88
--- /dev/null
+++ b/ide/emacs/android-compile.el
@@ -0,0 +1,166 @@
+;;; android-compile.el --- Compile the Android source tree.
+;;
+;; Copyright (C) 2009 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.
+
+;;; Commentary:
+;;
+;; Helper functions to compile Android file within emacs.
+;; This module ignores 'build/envsetup.sh' and any enviroment set by the
+;; 'lunch' shell function.
+;; Instead it relies solely on 'buildspec.mk', remember that when you
+;; switch configuration.
+;;
+;; The only interactive function is 'android-compile'.
+;; In your .emacs load this file (e.g (require 'android-compile)) then:
+;;
+;;   (add-hook 'c++-mode-hook 'android-compile)
+;;   (add-hook 'java-mode-hook 'android-compile)
+;; and/or
+;;   (global-set-key [f9] 'android-compile)
+;;
+;;
+;; TODO: Maybe we could cache the result of the compile function in
+;; buffer local vars.
+
+;;; Code:
+
+(require 'compile)
+(require 'android-common)
+
+;; No need to be customized.
+(defvar android-compile-ignore-re
+  "\\(^\\(\\sw\\|[/_]\\)+\\(Makefile\\|\\.mk\\):[0-9]+:.*warning\\)\\|\\(^/bin/bash\\)"
+  "RE to match line to suppress during a compilation.
+During the compilation process line matching the above will be
+suppressed if `android-compilation-no-buildenv-warning' is non nil.")
+
+(defun android-makefile-exists-p (directory)
+  "Return t if an Android makefile exists in DIRECTORY."
+  ; Test for Android.mk first: more likely.
+  (or (file-exists-p (concat directory "Android.mk"))
+      (file-exists-p (concat directory "Makefile"))))
+
+(defun android-find-makefile (topdir)
+  "Ascend the current path until an Android makefile is found.
+Makefiles are named Android.mk except in the root directory where
+the file is named Makefile.
+TOPDIR is the root directory of the build.
+Return a list with 2 elements (MAKEFILE_PATH IS_ROOT_MAKEFILE).
+MAKEFILE_PATH is the relative path of the makefile wrt TOPDIR.
+Signal an error if no Makefile was found."
+  ;; TODO: Could check that topdir is the start of default-directory.
+  (unless (> (length topdir) 2)
+    (error "Topdir invalid %s for current dir %s" topdir default-directory))
+  (let ((default-directory default-directory)
+        file)
+    ;; Ascend the path.
+    (while (and (> (length default-directory) (length topdir))
+                (not (android-makefile-exists-p default-directory)))
+      (setq default-directory
+            (substring default-directory 0
+                       (string-match "[^/]+/$" default-directory))))
+
+    (when (not (android-makefile-exists-p default-directory))
+      (error "Not in a valid android tree"))
+
+    (if (string= default-directory topdir)
+        (list "Makefile" t)
+      ;; Remove the root dir at the start of the filename
+      (setq default-directory (substring default-directory (length topdir) nil))
+      (setq file (concat default-directory "Android.mk"))
+      (list file nil))))
+
+;; This filter is registered as a `compilation-filter-hook' and is
+;; called when new data has been inserted in the compile buffer. Don't
+;; assume that only one line has been inserted, typically more than
+;; one has changed since the last call due to stdout buffering.
+;;
+;; We store in a buffer local variable `android-compile-context' a
+;; list with 2 elements, the process and point position at the end of
+;; the last invocation. The process is used to detect a new
+;; compilation. The point position is used to limit our search.
+;;
+;; On entry (point) is at the end of the last block inserted.
+(defun android-compile-filter ()
+  "Filter to discard unwanted lines from the compilation buffer.
+
+This filter is registered as a `compilation-filter-hook' and is
+called when new data has been inserted in the compile buffer.
+
+Has effect only if `android-compilation-no-buildenv-warning' is
+not nil."
+  ;; Currently we are looking only for compilation warnings from the
+  ;; build env. Move this test lower, near the while loop if we
+  ;; support more than one category of regexp.
+  (when android-compilation-no-buildenv-warning
+
+    ;; Check if android-compile-context does not exist or if the
+    ;; process has changed: new compilation.
+    (let ((proc (get-buffer-process (current-buffer))))
+      (unless (and (local-variable-p 'android-compile-context)
+                   (eq proc (cadr android-compile-context)))
+        (setq android-compile-context (list (point-min) proc))
+        (make-local-variable 'android-compile-context)))
+
+    (let ((beg (car android-compile-context))
+          (end (point)))
+      (save-excursion
+        (goto-char beg)
+        ;; Need to go back at the beginning of the line before we
+        ;; start the search: because of the buffering, the previous
+        ;; block inserted may have ended in the middle of the
+        ;; expression we are trying to match. As result we missed it
+        ;; last time and we would miss it again if we started just
+        ;; where we left of. By processing the line from the start we
+        ;; are catching that case.
+        (forward-line 0)
+        (while (search-forward-regexp android-compile-ignore-re end t)
+          ;; Nuke the line
+          (let ((bol (point-at-bol)))
+            (forward-line 1)
+            (delete-region bol (point)))))
+      ;; Remember the new end for next time around.
+      (setcar android-compile-context (point)))))
+
+(defun android-compile ()
+  "Elisp equivalent of mm shell function.
+Walk up the path until a makefile is found and build it.
+You need to have a proper buildspec.mk in your top dir.
+
+Use `android-compilation-jobs' to control the number of jobs used
+in a compilation."
+  (interactive)
+  (if (android-project-p)
+      (let* ((topdir (android-find-build-tree-root))
+             (makefile (android-find-makefile topdir))
+             (options
+              (concat " -j " (number-to-string android-compilation-jobs))))
+        (unless (file-exists-p (concat topdir "buildspec.mk"))
+          (error "buildspec.mk missing in %s." topdir))
+        ;; Add-hook do not re-add if already present. The compile
+        ;; filter hooks run after the comint cleanup (^M).
+        (add-hook 'compilation-filter-hook 'android-compile-filter)
+        (set (make-local-variable 'compile-command)
+             (if (cadr makefile)
+                 ;; The root Makefile is not invoked using ONE_SHOT_MAKEFILE.
+                 (concat "make -C " topdir options) ; Build the whole image.
+               (concat "ONE_SHOT_MAKEFILE=" (car makefile)
+                       " make -C " topdir options " files ")))
+        (if (interactive-p)
+            (call-interactively 'compile)))))
+
+(provide 'android-compile)
+
+;;; android-compile.el ends here
diff --git a/ide/emacs/android-host.el b/ide/emacs/android-host.el
new file mode 100644
index 0000000..d9b32e7
--- /dev/null
+++ b/ide/emacs/android-host.el
@@ -0,0 +1,122 @@
+;;; android-host.el --- Module to use host binaries from an Android dev tree.
+;;
+;; Copyright (C) 2009 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.
+
+;;; Commentary:
+;;
+;; This module defines interactive functions to send the most common
+;; commands to a device.
+;;
+;; Currently only one device is supported.
+;;
+;; In your .emacs load this file (e.g (require 'android-host)) then
+;; you can either create new shortcuts e.g:
+;;
+;;   (global-set-key [f8] 'android-adb-sync)
+;;
+;; or rely on autocompletion M-x and-sync will expand to
+;; M-x  android-adb-sync
+;;
+;; By default the following key bindings are active:
+;; C-x a a android-adb-root
+;; C-x a r android-adb-remount
+;; C-x a s android-adb-sync
+;; C-x a b android-adb-shell-reboot-bootloader
+;; C-x a f android-fastboot-flashall
+;;
+;; android-fastboot-flashall is still work in progress, check the
+;; associated buffer (*Android Output*) for errors when you use it.
+
+;;; Code:
+
+(require 'android-common)
+
+(defvar android-host-command-map (make-sparse-keymap))
+
+(defun android-host-key-prefix-set (var val)
+  "Bind the keys shortcuts to the functions.i"
+  ;; TODO: This should go in a minor mode keymap instead of
+  ;; messing with the global one.
+  (define-key global-map (read-kbd-macro val) android-host-command-map)
+  (custom-set-default var val))
+
+(let ((map android-host-command-map))
+  (define-key map (kbd "a") 'android-adb-root)
+  (define-key map (kbd "r") 'android-adb-remount)
+  (define-key map (kbd "s") 'android-adb-sync)
+  (define-key map (kbd "b") 'android-adb-shell-reboot-bootloader)
+  (define-key map (kbd "f") 'android-fastboot-flashall))
+
+(defcustom android-host-key-prefix "C-x a"
+  "Prefix keystrokes for Android commands."
+  :group 'android
+  :type 'string
+  :set 'android-host-key-prefix-set)
+
+(defun android-adb-remount ()
+  "Execute 'adb remount'."
+  (interactive)
+  (android-adb-command "remount"))
+
+(defun android-adb-root ()
+  "Execute 'adb root'."
+  (interactive)
+  (android-adb-command "root"))
+
+(defun android-adb-shell-reboot-bootloader ()
+  "Execute 'adb shell reboot bootloader'."
+  (interactive)
+  (android-adb-shell-command "reboot bootloader"))
+
+(defun android-adb-sync ()
+  "Execute 'adb sync'."
+  (interactive)
+  ;; Always force root and remount, this way sync always works even on
+  ;; a device that has just rebooted or that runs a userdebug build.
+  (android-adb-root)
+  (android-adb-remount)
+  (android-adb-command "sync" 'p))
+
+(defun android-fastboot-sentinel (process event)
+  "Called when the fastboot process is done."
+  ;; TODO: Should barf if the last lines are not:
+  ;;   OKAY
+  ;;   rebooting...
+  (princ
+   (format "Process: %s had the event `%s'" process event)))
+
+(defun android-fastboot-flashall (arg)
+  "Execute 'fastboot -p <product> flashall'.
+
+With no ARG, don't wipe the user data.
+With ARG, wipe the user data."
+  (interactive "P")
+  (when (get-buffer android-output-buffer-name)
+    (with-current-buffer android-output-buffer-name
+      (erase-buffer)))
+  (let ((proc
+         (if arg
+             (start-process-shell-command
+              "fastboot"
+              android-output-buffer-name
+              (concat (android-fastboot) " flashall -w"))
+           (start-process-shell-command
+            "fastboot" android-output-buffer-name
+            (concat (android-fastboot) " flashall")))))
+    (set-process-sentinel proc 'android-fastboot-sentinel)))
+
+
+(provide 'android-host)
+;;; android-host.el ends here
diff --git a/ndk/apps/san-angeles/project/res/layout/main.xml b/ndk/apps/san-angeles/project/res/layout/main.xml
index 25dbf6d..ca19a18 100644
--- a/ndk/apps/san-angeles/project/res/layout/main.xml
+++ b/ndk/apps/san-angeles/project/res/layout/main.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     >
 <TextView  
-    android:layout_width="fill_parent" 
+    android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:text="Hello World, DemoActivity"
     />
diff --git a/pdk/Pdk.mk b/pdk/Pdk.mk
index 5268384..d19b342 100644
--- a/pdk/Pdk.mk
+++ b/pdk/Pdk.mk
@@ -54,7 +54,7 @@
 pdk_camera_dir := frameworks/base/include/ui
 
 # Destination directory for docs (templates + doxygenated headers)
-pdk_docs_dest_dir := $(pdk_docs_intermediates)/docs/guide
+pdk_docs_dest_dir := $(pdk_docs_intermediates)/docs/porting
 pdk_app_eng_root := $(pdk_docs_intermediates)/docs
 
 # Working directory for source to be doxygenated
@@ -188,12 +188,12 @@
 LOCAL_MODULE := online-pdk
 
 LOCAL_DROIDDOC_OPTIONS:= \
-		-toroot /online-pdk/ \
+		-toroot / \
 		-hdf android.whichdoc online \
 		-hdf android.whichmodule $(LOCAL_MODULE)
 
 LOCAL_DROIDDOC_CUSTOM_TEMPLATE_DIR := build/tools/droiddoc/templates-pdk
-LOCAL_DROIDDOC_CUSTOM_ASSET_DIR := assets-pdk
+LOCAL_DROIDDOC_CUSTOM_ASSET_DIR := assets
 
 include $(BUILD_DROIDDOC)
 
@@ -205,10 +205,6 @@
 	@echo "PDK: $@"
 	$(copy-file-to-target-with-cp)
 
-$(OUT_DOCS)/pdk.py: $(pdk_hosting_dir)/pdk.py
-	@echo "PDK: $@"
-	$(copy-file-to-target-with-cp)
-
 # Name the tar files
 name := android_pdk_docs-$(REQUESTED_PRODUCT)
 ifeq ($(TARGET_BUILD_TYPE),debug)
@@ -232,11 +228,11 @@
 	$(hide) gzip -cf $< > $@
 
 # tar up all the files to make the pdk docs.
-$(pdk_docs_tarfile): $(DOCS_OUT_DIR)-timestamp $(OUT_DOCS)/app.yaml $(OUT_DOCS)/pdk.py
+$(pdk_docs_tarfile): $(DOCS_OUT_DIR)-timestamp $(OUT_DOCS)/app.yaml
 	@echo "PDK docs: $@"
 	@mkdir -p $(dir $@)
 	@rm -f $@
-	$(hide) tar rf $@ -C $(OUT_DOCS) $(LOCAL_MODULE) pdk.py  app.yaml
+	$(hide) tar rf $@ -C $(OUT_DOCS) $(LOCAL_MODULE) app.yaml
 
 # Debugging reporting can go here, add it as a target to get output.
 pdk_debug:
diff --git a/pdk/docs/CHANGE_HISTORY.TXT b/pdk/docs/CHANGE_HISTORY.TXT
deleted file mode 100755
index 379aade..0000000
--- a/pdk/docs/CHANGE_HISTORY.TXT
+++ /dev/null
@@ -1,23 +0,0 @@
-V 0.9 MWR Apr 6, 2009
-#####################
-
-* New files for new css files using droiddoc/clearsilver
-
-V 0.3 - June 9, 2008

-####################

-

-* Architectural diagrams now include a legend that describes the difference 

-  between solid and dashed elements

-

-* Removed Puppetmaster document

-

-* Removed external link to Android Architecture from the left navigation bar

-

-* small changes to Radio Layer Interface

-

-* Updated Host System Setup (source_setup_guide.html) to include mention of Linux 8.04 and Cygwin.

-

-* Updated Build System (build_system.html): Switched Device code options 1 & 2 to emphasize that 

-  the new first option yields more consistent results. 

-

-* Updated Bring Up (bring_up.html): removed "hotplugd" from step 7.
diff --git a/pdk/docs/README b/pdk/docs/README
new file mode 100644
index 0000000..883d83a
--- /dev/null
+++ b/pdk/docs/README
@@ -0,0 +1,15 @@
+This directory contains the source for the source.android.com site contents.
+The Platform Development Kit (PDK, a set of tools for the convenience of
+engineers doing building devices) is also built as part of the site build.
+
+Subdirectories include:
+  about -- general information about the Android Open Source Project
+  community -- information about the AOSP mailing lists
+  compatibility -- information about building compatible devices
+  downloads -- links to download files of interest
+  images -- images used in docs; note: this is NOT for UI assets/skins
+  porting -- tips & guides for porting the Android source to hardware
+  source -- how to access & use the Android source
+
+This directory originated as the PDK home (hence the name) and grew to
+encompass source.android.com.
diff --git a/pdk/docs/about/about_toc.cs b/pdk/docs/about/about_toc.cs
new file mode 100644
index 0000000..4676ace
--- /dev/null
+++ b/pdk/docs/about/about_toc.cs
@@ -0,0 +1,18 @@
+<script type="text/javascript" language="JavaScript">
+<!--
+function nothing() {}
+-->
+</script>
+
+<ul>
+    <li><a href="<?cs var:toroot ?>about/philosophy.html">Project Philosophy</a></li>
+    <li><a href="<?cs var:toroot ?>source/index.html">Getting Involved</a></li>
+    <li><a href="<?cs var:toroot ?>compatibility/index.html">Compatibility</a></li>
+    <li><a href="<?cs var:toroot ?>source/licenses.html">Licensing Information</a></li>
+</ul>
+
+<script type="text/javascript">
+<!--
+    buildToggleLists();
+//-->
+</script>
diff --git a/pdk/docs/about/index.jd b/pdk/docs/about/index.jd
new file mode 100644
index 0000000..2f98b65
--- /dev/null
+++ b/pdk/docs/about/index.jd
@@ -0,0 +1,20 @@
+page.title=About the Android Open Source Project
+doc.type=about
+doc.hidenav=true
+@jd:body
+<p>Android is an open-source software stack created for mobile phones and
+other devices.  The Android Open Source Project (AOSP) is tasked with the
+maintenance and further development of Android. Many device manufacturers have
+brought to market devices running Android, and they are readibly available
+around the world.</p>
+<p>Our primary purpose is to build an excellent software platform for everyday
+users. A number of companies have committed many engineers to achieve this
+goal, and the result is a full production quality consumer product whose
+source is open for customization and porting.</p>
+<p>You can find more information about Android from these pages:</p>
+<ul>
+  <li><a href="{@docRoot}about/philosophy.html">Our Project Philosophy and Goals</a></li>
+  <li><a href="{@docRoot}source/index.html">Interacting with the Project</a></li>
+  <li><a href="{@docRoot}compatibility/index.html">Android Compatibility</a></li>
+  <li><a href="{@docRoot}source/licenses.html">Licensing Information</a></li>
+</ul>
diff --git a/pdk/docs/about/philosophy.jd b/pdk/docs/about/philosophy.jd
new file mode 100644
index 0000000..1aa1ccf
--- /dev/null
+++ b/pdk/docs/about/philosophy.jd
@@ -0,0 +1,73 @@
+page.title=Philosophy and Goals
+doc.type=about
+doc.hidenav=true
+@jd:body
+<p>Android is an open-source software stack for mobile phones and similar
+devices.</p>
+<h2>Origin and Goal</h2>
+<p>Android was originated by a group of companies known as the Open Handset
+Alliance, led by Google. Today, many companies -- both original members of the
+OHA and others -- have invested heavily in Android, typically in the form of
+allocating significant engineering resources to improve Android and bring
+Android devices to Market.</p>
+<p>We created Android in response to our own experiences launching mobile
+apps. We wanted to make sure that there would always be an open platform
+available for carriers, OEMs, and developers to use to make their innovative
+ideas a reality. We wanted to make sure that there was no central point of
+failure, where one industry player could restrict or control the innovations
+of any other. The solution we chose was an open and open-source platform.</p>
+<p>But the ultimate goal, of course, is to improve the mobile experience for
+real users by facilitating innovation. Accordingly, the primary goal of the
+AOSP is to make sure Android is a success as an end user product.</p>
+<h2>Governance Philosophy</h2>
+<p>The companies that have invested in Android have done so on its merits,
+because we collectively believe that an open platform is necessary. Android is
+intentionally and explicitly an open-source -- as opposed to free software --
+effort: a group of organizations with shared needs has pooled
+resources to collaborate on a single implementation of a shared product. 
+The Android philosophy is pragmatic, first and foremost. The objective is
+a shared product that each contributor can tailor and customize.</p>
+<p>Uncontrolled customization can, of course, lead to incompatible
+implementations. To prevent this, the AOSP also maintains the Android
+Compatibility Program, which spells out what it means to be "Android
+compatible", and what is required of device builders to achieve that status.
+Anyone can (and will!) use the Android source code for any purpose, and we
+welcome all such uses. However, in order to take part in the shared
+ecosystem of applications that we are building around Android, device builders
+can take advantage of the Compatibility Program.</p>
+<p>Though Android consists of multiple sub-projects, this is strictly a
+project-management technique. We view and manage Android as a single,
+holistic software product, not a "distribution", specification, or collection
+of replaceable parts. Conceptually, our notion is that device builders port
+Android to a device; they don't implement a specification or curate a
+distribution.</p>
+<h2>How We Work</h2>
+<p>We know that quality does not come without hard work. Along with many
+partners, Google has contributed full-time engineers, product managers, UI
+designers, Quality Assurance, and all the other roles required to bring
+modern devices to market.  We integrate the open source administration and
+maintenance into the larger product development cycle.</p>
+<p>In a nutshell:</p>
+<ul>
+<li>At any given moment, there is a current latest release of the Android
+platform. This typically takes the form of a branch in the tree.</li>
+<li>Device builders and Contributors work with the current
+latest release, fixing bugs, launching new devices, experimenting with new
+features, and so on.</li>
+<li>In parallel, Google works internally on the next version of the
+Android platform and framework, working according to the product's needs and
+goals. Some of the work from the current latest tree will promoted into these
+releases.</li>
+<li>When the "n+1"th version is determined to be nearing completion, it will
+be published to the public source tree, and become the new latest
+release.</li>
+<li>Since Android is open source, nothing prevents device implementers from
+shipping devices on older (obsolete) Android builds. However, active work will
+be focused on the current platform release.</li>
+</ul>
+<p>To meet our goals, Android needs to achieve widespread, compatible
+adoption. We believe that the best way to accomplish that is to make sure that
+we ship high-quality, flagship devices with an intense product and end-user
+focus. The "next release" of Android is driven by the product needs for the next
+generation of mobile devices; the resulting excellent product is then released
+to open source and becomes the new current version of the platform.</p>
diff --git a/pdk/docs/community/community_toc.cs b/pdk/docs/community/community_toc.cs
new file mode 100644
index 0000000..431aae0
--- /dev/null
+++ b/pdk/docs/community/community_toc.cs
@@ -0,0 +1,24 @@
+<script type="text/javascript" language="JavaScript">
+<!--
+function nothing() {}
+-->
+</script>
+<ul>
+  <li><h2>Discussion Groups</h2><ul>
+    <li><a href="http://groups.google.com/group/android-platform">android-platform</a> <span style="font-size: 75%; font-variant: small-caps">[off-site]</span></li>
+    <li><a href="http://groups.google.com/group/android-porting">android-porting</a> <span style="font-size: 75%; font-variant: small-caps">[off-site]</span></li>
+    <li><a href="http://groups.google.com/group/android-kernel">android-kernel</a> <span style="font-size: 75%; font-variant: small-caps">[off-site]</span></li>
+    <li><a href="http://groups.google.com/group/repo-discuss">repo-discuss</a> <span style="font-size: 75%; font-variant: small-caps">[off-site]</span></li>
+    <li><a href="http://groups.google.com/group/android-framework">android-framework</a> <span style="font-size: 75%; font-variant: small-caps">[off-site]</span></li>
+  </ul></li>
+  <li><h2>Other Links</h2><ul>
+    <li><a href="<?cs var:toroot ?>community/groups-charter.html">Groups Charter</a></li>
+    <li><a href="http://developer.android.com/community/index.html">App Developer Groups</a> <span style="font-size: 75%; font-variant: small-caps">[off-site]</span></li>
+  </ul></li>
+</ul>
+<script type="text/javascript">
+<!--
+    buildToggleLists();
+//-->
+</script>
+
diff --git a/pdk/docs/community/groups-charter.jd b/pdk/docs/community/groups-charter.jd
new file mode 100644
index 0000000..6d5b501
--- /dev/null
+++ b/pdk/docs/community/groups-charter.jd
@@ -0,0 +1,31 @@
+page.title=Android Discussion Groups Charter
+doc.type=community
+@jd:body
+<h2>
+Audience
+</h2>
+<p>These discussion groups are intended for developers working with the Android platform. Everyone is welcome to join in, provided you follow our community's policies described below. Our users help each other, and many experts post to these groups, including members of the Open Handset Alliance.
+</p>
+<p>No topic is off-limits, provided it relates to Android in some way. However, since these are very busy lists, search the archives before posting your question; you may find your question has already been answered.
+</p>
+<h2>
+Mailing list rules
+</h2>
+<p>We love simplicity and hate restrictions, so we keep our policies minimal. The rules below describe what's expected of subscribers to the Android mailing lists.
+</p>
+<ul><li><b>Please be friendly</b>
+<br>Showing courtesy and respect to others is a vital part of the Android culture, and we expect everyone participating in the Android community to join us in accepting nothing less. Being courteous does not mean we can't constructively disagree with each other, but it does mean that we must be polite when we do so. There's never a reason to be antagonistic or dismissive toward anyone; if you think there is, think again before you post.<br><br>Mobile development is serious business, but it's also a lot of fun. Let's keep it that way. Let's strive to be one of the friendliest communities in all of open source.<br><br></li>
+<li><b>Allowed discussion topics</b>
+<br>Most topics are technical discussions of Android or users helping each other, but this group is intended for discussions of<i>everything</i>
+in the world of Android. We welcome announcements and discussion of products, libraries, publications, and other interesting Android-related news. We even welcome (polite!) discussion of articles and ideas critical of Android--after all, we can't improve if we don't listen. There are no restrictions on the subject matter, and we don't exclude discussions of commercial products if users are interested in talking about them.<br><br>However, we hate spam almost as passionately as we love courtesy and respect, so we reserve the right to limit discussions that amount to spam. Outright spam will result in the spammer being immediately and permanently banned from the list.
+</li>
+</ul>
+<p>The most important rule is friendliness. Remember: disrespect and rudeness are not welcome in our community under any circumstances. We don't have a formal policy on dealing with troublemakers, and we hope we never need one.That said, we do pledge to do our best to be fair, and we will always try to warn someone before banning him or her.
+</p>
+<h2>
+Contacting the moderators
+</h2>
+<p>If you see anyone being rude, call them out on it. This is your group too, and you don't have to accept someone else being disrespectful just because it wasn't directed at you. Just remember to be polite and courteous yourself! Don't add fuel to the fire.
+</p>
+<p>But if you see an outrageous violation, want to report spam, feel very strongly about something, or even if you just want to chat, then contact the mailing list's owners. It's what we're here for!
+</p>
diff --git a/pdk/docs/community/index.jd b/pdk/docs/community/index.jd
index bc04eee..6e6f59e 100644
--- a/pdk/docs/community/index.jd
+++ b/pdk/docs/community/index.jd
@@ -1,6 +1,114 @@
-home=true
+page.title=Community
+doc.type=community
 @jd:body
+<h1>Android Community</h1>
+<p>Welcome to the Android community!</p>
+<p>The key to any community is, obviously, communication. Like most projects,
+Android communicates via mailing lists. Because Android is an extremely large
+project with many components, we have many discussion forums, each focusing on
+a different topic.</p>
+<p>Please check out the groups below, and join any that seem interesting to
+you. Note that if you're a user looking for help with your Android device,
+this page probably isn't for you; you should contact your carrier or retailer
+for help with your phone.</p>
+<p>Please note that if you're looking for information about building
+applications for Android, you can find a separate set of groups for those at
+our sister site, developer.android.com: <a
+href="http://developer.android.com/community/index.html">http://developer.android.com/community/index.html</a></p>
 
-<p>
-  Some community information here
-</p>
+<h2>Getting the Most from Our Lists</h2>
+<p>Please consider the following before you post to our lists.</p>
+<ol>
+  <li><b>Read the <a
+  href="{@docRoot}community/groups-charter.html">Charter
+  for our forums.</a></b> This explains the (few) rules and guidelines for our
+  community.<br></li>
+  <li><b>Search the group archives to see whether your questions have already
+  been discussed.</b></li> This avoids time-wasting redundant discussions.
+  <li><b>Use a clear, relevant message subject.</b> This helps everyone,
+  both those trying to answer your question as well as those who may be
+  looking for information in the future.</li>
+  <li><b>Give plenty of details in your post.</b> Code or log snippets,
+  pointers to screenshots, and similar details will get better results and
+  make for better discussions. For a great guide to phrasing your questions,
+  read <a href="http://www.catb.org/%7Eesr/faqs/smart-questions.html">How To
+  Ask Questions The Smart Way</a>.</li>
+</ol>
+
+<h2>Open Source Project discussions</h2>
+<ul>
+<li><b>android-building</b><br/>
+Subscribe to this list for discussion and help on building the Android source
+code, and on the build system. If you've just checked out the source code and
+have questions about how to turn it into binaries, start here.<br/><br/>
+Subscribe using Google Groups: <a
+href="http://groups.google.com/group/android-building">android-building</a><br/>
+Subscribe via email: <a href="mailto:android-building+subscribe@googlegroups.com">android-building+subscribe@googlegroups.com</a>
+</li>
+
+<li><b>android-porting</b><br/>
+This list is for developers who want to port Android to a new device. If
+you're wondering how to combine the Android source code with your hardware,
+this is the right group for you. Discuss here the specifics of porting Android
+to individual devices, from obtaining toolchains and merging kernel drivers
+all the way to configuring or modifying applications for your specific
+configuration.<br/><br/>
+Subscribe using Google Groups: <a
+href="http://groups.google.com/group/android-porting">android-porting</a><br/>
+Subscribe via email: <a href="mailto:android-porting+subscribe@googlegroups.com">android-porting+subscribe@googlegroups.com</a>
+</li>
+
+<li><b>android-platform</b><br/>
+This list is for developers who want to contribute code to the Android
+user-space projects, such as the core system libraries, the Android
+services, the public APIs, or the built-in applications. Note: contributors
+to the Android kernel should go to the android-kernel list, below.<br/><br/>
+Subscribe using Google Groups: <a
+href="http://groups.google.com/group/android-platform">android-platform</a><br/>
+Subscribe via email: <a href="mailto:android-platform+subscribe@googlegroups.com">android-platform+subscribe@googlegroups.com</a>
+</li>
+
+<li><b>android-kernel</b><br/>
+This list is for deveopers who want to contribute to the Linux kernel that
+Android devices use. If you've downloaded the kernel code, if you know how to
+compile it, if you want to write kernel code to specifically support Android,
+this is your place. This group isn't for user-space topics (see
+android-platform for that), and people will shake their fingers at you and
+call you naughty if you ask user-space questions here.<br/><br/>
+Subscribe using Google Groups: <a
+href="http://groups.google.com/group/android-kernel">android-kernel</a><br/>
+Subscribe via email: <a href="mailto:android-kernel+subscribe@googlegroups.com">android-kernel+subscribe@googlegroups.com</a>
+</li>
+</ul>
+
+<h2>Using email with Google Groups</h2>
+<p>Instead of using the <a href="http://groups.google.com/">Google Groups</a>
+site, you can use your email client of choice to participate in the mailing lists.</p>
+<p>To subscribe to a group without using the Google Groups site, use the link
+under "subscribe via email" in the lists above.</p>
+<p>To set up how you receive mailing list postings by email:</p>
+<ol>
+<li>Sign into the group via the Google Groups site. For example, for the android-framework group you would
+visit <a
+href="http://groups.google.com/group/android-framework">http://groups.google.com/group/android-framework</a>.</li>
+<li>Click "Edit my membership" on the right side.</li>
+<li>Under "How do you want to read this group?" select one of the email options.</li>
+</ol>
+
+<h2>Android on IRC</h2>
+<p>We also have a presence on IRC via Freenode. We maintain two official IRC
+channels on irc.freenode.net:</p>
+<ul>
+<li><b>#android</b> - dedicated to general Android discussion and porting concerns</li>
+<li><b>#android-dev</b> - dedicated to discussion about writing Android applications</li>
+</ul>
+<p>The channels above are official. There are a few other channels the
+community is using, but are not official. These aren't official or officially
+moderated/managed, so you use the channels below at your own risk. The Open
+Handset Alliance doesn't endorse these channels, there's no warranty express
+or implied, and so on. There may be more.</p>
+<ul>
+<li><b>#android-offtopic</b> - for, well, off-topic discussions</li>
+<li><b>#android-root</b> - for discussion related to off-label uses of hardware</li>
+<li><b>#androidfra</b> - pour discuter d'Android en français</li>
+</ul>
diff --git a/pdk/docs/compatibility/compatibility_toc.cs b/pdk/docs/compatibility/compatibility_toc.cs
new file mode 100644
index 0000000..5688d14
--- /dev/null
+++ b/pdk/docs/compatibility/compatibility_toc.cs
@@ -0,0 +1,25 @@
+<script type="text/javascript" language="JavaScript">
+<!--
+function nothing() {}
+-->
+</script>
+
+<ul>
+  <li><h2>Getting Started</h2><ul>
+    <li><a href="<?cs var:toroot ?>compatibility/overview.html">Compatibility Overview</a></li>
+    <li><a href="">Current CDD</a></li>
+    <li><a href="<?cs var:toroot ?>compatibility/cts-intro.html">CTS Introduction</a></li>
+  </ul></li>
+
+  <li><h2>More Information</h2><ul>
+    <li><a href="<?cs var:toroot ?>downloads/index.html">Downloads</a></li>
+    <li><a href="<?cs var:toroot ?>faqs.html#compatibility">FAQs</a></li>
+    <li><a href="<?cs var:toroot ?>compatibility/contact-us.html">Contact Us</a></li>
+  </ul></li>
+</ul>
+
+<script type="text/javascript">
+<!--
+    buildToggleLists();
+//-->
+</script>
diff --git a/pdk/docs/compatibility/contact-us.jd b/pdk/docs/compatibility/contact-us.jd
new file mode 100644
index 0000000..ba4e887
--- /dev/null
+++ b/pdk/docs/compatibility/contact-us.jd
@@ -0,0 +1,31 @@
+page.title=Contact Us
+doc.type=compatibility
+@jd:body
+<p>Thanks for your interest in Android compatibility!</p>
+<p>If you have questions about Android compatibility that aren't covered in
+this site, you can reach us in one of a few different ways. To get the most
+out of any of these options, please first read "Getting the Most from Our
+Lists" on the <a href="{@docRoot}community/index.html">Community page.</a></p>
+
+<h3>Discussion Group</h3>
+<p>The preferred way to reach us is via the <a
+href="http://groups.google.com/group/android-compatibility">android-compatibility
+mailing list</a>. Use this list for all your compatibility-related questions.
+Please be aware that this is a public forum.</p>
+
+<h3>CTS Technical Questions</h3>
+<p>If you have specific issues with the Compatibility Test Suite that require
+you to disclose information you'd prefer not to be public, you can contact an
+email address we've set up specifically this purpose: <a
+href="mailto:cts@android.com">cts@android.com</a>. This email address is for
+cases that require disclosure of confidential information only, so general
+questions will be directed back to the public android-compatibility
+list. Note also that this list is for specific technical questions; general
+inquiries will also be directed back to the android-compatibility list.</p>
+
+<h3>Private Inquiries</h3>
+<p>Finally, business inquiries about the compatibility program, including
+requests to use branding elements and so on, can be sent to the address <a
+href="mailto:compatibility@android.com">compatibility@android.com</a>. Like
+the CTS address, this address is for specific, private inquiries; general
+questions will be directed back to the android-compatibility list.</p>
diff --git a/pdk/docs/compatibility/cts-intro.jd b/pdk/docs/compatibility/cts-intro.jd
new file mode 100644
index 0000000..f1d2359
--- /dev/null
+++ b/pdk/docs/compatibility/cts-intro.jd
@@ -0,0 +1,89 @@
+page.title=Compatibility Test Suite
+doc.type=compatibility
+@jd:body
+<h3>How does the CTS work?</h3>
+<div><img src="{@docRoot}images/cts-0.png"></div>
+<div>The CTS is an automated testing harness that includes two major software components:</div>
+<ul>
+<li>The CTS test harness runs on your desktop machine and manages test execution.</li>
+<li>Individual test cases are executed on attached mobile devices or on an
+emulator. The test cases are written in Java as JUnit tests and packaged as
+Android .apk files to run on the actual device target.</li>
+</ul>
+
+<h3>Workflow</h3>
+<ol>
+<li>Obtain the CTS source code. The CTS is included in the Android source code available from the Android
+Open Source Project. (To get a copy of that source code, <a
+href="{@docRoot}source/download.html">read this page.</a></li>
+<li>Attach at least one device (or emulator) to your machine.</li>
+<li>Launch the CTS. The CTS test harness loads the test plan onto the attached devices. For each test in the test harness:
+    <ul>
+    <li>The test harness pushes a .apk file to each device, executes the test through instrumentation, and records test results.</li>
+    <li>The test harness removes the .apk file from each device.</li>
+    </ul>
+</li>
+<li>Once all the tests are executed, you can view the test results in your browser and use the results to adjust your design. You can continue to run the CTS throughout your development process.</li>
+</ol>
+<div>When you are ready, you can submit the report generated by the CTS to cts@android.com. The report is a .zip archived file that contains XML results and supplemental information such as screen captures.</div>
+
+<h3>Types of test cases</h3>
+The CTS includes the following types of test cases:
+<ul>
+<li><i>Unit tests</i> test atomic units of code within the Android platform; e.g. a single class, such as java.util.HashMap.</li>
+<li><i>Functional tests</i> test a combination of APIs together in a higher-level use-case.</li>
+<li><i>Reference application tests</i> instrument a complete sample application to exercise a full set of APIs and Android runtime services</li>
+</ul>
+<div>Future versions of the CTS will include the following types of test cases:</div>
+<ul>
+<li><i>Robustness tests</i> test the durability of the system under stress.</li>
+<li><i>Performance tests</i> test the performance of the system against defined benchmarks, for example rendering frames per second.</li>
+</ul>
+
+<h3>Areas Covered</h3>
+The unit test cases cover the following areas to ensure compatibility <br>
+<table><tbody>
+<tr><td>Area</td><td>Description <br></td></tr>
+<tr><td>Signature tests</td>
+<td>For each Android release, there are XML files describing the signatures of all public APIs contained in the release. The CTS contains a utility to check those API signatures against the APIs available on the device. The results from signature checking are recorded in the test result XML file.
+</td>
+</tr>
+<tr><td>Platform API Tests</td>
+<td>Test the platform (core libraries and Android Application Framework) APIs as documented in the SDK <a href="http://code.google.com/android/reference/classes.html">Class Index</a>
+to ensure API correctness:
+<ul>
+<li>correct class, attribute and method signatures</li>
+<li>correct method behavior</li>
+<li>negative tests to ensure expected behavior for incorrect parameter handling</li>
+</ul>
+</td></tr>
+<tr><td>Dalvik VM Tests</td><td>The tests focus on testing the Dalvik VM</td></tr>
+<tr><td>Platform Data Model</td>
+<td>The CTS tests the core platform data model as exposed to application developers through content providers, as documented in the SDK <a href="http://code.google.com/android/reference/android/provider/package-summary.html">android.provider</a>
+package:
+<ul>
+<li>contacts</li>
+<li>browser</li>
+<li>settings</li>
+<li>more...</li>
+</ul>
+</td></tr>
+<tr><td>Platform Intents</td>
+<td>The CTS tests the core platform intents, as documented in the SDK <a href="http://code.google.com/android/reference/available-intents.html">Available Intents</a>.</td>
+</tr>
+<tr><td>Platform Permissions</td>
+<td>The CTS tests the core platform permissions, as documented in the SDK <a href="http://code.google.com/android/reference/android/Manifest.permission.html">Available Permissions</a>.</td>
+</tr>
+<tr><td>Platform Resources <br></td>
+<td>The CTS tests for correct handling of the core platform resource types, as documented in the SDK <a href="http://code.google.com/android/reference/available-resources.html">Available Resource Types</a>
+. This includes tests for:
+<ul>
+<li>simple values</li>
+<li>drawables</li>
+<li>nine-patch</li>
+<li>animations</li>
+<li>layouts</li>
+<li>styles and themes</li>
+<li>loading alternate resources</li>
+</ul></td></tr>
+</tbody></table>
diff --git a/pdk/docs/compatibility/index.jd b/pdk/docs/compatibility/index.jd
new file mode 100644
index 0000000..0c39a98
--- /dev/null
+++ b/pdk/docs/compatibility/index.jd
@@ -0,0 +1,67 @@
+page.title=Android Compatibility
+doc.type=compatibility
+@jd:body
+<p>Android is an open source product, and anyone can use the source code to build
+devices. The purpose of the Android compatibility program is to help Android
+device implementations remain compatible with all apps.</p>
+<p>A device is considered compatible if existing and new third-party
+applications run correctly on it. Poor device implementations that change APIs
+or alter behaviors will break these apps and so are not compatible. The
+Android compatibility program's aim is to ensure that these APIs are
+consistently implemented across devices.</p>
+<p>The latest version of the Android source code and compatibility program is
+1.6, which roughly corresponded to the Donut branch.  The compatibility
+program for Android 2.x (corresponding to Eclair) is coming soon.</p>
+<h2>Why build compatible Android devices?</h2>
+<h3>Users want a customizable device.</h3>
+<p>A mobile phone is a highly personal, always-on, always-present gateway to
+the Internet. We haven't met a user yet who didn't want to customize it by
+extending its functionality. That's why Android was designed as a robust
+platform for running after-market applications.</p>
+
+<h3>Developers outnumber us all.</h3>
+<p>No device manufacturer can hope to write all the software that anyone could
+conceivably need. We need third-party developers to write the apps users want,
+so the Android Open Source Project aims to make it as easy and open as
+possible for developers to build apps.</p>
+
+<h3>Everyone needs a common ecosystem.</h3>
+<p>Every line of code developers write to work around a particular phone's bug
+is a line of code that didn't add a new feature. The more compatible phones
+there are, the more apps there will be. By building a fully compatible Android
+device, you benefit from the huge pool of apps written for Android, while
+increasing the incentive for developers to build more of those apps.</p>
+
+
+<h2>Android compatibility is free, and it's easy.</h2>
+<p>If you are building a mobile device, you can follow these steps to make
+sure your device is compatible with Android. For more details about the
+Android compatibility program in general, see <a
+href="{@docRoot}compatibility/overview.html">the program overview</a>.</p>
+<p>Building a compatible device is a four-step process:</p>
+<ol>
+  <li><b>Obtain the Android software stack source code</b><p>This is the
+  <a href="{@docRoot}source/index.html">source code for the Android
+  platform</a>, that you port to your hardware.</p></li>
+  <li><b>Comply with Android Compatibility Definition Document</b><p>
+  This document enumerates the software and the hardware features of
+  a compatible Android device.</p></li>
+  <li><b>Pass the Compatibility Test Suite (CTS)</b><p>You can use the CTS
+  (included in the Android source code) as an ongoing aid to compatibility
+  during the development process.</p></li>
+  <li><b>Submit CTS report</b><p>[Optional] You can also submit your CTS report,
+  so that it can be validated and recorded.</p><p><i>Note:
+  the submission system is currently under construciton, and is not currently
+  available.</i></p></li>
+</ol>
+
+<h2>Benefits of compatibility</h2>
+<p>By submitting a validated CTS report, you receive public recognition of
+your device's compatibility. This also opens up additional options you can
+pursue such as use of the Android branding, access to Android Market, and
+more.</p>
+<p>As a consequence of some legal quirks, we aren't able to offer automatic
+licensing of either the Android Market or branding. To actually obtain access
+to these programs, you will need to <a
+href="{@docRoot}compatibility/contact-us.html">contact us</a> to obtain a
+license.</p>
diff --git a/pdk/docs/compatibility/overview.jd b/pdk/docs/compatibility/overview.jd
new file mode 100644
index 0000000..039e2c2
--- /dev/null
+++ b/pdk/docs/compatibility/overview.jd
@@ -0,0 +1,88 @@
+page.title=Compatibility Program Overview
+doc.type=compatibility
+@jd:body
+<p>The Android compatibility program makes it easy for mobile device
+manufacturers to develop compatible Android devices.</p>
+<h3>Program goals</h3>
+<p>The Android compatibility program works for the benefit of the entire
+Android community, including users, developers, and device manufacturers.</p>
+<p>Each group depends on the others. Users want a wide selection of devices
+and great apps; great apps come from developers motivated by a large market
+for their apps with many devices in users' hands; device manufacturers rely
+on a wide variety of great apps to increase their products' value for
+consumers.</p>
+<p>Our goals were designed to benefit each of these groups:</p>
+<ul>
+<li><b>Provide a consistent application and hardware environment to application
+developers.</b><p>Without a strong compatibility standard, devices can vary so
+greatly that developers must design different versions of their applications
+for different devices. The compatibility program provides a precise definition
+of what developers can expect from a compatible device in terms of APIs and
+capabilities. Developers can use this information to make good design
+decisions, and be confident that their apps will run well on any compatible
+device.</p></li>
+<li><b>Enable a consistent application experience for consumers.</b><p>If an
+application runs well on one compatible Android device, it should run well on
+any other device that is compatible with the same Android platform version.
+Android devices will differ in hardware and software capabilities, so the
+compatibility program also provides the tools needed for distribution systems
+such as Android Market to implement appropriate filtering. This means that
+users can only see applications which they can actually run.</p></li>
+<li><b>Enable device manufacturers to differentiate while being
+compatible.</b><p>The Android compatibility program focuses on the aspects of
+Android relevant to running third-party applications, which allows device
+manufacturers the flexibility to create unique devices that are nonetheless
+compatible.</p></li>
+<li><b>Minimize costs and overhead associated with
+compatibility.</b><p>Ensuring compatibility should be easy and inexpensive to
+device manufacturers. The testing tool (CTS) is free and will soon be available
+in open source. CTS is designed to be used for continuous self-testing during
+the device development process to eliminate the cost of changing your workflow
+or sending your device to a third party for testing. Meanwhile, there are no
+required certifications, and thus no corresponding costs and fees.</p></li>
+</ul>
+<p>The Android compatibility program consists of three key components:</p>
+<ul>
+<li>The source code to the Android software stack</li>
+<li>The Compatilbility Definition Document, representing the "policy"
+aspect of compatibility</li>
+<li>The Compatilbility Test Suite, representing the "mechanism" of compatibility</li>
+</ul>
+<p>Just as each version of the Android platform exists in a separate branch in
+the source code tree, there is a separate CTS and CDD for each version as
+well. The CDD, CTS, and source code are -- along with your hardware and your
+software customizations -- everything you need to create a compatible device.</p>
+
+<h3>Compatibility Definition Document (CDD)</h3>
+<p>For each release of the Android platform, a detailed Compatibility
+Definition Document (CDD) will be provided. The CDD represents the "policy"
+aspect of Android compatibility.</p>
+<p>No test suite, including CTS, can truly be comprehensive. For instance, the
+CTS includes a test that checks for the presence and correct behavior of
+OpenGL graphics APIs, but no software test can verify that the graphics
+actually appear correctly on the screen. More generally, it's impossible to
+test the presence of hardware features such as keyboards, display density,
+WiFi, and Bluetooth.</p>
+<p>The CDD's role is to codify and clarify specific requirements, and
+eliminate ambiguity.  The CDD does not attempt to be comprehensive. Since
+Android is a single corpus of open-source code, the code itself is the
+comprehensive "specification" of the platform and its APIs. The CDD acts as a
+"hub", referencing other content (such as SDK API documentation) that provides
+a framework in which the Android source code may be used so that the end
+result is a compatible system.</p>
+<p>If you want to build a device compatible with a given Android version,
+start by checking out the source code for that version, and then read the
+corresponding CDD and stay within its guidelines. For additional details,
+simply examine <a href="">the latest CDD</a>.</p>
+
+<h3>Compatibility Test Suite (CTS)</h3>
+<p>The CTS is a free, commercial-grade test suite, available along with the
+Android source code. The CTS represents the "mechanism" of compatibility.</p>
+<p>The CTS runs on a desktop machine and executes test cases directly on
+attached devices or an emulator. The CTS is a set of unit tests designed to be
+integrated into the daily workflow (such as via a continuous build system) of
+the engineers building a device. Its intent is to reveal incompatibilities
+early on, and ensure that the software remains compatible throughout the
+development process.</p>
+<p>For details on the CTS, consult the <a
+href="{@docRoot}compatibility/cts-intro.html">CTS introduction</a>.</p>
diff --git a/pdk/docs/downloads/downloads_toc.cs b/pdk/docs/downloads/downloads_toc.cs
new file mode 100644
index 0000000..28f43af
--- /dev/null
+++ b/pdk/docs/downloads/downloads_toc.cs
@@ -0,0 +1,21 @@
+<script type="text/javascript" language="JavaScript">
+<!--
+function nothing() {}
+-->
+</script>
+
+<ul>
+  <li><h2>PDK</h2><ul>
+    <li><a href="">PDK 1.6</a></li>
+  </ul></li>
+
+  <li><h2>Compatibility</h2><ul>
+    <li><a href="">Android 1.6</a></li>
+  </ul></li>
+</ul>
+
+<script type="text/javascript">
+<!--
+    buildToggleLists();
+//-->
+</script>
diff --git a/pdk/docs/downloads/index.jd b/pdk/docs/downloads/index.jd
new file mode 100644
index 0000000..b6f5a2f
--- /dev/null
+++ b/pdk/docs/downloads/index.jd
@@ -0,0 +1,44 @@
+page.title=Downloads
+doc.type=downloads
+doc.hidenav=true
+@jd:body
+<p>This page provides access to various downloads. Note that if you're looking
+for the Android SDK (for application developers), you should visit <a
+href="http://developer.android.com/sdk/index.html">developer.android.com</a>.</p>
+
+<h2>Compatibility</h2>
+<p>The Compatibility Definition Document can be downloaded below. The
+Compatibility Test Suite is available in the open-source tree.</p>
+<table class="download"> 
+  <tr> 
+      <th>Item</th> 
+      <th>File</th> 
+      <th>Size</th> 
+  </tr> 
+  <tr> 
+    <td>Android CDD 2.1</td> 
+    <td><a href="">android-cdd-2.1.pdf</a></td> 
+    <td>23070805 bytes</td> 
+  </tr> 
+  <tr class="alt-color"> 
+    <td>Android CTS 2.1 Manual</td> 
+    <td><a href="">android-cts-manual-2.1.0.pdf</a></td> 
+    <td>23070805 bytes</td> 
+  </tr> 
+  <tr> 
+    <td>Android CDD 1.6</td> 
+    <td><a href="">android-cdd-1.6.pdf</a></td> 
+    <td>23070805 bytes</td> 
+  </tr> 
+  <tr class="alt-color"> 
+    <td>Android CTS 1.6 Manual</td> 
+    <td><a href="">android-cts-manual-1.6.4.pdf</a></td> 
+    <td>23070805 bytes</td> 
+  </tr> 
+</table> 
+<p>For more information on how to build an Android-compatible device, see the
+<a href="{@docRoot}compatibility/index.html">Compatibility</a> page. Note that
+there is no compatibility program for Android 1.5 and earlier. Note also that
+there is no compatibility program for Android 2.0, since it was superceded by
+Android 2.1 after only a few weeks.
+</p>
diff --git a/pdk/docs/faqs.jd b/pdk/docs/faqs.jd
new file mode 100644
index 0000000..a55d380
--- /dev/null
+++ b/pdk/docs/faqs.jd
@@ -0,0 +1,325 @@
+page.title=Frequently Asked Questions
+doc.hidenav=true
+@jd:body
+<a name="aosp"></a><h2>Open Source</h2>
+<h3>What is the Android Open Source Project?</h3>
+<p>We use the phrase "Android Open Source Project" or "AOSP" to refer to the
+  people, the processes, and the source code that make up Android.</p>
+<p>The people oversee the project and develop the actual source code. The
+  processes refer to the tools and procedures we use to manage the development
+  of the software. The net result is the source code that you can use to build
+  cell phone and other devices.</p>
+
+<h3>Why did we open the Android source code?</h3>
+<p>Google started the Android project in response to our own experiences
+launching mobile apps. We wanted to make sure that there would always be an
+open platform available for carriers, OEMs, and developers to use to make
+their innovative ideas a reality. We also wanted to make sure that there was no
+central point of failure, so that no single industry player could restrict or control
+the innovations of any other.  The single most important goal of the Android
+Open-Source Project (AOSP) is to make sure that the open-source Android
+software is implemented as widely and compatibly as possible, to everyone's
+benefit.</p>
+<p>You can find more information on this topic at our Project Philosophy page.</p>
+
+<h3>What kind of open-source project is Android?</h3>
+<p>Google oversees the development of the core Android open-source platform,
+  and works to create robust developer and user communities. For the most part
+  the Android source code is licensed under the permissive Apache Software
+  License 2.0, rather than a "copyleft" license. The main reason for this is
+  because our most important goal is widespread adoption of the software, and
+  we believe that the ASL2.0 license best achieves that goal.</p>
+<p>You can find more information on this topic at our Project Philosophy and
+  Licensing pages. </p>
+
+<h3>Why is Google in charge of Android?</h3>
+<p>Launching a software platform is complex. Openness is vital to the
+  long-term success of a platform, since openness is required to attract
+  investment from developers and ensure a level playing field. However, the
+  platform itself must also be a compelling product to end users.</p>
+<p>That's why Google has committed the professional engineering resources
+  necessary to ensure that Android is a fully competitive software platform.
+  Google treats the Android project as a full-scale product development
+  operation, and strikes the business deals necessary to make sure that great
+  devices running Android actually make it to market.</p>
+<p>By making sure that Android is a success with end users, we help ensure the
+  vitality of Android as a platform, and as an open-source project. After all,
+  who wants the source code to an unsuccessful product?</p>
+<p>Google's goal is to ensure a successful ecosystem around Android, but no
+  one is required to participate, of course. We opened the Android source code
+  so anyone can modify and distribute the software to meet their own needs.</p>
+
+<h3>What is Google's overall strategy for Android product development?</h3>
+<p>We focus on releasing great devices into a competitive marketplace, and
+  then incorporate the innovations and enhancements we made into the core
+  platform, as the next version.</p>
+<p>In practice, this means that the Android engineering team typically focuses
+  on a small number of "flagship" devices, and develops the next version of
+  the Android software to support those product launches. These flagship
+  devices absorb much of the product risk and blaze a trail for the broad OEM
+  community, who follow up with many more devices that take advantage of the
+  new features. In this way, we make sure that the Android platform evolves
+  according to the actual needs of real-world devices.</p>
+
+<h3>How is the Android software developed?</h3>
+<p>Each platform version of Android (such as 1.5, 1.6, and so on) has a
+  corresponding branch in the open-source tree. At any given moment, the most
+  recent such branch will be considered the "current stable" branch version.
+  This current stable branch is the one that manufacturers port to their
+  devices. This branch is kept suitable for release at all times.</p>
+<p>Simultaneously, there is also a "current experimental" branch, which is
+  where speculative contributions, such as large next-generation features, are
+  developed. Bug fixes and other contributions can be included in the current
+  stable branch from the experimental branch as appropriate.</p>
+<p>Finally, Google works on the next version of the Android platform in tandem
+  with developing a flagship device. This branch pulls in changes from the
+  experimental and stable branches as appropriate.</p>
+<p>You can find more information on this topic at our Branches Releases
+  page.</p>
+
+<h3>Why are parts of Android developed in private?</h3>
+<p>It typically takes over a year to bring a device to market, but of course
+  device manufacturers want to ship the latest software they can. Developers,
+  meanwhile, don't want to have to constantly track new versions of the
+  platform when writing apps. Both groups experience a tension between
+  shipping products, and not wanting to fall behind.</p>
+<p>To address this, some parts of the next version of Android including the
+  core platform APIs are developed in a private branch. These APIs constitute
+  the next version of Android. Our aim is to focus attention on the current
+  stable version of the Android source code, while we refine the next version
+  of the platform using the flagship Android devices. This allows developers
+  and OEMs to focus on a single version without having to track unfinished
+  future work just to keep up.Other parts of the Android system that aren't
+  related to application compatibility are developed in the open, however.
+  It's our intention to move more of these parts to open development over
+  time.</p>
+
+<h3>When are source code releases made?</h3>
+<p>When they are ready. Some parts of Android are developed in the open, and
+  so that source code is always available. Other parts are developed first in
+  a private tree, and that source code is released when the next platform
+  version is ready.</p>
+<p>In some releases, core platform APIs will be ready far enough in advance
+  that we can push the source code out for an early look in advance of the
+  device's release; however in others, this isn't possible. In all cases, we
+  release the platform source when we feel the version has stabilized enough,
+  and when the development process permits. Releasing the source code is a
+  fairly complex process.</p>
+
+<h3>What is involved in releasing the source code for a new Android version?</h3>
+<p>Releasing the source code for a new version of the Android platform is a
+  significant process. First, the software gets built into a system image for
+  a device, and put through various forms of certification, including
+  government regulatory certification for the regions the phones will be
+  deployed. It also goes through operator testing. This is an important phase
+  of the process, since it helps shake out a lot of software bugs.</p>
+<p>Once the release is approved by the regulators and operators, the
+  manufacturer begins mass producing devices, and we turn to releasing the
+  source code.</p>
+<p>Simultaneous to mass production the Google team kicks off several efforts
+  to prepare the open source release. These efforts include final API changes
+  and documentation (to reflect any changes that were made during
+  qualification testing, for example), preparing an SDK for the new version,
+  and launching the platform compatibility information.</p>
+<p>Also included is a final legal sign-off to release the code into open
+  source. Just as open source contributors are required to sign a Contributors
+  License Agreement attesting to their IP ownership of their contribution,
+  Google too must verify that it is clear to make contributions.</p>
+<p>Starting at the time mass production begins, the software release process
+  usually takes around a month, which often roughly places source code
+  releases around the same time that the devices reach users.</p>
+
+<h3>How does the AOSP relate to the Android Compatibility Program?</h3>
+<p>The Android Open-Source Project maintains the Android software, and
+  develops new versions. Since it's open-source, this software can be used for
+  any purpose, including to ship devices that are not compatible with other
+  devices based on the same source.</p>
+<p>The function of the Android Compatibility Program is to define a baseline
+  implementation of Android that is compatible with third-party apps written
+  by developers. Devices that are "Android compatible" may participate in the
+  Android ecosystem, including Android Market; devices that don't meet the
+  compatibility requirements exist outside that ecosystem.</p>
+<p>In other words, the Android Compatibility Program is how we separate
+  "Android compatible devices" from devices that merely run derivatives of the
+  source code. We welcome all uses of the Android source code, but only
+  Android compatible devices -- as defined and tested by the Android
+  Compatibility Program -- may call themselves "Android" and participate in
+  the Android ecosystem.</p>
+
+<h3>How can I contribute to Android?</h3>
+<p>There are a number of ways you can contribute to Android. You can report
+  bugs, write apps for Android, or contribute source code to the Android
+  Open-Source Project.</p>
+<p>There are some limits on the kinds of code contributions we are willing or
+  able to accept. For instance, someone might want to contribute an
+  alternative application API, such as a full C++-based environment. We would
+  decline that contribution, since Android is focused on applications that run
+  in the Dalvik VM. Alternatively, we won't accept contributions such as GPL
+  or LGPL libraries that are incompatible with our licensing goals.</p>
+<p>We encourage those interested in contributing source code to contact us via
+  the AOSP Community page prior to beginning any work. You can find more
+  information on this topic at the Getting Involved page.</p>
+
+<h3>How do I become an Android committer?</h3>
+<p>The Android Open Source Project doesn't really have a notion of a
+  "committer". All contributions -- including those authored by Google
+  employees -- go through a web-based system known as "gerrit" that's part of
+  the Android engineering process. This system works in tandem with the git
+  source code management system to cleanly manage source code
+  contributions.</p>
+<p>Once submitted, changes need to be accepted by a designated Approver.
+  Approvers are typically Google employees, but the same approvers are
+  responsible for all submissions, regardless of origin.</p>
+<p>You can find more information on this topic at the Submitting Patches
+  page.</p>
+
+<a name="compatibility"></a><h2>Compatibility</h2>
+<h3>What does "compatibility" mean?</h3>
+<p>We define an "Android compatible" device as one that can run any
+  application written by third-party developers using the Android SDK and NDK.
+  We use this as a filter to separate devices that can participate in the
+  Android app ecosystem, and those that cannot. Devices that are properly
+  compatible can seek approval to use the Android trademark. Devices that are
+  not compatible are merely derived from the Android source code and may not
+  use the Android trademark.</p>
+<p>In other words, compatibility is a prerequisite to participate in the
+  Android apps ecosystem. Anyone is welcome to use the Android source code,
+  but if the device isn't compatible, it's not considered part of the Android
+  ecosystem, and irrelevant to developers.</p>
+
+<h3>What is the role of Android Market in compatibility?</h3>
+<p>Devices that are Android compatible may seek to license the Android Market
+  client software. This allows them to become part of the Android app
+  ecosystem, by allowing users to download developers' apps from a catalog
+  shared by all compatible devices. This option isn't available to devices
+  that aren't compatible.</p>
+
+<h3>What kinds of devices can be Android compatible?</h3>
+<p>The Android software can be ported to a lot of different kinds of devices,
+  including some on which third-party apps won't run properly. The Android
+  Compatibility Definition Document (CDD) spells out the specific device
+  configurations that will be considered compatible.</p>
+<p>For example, though the Android source code could be ported to run on a
+  device that doesn't have a camera, the CDD requires that in order to be
+  compatible, all devices must have a camera. This allows developers to rely
+  on a consistent set of device capabilities when writing their apps.</p>
+<p>The CDD will evolve over time to reflect market realities. For instance,
+  the 1.6 CDD only allows cell phones, but the 2.x CDD allows devices to omit
+  telephony hardware, allowing for non-phone devices such as tablet-style
+  music players to be compatible. As we make these changes, we will also
+  augment Android Market to allow developers to retain control over where
+  their apps are available. To continue the telephony example, an app that
+  manages SMS text messages would not be useful on a media player, so Android
+  Market allows the developer to restrict that app exclusively to phone
+  devices.</p>
+
+<h3>If my device is compatible, does it automatically have access to Android Market and branding?</h3>
+<p>Android Market is a service operated by Google. For legal and business
+  reasons, Google isn't able to make that service available in all parts of
+  the world. Similarly, Google is unable to license the Android trademark for
+  use in all cases.</p>
+<p>As a result, achieving compatibility does not automatically entitle a
+  device to include Android Market or use the Android name. Device
+  manufacturers should contact Google to obtain access to those tools.</p>
+
+<h3>If I am not a manufacturer, how can I get Android Market?</h3>
+<p>Android Market is only licensed to handset manufacturers shipping devices.
+  For questions about specific cases, contact
+  android-partnerships@google.com.</p>
+
+<h3>How can I get access to the Google apps for Android, such as Maps?</h3>
+<p>The Google apps for Android, such as YouTube, Google Maps and Navigation,
+  Gmail, and so on are not part of Android, and are licensed separately.
+  Contact android-partnerships@google.com for inquiries related to those
+  apps.</p>
+
+<h3>Is compatibility mandatory?</h3>
+<p>No. The Android Compatibility Program is optional. Since the Android source
+  code is open, anyone can use it to build any kind of device. However, if a
+  manufacturer wishes to use the Android name with their product, or wants
+  access to Android Market, they must first demonstrate that the device is
+  compatible.</p>
+
+<h3>How much does compatibility certification cost?</h3>
+<p>There is no cost to obtain Android compatibility for a device. The
+  Compatibility Test Suite is open-source and available to anyone to use to
+  test a device.</p>
+
+<h3>How long does compatibility take?</h3>
+<p>The process is automatic. The Compatibility Test Suite generates a report
+  that can be provided to Google to verify compatibility. Eventually we intend
+  to provide self-service tools to upload these reports to a public database.</p>
+
+<h3>Who determines what will be part of the compatibility definition?</h3>
+<p>Since Google is responsible for the overall direction of Android as a
+  platform and product, Google maintains the Compatibility Definition Document
+  for each release. We draft the CDD for a new Android version in consultation
+  with a number of OEMs, who provide input on its contents.</p>
+
+<h3>How long will each Android version be supported for new devices?</h3>
+<p>Since Android's code is open-source, we can't prevent someone from using an
+  old version to launch a device. Instead, Google chooses not to license the
+  Android Market client software for use on versions that are considered
+  obsolete. This allows anyone to continue to ship old versions of Android,
+  but those devices won't use the Android name and will exist outside the
+  Android apps ecosystem, just as if they were non-compatible.</p>
+
+<h3>Can a device have a different user interface and still be compatible?</h3>
+<p>The Android Compatibility Program focuses on whether a device can run
+  third-party applications. The user interface components shipped with a
+  device (such as home screen, dialer, color scheme, and so on) does not
+  generally have much effect on third-party apps. As such, device builders are
+  free to customize the user interface as much as they like. The Compatibility
+  Definition Document does restrict the degree to which OEMs may alter the
+  system user interface for the few areas that do impact third-party apps.</p>
+
+<h3>When are compatibility definitions released for new Android versions?</h3>
+<p>Our goal is to release new versions of Android Compatibility Definition
+  Documents (CDDs) once the corresponding Android platform version has
+  converged enough to permit it. Since the CDDs</p>
+
+<h3>How are device manufacturers' compatibility claims validated?</h3>
+<p>There is no validation process for Android device compatibility. However,
+  if the device is to include Android Market, Google will typically validate
+  the device for compatibility before agreeing to license the Market client
+  software.</p>
+
+<h3>What happens if a device that claims compatibility is later found to have compatibility problems?</h3>
+<p>Typically, Google's relationships with Android Market licensees allow us to
+  ask them to release updated system images that fix the problems.</p>
+
+<a name="cts"></a><h2>Compatibility Test Suite</h2>
+<h3>What is the purpose of the CTS?</h3>
+<p>The Compatibility Test Suite is a tool used by device manufacturers to help
+  ensure their devices are compatible, and to report test results for
+  validations. The CTS is intended to be run frequently by OEMs throughout the
+  engineering process to catch compatibility issues early.</p>
+
+<h3>What kinds of things does the CTS test?</h3>
+<p>The CTS currently tests that all of the supported Android strong-typed APIs
+  are present and behave correctly. It also tests other non-API system
+  behaviors such as application lifecycle and performance. We plan to add
+  support in future CTS versions to test "soft" APIs such as Intents as
+  well.</p>
+
+<h3>Will the CTS reports be made public?</h3>
+<p>Yes. While not currently implemented, Google intends to provide web-based
+  self-service tools for OEMs to publish CTS reports so that they can be
+  viewed by anyone. CTS reports can be shared as widely as manufacturers
+  prefer.</p>
+
+<h3>How is the CTS licensed?</h3>
+<p>The CTS is licensed under the same Apache Software License 2.0 that the
+  bulk of Android uses.</p>
+
+<h3>Does the CTS accept contributions?</h3>
+<p>Yes please! The Android Open-Source Project accepts contributions to
+  improve the CTS in the same way as for any other component. In fact,
+  improving the coverage and quality of the CTS test cases is one of the best
+  ways to help out Android.</p>
+
+<h3>Can anyone use the CTS on existing devices?</h3>
+<p>The Compatibility Definition Document requires that compatible devices
+  implement the 'adb' debugging utility. This means that any compatible device
+  -- including ones available at retail -- must be able to run the CTS
+  tests.</p>
diff --git a/pdk/docs/guide/pdk_toc.cs b/pdk/docs/guide/pdk_toc.cs
deleted file mode 100644
index d1493e6..0000000
--- a/pdk/docs/guide/pdk_toc.cs
+++ /dev/null
@@ -1,92 +0,0 @@
-<script type="text/javascript" language="JavaScript">
-<!--
-function nothing() {}
--->
-</script>
-
-<ul>
-
-<li> <h2>Setup and Building</h2>
-  <ul>
-     <li class="toggle-list">
-     <div><a href="<?cs var:toroot ?>guide/build_system.html">Build System</a></div>
-     <ul>  
-       <li><a href="<?cs var:toroot ?>guide/build_new_device.html">Configuring a New Product</a></li>
-       <li><a href="<?cs var:toroot ?>guide/build_cookbook.html">Build Cookbook</a></li>
-     </ul>
-     </li>
-     <li><a href="<?cs var:toroot ?>guide/release_keys.html">Release Keys and Signing Builds</a></li> 
- </ul>
-</li>
-
-<li> <h2>Customization</h2>
-  <ul>
-    <li><a href="<?cs var:toroot ?>guide/customization.html">Customization</a></li>
-  </ul>
-</li>
-
-<li> <h2>System</h2>
-
-<ul>
-  <li><a href="<?cs var:toroot ?>guide/bring_up.html">Bring up</a></li>
-  <li class="toggle-list">
-    <div><a href="javascript:nothing()">Connectivity</a></div>
-    <ul> 
-      <li><a href="<?cs var:toroot ?>guide/bluetooth.html">Bluetooth</a></li>
-      <li><a href="<?cs var:toroot ?>guide/gps.html">GPS</a></li>
-      <li><a href="<?cs var:toroot ?>guide/wifi.html">Wi-Fi</a></li>
-    </ul>
-  </li>
-
-  <li><a href="<?cs var:toroot ?>guide/display_drivers.html">Display Drivers</a></li>
-  <li class="toggle-list"> 
-    <div><a href="javascript:nothing()">Input Devices</a></div>
-    <ul>
-      <li><a href="<?cs var:toroot ?>guide/keymaps_keyboard_input.html">Keymaps and Keyboard</a></li>
-    </ul>
-  </li>
-  <li><a href="<?cs var:toroot ?>guide/lights.html">Lights</a></li>
-  <li class="toggle-list">
-    <div><a href="javascript:nothing()">Multimedia</a></div>
-    <ul>
-      <li><a href="<?cs var:toroot ?>guide/audio.html">Audio</a></li>
-      <li><a href="<?cs var:toroot ?>guide/camera.html">Camera/Video</a></li>
-    </ul>
-  </li>
-  
-  <li><a href="<?cs var:toroot ?>guide/power_management.html">Power Management</a></li>
-  <li><a href="<?cs var:toroot ?>guide/sensors.html">Sensors</a></li>
-  <li class="toggle-list">
-    <div><a href="javascript:nothing()">Telephony</a></div>
-    <ul>
-      <li><a href="<?cs var:toroot ?>guide/telephony.html">Radio Interface Layer</a></li>
-      <li><a href="<?cs var:toroot ?>guide/stk.html">SIM Toolkit Application (STK)</a></li>
-    </ul>
-  </li>
-
-</ul>
-</li>
-
-<li> <h2>Dalvik Virtual Machine</h2>
-  <ul>
-    <li><a href="<?cs var:toroot ?>guide/dalvik.html">Porting Dalvik</a></li>
-  </ul>
-</li>
-<li> <h2>Testing and Debugging</h2>
-  <ul>
-    <li><a href="<?cs var:toroot ?>guide/instrumentation_testing.html">Instrumentation Testing</a></li>
-    <li><a href="<?cs var:toroot ?>guide/debugging_gdb.html">Debugging with GDB</a></li>
-    <li><a href="<?cs var:toroot ?>guide/debugging_native.html">Debugging Native Code</a></li>
-    <li><a href="<?cs var:toroot ?>guide/tcpdump.html">Debugging with tcpdump</a></li>
-  </ul>
-</li>
-
-
-
-</ul>
-
-<script type="text/javascript">
-<!--
-    buildToggleLists();
-//-->
-</script>
diff --git a/pdk/docs/images/bluetooth-0.jpg b/pdk/docs/images/bluetooth-0.jpg
new file mode 100644
index 0000000..f06eebf
--- /dev/null
+++ b/pdk/docs/images/bluetooth-0.jpg
Binary files differ
diff --git a/pdk/docs/images/code-lines.png b/pdk/docs/images/code-lines.png
new file mode 100644
index 0000000..acfb77b
--- /dev/null
+++ b/pdk/docs/images/code-lines.png
Binary files differ
diff --git a/pdk/docs/images/cts-0.png b/pdk/docs/images/cts-0.png
new file mode 100644
index 0000000..cca38c5
--- /dev/null
+++ b/pdk/docs/images/cts-0.png
Binary files differ
diff --git a/pdk/docs/images/cts-process-0.gif b/pdk/docs/images/cts-process-0.gif
new file mode 100644
index 0000000..565da23
--- /dev/null
+++ b/pdk/docs/images/cts-process-0.gif
Binary files differ
diff --git a/pdk/docs/images/cts-process-1.png b/pdk/docs/images/cts-process-1.png
new file mode 100644
index 0000000..2656433
--- /dev/null
+++ b/pdk/docs/images/cts-process-1.png
Binary files differ
diff --git a/pdk/docs/images/discuss-0.png b/pdk/docs/images/discuss-0.png
new file mode 100644
index 0000000..e2cea10
--- /dev/null
+++ b/pdk/docs/images/discuss-0.png
Binary files differ
diff --git a/pdk/docs/images/documentation-0.png b/pdk/docs/images/documentation-0.png
new file mode 100644
index 0000000..e2cea10
--- /dev/null
+++ b/pdk/docs/images/documentation-0.png
Binary files differ
diff --git a/pdk/docs/images/download-0.png b/pdk/docs/images/download-0.png
new file mode 100644
index 0000000..e2cea10
--- /dev/null
+++ b/pdk/docs/images/download-0.png
Binary files differ
diff --git a/pdk/docs/images/git-repo-0.png b/pdk/docs/images/git-repo-0.png
new file mode 100644
index 0000000..e2cea10
--- /dev/null
+++ b/pdk/docs/images/git-repo-0.png
Binary files differ
diff --git a/pdk/docs/images/git-repo-1.png b/pdk/docs/images/git-repo-1.png
new file mode 100644
index 0000000..6bc8dcb
--- /dev/null
+++ b/pdk/docs/images/git-repo-1.png
Binary files differ
diff --git a/pdk/docs/images/home-bugdroid.png b/pdk/docs/images/home-bugdroid.png
new file mode 100644
index 0000000..c30fac9
--- /dev/null
+++ b/pdk/docs/images/home-bugdroid.png
Binary files differ
diff --git a/pdk/docs/images/how-it-works-0.png b/pdk/docs/images/how-it-works-0.png
new file mode 100644
index 0000000..3c1c9dc
--- /dev/null
+++ b/pdk/docs/images/how-it-works-0.png
Binary files differ
diff --git a/pdk/docs/images/how-it-works-1.png b/pdk/docs/images/how-it-works-1.png
new file mode 100644
index 0000000..856674a
--- /dev/null
+++ b/pdk/docs/images/how-it-works-1.png
Binary files differ
diff --git a/pdk/docs/images/lil-wrench.png b/pdk/docs/images/lil-wrench.png
new file mode 100644
index 0000000..74b4972
--- /dev/null
+++ b/pdk/docs/images/lil-wrench.png
Binary files differ
diff --git a/pdk/docs/images/submit-patches-0.png b/pdk/docs/images/submit-patches-0.png
new file mode 100644
index 0000000..ca7eaad
--- /dev/null
+++ b/pdk/docs/images/submit-patches-0.png
Binary files differ
diff --git a/pdk/docs/images/submit-patches-1.png b/pdk/docs/images/submit-patches-1.png
new file mode 100644
index 0000000..777a3c3
--- /dev/null
+++ b/pdk/docs/images/submit-patches-1.png
Binary files differ
diff --git a/pdk/docs/images/workflow-0.png b/pdk/docs/images/workflow-0.png
new file mode 100644
index 0000000..d8456b5
--- /dev/null
+++ b/pdk/docs/images/workflow-0.png
Binary files differ
diff --git a/pdk/docs/index.jd b/pdk/docs/index.jd
index 4175db7..217877d 100644
--- a/pdk/docs/index.jd
+++ b/pdk/docs/index.jd
@@ -1,133 +1,64 @@
+page.title=Welcome to Android
 home=true
 @jd:body
+<div style="float: left; width: 45%; font-size: 1.3em;">
+  <p>Here you can find the information and source code you need to build an
+  Android-compatible device.</p>
+  <p>Android is an open-source software stack for mobile devices, and a
+  corresponding open-source project led by Google. We created Android in
+  response to our own experiences launching mobile apps. We wanted to make
+  sure that there was no central point of failure, so that no industry player
+  can restrict or control the innovations of any other.  That's why we
+  created Android, and made its source code open.</p>
+  <p><a href="{@docRoot}about/index.html">Learn more &raquo;</a></p>
+</div>
+<div style="float: right; width: 35%;">
+<h3 style="padding-top: 0px;">News</h3>
+<p><b>Site redesign</b><br/>
+You're looking at the new and improved source.android.com! We've updated
+the layout and site design, and also added new information. We hope you find
+these improvements helpful.</p>
+<p><b>Introducing the Compatibility Program</b><br/>
+We're pleased to introduce the Android Compatibility Program. We've released
+two tools -- the Compatibility Definition Document and the Compatibility Test
+Suite -- to help device manufacturers build compatible devices. Full details
+of the Compatibility Program will be available in the first quarter of 2010.</p>
+</div>
+<img style="float: right; padding-right: 1.5em;" src="{@docRoot}images/home-bugdroid.png" alt="Android Mascot"/>
 
+<div style="clear: both;"/>
 
-	<div id="mainBodyFixed" align="top">
-              <div id="mainBodyLeft">			
-                   <h2>Android Open Source Project</h2>
-                   <!-- total max width is 520px -->
-                   <p> Android is the first free, open source, and fully customizable mobile platform. 
-                       Android offers a full stack: an operating system, middleware and key mobile applications.
-                       It also contains a rich set of APIs that allows third-party developers to develop great
-                       applications. </p>
-              </div><!-- end mainBodyLeft -->
+<table border="0" style="border: 0px; margin: 0px; padding: 0px;"><tr><td align="center" style="border: 0px; margin: 0px; padding: 0px;">
+<div class="rebox lil" style="float: left; width: 30%; margin: 1em;"> 
+  <h2 style="color: white; background-color: #95C0D0; border: 0px;">Get Involved</h2> 
+  <div class="p"> 
+    <p><img src="images/lil-wrench.png" alt="" style="margin: 1em;"/>
+    If you're interested in contributing to the Android source code or helping
+    out with the project in some other way, click here.</p> 
+    <p><a href="{@docRoot}source/index.html">More &raquo;</a></p> 
+  </div> 
+</div> 
 
-              <div id="mainBodyRight">
-                      <table id="rightColumn">
-                              <tr>
-                                      <td class="imageCell"><a href="{@docRoot}sdk/index.html"><img src="{@docRoot}assets/images/icon_download.jpg" style="padding:0" /></a></td>
-                                      <td>
-                                              <h2 class="green">Download</h2>
-                                              <p>The Android SDK has the tools, sample code, and docs you need to create great apps.  </p>
-                                              <p><a href="http://developer.android.com">Learn more &raquo;</a></p>
-                                      </td>
-                              </tr>
-                              <tr>
-                                      <td colspan="2"><div class="seperator">&nbsp;</div></td>
-                              </tr>
-                              <tr>
-                                      <td class="imageCell"><a href="http://www.android.com/market.html"><img src="{@docRoot}assets/images/icon_market.jpg" style="padding:0" /></a></td>
-                                      <td>
-                                              <h2 class="green">Publish</h2>
-                                              <p>Android Market is an open service that lets you distribute your apps to handsets.</p>
-                                              <p><a href="http://www.android.com/market.html">Learn more &raquo;</a></p>
-                                      </td>
-                              </tr>
-                              <tr>
-                                      <td colspan="2"><div class="seperator">&nbsp;</div></td>
-                              </tr>
-                              <tr>
-                                      <td class="imageCell"><a href="http://source.android.com"><img src="{@docRoot}assets/images/icon_contribute.jpg" style="padding:0" /></a></td>
-                                      <td>
-                                              <h2 class="green">Contribute</h2>
-                                              <p>Android Open Source Project gives you access to the entire platform source.</p>
-                                              <p><a href="http://source.android.com">Learn more &raquo;</a></p>
-                                      </td>
-                              </tr>
-                              <tr>
-                                      <td colspan="2"><div class="seperator">&nbsp;</div></td>
-                              </tr>
-                              <tr>
-                                      <td class="imageCell"><a href="http://www.youtube.com/user/androiddevelopers"><img src="{@docRoot}assets/images/video-droid.png" style="padding:0" /></a></td>
-                                      <td>
-                                              <h2 class="green">Watch</h2>
-                                              <object width="150" height="140"><param name="movie" value="http://www.youtube.com/v/GARMe7Km_gk&hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/GARMe7Km_gk&hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="150" height="140"></embed></object>
-                                              <p style="margin-top:1em"><a href="{@docRoot}videos/index.html">More Android videos &raquo;</a></p>
-                                      </td>
-                              </tr>
+<div class="rebox lil" style="float: left; width: 30%; margin: 1em;"> 
+  <h2 style="color: white; background-color: #95C0D0; border: 0px;">Build a Device</h2> 
+  <div class="p"> 
+    <p><img src="images/lil-wrench.png" alt="" style="margin: 1em;"/>
+    If you're an engineer building a device intended to run the Android
+    software stack, click here to find porting information and tips.</p> 
+    <p><a href="{@docRoot}porting/index.html">More &raquo;</a></p> 
+  </div> 
+</div> 
 
-                      </table>
-              </div>
-	</div>
+<div class="rebox lil" style="float: left; width: 30%; margin: 1em;"> 
+  <h2 style="color: white; background-color: #95C0D0; border: 0px;">Compatibility</h2> 
+  <div class="p"> 
+    <p><img src="images/lil-wrench.png" alt="" style="margin: 1em;"/>
+    If you're an OEM or other organization building an Android device, click
+    here to find out how to ensure that your device is fully compatible, and
+    how to take advantage of the benefits of compatibility.</p> 
+    <p><a href="{@docRoot}compatibility/index.html">More &raquo;</a></p> 
+  </div> 
+</div> 
+</td></tr></table>
 
-<!--[if lte IE 6]>
-  <style>
-    #arrow-left {
-      margin:0 0 0 5px;
-    }
-    #arrow-right {
-      margin-left:0;
-    }
-    .app-list-container {
-      margin: 37px 0 0 23px;
-    }
-    div#list-clip { 
-      width:468px;
-    }
-  </style>
-<![endif]-->
-
-<script type="text/javascript">
-
-// * -- carousel dictionary -- * //
-  /* layout:  imgLeft, imgRight, imgTop
-     icon:    image for carousel entry. cropped (height:70px, width:90px)
-     name:    string for carousel entry
-     img:     image for bulletin post. cropped (height: 170, width:230px)
-     title:   header for bulletin (optional, insert "" value to skip
-     desc:    the bulletin post. must include html tags. 
-  */
-
-  var droidList = {
-    'sdk': {
-      'layout':"imgLeft",
-      'icon':"sdk-small.png",
-      'name':"SDK 1.5 r3",
-      'img':"sdk-large.png",
-      'title':"Android 1.5 SDK",
-      'desc': "<p>Android 1.5 SDK is now available. It includes new APIs for Android 1.5, updated developer tools, multiple platform versions, and a Google APIs add-on.</p><p><a href='{@docRoot}sdk/1.5_r3/index.html'>Download Android 1.5 SDK &raquo;</a></p>"
-    },
-    
-    'io': {
-      'layout':"imgLeft",
-      'icon':"io-small.png",
-      'name':"Google I/O",
-      'img':"io-large.png",
-      'title':"Google I/O Developer Conference",
-      'desc': "<p>The Google I/O developer conference took place May 27-28 in San Francisco. If you missed the conference, you can experience the Android sessions by viewing YouTube videos.</p><p><a href='{@docRoot}videos/index.html'>See the sessions from Google I/O &raquo;</a></p>"
-    },
-
-    'mapskey': {
-      'layout':"imgLeft",
-      'icon':"maps-small.png",
-      'name':"Maps API Key",
-      'img':"maps-large.png",
-      'title':"Maps API Key",
-      'desc':"<p>If you're writing an Android application that uses Google Maps (with MapView), you must register your application to obtain a Maps API Key. Without the key, your maps application will not work on Android devices. Obtaining a key requires just a couple of steps.</p><p><a href='http://code.google.com/android/add-ons/google-apis/maps-overview.html'>Learn more &raquo;</a></p>"
-    },
-
-    'devphone': {
-      'layout':"imgLeft",
-      'icon':"devphone-small.png",
-      'name':"Dev Phone 1",
-      'img':"devphone-large.png",
-      'title':"Android Dev Phone 1",
-      'desc': "<p>Run and debug your Android applications directly on this device. Modify and rebuild the Android operating system, and flash it onto the phone. The Android Dev Phone 1 is carrier independent, and available for purchase by any developer registered with <a href='http://market.android.com/publish'>Android Market</a>.</p><p><a href='/guide/developing/device.html#dev-phone-1'>Learn more about the Android Dev Phone 1 &raquo;</a></p>"
-    }
-
-  }
-</script>
-<script type="text/javascript" src="{@docRoot}assets/carousel.js"></script>
-<script type="text/javascript">
-  initCarousel("sdk");
-</script>
+<div style="clear: both;"/>
diff --git a/pdk/docs/licenses/index.jd b/pdk/docs/licenses/index.jd
deleted file mode 100644
index a4f51dc..0000000
--- a/pdk/docs/licenses/index.jd
+++ /dev/null
@@ -1,47 +0,0 @@
-home=true
-doc.type=licenses
-@jd:body
-
-<div id="mainBodyFixed">
-
-<p>
-   The Android Open Source Project uses a few open source initiative approved open source licenses to enable availability
-   of source code and to accept contributions from individuals and corporations.
-</p>
-
-<p>
-   <b>Android Open Source Project license</b>
-</p>
-
-<p>
-   The preferred license for the Android Open Source Project is Apache 2.0. Apache 2.0 is a commercial and open source
-   friendly open source license. The majority of the Android platform is licensed under the Apache 2.0 license. While
-   the project will strive to adhere to the preferred license, there may be exceptions which will be handled on a case-by-case
-   basis. For example, the Linux kernel patches are under the GPLv2 license with system exceptions, which can be found on kernel.org
-</p>
-
-<p>
-   <b>Contributor License Grants</b>
-</p>
-
-<p>
-   All individual contributors of ideas, code, or documentation to the Android Open Source Project will be required to
-   complete, sign, and submit an Individual Contributor License Grant. The grant can be executed online through the code
-   review tool. The agreement clearly defines the terms under which intellectual property has been contributed to the
-   Android Open Source Project.  This license is for your protection as a contributor as well as the protection of the
-   project; it does not change your rights to use your own contributions for any other purpose.
-</p>
-
-<p>
-   For a corporation that has assigned employees to work on the Android Open Source Project, a Corporate Contributor License
-   Grant is available. This version of the Grant allows a corporation to authorize contributions submitted by its designated
-   employees and to grant copyright and patent licenses. Note that a Corporate Contributor License Grant does not remove the
-   need for any developer to sign their own Individual Contributor License Grant as an individual, to cover any of their
-   contributions which are not owned by the corporation signing the Corporate Contributor License Grant.
-</p>
-
-<p>
-   Please note that we based our grants on the ones that the Apache Software Foundation uses, which can be found on its site.
-</p>
-
-</div>
diff --git a/pdk/docs/licenses/licenses_toc.cs b/pdk/docs/licenses/licenses_toc.cs
deleted file mode 100644
index b2fa107..0000000
--- a/pdk/docs/licenses/licenses_toc.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-<script type="text/javascript" language="JavaScript">
-<!--
-function nothing() {}
--->
-</script>
-
-<ul>
-  <li> <h2> Referenced Licenses </h2>
-  <ul>
-    <li><a href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 license</a></li>
-    <li><a href="http://www.kernel.org/pub/linux/kernel/COPYING">GPL v2 license</a></li>
-  </ul>
-  </li>
-
-</ul>
-
-<script type="text/javascript">
-<!--
-    buildToggleLists();
-//-->
-</script>
diff --git a/pdk/docs/guide/audio.jd b/pdk/docs/porting/audio.jd
similarity index 98%
rename from pdk/docs/guide/audio.jd
rename to pdk/docs/porting/audio.jd
index 66c05f7..e82788f 100755
--- a/pdk/docs/guide/audio.jd
+++ b/pdk/docs/porting/audio.jd
@@ -1,6 +1,6 @@
 page.title=Audio
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/bluetooth.jd b/pdk/docs/porting/bluetooth.jd
similarity index 99%
rename from pdk/docs/guide/bluetooth.jd
rename to pdk/docs/porting/bluetooth.jd
index bcf88db..ceb8683 100755
--- a/pdk/docs/guide/bluetooth.jd
+++ b/pdk/docs/porting/bluetooth.jd
@@ -1,6 +1,6 @@
 page.title=Bluetooth
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
@@ -170,7 +170,7 @@
 
 <p><strong>Development Notes</strong></p>
 <ul>
-  <li><strong>HID Support<br />
+  <li><strong>HID Support <br />
   </strong>Cupcake features some early work&#151;Bluez has an HID plugin, <code>external/bluez/utils/input/Android.mk</code>, which gets compiled. <br />
     <br />
 You can interact directly with this plugin using <code>dbus-send</code></span> and <code>dbus-monitor</code>. While not officially supported, you should be able to connect and use a HID keyboard and mouse using the Bluez HID plugin API. Next steps include plumbing the plugin API in the Android Java framework and offering better support for HID input methods (new keymaps and mouse support).<br />
diff --git a/pdk/docs/guide/bluetooth/bluetooth_process.jd b/pdk/docs/porting/bluetooth/bluetooth_process.jd
similarity index 94%
rename from pdk/docs/guide/bluetooth/bluetooth_process.jd
rename to pdk/docs/porting/bluetooth/bluetooth_process.jd
index ea46f23..00ec0da 100755
--- a/pdk/docs/guide/bluetooth/bluetooth_process.jd
+++ b/pdk/docs/porting/bluetooth/bluetooth_process.jd
@@ -1,6 +1,6 @@
 page.title=Bluetooth Process Diagram
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <p>The diagram below offers a process-oriented architectural overview of Android's Bluetooth stack. Click <a href="../bluetooth.html">Bluetooth</a> to return to the Bluetooth overview page.</p>
diff --git a/pdk/docs/guide/bluetooth/images/androidBluetoothProcessDiagram.jpg b/pdk/docs/porting/bluetooth/images/androidBluetoothProcessDiagram.jpg
similarity index 100%
rename from pdk/docs/guide/bluetooth/images/androidBluetoothProcessDiagram.jpg
rename to pdk/docs/porting/bluetooth/images/androidBluetoothProcessDiagram.jpg
Binary files differ
diff --git a/pdk/docs/guide/bring_up.jd b/pdk/docs/porting/bring_up.jd
similarity index 99%
rename from pdk/docs/guide/bring_up.jd
rename to pdk/docs/porting/bring_up.jd
index a11fe00..1d04b86 100755
--- a/pdk/docs/guide/bring_up.jd
+++ b/pdk/docs/porting/bring_up.jd
@@ -1,6 +1,6 @@
 page.title=Bring Up
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <p>Once your code is built and you have verified that all necessary directories exist, power on and test your device with basic bring up, as described below. Bring up tests are typically designed to stress certain aspects of your system and allow you to characterize the device's behavior. </p>
@@ -264,7 +264,7 @@
     </tr>
   </table>
   <p>    Properties</p>
-    Init updates some system properties to provide some insight into<br />
+    Init updates some system properties to provide some insight into <br />
     what it's doing:</p>
   <table>
     <tr>
diff --git a/pdk/docs/guide/build_cookbook.jd b/pdk/docs/porting/build_cookbook.jd
similarity index 99%
rename from pdk/docs/guide/build_cookbook.jd
rename to pdk/docs/porting/build_cookbook.jd
index 4bed947..d619086 100755
--- a/pdk/docs/guide/build_cookbook.jd
+++ b/pdk/docs/porting/build_cookbook.jd
@@ -1,6 +1,6 @@
 page.title=Build Cookbook
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/build_new_device.jd b/pdk/docs/porting/build_new_device.jd
similarity index 99%
rename from pdk/docs/guide/build_new_device.jd
rename to pdk/docs/porting/build_new_device.jd
index 28e7c2e..271a43a 100755
--- a/pdk/docs/guide/build_new_device.jd
+++ b/pdk/docs/porting/build_new_device.jd
@@ -1,6 +1,6 @@
 page.title=Configuring a New Product
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 
@@ -62,7 +62,6 @@
   # These definitions override the defaults in config/config.make for &lt;board_name&gt;
   #
   # TARGET_NO_BOOTLOADER := false
-  # TARGET_HARDWARE_3D := false 
   #
   TARGET_USE_GENERIC_AUDIO := true</pre></li>  
   <li>If you wish to modify system properties, create a <code>system.prop</code> file in your <code>&lt;board_name&gt;</code> directory(<code>vendor/&lt;company_name&gt;/&lt;board_name&gt;</code>).<BR>
diff --git a/pdk/docs/guide/build_system.jd b/pdk/docs/porting/build_system.jd
similarity index 98%
rename from pdk/docs/guide/build_system.jd
rename to pdk/docs/porting/build_system.jd
index fd0ff80..686fba0 100755
--- a/pdk/docs/guide/build_system.jd
+++ b/pdk/docs/porting/build_system.jd
@@ -1,6 +1,6 @@
 page.title=Android Build System
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 
@@ -211,7 +211,7 @@
 <table border=1> 
 <tr> 
     <td> 
-        <code>eng<code> 
+        <code>eng <code> 
     </td> 
     <td> 
         This is the default flavor. A plain <code>make</code> is the
@@ -230,7 +230,7 @@
 </tr> 
 <tr> 
     <td> 
-        <code>user<code> 
+        <code>user <code> 
     </td> 
     <td> 
         <code>make user</code>
@@ -248,7 +248,7 @@
 </tr> 
 <tr> 
     <td> 
-        <code>userdebug<code> 
+        <code>userdebug <code> 
     </td> 
     <td> 
         <code>make userdebug</code>
diff --git a/pdk/docs/guide/camera.jd b/pdk/docs/porting/camera.jd
similarity index 99%
rename from pdk/docs/guide/camera.jd
rename to pdk/docs/porting/camera.jd
index 98636d8..0571fb5 100755
--- a/pdk/docs/guide/camera.jd
+++ b/pdk/docs/porting/camera.jd
@@ -1,6 +1,6 @@
 page.title=Camera
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/customization.jd b/pdk/docs/porting/customization.jd
similarity index 99%
rename from pdk/docs/guide/customization.jd
rename to pdk/docs/porting/customization.jd
index 9c56681..7c11a8e 100755
--- a/pdk/docs/guide/customization.jd
+++ b/pdk/docs/porting/customization.jd
@@ -1,6 +1,6 @@
 page.title=Customization
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/dalvik.jd b/pdk/docs/porting/dalvik.jd
similarity index 99%
rename from pdk/docs/guide/dalvik.jd
rename to pdk/docs/porting/dalvik.jd
index 6fa37da..50b7499 100755
--- a/pdk/docs/guide/dalvik.jd
+++ b/pdk/docs/porting/dalvik.jd
@@ -1,6 +1,6 @@
 page.title=Dalvik
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/debugging_gdb.jd b/pdk/docs/porting/debugging_gdb.jd
similarity index 99%
rename from pdk/docs/guide/debugging_gdb.jd
rename to pdk/docs/porting/debugging_gdb.jd
index f2a2db5..17ff471 100755
--- a/pdk/docs/guide/debugging_gdb.jd
+++ b/pdk/docs/porting/debugging_gdb.jd
@@ -1,6 +1,6 @@
 page.title=Debugging with GDB
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/debugging_native.jd b/pdk/docs/porting/debugging_native.jd
similarity index 99%
rename from pdk/docs/guide/debugging_native.jd
rename to pdk/docs/porting/debugging_native.jd
index 0f8b397..7bb655f 100755
--- a/pdk/docs/guide/debugging_native.jd
+++ b/pdk/docs/porting/debugging_native.jd
@@ -1,6 +1,6 @@
 page.title=Debugging Native Code
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 
diff --git a/pdk/docs/guide/display_drivers.jd b/pdk/docs/porting/display_drivers.jd
similarity index 99%
rename from pdk/docs/guide/display_drivers.jd
rename to pdk/docs/porting/display_drivers.jd
index 1eddd15..570f6f6 100755
--- a/pdk/docs/guide/display_drivers.jd
+++ b/pdk/docs/porting/display_drivers.jd
@@ -1,6 +1,6 @@
 page.title=Display Drivers
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 
diff --git a/pdk/docs/guide/getting_source_code.jd b/pdk/docs/porting/getting_source_code.jd
similarity index 99%
rename from pdk/docs/guide/getting_source_code.jd
rename to pdk/docs/porting/getting_source_code.jd
index e735274..30a2f9f 100755
--- a/pdk/docs/guide/getting_source_code.jd
+++ b/pdk/docs/porting/getting_source_code.jd
@@ -1,6 +1,6 @@
 page.title=Getting Source Code
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <a name="toc"/>
diff --git a/pdk/docs/guide/gps.jd b/pdk/docs/porting/gps.jd
similarity index 98%
rename from pdk/docs/guide/gps.jd
rename to pdk/docs/porting/gps.jd
index 2acad6d..1449460 100755
--- a/pdk/docs/guide/gps.jd
+++ b/pdk/docs/porting/gps.jd
@@ -1,6 +1,6 @@
 page.title=GPS
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/group__memory.jd b/pdk/docs/porting/group__memory.jd
similarity index 97%
rename from pdk/docs/guide/group__memory.jd
rename to pdk/docs/porting/group__memory.jd
index 0423515..224e0cb 100755
--- a/pdk/docs/guide/group__memory.jd
+++ b/pdk/docs/porting/group__memory.jd
@@ -1,6 +1,6 @@
 page.title=Providing Heap Memory
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div class="navigation" id="top">
diff --git a/pdk/docs/guide/group__networking.jd b/pdk/docs/porting/group__networking.jd
similarity index 97%
rename from pdk/docs/guide/group__networking.jd
rename to pdk/docs/porting/group__networking.jd
index e1e942c..67da8a6 100755
--- a/pdk/docs/guide/group__networking.jd
+++ b/pdk/docs/porting/group__networking.jd
@@ -1,6 +1,6 @@
 page.title=Networking Support
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div class="navigation" id="top">
diff --git a/pdk/docs/guide/images/androidBluetooth.gif b/pdk/docs/porting/images/androidBluetooth.gif
similarity index 100%
rename from pdk/docs/guide/images/androidBluetooth.gif
rename to pdk/docs/porting/images/androidBluetooth.gif
Binary files differ
diff --git a/pdk/docs/guide/images/androidPMArchitecture.gif b/pdk/docs/porting/images/androidPMArchitecture.gif
similarity index 100%
rename from pdk/docs/guide/images/androidPMArchitecture.gif
rename to pdk/docs/porting/images/androidPMArchitecture.gif
Binary files differ
diff --git a/pdk/docs/guide/images/android_audio_architecture.gif b/pdk/docs/porting/images/android_audio_architecture.gif
similarity index 100%
rename from pdk/docs/guide/images/android_audio_architecture.gif
rename to pdk/docs/porting/images/android_audio_architecture.gif
Binary files differ
diff --git a/pdk/docs/guide/images/cameraPreview.jpg b/pdk/docs/porting/images/cameraPreview.jpg
similarity index 100%
rename from pdk/docs/guide/images/cameraPreview.jpg
rename to pdk/docs/porting/images/cameraPreview.jpg
Binary files differ
diff --git a/pdk/docs/guide/images/cameraTakePicture.jpg b/pdk/docs/porting/images/cameraTakePicture.jpg
similarity index 100%
rename from pdk/docs/guide/images/cameraTakePicture.jpg
rename to pdk/docs/porting/images/cameraTakePicture.jpg
Binary files differ
diff --git a/pdk/docs/guide/images/camera_video2.gif b/pdk/docs/porting/images/camera_video2.gif
similarity index 100%
rename from pdk/docs/guide/images/camera_video2.gif
rename to pdk/docs/porting/images/camera_video2.gif
Binary files differ
diff --git a/pdk/docs/guide/images/customLogo.gif.png b/pdk/docs/porting/images/customLogo.gif.png
similarity index 100%
rename from pdk/docs/guide/images/customLogo.gif.png
rename to pdk/docs/porting/images/customLogo.gif.png
Binary files differ
diff --git a/pdk/docs/guide/images/stk.gif b/pdk/docs/porting/images/stk.gif
similarity index 100%
rename from pdk/docs/guide/images/stk.gif
rename to pdk/docs/porting/images/stk.gif
Binary files differ
diff --git a/pdk/docs/guide/images/stk_display_text.gif b/pdk/docs/porting/images/stk_display_text.gif
similarity index 100%
rename from pdk/docs/guide/images/stk_display_text.gif
rename to pdk/docs/porting/images/stk_display_text.gif
Binary files differ
diff --git a/pdk/docs/guide/images/stk_display_text2.gif b/pdk/docs/porting/images/stk_display_text2.gif
similarity index 100%
rename from pdk/docs/guide/images/stk_display_text2.gif
rename to pdk/docs/porting/images/stk_display_text2.gif
Binary files differ
diff --git a/pdk/docs/guide/images/stk_refresh_init.gif b/pdk/docs/porting/images/stk_refresh_init.gif
similarity index 100%
rename from pdk/docs/guide/images/stk_refresh_init.gif
rename to pdk/docs/porting/images/stk_refresh_init.gif
Binary files differ
diff --git a/pdk/docs/guide/images/stk_refresh_reset.gif b/pdk/docs/porting/images/stk_refresh_reset.gif
similarity index 100%
rename from pdk/docs/guide/images/stk_refresh_reset.gif
rename to pdk/docs/porting/images/stk_refresh_reset.gif
Binary files differ
diff --git a/pdk/docs/guide/images/stk_refresh_update.gif b/pdk/docs/porting/images/stk_refresh_update.gif
similarity index 100%
rename from pdk/docs/guide/images/stk_refresh_update.gif
rename to pdk/docs/porting/images/stk_refresh_update.gif
Binary files differ
diff --git a/pdk/docs/guide/images/stk_send_SMS.gif b/pdk/docs/porting/images/stk_send_SMS.gif
similarity index 100%
rename from pdk/docs/guide/images/stk_send_SMS.gif
rename to pdk/docs/porting/images/stk_send_SMS.gif
Binary files differ
diff --git a/pdk/docs/guide/images/telephony.gif b/pdk/docs/porting/images/telephony.gif
similarity index 100%
rename from pdk/docs/guide/images/telephony.gif
rename to pdk/docs/porting/images/telephony.gif
Binary files differ
diff --git a/pdk/docs/guide/images/telephony_solicted_example.gif b/pdk/docs/porting/images/telephony_solicted_example.gif
similarity index 100%
rename from pdk/docs/guide/images/telephony_solicted_example.gif
rename to pdk/docs/porting/images/telephony_solicted_example.gif
Binary files differ
diff --git a/pdk/docs/guide/images/telephony_unsolicted_example.gif b/pdk/docs/porting/images/telephony_unsolicted_example.gif
similarity index 100%
rename from pdk/docs/guide/images/telephony_unsolicted_example.gif
rename to pdk/docs/porting/images/telephony_unsolicted_example.gif
Binary files differ
diff --git a/pdk/docs/guide/index.jd b/pdk/docs/porting/index.jd
similarity index 87%
rename from pdk/docs/guide/index.jd
rename to pdk/docs/porting/index.jd
index d22fae8..76609d2 100644
--- a/pdk/docs/guide/index.jd
+++ b/pdk/docs/porting/index.jd
@@ -1,6 +1,6 @@
 page.title=Android Platform Developer's Guide
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 
@@ -21,7 +21,7 @@
 <p>If you are new to Android, start with the platform documentation on the following sites:
 <ul>
 <li><a href="http://developer.android.com">Android Developers site</a>:  This site offers high-level platform documentation and architecture concepts.</li>
-<li><a href="http://source.android.com">Android Open Source Project site</a>:  This site provides instructions on how to get the source code, establish a development environment, and perform a simple build.</li>
+<li><a href="{@docRoot}">Android Open Source Project site</a>:  This site provides instructions on how to get the source code, establish a development environment, and perform a simple build.</li>
 </ul>
 
 <p>When you are ready to start customizing the platform or porting to your target hardware, start in this guide with the <a href="build_system.html">Build System overview</a>.</p>
diff --git a/pdk/docs/guide/instrumentation_framework.jd b/pdk/docs/porting/instrumentation_framework.jd
similarity index 99%
rename from pdk/docs/guide/instrumentation_framework.jd
rename to pdk/docs/porting/instrumentation_framework.jd
index f2c51ef..fcb006b 100755
--- a/pdk/docs/guide/instrumentation_framework.jd
+++ b/pdk/docs/porting/instrumentation_framework.jd
@@ -1,6 +1,6 @@
 page.title=Instrumentation Framework
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <a name="toc"/>
diff --git a/pdk/docs/guide/instrumentation_testing.jd b/pdk/docs/porting/instrumentation_testing.jd
similarity index 99%
rename from pdk/docs/guide/instrumentation_testing.jd
rename to pdk/docs/porting/instrumentation_testing.jd
index e4d7cc5..c3765f4 100755
--- a/pdk/docs/guide/instrumentation_testing.jd
+++ b/pdk/docs/porting/instrumentation_testing.jd
@@ -1,6 +1,6 @@
 page.title=Instrumentation Testing
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/intro_source_code.jd b/pdk/docs/porting/intro_source_code.jd
similarity index 99%
rename from pdk/docs/guide/intro_source_code.jd
rename to pdk/docs/porting/intro_source_code.jd
index 21b34a7..2ba413c 100755
--- a/pdk/docs/guide/intro_source_code.jd
+++ b/pdk/docs/porting/intro_source_code.jd
@@ -1,6 +1,6 @@
 page.title=Source Code Overview
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <a name="toc"/>
diff --git a/pdk/docs/guide/keymaps_keyboard_input.jd b/pdk/docs/porting/keymaps_keyboard_input.jd
similarity index 99%
rename from pdk/docs/guide/keymaps_keyboard_input.jd
rename to pdk/docs/porting/keymaps_keyboard_input.jd
index 5db0a86..f712015 100755
--- a/pdk/docs/guide/keymaps_keyboard_input.jd
+++ b/pdk/docs/porting/keymaps_keyboard_input.jd
@@ -1,6 +1,6 @@
 page.title=Keymaps and Keyboard Input
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 
diff --git a/pdk/docs/guide/lights.jd b/pdk/docs/porting/lights.jd
similarity index 98%
rename from pdk/docs/guide/lights.jd
rename to pdk/docs/porting/lights.jd
index 1c445b2..6bbfb89 100755
--- a/pdk/docs/guide/lights.jd
+++ b/pdk/docs/porting/lights.jd
@@ -1,6 +1,6 @@
 page.title=Lights
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/modules.html b/pdk/docs/porting/modules.html
similarity index 100%
rename from pdk/docs/guide/modules.html
rename to pdk/docs/porting/modules.html
diff --git a/pdk/docs/porting/porting_toc.cs b/pdk/docs/porting/porting_toc.cs
new file mode 100644
index 0000000..02b18e3
--- /dev/null
+++ b/pdk/docs/porting/porting_toc.cs
@@ -0,0 +1,92 @@
+<script type="text/javascript" language="JavaScript">
+<!--
+function nothing() {}
+-->
+</script>
+
+<ul>
+
+<li> <h2>Setup and Building</h2>
+  <ul>
+     <li class="toggle-list">
+     <div><a href="<?cs var:toroot ?>porting/build_system.html">Build System</a></div>
+     <ul>  
+       <li><a href="<?cs var:toroot ?>porting/build_new_device.html">Configuring a New Product</a></li>
+       <li><a href="<?cs var:toroot ?>porting/build_cookbook.html">Build Cookbook</a></li>
+     </ul>
+     </li>
+     <li><a href="<?cs var:toroot ?>porting/release_keys.html">Release Keys and Signing Builds</a></li> 
+ </ul>
+</li>
+
+<li> <h2>Customization</h2>
+  <ul>
+    <li><a href="<?cs var:toroot ?>porting/customization.html">Customization</a></li>
+  </ul>
+</li>
+
+<li> <h2>System</h2>
+
+<ul>
+  <li><a href="<?cs var:toroot ?>porting/bring_up.html">Bring up</a></li>
+  <li class="toggle-list">
+    <div><a href="javascript:nothing()">Connectivity</a></div>
+    <ul> 
+      <li><a href="<?cs var:toroot ?>porting/bluetooth.html">Bluetooth</a></li>
+      <li><a href="<?cs var:toroot ?>porting/gps.html">GPS</a></li>
+      <li><a href="<?cs var:toroot ?>porting/wifi.html">Wi-Fi</a></li>
+    </ul>
+  </li>
+
+  <li><a href="<?cs var:toroot ?>porting/display_drivers.html">Display Drivers</a></li>
+  <li class="toggle-list"> 
+    <div><a href="javascript:nothing()">Input Devices</a></div>
+    <ul>
+      <li><a href="<?cs var:toroot ?>porting/keymaps_keyboard_input.html">Keymaps and Keyboard</a></li>
+    </ul>
+  </li>
+  <li><a href="<?cs var:toroot ?>porting/lights.html">Lights</a></li>
+  <li class="toggle-list">
+    <div><a href="javascript:nothing()">Multimedia</a></div>
+    <ul>
+      <li><a href="<?cs var:toroot ?>porting/audio.html">Audio</a></li>
+      <li><a href="<?cs var:toroot ?>porting/camera.html">Camera/Video</a></li>
+    </ul>
+  </li>
+  
+  <li><a href="<?cs var:toroot ?>porting/power_management.html">Power Management</a></li>
+  <li><a href="<?cs var:toroot ?>porting/sensors.html">Sensors</a></li>
+  <li class="toggle-list">
+    <div><a href="javascript:nothing()">Telephony</a></div>
+    <ul>
+      <li><a href="<?cs var:toroot ?>porting/telephony.html">Radio Interface Layer</a></li>
+      <li><a href="<?cs var:toroot ?>porting/stk.html">SIM Toolkit Application (STK)</a></li>
+    </ul>
+  </li>
+
+</ul>
+</li>
+
+<li> <h2>Dalvik Virtual Machine</h2>
+  <ul>
+    <li><a href="<?cs var:toroot ?>porting/dalvik.html">Porting Dalvik</a></li>
+  </ul>
+</li>
+<li> <h2>Testing and Debugging</h2>
+  <ul>
+    <li><a href="<?cs var:toroot ?>porting/instrumentation_testing.html">Instrumentation Testing</a></li>
+    <li><a href="<?cs var:toroot ?>porting/debugging_gdb.html">Debugging with GDB</a></li>
+    <li><a href="<?cs var:toroot ?>porting/debugging_native.html">Debugging Native Code</a></li>
+    <li><a href="<?cs var:toroot ?>porting/tcpdump.html">Debugging with tcpdump</a></li>
+  </ul>
+</li>
+
+
+
+</ul>
+
+<script type="text/javascript">
+<!--
+    buildToggleLists();
+//-->
+</script>
diff --git a/pdk/docs/guide/power_management.jd b/pdk/docs/porting/power_management.jd
similarity index 99%
rename from pdk/docs/guide/power_management.jd
rename to pdk/docs/porting/power_management.jd
index daff6ed..28f9519 100755
--- a/pdk/docs/guide/power_management.jd
+++ b/pdk/docs/porting/power_management.jd
@@ -1,6 +1,6 @@
 page.title=Power Management
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <a name="toc"/>
@@ -103,7 +103,7 @@
         <th scope="col">Description</th>
     </tr>
     <tr>
-      <td>ACQUIRE_CAUSES_WAKEUP<br/></td>
+      <td>ACQUIRE_CAUSES_WAKEUP <br/></td>
         <td>Normally wake locks don't actually wake the device, they just cause it to remain on once it's already on. Think of the video player app as the normal behavior. Notifications that pop up and want the device to be on are the exception; use this flag to be like them.</td>
     </tr>
     <tr>
diff --git a/pdk/docs/guide/release_keys.jd b/pdk/docs/porting/release_keys.jd
similarity index 99%
rename from pdk/docs/guide/release_keys.jd
rename to pdk/docs/porting/release_keys.jd
index 7e83834..116cdbb 100755
--- a/pdk/docs/guide/release_keys.jd
+++ b/pdk/docs/porting/release_keys.jd
@@ -1,6 +1,6 @@
 page.title=Creating Release Keys and Signing Builds
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/sensors.jd b/pdk/docs/porting/sensors.jd
similarity index 98%
rename from pdk/docs/guide/sensors.jd
rename to pdk/docs/porting/sensors.jd
index 61ca2d9..1b24026 100755
--- a/pdk/docs/guide/sensors.jd
+++ b/pdk/docs/porting/sensors.jd
@@ -1,6 +1,6 @@
 page.title=Sensors
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/source_setup_guide.jd b/pdk/docs/porting/source_setup_guide.jd
similarity index 99%
rename from pdk/docs/guide/source_setup_guide.jd
rename to pdk/docs/porting/source_setup_guide.jd
index 83c4a01..77e1d60 100755
--- a/pdk/docs/guide/source_setup_guide.jd
+++ b/pdk/docs/porting/source_setup_guide.jd
@@ -1,6 +1,6 @@
 page.title=Host System Setup
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <a name="toc"/>
diff --git a/pdk/docs/guide/stk.jd b/pdk/docs/porting/stk.jd
similarity index 99%
rename from pdk/docs/guide/stk.jd
rename to pdk/docs/porting/stk.jd
index 4f68c48..a73ed93 100755
--- a/pdk/docs/guide/stk.jd
+++ b/pdk/docs/porting/stk.jd
@@ -1,6 +1,6 @@
 page.title=Sim Toolkit Application (STK)
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/system_requirements.jd b/pdk/docs/porting/system_requirements.jd
similarity index 98%
rename from pdk/docs/guide/system_requirements.jd
rename to pdk/docs/porting/system_requirements.jd
index 0077447..0a0b331 100755
--- a/pdk/docs/guide/system_requirements.jd
+++ b/pdk/docs/porting/system_requirements.jd
@@ -1,6 +1,6 @@
 page.title=Device Requirements
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <p>While Android is designed to support a wide variety of hardware platforms and configurations, this section provides recommended minimum device requirements.</p>
diff --git a/pdk/docs/guide/tcpdump.jd b/pdk/docs/porting/tcpdump.jd
similarity index 99%
rename from pdk/docs/guide/tcpdump.jd
rename to pdk/docs/porting/tcpdump.jd
index 01f77bb..1627bc7 100755
--- a/pdk/docs/guide/tcpdump.jd
+++ b/pdk/docs/porting/tcpdump.jd
@@ -1,6 +1,6 @@
 page.title=Debugging with tcpdump and other tools
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 
diff --git a/pdk/docs/guide/telephony.jd b/pdk/docs/porting/telephony.jd
similarity index 99%
rename from pdk/docs/guide/telephony.jd
rename to pdk/docs/porting/telephony.jd
index 2004e63..dcf5773 100755
--- a/pdk/docs/guide/telephony.jd
+++ b/pdk/docs/porting/telephony.jd
@@ -1,6 +1,6 @@
 page.title=Radio Layer Interface
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/guide/wifi.jd b/pdk/docs/porting/wifi.jd
similarity index 98%
rename from pdk/docs/guide/wifi.jd
rename to pdk/docs/porting/wifi.jd
index 1e9f527..eea431b 100755
--- a/pdk/docs/guide/wifi.jd
+++ b/pdk/docs/porting/wifi.jd
@@ -1,6 +1,6 @@
 page.title=Wi-Fi
 pdk.version=1.0
-doc.type=guide
+doc.type=porting
 @jd:body
 
 <div id="qv-wrapper">
diff --git a/pdk/docs/releases/index.jd b/pdk/docs/releases/index.jd
deleted file mode 100644
index b3b7154..0000000
--- a/pdk/docs/releases/index.jd
+++ /dev/null
@@ -1,7 +0,0 @@
-home=true
-doc.type=releases
-@jd:body
-
-<p>
-  Some release information here
-</p>
diff --git a/pdk/docs/releases/releases_toc.cs b/pdk/docs/releases/releases_toc.cs
deleted file mode 100644
index a1842b5..0000000
--- a/pdk/docs/releases/releases_toc.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-<script type="text/javascript" language="JavaScript">
-<!--
-function nothing() {}
--->
-</script>
-
-<ul>
-  <li> <h2> Android Releases </h2>
-  <ul>
-    <li><a href="xxx">Android 1.0</a></li>
-    <li><a href="xxx">Android 1.1</a></li>
-    <li><a href="xxx">Android 1.5</a></li>
-  </ul>
-  </li>
-
-</ul>
-
-<script type="text/javascript">
-<!--
-    buildToggleLists();
-//-->
-</script>
diff --git a/pdk/docs/source/building-dream.jd b/pdk/docs/source/building-dream.jd
new file mode 100644
index 0000000..89392fd
--- /dev/null
+++ b/pdk/docs/source/building-dream.jd
@@ -0,0 +1,38 @@
+page.title=Building for an Android Dev Phone
+doc.type=source
+@jd:body
+<p><i>The information on this page is a bit out of date. We'll update this
+page as soon as we can.</i></p>
+<div>The basic manifest for cupcake (and above) defines which projects are
+needed to do a generic build for the emulator or for unlocked Dream devices
+(e.g. the Android Dev Phone 1). You need to have an appropriate device running
+a matching official image.<br><br>To build donut or master for dream (your
+device needs to be an ADP1 running an official 1.6 system):<br><ol><li>Follow
+the <a href="{@docRoot}source/download.html">normal steps</a>
+to setup repo and check out the sources.
+</li>
+<li>At the root of your source tree, run ". build/envsetup.sh" like you normally would for an emulator build.
+</li>
+<li>Run "make adb" if you don't already have adb in your path.
+</li>
+<li>run "adb root".<br></li>
+<li>in vendor/htc/dream-open/ there is a script called "extract-files.sh" that must be run (from that directory) to extract some proprietary binaries from your device (*). You only need to do this once.<br></li>
+<li>run "lunch aosp_dream_us-eng" to specifically configure the build system for dream (the default is the equivalent of "lunch generic-eng", which doesn't contain dream-specific files).<br></li>
+<li>run make from the top of the source tree.
+</li>
+<li>from this point, the fastboot tool (which is put automatically in your path) can be used to flash a device: boot the device into the bootloader by holding the back key while pressing the power key, and run "fastboot -w flashall".<br></li>
+</ol>
+To build cupcake for dream (your device needs to be an ADP1 running an official 1.5 system):<br><ol><li>Follow the <a href="{@docRoot}source/download.html">normal steps</a>
+to setup repo and check out the sources.
+</li>
+<li>At the root of your source tree, run ". build/envsetup.sh" like you normally would for an emulator build.
+</li>
+<li>Run "make adb" if you don't already have adb in your path.<br></li>
+<li>in vendor/htc/dream-open/ there is a script called "extract-files.sh" that must be run (from that directory) to extract some proprietary binaries from your device (*). You only need to do this once.<br></li>
+<li>run "lunch htc_dream-eng" to specifically configure the build system for dream (the default is the equivalent of "lunch generic-eng", which doesn't contain dream-specific files).<br></li>
+<li>run make from the top of the source tree.
+</li>
+<li>from this point, the fastboot tool (which is put automatically in your path) can be used to flash a device: boot the device into the bootloader by holding the back key while pressing the power key, and run "fastboot -w flashall".<br></li>
+</ol>
+* The Dream device software contains some proprietary binaries.For contractual reasons, these cannot be redistributed to be used directly with the Android Open-Source Project, but the provided script may be used to extract these binaries from your development device so that they can be correctly included in your build.These libraries include the openGL|ES library, the Qualcomm camera library, the HTC Radio Interface Library, etc.
+</div>
diff --git a/pdk/docs/source/cla-corporate.jd b/pdk/docs/source/cla-corporate.jd
new file mode 100644
index 0000000..0f9452b
--- /dev/null
+++ b/pdk/docs/source/cla-corporate.jd
@@ -0,0 +1,51 @@
+page.title=Corporate Contributor License Agreement
+doc.type=source
+@jd:body
+<div><p>In order to clarify the intellectual property license granted with Contributions from any person or entity, the Android Open Source Project (the "Project") must have a Contributor License Grant ("Grant") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Project and the Android Open Source Project Leads (the "Project Leads"); it does not change your rights to use your own Contributions for any other purpose.
+</p>
+<p>This version of the Grant allows an entity (the "Corporation") to submit Contributions to the Project Leads, to authorize Contributions submitted by its designated employees to the Project Leads, and to grant copyright and patent licenses thereto. If you have not already done so, please complete and send an original signed Grant to
+</p>
+<blockquote>Google Inc.<br>Attn: Open Source Program Office <br>1600 Amphitheatre Pkwy <br>Building 43<br>Mountain View, CA 94043<br>U.S.A.<br></blockquote>
+<p>Scanned agreements may also be emailed in PDF form to cla-submissions@google.com
+</p>
+<p>If necessary, you may send it by facsimile to (650) 887-1625. Please read this document carefully before signing and keep a copy for your records.
+</p>
+<pre>Corporation name: ___________________________________________________<br><br><br><br>Corporation address: ________________________________________________<br><br><br><br>_____________________________________________________________________<br><br><br><br>_____________________________________________________________________<br><br><br><br>Point of Contact: ___________________________________________________<br><br><br><br>E-Mail:  ____________________________________________________________<br><br><br><br>Telephone: _____________________<br><br><br><br>Fax: ___________________________<br><br></pre>
+<p>You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Project. Except for the license granted herein to the Project Leads and recipients of software distributed by the Project Leads, You reserve all right, title, and interest in and to Your Contributions.
+</p>
+<ol><li><p>Definitions.
+</p>
+<p>"You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Grant to the Project Leads. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
+</p>
+<p>"Contribution" shall mean the code, documentation or other original works of authorship expressly identified in Schedule B, as well as any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to the Project Leads for inclusion in, or documentation of, any of the products managed or maintained by the Project Leads (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Project Leads or their representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Project Leads for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
+</p>
+</li>
+<li><p>Grant of Copyright License. Subject to the terms and conditions of this Grant, You hereby grant to the Project Leads and to recipients of software distributed by the Project Leads a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
+</p>
+</li>
+<li><p>Grant of Patent License. Subject to the terms and conditions of this Grant, You hereby grant to the Project Leads and to recipients of software distributed by the Project Leads a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Grant for that Contribution or Work shall terminate as of the date such litigation is filed.
+</p>
+</li>
+<li><p>You represent that You are legally entitled to grant the above license. You represent further that each employee of the Corporation designated on Schedule A below (or in a subsequent written modification to that Schedule) is authorized to submit Contributions on behalf of the Corporation.
+</p>
+</li>
+<li><p>You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others).
+</p>
+</li>
+<li><p>You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</li>
+<li><p>Should You wish to submit work that is not Your original creation, You may submit it to the Project Leads separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".<br></p>
+</li>
+<li><p>It is your responsibility to notify the Project Leads when any change is required to the list of designated employees authorized to submit Contributions on behalf of the Corporation, or to the Corporation's Point of Contact with the Project.
+</p>
+</li>
+</ol>
+<pre><br><br><br>Please sign: __________________________________   Date: _______________<br><br><br><br>Title:  _______________________________________________________________<br><br><br><br>Corporation: __________________________________________________________<br><br></pre>
+<h3>
+Schedule A</h3>
+[Initial list of designated employees. NB: authorization is not tied to particular Contributions.]
+<h3>
+Schedule B</h3>
+[Identification of optional concurrent software grant. Would be left blank or omitted if there is no concurrent software grant.]
+</div>
diff --git a/pdk/docs/source/cla-individual.jd b/pdk/docs/source/cla-individual.jd
new file mode 100644
index 0000000..8890be8
--- /dev/null
+++ b/pdk/docs/source/cla-individual.jd
@@ -0,0 +1,44 @@
+page.title=Contributor License Agreement for Individuals
+doc.type=source
+@jd:body
+<div><p><i>Please visit the <a href="https://review.source.android.com/#settings,new-agreement">code review tool</a>
+to execute the grant online.This page provides the text of the Individual Contributor License Grant for your quick review.</i>
+<br></p>
+<p><br></p>
+<p>In order to clarify the intellectual property license granted with Contributions from any person or entity, the Android Open Source Project (the "Project") must have a Contributor License Grant ("Grant") on file that has been signed by each Contributor, indicating agreement to the license terms below. This license is for your protection as a Contributor as well as the protection of the Project and the Android Open Source Project Leads (the "Project Leads"); it does not change your rights to use your own Contributions for any other purpose. If you have not already done so, please complete and send an original signed Grant to
+</p>
+<blockquote>Google Inc.<br>Attn: Open Source Program Office <br>1600 Amphitheatre Pkwy <br>Building 43<br>Mountain View, CA 94043<br>U.S.A.<br></blockquote>
+<p>Scanned agreements may also be emailed in PDF form to cla-submissions@google.com, sent by facsimile to (650) 887-1625, or <a href="https://review.source.android.com/#settings,new-agreement">signed electronically</a>
+.
+</p>
+<p>Please read this document carefully before signing and keep a copy for your records.
+</p>
+<pre><br><br>Full name: ____________________________  E-Mail: ______________________<br><br><br><br>Mailing Address: ______________________  Telephone: ___________________<br><br><br><br>_______________________________________  Facsimile: ___________________<br><br><br><br>_______________________________________  Country:   ___________________<br><br><br></pre>
+<p>You accept and agree to the following terms and conditions for Your present and future Contributions submitted to the Project. Except for the license granted herein to the Project Leads and recipients of software distributed by the Project Leads, You reserve all right, title, and interest in and to Your Contributions.
+</p>
+<p><br></p>
+<ol><li><p>Definitions. "You" (or "Your") shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Grant. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "Contribution" shall mean any original work of authorship, including any modifications or additions to an existing work, that is intentionally submitted by You to the Project Leads for inclusion in, or documentation of, any of the products managed or maintained by the Project Leads (the "Work"). For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Project Leads or their representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Project Leads for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as "Not a Contribution."
+</p>
+</li>
+<li><p>Grant of Copyright License. Subject to the terms and conditions of this Grant, You hereby grant to the Project Leads and to recipients of software distributed by the Project Leads a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute Your Contributions and such derivative works.
+</p>
+</li>
+<li><p>Grant of Patent License. Subject to the terms and conditions of this Grant, You hereby grant to the Project Leads and to recipients of software distributed by the Project Leads a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Grant for that Contribution or Work shall terminate as of the date such litigation is filed.
+</p>
+</li>
+<li><p>You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your Contributions to the Project Leads, or that your employer has executed a separate Corporate Contributor License Grant with the Project Leads.
+</p>
+</li>
+<li><p>You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
+</p>
+</li>
+<li><p>You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON- INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE.
+</p>
+</li>
+<li><p>Should You wish to submit work that is not Your original creation, You may submit it to the Project Leads separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as "Submitted on behalf of a third-party: [named here]".<br></p>
+</li>
+<li><p>You agree to notify the Project Leads of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
+</p>
+</li>
+</ol>
+</div>
diff --git a/pdk/docs/source/code-lines.jd b/pdk/docs/source/code-lines.jd
new file mode 100644
index 0000000..61b400d
--- /dev/null
+++ b/pdk/docs/source/code-lines.jd
@@ -0,0 +1,77 @@
+page.title=Android Code-Lines
+doc.type=source
+@jd:body
+<p>The Android Open Source Project maintains a complete software stack intended
+to be ported by OEMs and other device implementors to run on actual hardware.
+Accordingly, we maintain a number of "code lines" to clearly separate the
+current stable version of Android from unstable experimental work.</p>
+<p>The chart below depicts at a conceptual level how AOSP manages code and
+releases. We're referring to these as "code lines" instead of "branches"
+simply because at any given moment there may be more than one branch extant
+for a given "code line".  For instance, when a release is cut, sometimes that
+will become a new branch in git, and sometimes not, based on the needs of the
+moment.</p>
+<img src="{@docRoot}images/code-lines.png"/>
+<h3>Notes and Explanations</h3>
+<ul>
+<li>A <i>release</i> corresponds to a formal version of the Android platform, such
+as 1.5, 2.0, and so on. Generally speaking, a release of the platform
+corresponds to a version of the <code>SdkVersion</code> field used in
+AndroidManifest.xml files, and defined in <code>frameworks/base/api</code> in
+the source tree.</li>
+<li>An <i>upstream</i> project is an open-source project from which the Android
+stack is pulling code. These include obvious projects such as the Linux kernel
+and WebKit, but over time we are migrating some of the semi-autonomous
+Android projects (such as Dalvik, the Android SDK tools, Bionic, and so on) to
+work as "upstream" projects. These will be developed entirely in the public
+tree, and snapshots will be periodically pulled into releases.</li>
+<li>The diagram refers to "Eclair" and "Flan"; however, they are simply
+placeholders, and the diagram actually reflects the overall release and
+branching strategy.</li>
+<li>At all times, the Release code-line (which may actually consist of
+more than one actual branch in git) is considered the sole canonical source
+code for a given Android platform. OEMs and other groups building devices
+should pull only from a Release branch.</li>
+<li>We will be setting up an "Experimental" code-line to capture changes from
+the community, so that they can be iterated on, with an eye toward stability.</li>
+<li>Changes that prove stable will eventually be pulled into a Release
+branch. Note that this will only apply to bug fixes, app improvements, and
+other things that do not affect the APIs of the platform.</li>
+<li>Changes will be pulled into Release branches from upstream projects
+(include the Android "upstream" projects) as necessary.</li>
+<li>The "n+1"th version (that is, next major version of the framework and
+platform APIs) will be developed by Google internally. (See below for
+details.)</li>
+<li>Changes will be pulled from upstream, Release, and Experimental branches
+into Google's private branch as necessary.</li>
+<li>When the platform APIs for the next version have stabilized and been fully
+tested, Google will cut a release of the next platform version. (This
+specifically refers to a new <code>SdkVersion</code>.) This will also
+correspond to the internal code-line being made a public Release branch, and the
+new current platform code-line.</li>
+<li>When a new platform version is cut, a corresponding Experimental
+code-line.</li>
+</ul>
+<h3>About Private Code-Lines</h3>
+<p>The source management strategy above includes a code-line that Google will
+keep private. The reason for this is to focus attention on the current public
+version of Android.</p>
+<p>OEMs and other device builders naturally want to ship devices with the
+latest version of Android. Similarly, application developers don't want to
+deal with more extant platform versions than strictly necessary.  Meanwhile,
+Google retains responsibility for the strategic direction of Android as a
+platform and a product. Our approach is based on focusing on a small number of
+flagship devices to drive features, and secure protections of Android-related
+intellectual property through patents and the like.</p>
+<p>As a result, Google frequently has possession of confidential
+information of third parties, and we must refrain from revealing patentable
+features until we've secured the appropriate protections. Meanwhile, there are
+real risks to the platform arising from having too many platform versions
+extant at once. For these reasons, we have structured the open-source project
+-- including third-party contributions -- to focus on the currently-public
+stable version of Android. "Deep development" on the next version of the
+platform will happen in private, until it's ready to become an official
+release.</p>
+<p>We recognize that many contributors will disagree with this approach. We
+respect that others may have a different point of view; however, this is the
+approach that we feel is best, and the one we've chosen to implement.</p>
diff --git a/pdk/docs/source/code-style.jd b/pdk/docs/source/code-style.jd
new file mode 100644
index 0000000..8b5946e
--- /dev/null
+++ b/pdk/docs/source/code-style.jd
@@ -0,0 +1,435 @@
+page.title=Code Style Guidelines for Contributors
+doc.type=source
+@jd:body
+<div>
+<p>The rules below are not guidelines or recommendations, but strict rules.
+Contributions to Android generally <b>will not be accepted if they do not
+adhere to these rules.</b>
+</p>
+<p>Not all existing code follows these rules, but all new code is expected to.</p>
+<h1><a>Java Language Rules</a>
+</h1>
+<p>We follow standard Java coding conventions. We add a few rules:
+</p>
+<ol><li><a href="#exceptionsIgnore">Exceptions</a>
+: Never catch and ignore them without explanation.
+</li>
+<li><a href="#exceptionsAll">Exceptions</a>
+: do not catch generic Exception, except in library code at the root of the stack.
+</li>
+<li><a href="#finalizers">Finalizers</a>
+: generally don't use them.
+</li>
+<li><a href="#imports">Imports</a>
+: Fully qualify imports
+</li>
+</ol>
+<h1><a>Java Library Rules</a>
+</h1>
+<p>There are conventions for using Android's Java libraries and tools. In some cases, the convention has changed in important ways and older code might use a deprecated pattern or library. When working with such code, it's okay to continue the existing style (see <a href="#consistency">Consistency</a>
+). When creating new components never use deprecated libraries.
+</p>
+<h1><a>Java Style Rules</a>
+</h1>
+<p>Programs are much easier to maintain when all files have a consistent style. We follow the standard Java coding style, as defined by Sun in their <a href="http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html">Code Conventions for the Java Programming Language</a>
+, with a few exceptions and additions. This style guide is comprehensive and detailed and is in common usage in the Java community.
+</p>
+<p>In addition, we enforce the following style rules:
+</p>
+<ol><li><a href="#javadoc">Comments/Javadoc</a>
+: write it; use standard style
+</li>
+<li><a href="#shortmethods">Short methods</a>
+: don't write giant methods
+</li>
+<li>Fields: should either be at the top of the file, or immediately before the methods that use them
+</li>
+<li><a href="#localvariables">Local variables</a>
+: limit the scope
+</li>
+<li><a href="#import_style">Imports</a>
+: android; third party alphabetical; java(x)
+</li>
+<li><a href="#indentation">Indentation</a>
+: 4 spaces, no tabs.
+</li>
+<li><a href="#linelen">Line length</a>
+: 100 columns
+</li>
+<li><a href="#field_names">Field names</a>
+: Non-public, non-static fields start with m. Static fields start s.
+</li>
+<li><a href="#braces">Braces</a>
+: Opening braces don't go on their own line.
+</li>
+<li><a href="#annotations">Annotations</a>
+: Use the standard annotations.
+</li>
+<li><a href="#acronyms">Acronyms are words</a>
+: Treat acronyms as words in names, yielding XmlHttpRequest, getUrl(), etc.
+</li>
+<li><a href="#todo">TODO style</a>
+: "TODO: write this description"
+</li>
+<li><a href="#consistency">Consistency</a>
+: Look at what's around you!
+</li>
+<li><a href="#logging">Logging</a>
+: Be careful with logging. It's expensive.
+</li>
+</ol>
+<h1><a>Javatests Style Rules</a>
+</h1>
+<ol><li><a href="#testmethodnames">Naming test methods</a>
+: testMethod_specificCase is ok
+</li>
+</ol>
+<hr><h2>
+Java Language Rules
+</h2>
+<h2><a>Exceptions: do not ignore</a>
+</h2>
+Sometimes it is tempting to write code that completely ignores an exception like this:
+<pre>void setServerPort(String value) {<br>try {<br>serverPort = Integer.parseInt(value);<br>} catch (NumberFormatException e) {<br>}<br>}<br><br></pre>
+<p>You must never do this. While you may think that your code will never encounter this error condition or that it is not important to handle it, ignoring exceptions like above creates mines in your code for someone else to trip over some day. You must handle every Exception in your code in some principled way. The specific handling varies depending on the case.
+</p>
+<blockquote>Anytime somebody has an empty catch clause they should have a creepy feeling. There are definitely times when it is actually the correct thing to do, but at least you have to think about it. In Java you can't escape the creepy feeling.<br><div>-<a href="http://www.artima.com/intv/solid4.html">James Gosling</a>
+</div>
+</blockquote>
+<p>Acceptable alternatives (in order of preference) are:
+</p>
+<ul><li>Throw the exception up to the caller of your method.
+<pre>void setServerPort(String value) throws NumberFormatException {<br>serverPort = Integer.parseInt(value);<br>}<br><br></pre>
+</li>
+<li>Throw a new exception that's appropriate to your level of abstraction.
+<pre>void setServerPort(String value) throws ConfigurationException {<br>try {<br>serverPort = Integer.parseInt(value);<br>} catch (NumberFormatException e) {<br>throw new ConfigurationException("Port " + value + " is not valid.");<br>}<br><br></pre>
+</li>
+<li>Handle the error gracefully and substitute an appropriate value in the catch {} block.
+<pre>/** Set port. If value is not a valid number, 80 is substituted. */<br>void setServerPort(String value) {<br>try {<br>serverPort = Integer.parseInt(value);<br>} catch (NumberFormatException e) {<br>serverPort = 80;  // default port for server <br>}<br></pre>
+</li>
+<li>Catch the Exception and throw a new RuntimeException. This is dangerous: only do it if you are positive that if this error occurs, the appropriate thing to do is crash.
+<pre>/** Set port. If value is not a valid number, die. */<br>void setServerPort(String value) {<br>try {<br>serverPort = Integer.parseInt(value);<br>} catch (NumberFormatException e) {<br>throw new RuntimeException("port " + value " is invalid, ", e);<br>}<br></pre>
+Note that the original exception is passed to the constructor for RuntimeException. This wrapped exception paradigm is very useful but only works in Java 1.4. If your code must compile under Java 1.3, you will need to omit the exception that is the cause.<br><br></li>
+<li>Last resort: if you are confident that actually ignoring the exception is appropriate then you may ignore it, but you must also comment why with a good reason:
+<pre>/** If value is not a valid number, original port number is used. */<br>void setServerPort(String value) {<br>try {<br>serverPort = Integer.parseInt(value);<br>} catch (NumberFormatException e) {<br>// Method is documented to just ignore invalid user input.<br>// serverPort will just be unchanged.<br>}<br>}<br></pre>
+</li>
+</ul>
+<h2><a>Exceptions: do not catch generic Exception</a>
+</h2>
+Sometimes it is tempting to be lazy when catching exceptions and do something like this:
+<pre>try {<br>someComplicatedIOFunction();        // may throw IOException <br>someComplicatedParsingFunction();   // may throw ParsingException <br>someComplicatedSecurityFunction();  // may throw SecurityException <br>// phew, made it all the way <br>} catch (Exception e) {               // I'll just catch all exceptions <br>handleError();                      // with one generic handler!<br>}<br><br></pre>
+You should not do this. In almost all cases it is inappropriate to catch generic Exception or Throwable, preferably not Throwable, because it includes Error exceptions as well. It is very dangerous. It means that Exceptions you never expected (including RuntimeExceptions like ClassCastException) end up getting caught in application-level error handling. It obscures the failure handling properties of your code. It means if someone adds a new type of Exception in the code you're calling, the compiler won't help you realize you need to handle that error differently. And in most cases you shouldn't be handling different types of exception the same way, anyway.
+<p>There are rare exceptions to this rule: certain test code and top-level code where you want to catch all kinds of errors (to prevent them from showing up in a UI, or to keep a batch job running). In that case you may catch generic Exception (or Throwable) and handle the error appropriately. You should think very carefully before doing this, though, and put in comments explaining why it is safe in this place.
+</p>
+<p>Alternatives to catching generic Exception:
+</p>
+<ul><li>Catch each exception separately as separate catch blocks after a single try. This can be awkward but is still preferable to catching all Exceptions. Beware repeating too much code in the catch blocks.
+</li>
+<li>Refactor your code to have more fine-grained error handling, with multiple try blocks. Split up the IO from the parsing, handle errors separately in each case.
+</li>
+<li>Rethrow the exception. Many times you don't need to catch the exception at this level anyway, just let the method throw it.
+</li>
+</ul>
+Remember: exceptions are your friend! When the compiler complains you're not catching an exception, don't scowl. Smile: the compiler just made it easier for you to catch runtime problems in your code.
+<h2><a>Finalizers</a>
+</h2>
+<p><b>What it is</b>
+: Finalizers are a way to have a chunk of code executed when an object is garbage collected.
+</p>
+<p><b>Pros</b>
+: can be handy for doing cleanup, particularly of external resources.
+</p>
+<p><b>Cons</b>
+: there are no guarantees as to when a finalizer will be called, or even that it will be called at all.
+</p>
+<p><b>Decision</b>
+: we don't use finalizers. In most cases, you can do what you need from a finalizer with good exception handling. If you absolutely need it, define a close() method (or the like) and document exactly when that method needs to be called. See InputStream for an example. In this case it is appropriate but not required to print a short log message from the finalizer, as long as it is not expected to flood the logs.
+</p>
+<p>The one exception is it is OK to write a finalizer if all it does is make calls to X.assertTrue().
+</p>
+<h2><a>Imports</a>
+</h2>
+<h3>
+Wildcards in imports
+</h3>
+<p><b>What it is</b>
+: When you want to use class Bar from package foo,there are two possible ways to import it:
+</p>
+<ol><li>import foo.*;
+</li>
+<li>import foo.Bar;
+</li>
+</ol>
+<p><b>Pros of #1</b>
+: Potentially reduces the number of import statements.
+</p>
+<p><b>Pros of #2</b>
+: Makes it obvious what classes are actually used. Makes code more readable for maintainers.
+</p>
+<p><b>Decision</b>
+:Use style #2 for importing all Android code. An explicit exception is made for java standard libraries (java.util.*, java.io.*, etc.) and unit test code (junit.framework.*).
+</p>
+<h2><a>Comments/Javadoc</a>
+</h2>
+<p>Every file should have a copyright statement at the top. Then a package statement and import statements should follow, each block separated by a blank line. And then there is the class or interface declaration. In the Javadoc comments, describe what the class or interface does.
+</p>
+<pre>/*<br>* Copyright (C) 2007 The Android Open Source Project <br>*<br>* Licensed under the Apache License, Version 2.0 (the "License");<br>* you may not use this file except in compliance with the License.<br>* You may obtain a copy of the License at <br>*<br>*      http://www.apache.org/licenses/LICENSE-2.0<br>*<br>* Unless required by applicable law or agreed to in writing, software <br>* distributed under the License is distributed on an "AS IS" BASIS,<br>* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.<br>* See the License for the specific language governing permissions and <br>* limitations under the License.<br>*/<br><br>package com.android.internal.foo;<br><br>import android.os.Blah;<br>import android.view.Yada;<br><br>import java.sql.ResultSet;<br>import java.sql.SQLException;<br><br>/**<br>* Does X and Y and provides an abstraction for Z.<br>*/<br>public class Foo {<br>...<br>}<br></pre>
+<p>Every class and nontrivial public method you write <b>must</b>
+contain a Javadoc comment with at least one sentence describing what the class or method does. This sentence should start with a 3rd person descriptive verb. Examples:
+</p>
+<pre>/** Returns the correctly rounded positive square root of a double value. */<br>static double sqrt(double a) {<br>}<br><br>/**<br>* Constructs a new String by converting the specified array of <br>* bytes using the platform's default character encoding.<br>*/<br>public String(byte[] bytes) {<br>}<br></pre>
+<p>You do not need to write Javadoc for trivial get and set methods such as setFoo() if all your Javadoc would say is "sets Foo". If the method does something more complex (such as enforcing a constraint or having an important side effect), then you must document it. And if it's not obvious what the property "Foo" means, you should document it.
+</p>
+<p>Every method you write, whether public or otherwise, would benefit from Javadoc. Public methods are part of an API and therefore require Javadoc.
+</p>
+Android does not currently enforce a specific style for writing Javadoc comments, but you <b>should</b>
+follow the <a href="http://java.sun.com/j2se/javadoc/writingdoccomments/">Sun Javadoc conventions</a>
+.
+<h2><a>Short methods</a>
+</h2>
+To the extent that it is feasible, methods should be kept small and focused. It is, however, recognized that long methods are sometimes appropriate, so no hard limit is placed on method length. If a method exceeds 40 lines or so, think about whether it can be broken up without harming the structure of the program.
+<h2><a>Local variables</a>
+</h2>
+The scope of local variables should be kept to a minimum (<i>Effective Java</i>
+Item 29). By doing so, you increase the readability and maintainability of your code and reduce the likelihood of error. Each variable should be declared in the innermost block that encloses all uses of the variable.
+<p>Local variables should be declared at the point they are first used. Nearly every local variable declaration should contain an initializer. If you don't yet have enough information to initialize a variable sensibly, you should postpone the declaration until you do.
+</p>
+<p>One exception to this rule concerns try-catch statements. If a variable is initialized with the return value of a method that throws a checked exception, it must be initialized inside a try block. If the value must be used outside of the try block, then it must be declared before the try block, where it cannot yet be sensibly initialized:
+</p>
+<pre>// Instantiate class cl, which represents some sort of Set <br>Set s = null;<br>try {<br>s = (Set) cl.newInstance();<br>} catch(IllegalAccessException e) {<br>throw new IllegalArgumentException(cl + " not accessible");<br>} catch(InstantiationException e) {<br>throw new IllegalArgumentException(cl + " not instantiable");<br>}<br><br>// Exercise the set <br>s.addAll(Arrays.asList(args));<br></pre>
+<p>But even this case can be avoided by encapsulating the try-catch block in a method:
+</p>
+<pre>Set createSet(Class cl) {<br>// Instantiate class cl, which represents some sort of Set <br>try {<br>return (Set) cl.newInstance();<br>} catch(IllegalAccessException e) {<br>throw new IllegalArgumentException(cl + " not accessible");<br>} catch(InstantiationException e) {<br>throw new IllegalArgumentException(cl + " not instantiable");<br>}<br>}<br>...<br>// Exercise the set <br>Set s = createSet(cl);<br>s.addAll(Arrays.asList(args));<br></pre>
+Loop variables should be declared in the for statement itself unless there is a compelling reason to do otherwise:
+<pre>for (int i = 0; i n; i++) {<br>doSomething(i);<br>}<br><br>for (Iterator i = c.iterator(); i.hasNext(); ) {<br>doSomethingElse(i.next());<br>}<br><br><br></pre>
+<h2><a>Imports</a>
+</h2>
+The ordering of import statements is:Android importsImports from third parties (com, junit, net, org)<br>java and javax
+<p>To exactly match the IDE settings, the imports should be:
+</p>
+Alphabetical within each grouping.<br>Capital letters are considered to come before lower case letter (e.g. Z before a).There should be a blank line between each major grouping (android, com, junit, net, org, java, javax).
+<h4>
+Why?
+</h4>
+<p>Originally there was no style requirement on the ordering. This meant that the IDE's were either always changing the ordering, or IDE developers had to disable the automatic import management features and maintain the imports by hand. This was deemed bad. When java-style was asked, the preferred styles were all over the map. It pretty much came down to our needing to "pick an ordering and be consistent." So we chose a style, updated the javaguide and made the IDE's obey it. We expect that as IDE users work on the code, the imports in all of the packages will end up matching this pattern without any extra engineering effort.
+</p>
+<p>The style chosen such that:
+</p>
+The imports people want to look at first tend to be at the top (android)The imports people want to look at least tend to be at the bottom (java)Humans can easily follow the styleThe IDE's can follow the style
+<h3>
+What about static imports?
+</h3>
+The use and location of static imports have been mildly controversial issues. Some people would prefer static imports to be interspersed with the remaining imports, some would prefer them reside above or below all other imports. Additinally, we have not yet come up with a way to make all IDEs use the same ordering.
+<p>Since most people consider this a low priority issue, just use your judgement and please be consistent.
+</p>
+
+<h2><a>Indentation</a>
+</h2>
+<p>We use 4 space indents for blocks. We never use tabs. When in doubt, be consistent with code around you.
+</p>
+<p>We use 8 space indents for line wraps, including function calls and assignments. For example, this is correct:
+</p>
+<pre>Instrument i <br>= someLongExpression(that, wouldNotFit, on, one, line);</pre>
+and this is not correct:
+<pre>Instrument i <br>= someLongExpression(that, wouldNotFit, on, one, line);</pre>
+<h2><a>Field Names</a>
+</h2>
+<ul><li>Non-public, non-static field names start with m.
+</li>
+<li>Static field names start with s.
+</li>
+<li>Other fields start with a lower case letter.
+</li>
+<li>Public static final fields (constants) are ALL_CAPS_WITH_UNDERSCORES.
+</li>
+</ul>
+<p>For example:
+</p>
+<pre>public class MyClass {<br>public static final int SOME_CONSTANT = 42;<br>public int publicField;<br>private static MyClass sSingleton;<br>int mPackagePrivate;<br>private int mPrivate;<br>protected int mProtected;<br>}</pre>
+<h2><a>Braces</a>
+</h2>
+<p>Braces do not go on their own line; they go on the same line as the code before them. So:
+</p>
+<pre>class MyClass {<br>int func() {<br>if (something) {<br>// ...<br>} else if (somethingElse) {<br>// ...<br>} else {<br>// ...<br>}<br>}<br>}<br></pre>
+<p>We require braces around the statements for a conditional. Except, if the entire conditional (the condition and the body) fit on one line, you may (but are not obligated to) put it all on one line. That is, this is legal:
+</p>
+<pre>if (condition) {<br>body; // ok <br>}<br>if (condition) body; // ok</pre>
+<p>but this is still illegal:
+</p>
+<pre>if (condition)<br>body; // bad <br></pre>
+<h2><a>Line length</a>
+</h2>
+<p>Each line of text in your code should be at most 100 characters long.
+</p>
+<p>There has been lots of discussion about this rule and the decision remains that 100 characters is the maximum.
+</p>
+<p>Exception: if a comment line contains an example command or a literal URL longer than 100 characters, that line may be longer than 100 characters for ease of cut and paste.
+</p>
+<p>Exception: import lines can go over the limit because humans rarely see them. This also simplifies tool writing.
+</p>
+<h2>
+Java 1.5 Annotations
+</h2>
+<p>Annotations should precede other modifiers for the same language element. Simple marker annotations (e.g. @Override) can be listed on the same line with the language element. If there are multiple annotations, or parameterized annotations, they should each be listed one-per-line in alphabetical order.
+</p>
+<p>Android -standard practices for the three predefined annotations in Java 1.5's are:
+</p>
+@DeprecatedThe @Deprecated annotation must be used whenever the use of the annotated element is discouraged. If you use the @Deprecated annotation, you must also have a @deprecated Javadoc tag and it should name an alternate implementation. In addition, remember that a @Deprecated method is <b>still</b>
+supposed to work.
+<p>If you see old code that has a @deprecated Javadoc tag, please add the @Deprecated annotation.
+</p>
+@OverrideThe @Override annotation must be used whenever a method overrides the declaration or implementation from a super-class.
+<p>For example, if you use the {@inheritdocs} Javadoc tag, and derive from a class (not an interface), you must also annotate that the method @Overrides the parent class's method.
+</p>
+@SuppressWarningsThe @SuppressWarnings annotation should only be used under circumstances where it is impossible to eliminate a warning. If a warning passes this "impossible to eliminate" test, the@SuppressWarnings annotation <b>must</b>
+be used, so as to ensure that all warnings reflect actual problems in the code.
+<p>When a @SuppressWarnings annotation is necessary, it must be prefixed with a TODO comment that explains the "impossible to eliminate" condition. This will normally identify an offending class that has an awkward interface. For example:
+</p>
+<pre>// TODO: The third-party class com.third.useful.Utility.rotate() needs generics <br>@SuppressWarnings({"generic-cast"})<br>ListStringblix = Utility.rotate(blax);<br></pre>
+When a @SuppressWarnings annotation is required, the code should be refactored to isolate the software elements where the annotation applies.
+<h2><a>Acronyms in names</a>
+</h2>
+<p>Treat acronyms and abbreviations as words. The names are much more readable:
+</p>
+
+<table><tbody><tr><td>Good
+</td>
+<td>Bad
+</td>
+</tr>
+<tr><td>XmlHttpRequest</td>
+<td>XMLHTTPRequest
+</td>
+</tr>
+<tr><td>getCustomerId</td>
+<td>getCustomerID
+</td>
+</tr>
+</tbody>
+</table>
+
+<p>This style rule also applies when an acronym or abbreviation is the entire name:
+</p>
+
+<table><tbody><tr><td>Good
+</td>
+<td>Bad
+</td>
+</tr>
+<tr><td>class Html</td>
+<td>class HTML
+</td>
+</tr>
+<tr><td>String url;</td>
+<td>String URL;
+</td>
+</tr>
+<tr><td>long id;</td>
+<td>long ID;
+</td>
+</tr>
+</tbody>
+</table>
+
+<p>Both the JDK and the Android code bases are very inconsistent with regards to acronyms, therefore, it is virtually impossible to be consistent with the code around you. Bite the bullet, and treat acronyms as words.
+</p>
+<p>For further justifications of this style rule, see <i>Effective Java</i>
+Item 38 and <i>Java Puzzlers</i>
+Number 68.
+</p>
+<h2><a>TODO style</a>
+</h2>
+<p>Use TODO comments for code that is temporary, a short-term solution, or good-enough but not perfect.
+</p>
+<p>TODOs should include the string TODO in all caps, followed by a colon:
+</p>
+<pre>// TODO: Remove this code after the UrlTable2 has been checked in.<br><br>// TODO: Change this to use a flag instead of a constant.</pre>
+<p>If your TODO is of the form "At a future date do something" make sure that you either include a very specific date ("Fix by November 2005") or a very specific event ("Remove this code after all production mixers understand protocol V7.").
+</p>
+<h2>
+Consistency
+</h2>
+<p>Our parting thought: BE CONSISTENT. If you're editing code, take a few minutes to look at the code around you and determine its style. If they use spaces around their if clauses, you should too. If their comments have little boxes of stars around them, make your comments have little boxes of stars around them too.
+</p>
+<p>The point of having style guidelines is to have a common vocabulary of coding, so people can concentrate on what you're saying, rather than on how you're saying it. We present global style rules here so people know the vocabulary. But local style is also important. If code you add to a a file looks drastically different from the existing code around it, it throws readers out of their rhythm when they go to read it. Try to avoid this.
+</p>
+<h2><a>Logging</a>
+</h2>
+<p>While logging is necessary it has a significantly negative impact on performance and quickly loses its usefulness if it's not kept reasonably terse. The logging facilities provides five different levels of logging. Below are the different levels and when and how they should be used.
+</p>
+
+<ul><li><b>ERROR:</b>
+This level of logging should be used when something fatal has happened, i.e. something that will have user-visible consequences and won't be recoverable without explicitly deleting some data, uninstalling applications, wiping the data partitions or reflashing the entire phone (or worse). This level is always logged. Issues that justify some logging at the ERROR level are typically good candidates to be reported to a statistics-gathering server.
+</li>
+<li><b>WARNING:</b>
+This level of logging should used when something serious and unexpected happened, i.e. something that will have user-visible consequences but is likely to be recoverable without data loss by performing some explicit action, ranging from waiting or restarting an app all the way to re-downloading a new version of an application or rebooting the device. This level is always logged. Issues that justify some logging at the WARNING level might also be considered for reporting to a statistics-gathering server.
+</li>
+<li><b>INFORMATIVE:</b>
+This level of logging should used be to note that something interesting to most people happened, i.e. when a situation is detected that is likely to have widespread impact, though isn't necessarily an error. Such a condition should only be logged by a module that reasonably believes that it is the most authoritative in that domain (to avoid duplicate logging by non-authoritative components). This level is always logged.
+</li>
+<li><b>DEBUG:</b>
+This level of logging should be used to further note what is happening on the device that could be relevant to investigate and debug unexpected behaviors. You should log only what is needed to gather enough information about what is going on about your component. If your debug logs are dominating the log then you probably should be using verbose logging. This level will be logged, even on release builds, and is required to be surrounded by an if (LOCAL_LOG) or if (LOCAL_LOGD) block, where LOCAL_LOG[D] is defined in your class or subcomponent, so that there can exist a possibility to disable all such logging. There must therefore be no active logic in an if (LOCAL_LOG) block. All the string building for the log also needs to be placed inside the if (LOCAL_LOG) block. The logging call should not be re-factored out into a method call if it is going to cause the string building to take place outside of the if (LOCAL_LOG) block. There is some code that still says if (localLOGV). This is considered acceptable as well, although the name is nonstandard.
+</li>
+<li><b>VERBOSE:</b>
+This level of logging should be used for everything else. This level will only be logged on debug builds and should be surrounded by if (LOCAL_LOGV) block (or equivalent) so that it can be compiled out by default. Any string building will be stripped out of release builds and needs to appear inside the if (LOCAL_LOGV) block.
+</li>
+</ul>
+<p><i>Note:</i>
+Within a given module, other than at the VERBOSE level, an error should only be reported once if possible: within a single chain of function calls within a module, only the innermost function should return the error, and callers in the same module should only add some logging if that significantly helps to isolate the issue.
+</p>
+<p><i>Note:</i>
+In a chain of modules, other than at the VERBOSE level, when a lower-level module detects invalid data coming from a higher-level module, the lower-level module should only log this situation to the DEBUG log, and only if logging provides information that is not otherwise available to the caller. Specifically, there is no need to log situations where an exception is thrown (the exception should contain all the relevant information), or where the only information being logged is contained in an error code. This is especially important in the interaction between the framework and applications, and conditions caused by third-party applications that are properly handled by the framework should not trigger logging higher than the DEBUG level. The only situations that should trigger logging at the INFORMATIVE level or higher is when a module or application detects an error at its own level or coming from a lower level.
+</p>
+<p><i>Note:</i>
+When a condition that would normally justify some logging is likely to occur many times, it can be a good idea to implement some rate-limiting mechanism to prevent overflowing the logs with many duplicate copies of the same (or very similar) information.
+</p>
+<p><i>Note:</i>
+Losses of network connectivity are considered common and fully expected and should not be logged gratuitously. A loss of network connectivity that has consequences within an app should be logged at the DEBUG or VERBOSE level (depending on whether the consequences are serious enough and unexpected enough to be logged in a release build).
+</p>
+<p><i>Note:</i>
+A full filesystem on a filesystem that is acceessible to or on behalf of third-party applications should not be logged at a level higher than INFORMATIVE.
+</p>
+<p><i>Note:</i>
+Invalid data coming from any untrusted source (including any file on shared storage, or data coming through just about any network connections) is considered expected and should not trigger any logging at a level higher then DEBUG when it's detected to be invalid (and even then logging should be as limited as possible).
+</p>
+<p><i>Note:</i>
+Keep in mind that the '+' operator, when used on Strings, implicitly creates a StringBuilder with the default buffer size (16 characters) and potentially quite a few other temporary String objects, i.e. that explicitly creating StringBuilders isn't more expensive than relying on the default '+' operator (and can be a lot more efficient in fact). Also keep in mind that code that calls Log.v() is compiled and executed on release builds, including building the strings, even if the logs aren't being read.
+</p>
+<p><i>Note:</i>
+Any logging that is meant to be read by other people and to be available in release builds should be terse without being cryptic, and should be reasonably understandable. This includes all logging up to the DEBUG level.
+</p>
+<p><i>Note:</i>
+When possible, logging should be kept on a single line if it makes sense. Line lengths up to 80 or 100 characters are perfectly acceptable, while lengths longer than about 130 or 160 characters (including the length of the tag) should be avoided if possible.
+</p>
+<p><i>Note:</i>
+Logging that reports successes should never be used at levels higher than VERBOSE.
+</p>
+<p><i>Note:</i>
+Temporary logging that is used to diagnose an issue that's hard to reproduce should be kept at the DEBUG or VERBOSE level, and should be enclosed by if blocks that allow to disable it entirely at compile-time.
+</p>
+<p><i>Note:</i>
+Be careful about security leaks through the log. Private information should be avoided. Information about protected content must definitely be avoided. This is especially important when writing framework code as it's not easy to know in advance what will and will not be private information or protected content.
+</p>
+<p><i>Note:</i>
+System.out.println() (or printf() for native code) should never be used. System.out and System.err get redirected to /dev/null, so your print statements will have no visible effects. However, all the string building that happens for these calls still gets executed.
+</p>
+<p><i>Note:</i>
+<b>The golden rule of logging is that your logs may not unnecessarily push other logs out of the buffer, just as others may not push out yours.</b>
+</p>
+<h2>
+Javatests Style Rules
+</h2>
+
+<h2><a>Naming test methods</a>
+</h2>
+<a>When naming test methods, you can use an underscore to seperate what is being tested from the specific case being tested. This style makes it easier to see exactly what cases are being tested.</a>
+<p><a>Example:</a>
+</p>
+<pre><a>testMethod_specificCase1 <br>testMethod_specificCase2</a>
+</pre>
+
+<pre><a>void testIsDistinguishable_protanopia() {<br>ColorMatcher colorMatcher = new ColorMatcher(PROTANOPIA)<br>assertFalse(colorMatcher.isDistinguishable(Color.RED, Color.BLACK))<br>assertTrue(colorMatcher.isDistinguishable(Color.X, Color.Y))<br>}</a>
+</pre>
+</div>
+</div>
+</div>
diff --git a/pdk/docs/source/download.jd b/pdk/docs/source/download.jd
new file mode 100644
index 0000000..065a708
--- /dev/null
+++ b/pdk/docs/source/download.jd
@@ -0,0 +1,303 @@
+page.title=Get Android Source Code
+doc.type=source
+@jd:body
+<div><br>This document describes how to set up your local work environment, how to use Repo to get the Android files, and how to build the files on your machine.<br><br>Related reading:<br></div>
+<ul><li>For an overview of the entire code-review and code-update process, see
+<a href="{@docRoot}source/life-of-a-patch.html">Life of a Patch</a>
+.</li>
+<li>For reference details about Repo, see <a href="{@docRoot}source/git-repo.html">Using Repo and Git</a>
+.<br></li>
+</ul>
+<h2>
+What's in the source?</h2>
+<div>To see snapshots and histories of the files available in the public Android repositories, visit the <a href="http://android.git.kernel.org/">GitWeb</a>
+web interface.</div>
+<div></div>
+<div>The source is approximentely 2.1GB in size.You will need 6GB free to complete the build.<br><br></div>
+<h2>
+Setting up your machine</h2>
+<div>To build the Android source files, you will need to use Linux or Mac OS. Building under Windows is not currently supported.</div>
+<div><br></div>
+<h3>
+Linux</h3>
+The Android build is routinely tested on recent versions of Ubuntu (6.06 and later), but reports of successes or failures on other distributions are welcome.<br><h4>
+Ubuntu Linux (32-bit x86)</h4>
+<div>To set up your Linux development environment, make sure you have the following:</div>
+<div><div><div><ul><li>Required Packages:</li>
+<ul><li>Git 1.5.4 or newer <span>and the GNU Privacy Guard.<br></span>
+</li>
+</ul>
+</ul>
+</div>
+</div>
+</div>
+</div>
+<div><div><div><div><ul><ul><li>JDK 5.0, update 12 or higher.Java 6 is not supported, because of incompatibilities with @Override.<br></li>
+</ul>
+</ul>
+</div>
+</div>
+</div>
+</div>
+<div><div><div><div><ul><ul><li><span>flex, bison, gperf, libsdl-dev, libesd0-dev, libwxgtk2.6-dev (optional), build-essential, zip, curl.</span>
+</li>
+</ul>
+</ul>
+</div>
+</div>
+</div>
+</div>
+<blockquote><span>$ sudo apt-get install</span>
+<span>git-core gnupg</span>
+<span>sun-java5-jdk</span>
+<span>flex bison gperf <span>libsdl-dev libesd0-dev</span>
+libwxgtk2.6-dev build-essential zip <span>curl libncurses5-dev zlib1g-dev <br></span>
+</span>
+</blockquote>
+<div><div><div><div><ul><li><span><span>You might also want Valgrind, a tool that will help you find memory leaks, stack corruption, array bounds overflows, etc.</span>
+</span>
+</li>
+</ul>
+</div>
+</div>
+</div>
+</div>
+<blockquote><div><span>$ sudo apt-get install valgrind <br></span>
+</div>
+</blockquote>
+<ul><li><span><span>Intrepid (</span>
+</span>
+8.10) users may need a newer version of libreadline:</li>
+</ul>
+<div>$ sudo apt-get install lib32readline5-dev <br></div>
+</div>
+<div><div><div><div><div><div><h4>
+Ubuntu Linux (64-bit x86)</h4>
+This has not been as well tested. Please send success or failure reports to <a href="mailto:android-porting@googlegroups.com">android-porting@googlegroups.com</a>
+.</div>
+<div><br></div>
+<div>The Android build requires a 32-bit build environment as well as some other tools:<br></div>
+<div><ul><li>Required Packages:</li>
+<ul><li>Git, JDK, flex, and the other packages as listed above in the i386 instructions:<span><br></span>
+</li>
+<li>JDK 5.0, update 12 or higher.Java 6 is not supported, because of incompatibilities with @Override.</li>
+<li>Pieces from the 32-bit cross-building environment</li>
+<li>X11 development <br></li>
+</ul>
+</ul>
+</div>
+</div>
+</div>
+</div>
+<blockquote><span><span>$</span>
+sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl</span>
+sun-java5-jdk <span><span>zlib1g-dev</span>
+</span>
+gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev</blockquote>
+<ul><li>Set the system to use the right version of java by default:<br><br>$sudo update-java-alternatives -sjava-1.5.0-sun <br></li>
+</ul>
+<ul><li>X11: Ubuntu doesn't have packages for the X11 libraries, but that can be worked around with the following command:<br><br>$ sudo ln -s /usr/lib32/libX11.so.6 /usr/lib32/libX11.so <br><br></li>
+</ul>
+<div><div><div><div><div><h4>
+Running Linux in a virtual machine</h4>
+If you are running Linux in a virtual machine, you will need at least 1.5GB of RAM and 10GB or more of disk space in order to build the Android tree.<br><h4>
+Other Linux</h4>
+<p>There's no reason why Android cannot be built on non-Ubuntu systems. Please send any success or failure reports to <a href="mailto:android-porting@googlegroups.com">android-porting@googlegroups.com</a>
+<span>. In general you will need:</span>
+</p>
+<ul><li>Python 2.4, which you can <a href="http://www.python.org/download/">download from python.org</a>.</li>
+<li>JDK 5.0, update 12 or higher, which you can <a href="http://java.sun.com/javase/downloads/">download from java.sun.com</a>. Java 6 is not supported, because of incompatibilities with @Override.</li>
+<li>Git 1.5.4 or newer. You can find it at <a href="http://git.or.cz/">http://git.or.cz/</a>.</li>
+</ul>
+<p>Anything missing from this list? Please let us know!</p>
+<h4>
+<span><br></span>
+</h4>
+</div>
+<div><h3>
+Mac OS <br></h3>
+</div>
+<div><p><span>Requirements:</span>
+</p>
+<ul><li><span>To build the Android files in a Mac OS environment, you need an Intel/x86 machine running MacOS 10.4 ("Tiger") or 10.5 ("Leopard"). At the moment MacOS 10.6 ("Snow Leopard") is not supported. The Android build system and tools do not support the obsolete PowerPC architecture.</span>
+</li>
+<li><span>Android must be built on a case-sensitive file system.<br></span>
+</li>
+<ul><li>We recommend that you build Android on a partition that has been formatted with the "Case-sensitive Journaled HFS+" file system:</li>
+<ul><li>A case-sensitive file system is required because the sources contain files that differ only in case.</li>
+<li>Journaled systems are more robust. (This is optional, but recommended.)</li>
+<li>HFS+ is required to successfully build Mac OS applications such as the Android Emulator for OS X.</li>
+</ul>
+<li>If you want to avoid partitioning/formatting your hard drive, you can use a case-sensitive disk image instead.</li>
+<ul><li>To create the image:<br><ul><li>launch /Applications/Utilities/Disk Utility</li>
+<li>select "New Image"</li>
+<li>size: 8 GB (this will work, but you can choose more if you want to)</li>
+<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>
+<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>
+</ul>
+<ul></ul>
+To set up your Mac OS development environment, follow these steps:<br><ol><li>Install the XCode version 2.4 or later from <a href="http://developer.apple.com/">http://developer.apple.com</a>. We recommend version 3.0 or newer.<br></li>
+<li>Install MacPorts. To do this:</li>
+<ol><li>Download the tar file from <a href="http://www.macports.org/">http://www.macports.org/</a> and untar the files.</li>
+<li>Run the following:<span><br>$ ./configure <br></span>
+<span>$</span>
+<span>make <br></span>
+<span>$</span>
+<span>sudo make install</span>
+</li>
+<li>Make sure that /opt/local/bin is in your path before /usr/bin. by running <br>$ echo $PATH <br>If you don't see /opt/local/bin, edit $HOME/.bash_profile and add the line <br>export PATH=/opt/local/bin:$PATH <br>(or the equivalent for other shells) after any other PATH-related lines.<span>To verify that your path is now correct, o</span>
+pen a new terminal and <span>run</span>
+echo $PATH <span>again</span>
+.</li>
+<li>Ask MacPorts to update itself:<br><span></span>
+<span>$</span>
+<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>
+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>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>
+</ol>
+</div>
+</div>
+</div>
+<div><br></div>
+<h2>
+Installing Repo <br></h2>
+<div><p>Repo is a tool that makes it easier to work with Git in the context of
+Android. For more information about Repo, see <a
+href="{@docRoot}source/git-repo.html">Using Repo and Git</a>
+.<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>
+</span>
+</li>
+<li><span>Download thereposcript and make sure it is executable:</span>
+<br>$ curl http://android.git.kernel.org/repo~/bin/repo <div>$ chmod a+x ~/bin/repo</div>
+</li>
+</ol>
+</div>
+<div><p><br></p>
+<h2>
+Initializing a Repo client <br></h2>
+</div>
+<div><ol><li><span>Create an empty directory to hold your working files:</span>
+<span><br></span>
+<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>
+<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>
+<br><span>$ repo init</span>
+-u git://android.git.kernel.org/platform/manifest.git -b cupcake <br></li>
+</ul>
+<li><span>When prompted, configure Repo with your real name and email address. If you plan to submit code, use an email address that is associated with a <a href="https://www.google.com/accounts">Google account</a>
+.</span>
+<br></li>
+</ol>
+<span><span>A successful initialization will end with a message such as</span>
+<br><span>repo</span>
+initialized in /mydroid</span>
+<br><span><span><br>Your client directory should now contain a.repodirectory where files such as the manifest will be kept.</span>
+<br><br></span>
+<span><span><b>What will my name and email be used for?</b>
+<br></span>
+<span><br>To use the Gerrit code-review tool,</span>
+<span>you will need an email address that is connected with a <a href="http://www.google.com/accounts">registered Google account</a>
+(which does not have to be a Gmail address). Make sure this is</span>
+<span>a live address</span>
+<span>at which you can receive messages</span>
+<span>.</span>
+<span>The real name that you provide here will show up in attributions for your code submissions.</span>
+</span>
+<br></div>
+<span><p><b>What is a manifest file?</b>
+</p>
+<p><span>The Android source files are divided among a number of different repositories.</span>
+<span>A manifest</span>
+<span>file contains a mapping of where the files from these repositories will be placed within your working directory w</span>
+<span>hen you synchronize your files.<br></span>
+</p>
+<p><span><br></span>
+</p>
+</span>
+<h2>
+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>
+<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
+directory under their project names.</span>
+</span>
+<br></div>
+<span><h2>
+<br></h2>
+<h2>
+Verifying Git Tags</h2>
+<span>Load the following public key into your GnuPG key database.The key is used to sign annotated tags that represent releases.</span>
+<br><br></span>
+<span>$ gpg --import <br><br></span>
+<span><span>then paste the key(s) below, and press Control-D to end the input and process the keys.</span>
+After importing the keys, you can verify any tag with <br><br></span>
+<span>$ git tag -v <i>tagname</i>
+</span>
+<span><br><br><b><u>key 9AB10E78: "The Android Open Source Projectinitial-contribution@android.com"</u>
+</b>
+<br></span>
+<pre>-----BEGIN PGP PUBLIC KEY BLOCK-----<br>Version: GnuPG v1.4.2.2 (GNU/Linux)<br><br>mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV <br>lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7<br>8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD <br>u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z <br>wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq <br>/HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5<br>jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4<br>MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9<br>b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJv <br>aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5k <br>cm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX <br>gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI <br>2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAl <br>QN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806Up <br>hisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbk <br>C2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMX <br>LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+<br>OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M <br>pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s <br>KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb <br>N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA <br>vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo <br>G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ <br>hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l <br>EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM=<br>=Wi5D <br>-----END PGP PUBLIC KEY BLOCK-----<br></pre>
+<span><br><h2>
+Building the code</h2>
+<span>To build the files, runmakefrom within your working directory:</span>
+<br><span>$ cd ~/mydroid</span>
+<span><br>$ make</span>
+<br></span>
+<p>If your build fails, complaining about a missing "run-java-tool", try setting the ANDROID_JAVA_HOME env var to $JAVA_HOME before making.E.g.,</p>
+<p>$ export ANDROID_JAVA_HOME=$JAVA_HOME</p>
+<h2>
+Using an IDE</h2>
+<ul><li><a href="{@docRoot}source/using-eclipse.html">Using Eclipse</a>
+for Android platform development <br></li>
+</ul>
+<h2>
+Troubleshooting</h2>
+<p><span><b>ImportError: No module na</b>
+<span><b>med</b>
+</span>
+<span><b>readline</b>
+</span>
+<b><br></b>
+</span>
+</p>
+<p><span>Mac users getting this should install Python 2.5.2.</span>
+</p>
+<p><span>Linux users that installed Python from source, make sure the dependencies for libreadline are installed, and rebuild Python.</span>
+</p>
+<span><h2>
+What's next?</h2>
+</span>
+<span>To learn about reporting an issue and searching previously reported issues,</span>
+<span>see</span>
+<a href="{@docRoot}source/report-bugs.html">Report bugs</a>
+<span>.</span>
+<span>For information about editing the files and uploading changes to the
+code-review server, see <a href="{@docRoot}source/submit-patches.html">Contribute</a>
+.</span>
+</div>
+</div>
+</div>
+</div>
diff --git a/pdk/docs/source/git-repo.jd b/pdk/docs/source/git-repo.jd
new file mode 100644
index 0000000..ac7fd37
--- /dev/null
+++ b/pdk/docs/source/git-repo.jd
@@ -0,0 +1,320 @@
+page.title=Using Repo and Git
+doc.type=source
+@jd:body
+<p>To work with the Android code, you will need to use both Git and Repo.<br></p>
+<ul><li><i>Git</i>
+is an open-source version-control system designed to handle very large projects that are distributed over multiple repositories. In the context of Android, we use Git for local operations such as local branching, commits, diffs, and edits.<br><br></li>
+<li><i>Repo</i>
+is a tool that we built on top of Git. Repo helps us manage the many Git repositories, does the uploads to our <a href="http://review.source.android.com/">revision control system</a>
+, and automates parts of the Android development workflow. Repo is not meant to replace Git, only to make it easier to work with Git in the context of Android. The repocommand is an executable Python script that you can put anywhere in your path.<i><br><br></i>
+In working with the Android source files, you will use Repo for across-network operations. For example, with a single Repo command you can download files from multiple repositories into your local working directory.
+</li>
+</ul>
+<h2>
+About Git
+</h2>
+<h3>
+Why Git?
+</h3>
+One of the challenges in setting up the Android project was figuring out how to best support the outside community--from the hobbiest community to large OEMs building mass-market consumer devices. We wanted components to be replaceable, and we wanted interesting components to be able to grow a life of their own outside of Android. We first chose a distributed revision control system, then further narrowed it down to Git.<br><h3>
+Already a Git user?
+</h3>
+In most situations, you can use Git instead of Repo, or mix Repo and Git
+commands to form complex commands. Using Repo for basic across-network
+operations will make your work much simpler, however.
+<br></div>
+<div><div><h2>
+Task reference <br></h2>
+The task list below shows a summary of how to do common Repo and Git tasks.
+For complete quick-start information and examples, see <a
+href="{@docRoot}source/download.html">Get source</a>
+.
+<h3>
+Installing Repo <br></h3>
+$ curl http://android.git.kernel.org/repo ~/bin/repo <div>$ chmod a+x ~/bin/repo</div>
+$ mkdir <i>working-directory-name</i>
+<br>$ cd <i>working-directory-name <br></i>
+$ repo init-u git://android.git.kernel.org/platform/manifest.git <br><br><h3>
+Synchronizing your client
+</h3>
+To synchronize the files for all available projects:<br>$ repo sync <br><br>To
+synchronize the files for selected projects:<br>$ repo sync <i>project1
+project2 ...</i>
+<i><br></i>
+<br><h3>
+Why use topic branches?
+</h3>
+Start a topic branch in your local work environment whenever you begin a change, for example when you begin work on a bug or new feature.<br><br>A topic branch is not a copy of the original files; it is a pointer to a particular commit. This makes creating local branches and switching among them a light-weight operation. By using branches, you canisolateone aspect of your work from the others. For an interesting article about using topic branches, see <a href="http://www.kernel.org/pub/software/scm/git/docs/howto/separating-topic-branches.txt">Separating topic branches</a>
+.
+<div><img src="{@docRoot}images/git-repo-0.png">
+</div>
+<br><br><h3>
+Creating topic branches
+</h3>
+To start a topic branch using Repo:<br>$ repo start <i>branchname</i>
+<br><br>To verify that your new branch was created:<br>$ repo status <br><br><h3>
+Using topic branches
+</h3>
+To assign the branch to a particular project:<br>$ repo start <i>branch</i>
+<i>name project</i>
+<br><br>To switch back and forth among branches that you have created in your local work environment:<br>$ git checkout <i>branchname</i>
+<br><br>To see a list of existing branches:<br>$ git branch <br>or...<br>$ repo branches <br><br>The name of the current branch will be preceded by an asterisk.<br><br></div>
+<div><i><b>Note:</b>
+<br></i>
+A bug might be causing repo sync to reset the local topic branch. If git branch shows * (no branch) after you run repo sync, then run git checkoutagain.<br></div>
+<div><br><h3>
+Viewing client status
+</h3>
+To list the state of your files:<br>$ repo status <br><br>To see uncommitted edits:<br>$ repo diff <br><br>Therepo diffcommand shows every local edit that you have made that would <i>not</i>
+go into the commit, if you were to commit right now.<br><br>To see every edit that would go into the commit if you were to commit right now, you need a Git command, git diff. Before running it, be sure you are down in the project directory:<br>$ cd ~/<i>workingdirectory</i>
+/<i>project</i>
+<br>$ git diff --cached <br><br><h3>
+Recovering sync conflicts
+</h3>
+If a repo sync shows sync conflicts:<br><ol><li>View the files that are unmerged (status code = U).
+</li>
+<li>Edit the conflict regions as necessary.
+</li>
+<li>Change into the relevant project directory, run git add and git commit for the files in question, and then "rebase" the changes. For example:<br>$ cd bionic <br>$ git add bionic/*<br>$ git commit <br>$ git rebase --continue <br><br></li>
+<li>When the rebase is complete start the entire sync again:<br>$ repo syncbionic <i>proj2</i>
+<i>proj3</i>
+<i>...</i>
+
+<i>projN</i>
+<br></li>
+</ol>
+<h3>
+Cleaning up your client files <br></h3>
+To update your local working directory after changes are merged in Gerrit:<br>$repo sync <br><br>To safely remove stale topic branches:<br>$ repo prune <br><br><h3>
+Deleting a client
+</h3>
+Deleting a client will <b>permanently delete</b>
+any changes you have not yet uploaded for review.Becauseall state information is stored in your client, you only need to delete the directory from your filesystem:<br><br>$ cd <i>~</i>
+<br>$ rm -rf <i>working-directory-name</i>
+<br><br><h3>
+Scripting common tasks
+</h3>
+You can use Repo to run the same program across all projects:<br><br>$ repo forall[<i>proj1</i>
+<i>proj2</i>
+<i>...</i>
+
+<i>projN</i>
+]-c '<i>echo $REPO_PROJECT $@</i>
+'[<i>arg1</i>
+<i>arg2</i>
+<i>...</i>
+
+<i>argN</i>
+]<br><br>The -c argument is evaluated through /bin/sh and any arguments after it are passed through as shell positional parameters.<br><br><h2>
+Repo command reference
+</h2>
+Repo usage takes the following form:<br>repo <i>command options</i>
+<br><br>Optional elements are shown in brackets[ ]. Once Repo is installed, you can get information about any command by running <br>repo help <i>command</i>
+<br><br><h3>
+init
+</h3>
+repo init -u <i>url</i>
+[<i>options</i>
+]<br><br><div>Installs Repo in the current directory. This creates a .repo/ directory that contains Git repositories for the Repo source code and the standard Android manifest files. The .repo/ directory also containsmanifest.xml, which is a symlink to the selected manifest in the .repo/manifests/ directory.<br><br>The -u argument specifies a URL from which to retrieve a manifest repository. For example:<br>$ repo init -u git://android.git.kernel.org/platform/manifest.git <br><br>To select a manifest file within the repository, use the -m option. (If no manifest name is selected, the default is default.xml.)For example:<br>$ repo init -ugit://android.git.kernel.org/platform/manifest.git-m dalkvik-plus.xml <br><br>To specify a revision, that is, a particular manifest-branch, use the -b option. For example:<br>$ repo init -ugit://android.git.kernel.org/platform/manifest.git-b release-1.0<br><br>To see other repo init options, run <br>$ repo help init <br><br><b>Note:</b>
+For all remaining Repo commands, the current working directory must either be the parent directory of .repo/ or a subdirectory of the parent directory.<br><br></div>
+<h3>
+sync
+</h3>
+repo sync [<i>project-list</i>
+]<br><br><div>Downloads new changes and updates the working files in your local environment. After a successful repo sync, the code in specified projects will be up to date with the code in the remote repository.<br><br>You can specify project-list as a list of names or a list of paths to local source directories for the projects:<br>repo sync [<i>proj1</i>
+<i>proj2</i>
+<i>...</i>
+
+<i>projN</i>
+]<br><br>If you run repo sync without any arguments, it will synchronize the files for all the projects.<br><br></div>
+<p><b>How Repo synchronization works</b>
+<br></p>
+<div>When you run repo sync, this is what happens:<br></div>
+<ol><li>If the project has never been synchronized, then repo sync is equivalent to git clone. All branches in the remote repository are copied to the local project directory.
+</li>
+<li>If the project has already been synchronized once, then repo sync is equivalent to:<br>git remote update <br>git rebase origin/<i>branch</i>
+<br>where <i>branch</i>
+is the currently checked-out branch in the local project directory. If the local branch is not tracking a branch in the remote repository, then no synchronization will occur for the project.<br><br>If the git rebase operation results in merge conflicts, you will need to use the normal Git commands (for example, git rebase --continue) to resolve the conflicts.<br></li>
+</ol>
+<div>The repo sync command also updates the private repositories in the .repo/ directory.<br></div>
+<br><h3>
+upload
+</h3>
+repo upload [<i>project-list</i>
+]<br><br><div>For the specified projects, Repo compares the local branches to the remote branches updated during the last repo sync. Repo will prompt you to select one or more of the branches that have not yet been uploaded for review.<br><br>After you select one or more branches, all commits on the selected branches are transmitted to Gerrit over an SSH connection.You will need to configure an SSH key to enable upload authorization.Visit <a href="http://review.source.android.com/Gerrit#settings,ssh-keys">SSH Keys</a>
+within the user settings panel to register your public keys with Gerrit.To enable password-less uploads, consider using ssh-agent on your client system.<br><br>When Gerrit receives the object data over its SSH server, it will turn each commit into a change so that reviewers can comment on each commit individually.<br><br>To combine several "checkpoint" commits together into a single commit, use git rebase -i before you run repo upload.<br><br>You can specify project-list as a list of names or a list of paths to local source directories for the projects:<br>repo upload [<i>proj1</i>
+<i>proj2</i>
+<i>...</i>
+
+<i>projN</i>
+]<br><br>If you run repo upload without any arguments, it will search all the projects for changes to upload.<br><br>To make edits to changes after they have been uploaded, you should use a tool likegit rebase -ior git commit --amend to update your local commits.<br><br>After your edits are complete:<br></div>
+<div><ol><li>Make sure the updated branch is the currently checked out branch.
+</li>
+<li>Use repo upload --replace <i>proj1</i>
+to open the change matching editor.
+</li>
+<li>For each commit in the series, enter the Gerrit change Id inside the brackets:<br></li>
+</ol>
+</div>
+<div># Replacing from branch foo <br>[ 3021 ] 35f2596c Refactor part of GetUploadableBranches to lookup one specific...<br>[ 2829 ] ec18b4ba Update proto client to support patch set replacments <br>[ 3022 ] c99883fe Teach 'repo upload --replace' how to add replacement patch se...<br># Insert change numbers in the brackets to add a new patch set.<br># To create a new change record, leave the brackets empty.<br><br>After the upload is complete the changes will have an additional Patch Set (e.g. Patch Set 2, Patch Set 3, ...).<br></div>
+<br><h3>
+diff
+</h3>
+repo diff [<i>project-list</i>
+]<br><br><div>Shows changes between commit and working tree.<br><br>You can specify project-list as a list of names or a list of paths to local source directories for the projects:<br>repo diff [<i>proj1</i>
+<i>proj2</i>
+<i>...</i>
+
+<i>projN</i>
+]<br><br>Options:<br>-h, --helpmeans show this help message and exit.<br></div>
+<br><h3>
+download <br></h3>
+repo download <i>target</i>
+<i>change</i>
+<br><br><div>Downloads the specified change into the specified local directory. (Added to Repo as of version 1.0.4.)<br><br>For example, to download <a href="http://review.source.android.com/1241">change 1241</a>
+into your platform/frameworks/base directory:<br>$ repo download platform/frameworks/base 1241<br><br>A"repo sync"should effectively remove any commits retrieved via "repo download".Or, you can check out the remote branch; e.g., "git checkout m/master".<br><br><b>Note:</b>
+As of Jan. 26, 2009, there is a mirroring lag of approximately 5 minutes between when a change is visible on the web in <a href="http://review.source.android.com/">Gerrit</a>
+and when repo download will be able to find it, because changes are actually downloaded off the git://android.git.kernel.org/ mirror farm. There will always be a slight mirroring lag as Gerrit pushes newly uploaded changes out to the mirror farm.
+</div>
+<br><h3>
+forall
+</h3>
+repo forall [<i>project-list</i>
+] -c <i>command</i>
+[<i>arg.</i>
+..]<br><br><div>Runs a shell command in each project.<br><br>You can specify project-list as a list of names or a list of paths to local source directories for the projects <br></div>
+<br><h3>
+help
+</h3>
+repo help [<i>command</i>
+]<br><br><div>Displays detailed help about a command.<br></div>
+<br><h3>
+prune <br></h3>
+repo prune [<i>project-list</i>
+]<br><br><div>Prunes (deletes) topics that are already merged.<br><br>You can specify project-list as a list of names or a list of paths to local source directories for the projects:<br>repo prune [<i>proj1</i>
+<i>proj2</i>
+<i>...</i>
+
+<i>projN</i>
+]<br></div>
+<br><h3>
+start
+</h3>
+repo start <i>newbranchname</i>
+[<i>project-list</i>
+]<br><br><div>Starts a new branch for development.<br><br>The <i>newbranchname</i>
+argument should provide a short description of the change you are trying to make to the projects.If you don't know, consider using the name default.<br><br>The <i>project-list</i>
+specifies which projects will participate in this topic branch. You can specify project-list as a list of names or a list of paths to local working directories for the projects:<br>repo start default [<i>proj1</i>
+<i>proj2</i>
+<i>...</i>
+
+<i>projN</i>
+]<br><br>"." is a useful shorthand for the project in the current working directory.<br></div>
+<br><h3>
+status
+</h3>
+repo status [<i>project-list</i>
+]<br><br><div>Shows the status of the current working directory. You can specify project-list as a list of names or a list of paths to local source directories for the projects:<br>repo status [<i>proj1</i>
+<i>proj2</i>
+<i>...</i>
+
+<i>projN</i>
+]<br><br>To see the status for only the current branch, run <br>repo status .<br><br>The status information will be listed by project. For each file in the project, a two-letter code is used:<br></div>
+<div><ul><li>In the left-most column, an uppercase letter indicates what is happening in the index (the staged files) when compared to the last committed state.<br><br></li>
+<li>In the next column, a lowercase letter indicates what is happening in the working directory when compared to the index (what is staged).
+</li>
+</ul>
+<table><tbody><tr><td><b>Character</b>
+</td>
+<td><b>Meaning</b>
+</td>
+</tr>
+<tr><td>A
+</td>
+<td>The file is added (brand new). Can only appear in the first column.<br></td>
+</tr>
+<tr><td>M or m <br></td>
+<td>The file already exists but has been modified in some way.
+</td>
+</tr>
+<tr><td>D or d <br></td>
+<td>The file has been deleted.<br></td>
+</tr>
+<tr><td>R
+</td>
+<td>The file has been renamed. Can only appear in the first column. The new name is also shown on the line.</td>
+</tr>
+<tr><td>C
+</td>
+<td>The file has been copied from another file. Can only appear in the first column. The source is also shown.
+</td>
+</tr>
+<tr><td>T
+</td>
+<td>Only the file's mode (executable or not) has been changed. Can only appear in the first column.
+</td>
+</tr>
+<tr><td>U
+</td>
+<td>The file has merge conflicts and is still unmerged. Can only appear in the first column.
+</td>
+</tr>
+<tr><td>-
+</td>
+<td>The file state is unmodified. A hyphen in <i>both</i>
+columns means this is a new file, unknown to Git. After you run git add on this file, repo status will show A-, indicating the file has been added.<br></td>
+</tr>
+</tbody>
+</table>
+<br>For example, if you edit the file main.py within the appeng project without staging the changes, then repo status might show <br><br>project appeng/<br>-mmain.py <br><br>If you go on to stage the changes to main.py by running git add, then repo status might show <br><br>project appeng/<br>M- main.py <br><br>If you then make further edits to the already-staged main.py and make edits to another file within the project, app.yaml, then repo status might show <br><br>project appeng/<br>-mapp.yaml <br>Mm main.py <br><br></div>
+<h2>
+Git and Repo cheatsheet
+</h2>
+Click on the cheatsheet to open it in a new window for easier printing.
+
+<div><img src="{@docRoot}images/git-repo-1.png">
+</div>
+
+<!--
+<h2>Additional Resources</h2>
+<h3>Resources for platform developers</h3> 
+Google I/O videos:
+<ul>
+  <li><a href="http://sites.google.com/site/io/an-introduction-to-android">Introduction to Android</a></li> 
+  <li><a href="http://sites.google.com/site/io/anatomy-physiology-of-an-android">Anatomy Physiology of an Android</a></li> 
+  <li><a href="http://sites.google.com/site/io/inside-the-android-application-framework">Inside the Android Application Framework</a></li> 
+  <li><a href="http://sites.google.com/site/io/dalvik-vm-internals">Dalvik VM Internals</a></li> 
+</ul> 
+ 
+Getting started with the Android source code:
+<ul>
+  <li><a href="http://source.android.com/download">Get source</a></li> 
+  <li><a href="http://source.android.com/submit-patches/code-style-guide">Code Style Guide</a></li> 
+</ul> 
+ 
+Repo and Git resources:
+<ul>
+  <li><a href="http://source.android.com/download/using-repo#TOC-Git-and-Repo-cheatsheet">Git and Repo cheat sheet</a></li> 
+  <li><a href="http://source.android.com/download/using-repo">Using Repo and Git</a></li> 
+  <li>The <a href="http://book.git-scm.com/">Git Community Book</a> maintained by Scott Chacon</li> 
+  <li><a href="http://git.or.cz/gitwiki/FrontPage">GitWiki</a></li> 
+  <li><a href="http://www.kernel.org/pub/software/scm/git/docs/">Git Manual Page</a></li> 
+  <li><a href="http://www.gitcasts.com/">GitCasts</a> (Git how-to videos)</li> 
+</ul> 
+ 
+Documentation on specific tasks:
+<ul>
+  <li><a href="http://source.android.com/documentation/building-for-dream">Building for an Android Developer Phone</a></li> 
+</ul> 
+-->
+
+<h2>
+<b>Terminology</b>
+</h2>
+<i>Staged</i>
+<i>changes</i>
+<br>Changes marked by git add for inclusion in the next commit's snapshot.<br><br><i>Commit <br></i>
+At intervals, you use git commit to save a snapshot of the staged files and a log message that describes the change.<br><br><i>Manifest</i>
+<br>A manifest file that contains a list of repositories and a mapping of where the files from these repositories will be located within your working directory. When you synchronize your files, the files contained in the repositories that are listed in the manifest will be pulled into your working directory.</div>
+</div>
+</div>
diff --git a/pdk/docs/source/index.jd b/pdk/docs/source/index.jd
new file mode 100644
index 0000000..230a0b3
--- /dev/null
+++ b/pdk/docs/source/index.jd
@@ -0,0 +1,35 @@
+page.title=Get Involved
+doc.type=source
+@jd:body
+<div>
+<p>Thanks for your interest in Android! Here are some ways you can get involved
+and help Google improve Android. For background on the Android project and our
+goals, check out the <a href="{@docRoot}about/philosophy.html">Project
+Philosophy page</a>.</p>
+
+<h2>Report Bugs</h2>
+<p>One of the easiest and most effective ways you can help improve Android is
+to file bugs. For more information, visit the <a
+href="{@docRoot}source/report-bugs.html">Reporting Bugs</a> page.</p>
+<p>Please note that we can't guarantee that any particular bug can be fixed in
+any particular release. To see what happens to your bug once you report it,
+read <a href="{@docRoot}source/life-of-a-bug.html">Life of a Bug</a>.</p>
+
+<h2>Develop Apps</h2>
+<p>We created Android so that all developers can distribute their applications
+to users on an open platform. One of the best ways you can help Android is to
+write cool apps that users love!</p>
+<p>To get started, visit <a
+href="http://developer.android.com/">developer.android.com</a>. This site
+provides the information and tools you need to write applications for
+compatible Android devices, using the SDK.</p>
+
+<h2>Contribute to the Code</h2>
+<p>Code is King. We'd love to review any changes you submit, so please check
+out the source, pick a bug or feature, and get coding.</p>
+<p>You can get started with  by learning about the <a
+href="{@docRoot}source/life-of-a-patch.html">Life of a Patch</a>, and by
+learning about <code>git</code>, <code>repo</code>, and other tools using the
+links to the left. If you need help along the way, you can join our <a
+href="{@docRoot}community/index.html">discussion groups.</a></p>
+</div>
diff --git a/pdk/docs/source/licenses.jd b/pdk/docs/source/licenses.jd
new file mode 100644
index 0000000..846a92a
--- /dev/null
+++ b/pdk/docs/source/licenses.jd
@@ -0,0 +1,85 @@
+page.title=Licenses
+doc.type=source
+@jd:body
+<div>
+<p>The Android Open Source Project uses a few <a
+href="http://www.opensource.org/">open source initiative</a> approved open
+source licenses to enable availability of source code and to accept
+contributions from individuals and corporations.</p>
+<h2>Android Open Source Project license</h2>
+<p>The preferred license for the Android Open Source Project is <a
+href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0</a>. Apache 2.0
+is a commercial and open source friendly open source license. The majority of
+the Android platform is licensed under the <a
+href="http://www.apache.org/licenses/">Apache 2.0 license</a>. While the
+project will strive to adhere to the preferred license, there may be
+exceptions which will be handled on a case-by-case basis. For example, the
+Linux kernel patches are under the GPLv2 license with system exceptions, which
+can be found on <a
+href="http://www.kernel.org/pub/linux/kernel/COPYING">kernel.org</a>.
+</p>
+<h2>Contributor License Grants</h2>
+<p>All <b>individual</b> contributors (that is, contributors making contributions
+only on their own behalf) of ideas, code, or documentation to the Android Open
+Source Project will be required to complete, sign, and submit an <a
+href="{@docRoot}source/cla-individual.html">Individual
+Contributor License Grant</a>. The grant can be executed online through the <a
+href="https://review.source.android.com/#settings,agreements">code review
+tool</a>. The agreement clearly defines the terms under which intellectual
+property has been contributed to the Android Open Source Project.This license
+is for your protection as a contributor as well as the protection of the
+project; it does not change your rights to use your own contributions for any
+other purpose.</p>
+<p>For a <b>corporation</b> (or other entity) that has assigned employees to
+work on the Android Open Source Project, a <a
+href="{@docRoot}source/cla-corporate.html">Corporate
+Contributor License Grant</a> is available. This version of the Grant allows a
+corporation to authorize contributions submitted by its designated employees
+and to grant copyright and patent licenses. Note that a Corporate Contributor
+License Grant does not remove the need for any developer to sign their own
+Individual Contributor License Grant as an individual, to cover any of their
+contributions which are <b><i>not</i></b> owned by the corporation signing the
+Corporate Contributor License Grant.
+</p>
+<p>Please note that we based our grants on the ones that the <a
+href="http://www.apache.org/">Apache Software Foundation</a> uses, which can
+be found on <a href="http://www.apache.org/licenses/">the Apache web site</a>.</p>
+<h2>Why Apache Software License?</h2>
+<p>We are sometimes asked why Apache Software License 2.0 is the preferred
+license for Android. For userspace (that is, non-kernel) software, we do in
+fact prefer ASL2.0 (and similar licenses like BSD, MIT, etc.) over other
+licenses such as LGPL.</p>
+<p>Android is about freedom and choice. The purpose of Android is promote
+openness in the mobile world, but we don't believe it's possible to predict or
+dictate all the uses to which people will want to put our software. So, while
+we encourage everyone to make devices that are open and modifiable, we don't
+believe it is our place to force them to do so. Using LGPL libraries would
+often force them to do so.</p>
+<p>Here are some of our specific concerns:</p>
+<ol>
+<li>LGPL (in simplified terms) requires either: shipping of source to the
+application; a written offer for source; or linking the LGPL-ed library
+dynamically and allowing users to manually upgrade or replace the library.
+Since Android software is typically shipped in the form of a static system
+image, complying with these requirements ends up restricting OEMs' designs.
+(For instance, it's difficult for a user to replace a library on read-only
+flash storage.)</li>
+<li>LGPL requires allowance of customer modification and reverse
+engineering for debugging those modifications.  Most device makers do
+not want to have to be bound by these terms, so to minimize the burden on
+these companies we minimize usage of LGPL software in userspace.</li>
+<li>Historically, LGPL libraries have been the source of a large number
+of compliance problems for downstream device makers and application
+developers. Educating engineers on these issues is difficult and slow-going,
+unfortunately. It's critical to Android's success that it be as easy as
+possible for device makers to comply with the licenses.  Given the
+difficulties with complying with LGPL in the past, it is most prudent to
+simply not use LGPL libraries if we can avoid it.</li>
+</ol>
+<p>The issues discussed above are our reasons for preferring ASL2.0 for
+our own code. They aren't criticisms of LGPL or other licenses. We do
+feel strongly on this topic, even to the point where we've gone out of our
+way to make sure as much code as possible is ASL2.0. However, we love all free
+and open source licenses, and respect others' opinions and preferences. We've
+simply decided that ASL2.0 is the right license for our goals.</p>
+</div>
diff --git a/pdk/docs/source/life-of-a-bug.jd b/pdk/docs/source/life-of-a-bug.jd
new file mode 100644
index 0000000..1d58ae1
--- /dev/null
+++ b/pdk/docs/source/life-of-a-bug.jd
@@ -0,0 +1,128 @@
+page.title=Life of a Bug
+doc.type=source
+@jd:body
+<p>The Android Open Source project maintains a public issue tracker where you
+can report bugs and request features for the Android software stack. (For
+details on this issue tracker, please see <a
+href="{@docRoot}source/report-bugs.html">the Reporting Bugs page</a>.)
+Reporting bugs is great (thank you!), but what happens to a bug report once
+you file it? This page describes the Life of a Bug.</p>
+<p><i>Please note: the the Android Open Source Project (AOSP) issue tracker is
+intended only for bugs &amp; feature requests related to the Android software
+stack. Because many users find their way here looking for the Google apps for
+Android (such as Gmail and so on), we have components set up for their
+convenience. However, these apps are not part of Android, and any issues
+reported on these components are not guaranteed to to receive attention.
+Most notably, to report issues related to Android Market, you should visit the
+<a href="http://www.google.com/support/forum/p/Android+Market?hl=en">Android
+Market Support Forum</a>.</i></p>
+<p>Here's the Life of a Bug, in a nutshell:</p>
+<ol>
+<li>A bug is filed, and has the state "New".</li>
+<li>An AOSP contributor periodically reviews and triages bugs. Bugs are
+triaged into one of four "buckets": New, Open, No-Action, or Resolved.</li>
+<li>Each bucket includes a number of states that provide more detail on the
+fate of the issue.</li>
+<li>Bugs in the "Resolved" bucket will eventually be included in a future
+release of the Android software.</li>
+</ol>
+<h2>Bucket Details</h2>
+<p>Here is some additional information on each bucket, what it means, and how
+it's handled.</p>
+<h3>New Issues</h3>
+<p>New issues include bug reports that are not yet being acted upon. The two
+states are:</p>
+<ul>
+<li><b>New</b><p>The bug report has not yet been triaged (that is, reviewed by
+an AOSP contributor.)</p></li>
+<li><b>NeedsInfo</b><p>The bug report has insufficient information to act
+upon. The person who reported the bug needs to provide additional detail
+before it can be triaged. If enough time passes and no new information is
+provided, the bug may be closed by default, as one of the No-Action
+states.</p></li>
+</ul>
+
+<h3>Open Issues</h3>
+<p>This bucket contains bugs that need action, but which are still
+unresolved, pending a change to the source code.</p>
+<ul>
+<li><b>Unassigned</b><p>The bug report has been recognized as an adequately
+detailed report of a legitimate issue, but has not yet been assigned to an
+AOSP contributor to be fixed. Typically, bugs in this state are considered low
+priority, at least insofar that if they were high priority, they'd be assigned
+to a contributor.</p></li>
+<li><b>Reviewed</b><p>Like <code>Unassigned</code>, but the issue
+represented is being tracked in a separate bug database. For example, the bug
+might have been reported via an internal bug-tracking system,
+which is considered the "master" copy. (For instance, Google maintains one
+such private issue tracker, intended primarily for bugs which contain
+sensitive information which can't be revealed publicly.)</p></li>
+<li><b>Assigned</b><li>Like <code>Unassigned</code>, but the bug has been
+actually assigned to a specific contributor to fix.</p></li>
+</ul>
+<p>Typically, a given bug will start in <code>Unassigned</code>, where it
+will remain until it is associated with a specific upcoming release, at which
+point it will enter <code>Reviewed</code> or <code>Assigned</code>. However,
+note that this isn't a guarantee, and it's not uncommon for bugs to go from
+<code>Unassigned</code> to one of the Resolved states.</p>
+<p>In general, if a bug is in one of these Open states, the AOSP team has
+recognized it as a legitimate issue and will fix it according to the product
+priorities and milestones. However, it's impossible to guarantee a fix in time 
+for any particular release.</p>
+
+<h3>No-Action Issues</h3>
+<p>This bucket contains bugs that have for one reason or another been
+determined to not require any action.</p>
+<ul>
+<li><b>Spam</b><p>A kind soul sent us some delicious pork products, that we,
+regrettably, do not want.</p></li>
+<li><b>Question</b><p>Someone mistook the issue tracker for a help forum.
+(This is not as uncommon as one might assume: many users whose native language
+isn't English can make this mistake.)</p></li>
+<li><b>Unreproducible</b><p>An AOSP contributor attempted to reproduce the
+behavior described, and was unable to do so. This sometimes means that the bug
+is legitimate but simply rare or difficult to reproduce, and sometimes means
+that the bug was fixed in a later release.</p></li>
+<li><b>WorkingAsIntended</b><p>An AOSP contributor has determined that the
+behavior described isn't a bug, but is the intended behavior. This state is
+also commonly referred to as "WAI".</b></li>
+<li><b>Declined</b><p>This is like <code>WorkingAsIntended</code>, except
+typically used for feature requests instead of bugs.  That is, an AOSP
+contributor has determined that the request is not going to be implemented in
+Android.</b></li>
+</ul>
+
+<h3>Resolved Issues</h3>
+<p>This bucket contains bugs that have had action taken, and are now
+considered resolved.</p>
+<ul>
+<li><b>FutureRelease</b><p>This bug has been fixed (or feature implemented) in
+a source tree, but has not yet been included in a formal Android
+platform release. (Note that this may also include fixes that exist in a
+private source tree that has not yet been contributed to a public
+tree.)</p></li>
+<li><b>Released</b><p>This bug has been fixed, and is included in a formal
+Android platform release. When this state is set, we try to also set a
+property indicating which release it was fixed in.</p></li>
+<li><b>Duplicate</b><p>This bug is a duplicate of another, existing bug
+report.</p></li>
+</ul>
+
+<h2>Other Stuff</h2>
+<p>The states and lifecycle above are how we generally try to track software.
+However, Android contains a lot of software and gets a correspondingly large
+number of bugs. As a result, sometimes bugs don't make it through all the
+states in a formal progression. We do try to keep the system up to date, but
+we tend to do so in periodic "bug sweeps" where we review the database and
+make updates.</p>
+<p>Since the AOSP is essentially constantly evolving, we do make tweaks to
+the list of bug states and the lifecycle described above.  When we do this,
+however, we'll be sure to update this page as well.</p>
+<p>Finally, you should be aware that for a variety of reasons, there are
+actually multiple issue trackers for Android-related issues. The <a
+href="http://code.google.com/p/android/issues/list">Google Code Project
+Hosting Issue Tracker</a> is the <b>only</b> official public issue tracker; however,
+Google also maintains a private issue tracker, own, as do most OEMs. We try to
+keep the public issue tracker in sync with private issue trackers
+wherever possible, but in cases where confidential information and security
+issues are involved, this isn't always possible.</p>
diff --git a/pdk/docs/source/life-of-a-patch.jd b/pdk/docs/source/life-of-a-patch.jd
new file mode 100644
index 0000000..458afa5
--- /dev/null
+++ b/pdk/docs/source/life-of-a-patch.jd
@@ -0,0 +1,11 @@
+page.title=Life of a Patch
+doc.type=source
+@jd:body
+<p>The Android Open Source Project (AOSP) uses a web-based code review tool
+known as "gerrit". The image below is a flowchart that details what happens to
+a patch, once it's been written. Though it may appear complex, the majority of
+the steps below are performed in the web application.</p>
+<p>For full instructions on how to get set up to use gerrit and git, please
+see <a href="{@docRoot}source/submit-patches.html">the Submitting Patches
+page</a>.</p>
+<img src="{@docRoot}images/workflow-0.png"/>
diff --git a/pdk/docs/source/overview-1.0.jd b/pdk/docs/source/overview-1.0.jd
new file mode 100644
index 0000000..e1b5cd6
--- /dev/null
+++ b/pdk/docs/source/overview-1.0.jd
@@ -0,0 +1,157 @@
+page.title=Android 1.0 Features
+doc.type=source
+@jd:body
+<div><div><div><div>This page provides a high-level overview of Android 1.0
+features. To see the code itself, you can either use the <a href="http://android.git.kernel.org/">GitWeb</a>
+interface to view snapshots of the files, or you can <a
+href="{@docRoot}source/download.html">download</a>
+the source code onto your local machine.<br><br><b>Applications</b>
+<br><br>The Android platform comes with a variety of applications written using the Java programming language:<br><ul><li><i>Home</i>
+displays applications, widgets, and shortcuts. It also supports customizable wall paper.
+</li>
+<li><i>Phone</i>
+supports regular telephony functions as well as call controls, conference calls, supplementary services, and easy integration with <i>Contacts</i>
+.<br></li>
+<li><i>Web Browser</i>
+is a fully featured WebKit-based browser that supports HTML and XHTML.
+</li>
+<li><i>Email</i>
+provides access to email servers commonly found on the Internet and supports POP3, IMAP4, and SMTP.
+</li>
+<li><i>Media Player</i>
+enables managing, importing, and playing back content that has been encoded in various forms.<br></li>
+<li><i>Alarm Clock, Calculator, Calendar, Camera, Contacts, IM, MMS, Settings,</i>
+<i>Voice Dialer</i>
+, and many other applications are also included in this release.<br></li>
+</ul>
+<b>Application framework</b>
+<br><br></div>
+<div>The Android Application Framework has been designed to provide a rich set of APIs for third-party application developers. For more information, visit the <a href="http://developer.android.com/guide/index.html">Android SDK developer guide</a>
+.<b><br></b>
+</div>
+<div></div>
+<div><b>Android runtime</b>
+<b><br><br></b>
+Android applications run on Dalvik, a custom virtual machine (VM) designed for embedded use. The Dalvik VM runs dex executable files, which are typically compiled from source code written in Java.<br><br></div>
+<div>The dex executable format is designed to have these characteristics:<br><ul><li>Efficient on-device storage.
+</li>
+<li>Efficient runtime memory usage.
+</li>
+<li>Ease of interpretation.<br></li>
+</ul>
+Dalvik has the following runtime characteristics:
+<ul><li>Efficient support for multiple concurrent VM processes, including amortized initialization and heavily shared memory.
+</li>
+<li>Optimized interpreter.
+</li>
+<li>Efficient linkage to low-level native code.
+</li>
+<li>A familiar and rich set of core library functionality. For a complete list of supported libraries, see <a href="http://developer.android.com/reference/packages.html">http://developer.android.com/reference/packages.html</a>
+.
+</li>
+<li>Enhanced JDWP support, enabling easier debugging of multiple processes simultaneously.
+</li>
+<li>JNI support.
+</li>
+</ul>
+<b>Native libraries <br></b>
+<br>The Android platform makes use of many native libraries, including:<br><ul><li><i>Bionic</i>
+, a custom libc implementation optimized for embedded systems.
+</li>
+<li>Graphics libraries for 2D and 3D (OpenGL ES 1.0) graphics support.<br></li>
+<li>openCore to provide the bulk of Android's multimedia capability. It includes support for network streaming (HTTP and RTSP), as well as most of the codecs and media file parsers used by the system.<br></li>
+<li>sqlite to support having a lightweight transactional data store.
+</li>
+<li>WebKit library to power Android's WebKit based full web browser.<br></li>
+</ul>
+<br><b>System software</b>
+<b><br></b>
+<br></div>
+<div>About Android's operating system:
+<ul><li>Based on Linux 2.6.25 for ARM.<br></li>
+<li>Platform currently expects ARM V5T or better architecture. Support for earlier architectures could be added, but CPUs without an MMU would be difficult to support.
+</li>
+<li>A set of kernel enhancements are provided to support Android. The patches include alarm, ashmem, binder, power management, low memory killer, kernel degugger, and logger <b>.<br></b>
+</li>
+<li>While the platform is designed to be chipset agnostic, and will run on virtually any ARM-based Linux kernel environment, version 1.0 of the platform has been tested and verified on the MSM 7K chipsets <b>.</b>
+Over time we expect to see support for other major chipsets.
+Kernel patches for MSM based chipsets are also available.
+</li>
+<li>FAT32 file system is supported.
+</li>
+<li>Support for TCP/IP (TCP, UDP, etc).
+</li>
+</ul>
+</div>
+<div>A minimal reference bootloader for the supported chipset is provided. It is capable of booting Linux from RAM, debugger, and NAND Flash.<br></div>
+<div><br>About Android's support for debugging:<br><ul><li>Debugging native code is supported via GDB (GNU Project Debugger) over USB.
+</li>
+<li>Debugging managed code is supported via any JDWP-compatible debugger over USB.
+</li>
+<li>Logging and crash logs supported for debugging.
+</li>
+</ul>
+<b>Supported hardware <br></b>
+<ul><li>The platform will run on almost on any ARM based Linux kernel environment.
+</li>
+<li>The platform requires a minimum of 128 MB of RAM and 256 MB ofFlash memory. AnOEM may want to support more Flash memory to make it possible to download more third-party applications to user devices.<br></li>
+<li>The platform will interface with a baseband radio stack provided externally via a Radio Interface Layer (RIL).
+</li>
+<li>802.11 b/g Wi-Fi
+</li>
+<li>Standard USB interface, including USB 2.0
+</li>
+<li>Bluetooth 2.0 EDR (Enhanced Data Rate)
+</li>
+<li>Camera for still and video capture
+</li>
+<li>Removable storage
+</li>
+</ul>
+<b>Supported display</b>
+<br><ul><li>HVGA resolution <br></li>
+<li>16 bit color depth <br></li>
+<li>Landscape and portrait orientation, including dynamic runtime switching
+</li>
+<li>Finger-based touchscreen navigation
+</li>
+</ul>
+<b>Supported keypads and buttons</b>
+<br><ul><li>QWERTY
+</li>
+<li>5-way navigation
+</li>
+<li>Hardware buttons: Send, End, Home, Back, Menu</li>
+<li>Power button
+</li>
+<li>Volume keys (up and down)
+</li>
+<li>Camera trigger button, including detection for both partial press (to focus) and full press (to actually take a picture)
+</li>
+</ul>
+<b>Supported audio outputs</b>
+<br><ul><li>Audio output via the headphone jack (mono and stereo)
+</li>
+<li>64 kbps Bluetooth audio supported</li>
+</ul>
+<b>Supported notifications</b>
+<br><ul><li>LEDs
+</li>
+<li>Vibration
+</li>
+</ul>
+<b>Supported radio and telephony features <br></b>
+<ul><li>GPRS, EDGE, UMTS, HSDPA
+</li>
+<li>International roaming, SMS, MMS <br></li>
+<li>Emergency call support <br></li>
+<li>Supplementary Services for Telephony, for example call waiting and conference calling <br></li>
+<li>Unstructured Supplementary Service Data (USSD)
+</li>
+<li>Reference Radio Interface Layer (RIL)
+</li>
+</ul>
+</div>
+</div>
+</div>
+</div>
diff --git a/pdk/docs/source/overview-1.5.jd b/pdk/docs/source/overview-1.5.jd
new file mode 100644
index 0000000..dd74874
--- /dev/null
+++ b/pdk/docs/source/overview-1.5.jd
@@ -0,0 +1,198 @@
+page.title=Android 1.5 Features
+doc.type=source
+@jd:body
+<h3><b>Release features - Android 1.5</b>
+</h3>
+<div><div><div><div><b>Previous release highlights</b>
+:<a href="{@docRoot}source/overview-1.0.html">Android 1.0</a>
+<br><br>This page provides a high-level overview of the new features added to
+Android 1.5. To see the code itself, you can either use the<a href="http://android.git.kernel.org/">GitWeb</a>
+interface to view snapshots of the files, or you can<a
+href="{@docRoot}source/download.html">download</a>
+the source code onto your local machine. You can use<i>repo init -u</i>
+git://android.git.kernel.org/platform/manifest.git<i>-b android-1.5</i>
+to download the source code for Android 1.5.<br><br><b>User interface refinements:</b>
+<br><ul><li>System-wide:
+<ul><li>Refinement of all core UI elements
+</li>
+<li>Animated window transitions (off by default)
+</li>
+<li>Accelerometer-based application rotations
+</li>
+</ul>
+</li>
+<li>UI polish for:
+<ul><li>In-call experience
+</li>
+<li>Contacts, Call log, and Favorites
+</li>
+<li>SMS MMS
+</li>
+<li>Browser
+</li>
+<li>Calendar
+</li>
+<li>Email
+</li>
+<li>Camera Gallery
+</li>
+<li>Application management
+</li>
+</ul>
+</li>
+</ul>
+<div><b><br>Performance improvements:</b>
+<br></div>
+<ul><li>Faster Camera start-up and image capture
+</li>
+<li>Much faster acquisition of GPS location (powered by SUPL AGPS)
+</li>
+<li>Smoother page scrolling in Browser
+</li>
+</ul>
+<br><b>Applications</b>
+<br><ul><li>Camera Gallery
+</li>
+<ul><li>Video recording
+</li>
+<li>Video playback (MPEG-4 3GP formats)
+</li>
+</ul>
+<li>Browser
+</li>
+<ul><li>Updated with latest Webkit browser Squirrelfish Javascript engines
+</li>
+<li>Copy 'n paste in browser
+</li>
+<li>Search within a page
+</li>
+<li>User-selectable text-encoding
+</li>
+<li>UI changes include:
+</li>
+<ul><li>Unified Go and Search box
+</li>
+<li>Tabbed bookmarks/history/most-visited screen
+</li>
+</ul>
+</ul>
+<li>Contacts
+</li>
+<ul><li>Shows user picture for Favorites
+</li>
+<li>Specific date/time stamp for events in call log
+</li>
+<li>One-touch access to a contact card from call log event
+</li>
+</ul>
+</ul>
+<b><br>Application framework</b>
+<br><br></div>
+<div><ul><li>On-screen soft keyboard
+</li>
+<ul><li>Works in both portrait and landscape orientation
+</li>
+<li>Support for user installation of 3rd party keyboards
+</li>
+<li>User dictionary for custom words
+</li>
+</ul>
+<li>Home screen
+</li>
+<ul><li>Widgets
+</li>
+<ul><li>Bundled home screen widgets include: analog clock, calendar, music player, picture frame, and search
+</li>
+</ul>
+<li>Live folders
+</li>
+</ul>
+<li>UI framework
+</li>
+<ul><li>Framework for easier background/UI thread interaction
+</li>
+<li>New SlidingDrawer widget
+</li>
+<li>Horizontal ScrollView widget
+</li>
+</ul>
+<li>Home Screen framework
+</li>
+<ul><li>APIs for creating secure home screen widgets
+</li>
+<li>APIs for populating live folders with custom content
+</li>
+</ul>
+<li>Media framework
+</li>
+<ul><li>Raw audio recording and playback APIs
+</li>
+<li>Interactive MIDI playback engine
+</li>
+<li>Video recording APIs for developers (3GP format)
+</li>
+<li>Video and photo sharing Intents
+</li>
+<li>Media search Intent
+</li>
+</ul>
+<li>Input Method framework
+</li>
+<ul><li>Text prediction engine
+</li>
+<li>Ability to provide downloadable IMEs to users
+</li>
+</ul>
+<li>Speech recognition framework
+</li>
+<ul><li>Support for using speech recognition libraries via Intent
+</li>
+</ul>
+<li>Misc API additions
+</li>
+<ul><li>LocationManager - Applications can get location change updates via Intent
+</li>
+<li>WebView - Touch start/end/move/cancel DOM event support
+</li>
+<li>SensorManager - redesigned sensor APIs
+</li>
+<li>GLSurfaceView - convenience framework for creating OpenGL applications
+</li>
+<li>Broadcast Intent for app update install succeeded - for smoother app upgrade experience
+</li>
+</ul>
+</ul>
+</div>
+<div></div>
+<div><br><b>System software</b>
+<br><br></div>
+<ul><li>New Linux kernel (version 2.6.27)
+</li>
+<li>SD card filesystem auto-checking and repair
+</li>
+<li>SIM Application Toolkit 1.0
+</li>
+</ul>
+<div><b><br>Supported hardware<br></b>
+<ul><li>Bluetooth</li>
+<ul><li>Stereo Bluetooth support (A2DP and AVCRP profiles)
+</li>
+<li>Auto-pairing
+</li>
+<li>Improved handsfree experience
+</li>
+</ul>
+</ul>
+<br><b>Developer tools</b>
+<br></div>
+<div><ul><li>Support for multiple versions of Android in a single SDK installation
+</li>
+<li>Improved JUnit support in ADT
+</li>
+<li>Easier application performance profiling
+</li>
+</ul>
+</div>
+</div>
+</div>
+</div>
diff --git a/pdk/docs/source/overview.jd b/pdk/docs/source/overview.jd
new file mode 100644
index 0000000..2763c52
--- /dev/null
+++ b/pdk/docs/source/overview.jd
@@ -0,0 +1,93 @@
+page.title=Android 1.6 Platform Overview
+doc.type=source
+@jd:body
+<p>This page provides a high-level overview of the new features added to
+Android 1.6. To see the code itself, you can either use the <a
+href="http://android.git.kernel.org/">GitWeb</a>
+interface to view snapshots of the files, or you can <a
+href="{@docRoot}source/download.html">download</a>
+the source code onto your local machine. You can use <code>repo init -u
+git://android.git.kernel.org/platform/manifest.git -b android-1.6</code>
+to download the source code for Android 1.6.</p>
+<p><i>Note: platform overview information for Android 2.x has not yet been
+published, since the <a
+href="{@docRoot}compatibility/index.html">Compatibility Program</a> for
+Android 2.x has not yet launched. When the Compatibilty Definition Document
+for 2.x is released, this page will be updated to match.</i></p>
+<p>Information about older Android releases is also available:<ul>
+<li><a href="{@docRoot}source/overview-1.5.html">Android 1.5 Platform Overview</a></li>
+<li><a href="{@docRoot}source/overview-1.0.html">Android 1.0 Platform Overview</a></li>
+</ul></p>
+<h2>User interface refinements</h2>
+<h3>Quick Search Box for Android </h3>
+<p>Android 1.6 includes a redesigned search framework that provides a quick, effective, and consistent way for users to search across multiple sources—such as browser bookmarks history, contacts, and the web—directly from the home screen.
+</p>
+<p><br></p>
+<p>The system constantly learns which search results are more relevant based on what is clicked. So popular contacts or apps that have previously been picked will bubble up to the top when a user types the first few letters of a relevant query.
+</p>
+<p><br></p>
+<p>The search framework also provides developers a way to easily expose relevant content from their applications in Quick Search Box.
+</p>
+<h3>Camera, Camcorder, and Gallery </h3>
+<p>An updated user interface provides an integrated camera, camcorder, and gallery experience. Users can quickly toggle between still and video capture modes. Additionally, the gallery enables users to select multiple photos for deletion.<br></p>
+<p><br></p>
+<p>Android 1.6 also provides a much faster camera experience. Compared to the previous release, launching the camera is now 39% faster, and there is a 28% improvement in the time from completing one shot to the next.
+</p>
+<h3>VPN, 802.1x </h3>
+<p>A new Virtual Private Network (VPN) control panel in Settings allows users to configure and connect to the following types of VPNs:
+</p>
+<ul><li>L2TP/IPSEC pre-shared key based VPN
+  </li>
+<li>L2TP/IPsec certificate based VPN
+  </li>
+<li>L2TP only VPN
+  </li>
+<li>PPTP only VPN
+  </li>
+</ul>
+<h3>Battery usage indicator </h3>
+<p>A new battery usage screen lets users see which apps and services are consuming battery power. If the user determines that a particular service or application is using too much power, they can take action to save the battery by adjusting settings, stopping the application, or uninstalling the application.
+</p>
+<h3>Accessibility </h3>
+<p>Users will be able to download new accessibility services built on the new accessibility framework and enable them in Settings.
+</p>
+<h2>New Platform Technologies </h2>
+<h3>Expanded Search Framework </h3>
+<p>The Android search framework has been redesigned and expanded to provide third-party applications the opportunity to surface content from their applications in Quick Search Box, the global search tool. To do this, developers will need to make their app "searchable" and provide suggestions in response to user queries. To enable application search suggestions, users simply select each application from which they'd like to receive suggestions, under Searchable items in the Search settings.
+</p>
+<h3>Text-to-speech engine</h3>
+<p>Android 1.6 features a multi-lingual speech synthesis engine called Pico. It allows any Android application to "speak" a string of text with an accent that matches the language. The engine supports the following languages: English (American and British accents), French, Italian, German and Spanish. If you're using a T-Mobile G1 or Dream device, you'll need to download the SpeechSynthesis Data Installer from Android Market, which includes the "voices" needed by the text-to-speech engine.
+</p>
+<h3>Gestures </h3>
+<p>A new gestures framework provides application developers with a framework for creating, storing, loading, and recognizing gestures and associating them with specific actions.
+</p>
+<p>Developers can use the new GestureBuilder tool included in the Android 1.6 SDK to generate libraries of gestures to include with their application.
+</p>
+<h3>Accessibility </h3>
+<p>Android 1.6 provides a new accessibility framework. With this framework, developers can create accessibility plugins that respond to user input, such as making a sound when a new window is shown, vibrating when navigating to the top of a list, and providing spoken feedback.
+</p>
+<h3>Expanded support for screen densities and resolutions </h3>
+<p>Android 1.6 adds screen support that enables applications to be rendered properly on different display resolutions and densities. Developers can also specify the types of screens supported by their application.
+</p>
+<h3>Telephony support for CDMA </h3>
+<p>Android 1.6 includes support for CDMA in the telephony stack.
+</p>
+<h3>New version of OpenCore </h3>
+<p>Android 1.6 includes the updated OpenCore 2 media engine, which has:
+</p>
+<ul><li>Support for OpenMAX encoders
+  </li>
+<li>Support for additional audio codecs in AuthorEngine
+  </li>
+<li>Improved buffering model supports shared buffers allocated in the decoder
+  </li>
+</ul>
+<h3>2.6.29 Linux kernel </h3>
+<p>Android 1.6 upgrades the Linux kernel from 2.6.27 to 2.6.29.
+</p>
+<h2>New Framework APIs</h2>
+<p>For a detailed overview of new APIs, see the <a
+href="http://developer.android.com/sdk/android-1.6.html#api-changes">Version
+Notes</a>. For a complete report of all API changes, see the <a
+href="http://developer.android.com/sdk/api_diff/4/changes.html">API
+Differences Report</a>.</p>
diff --git a/pdk/docs/source/report-bugs.jd b/pdk/docs/source/report-bugs.jd
new file mode 100644
index 0000000..138080d
--- /dev/null
+++ b/pdk/docs/source/report-bugs.jd
@@ -0,0 +1,133 @@
+page.title=Report Bugs
+doc.type=source
+@jd:body
+<div>
+<p>Thanks for your interest in Android! One of the best ways you can help us
+improve Android is to let us know about any problems you find with it.</p>
+<p>First, though: if you think you've found a security vulnerability,
+<b>please don't use the forms below</b>. (Using the public forms below may
+allow anyone to see your report, which may put users at risk until the bug is
+fixed.) Instead, please report security bugs to our security team by emailing
+<a href="mailto:security@android.com">security@android.com</a>.  We believe in
+responsible disclosure of security vulnerabilities, and will give you proper
+attribution for any issues you report.</p>
+<p>Here's how to report non-security bugs:</p>
+<ol>
+  <li><a href="http://code.google.com/p/android/issues/advsearch">Search for
+  your bug</a> to see if anyone has already reported it.</li>
+  <li>If you find your issue and it's important to you, star it! That's how we
+  know which bugs are most important to fix.</li>
+  <li>If no one's reported your bug, file the bug. You can use one of these
+  templates:<ul>
+    <li><a
+    href="http://code.google.com/p/android/issues/entry?template=User%20bug%20report">Bugs
+    in your Device (for users)</a> - use this if you want to report a bug in a
+    device you own</li>
+    <li><a
+    href="http://code.google.com/p/android/issues/entry?template=Developer%20bug%20report">Bugs
+    in the Software (for developers)</a> - use this if you found a bug in the
+    course of developing an app</li>
+    <li><a
+    href="http://code.google.com/p/android/issues/entry?template=Feature%20request">Request
+    a New Feature</a> - use this for a feature you'd like to see in a future
+    verison</li>
+  </ul></li>
+</ol>
+<p>Please note that we can't guarantee that any particular bug can be fixed in
+any particular release. To see what happens to your bug once you report it,
+read <a href="{@docRoot}source/life-of-a-bug.html">Life of a Bug</a>.</p>
+<p>In general, please put as much info in bugs as you can. Just a one liner
+telling us something isn't working is usually useless, and will probably be
+closed without any action. The more detail you provide, the more likely your
+issue is to be resolved. Below, there are some examples of a good bug report
+and a poor bug report.</p>
+<h3>A Poor Bug Report</h3>
+<pre>
+Title: Error message
+
+When running Eclipse I get an "Internal Error" that says "See the .log file
+for more details".
+
+Steps to reproduce:
+Happens when "Object o = null". Doesn't happen when changed to "Object o".
+
+Expected results:
+I wouldn't get the error message--would work with Object o = null.
+
+Observed results:
+See above.
+</pre>
+<p>This is a poor bug report because it doesn't provide any context for the
+issue; is it a problem in the Dalvik virtual machine, the core framework, or
+something else? It also doesn't provide any code or hint on how to reproduce
+it. In other words, this bug report doesn't provide enough information for
+anyone to take action on, so it would be ignored.</p>
+<h3>A Good Bug Report</h3>
+<pre>
+Title: Stepping over "Object o = null" causes Eclipse "Internal Error"
+
+Interesting bug, while using Eclipse 3.3.1.1 with m37a of android and
+the following code:
+
+package com.saville.android;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.util.Log;
+
+public class TestObjectNull extends Activity {
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        setContentView(R.layout.main);
+
+        Object o = null;
+
+        o = "hi";
+
+        Log.v(TAG, "o=" + o);
+    }
+
+    static final String TAG = "TestObjectNull";
+
+}
+
+Eclipse indicates an "Internal Error" with "See the .log file for more
+details" and then asks if I want to exit the workbench. This occurs when I
+place a break point on "setContentView(R.layout.main);" and then single
+step over "Object o = null;"
+
+If I change "Object o = null;" to "Object o" all is well.
+
+The last lines of the .log file are:
+
+!ENTRY org.eclipse.core.jobs 4 2 2008-01-01 13:04:15.825
+!MESSAGE An internal error occurred during: "has children update".
+!STACK 0
+java.lang.InternalError: Invalid signature: "&lt;null&gt;"
+        at
+org.eclipse.jdi.internal.TypeImpl.signatureToTag(TypeImpl.java:307)
+        at
+org.eclipse.jdi.internal.LocalVariableImpl.tag(LocalVariableImpl.java:185)
+        at
+org.eclipse.jdi.internal.StackFrameImpl.getValues(StackFrameImpl.java:128)
+        at
+org.eclipse.jdi.internal.StackFrameImpl.getValue(StackFrameImpl.java:73)
+        at
+org.eclipse.jdt.internal.debug.core.model.JDILocalVariable.retrieveValue(JDILocalVariable.java:57)
+        at
+org.eclipse.jdt.internal.debug.core.model.JDIVariable.getCurrentValue(JDIVariable.java:66)
+        at
+org.eclipse.jdt.internal.debug.core.model.JDIVariable.getValue(JDIVariable.java:88)
+        at
+org.eclipse.debug.internal.ui.model.elements.VariableContentProvider.hasChildren(VariableContentProvider.java:62)
+        at
+org.eclipse.jdt.internal.debug.ui.variables.JavaVariableContentProvider.hasChildren(JavaVariableContentProvider.java:73)
+        at
+org.eclipse.debug.internal.ui.model.elements.ElementContentProvider.updateHasChildren(ElementContentProvider.java:223)
+        at
+org.eclipse.debug.internal.ui.model.elements.ElementContentProvider$3.run(ElementContentProvider.java:200)
+        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
+</pre>
+</div>
diff --git a/pdk/docs/source/roles.jd b/pdk/docs/source/roles.jd
new file mode 100644
index 0000000..451c821
--- /dev/null
+++ b/pdk/docs/source/roles.jd
@@ -0,0 +1,73 @@
+page.title=People and Roles
+doc.type=source
+@jd:body
+<p>The Android Open Source Project (AOSP) includes individuals working in a variety
+of roles. As noted in <a href="{@docRoot}about/philosophy.html">Our
+Philosophy</a>, Google is responsible for Android product management
+and the engineering process for the core framework and platform; however,
+the project considers contributions from any source, not just Google. This
+page describes the kinds of roles that interested parties can take on.</p>
+<p>Anyone who is interested in exploring and contributing to Android can use the
+Android Open Source Project resources. Anyone can join the mailing lists, ask
+questions, contribute patches, report bugs, look at submitted patches, and use
+the tools. To get started with the Android code, see <a
+href="{@docRoot}source/index.html">Get Involved</a>.</p>
+
+<h2>Contributor</h2>
+<p>A "Contributor" is anyone making contributions to the AOSP source code,
+including both employees of Google or other companies, as well as
+external developers who are contributing to Android on their own behalf.
+There is no distinction between Contributors who are employed by 
+Google, and those who are not: all engineers use the same git/gerrit tools, 
+follow the same code review process, and are subject to the same requirements
+on code style and so on.</p>
+<p/>
+
+<h2>Developer</h2>
+<p>A "Developer" is an engineer writing applications that run on Android
+devices. There is, of course, no difference in skillset between a "Developer"
+and a "Contributor"; AOSP simply uses "Developer" to help identify our audience.
+Since the key purpose of Android is to cultivate an open development platform,
+"Developers" are one of the key customers of the Android platform. As such, we
+talk about them a lot, though this isn't technically a separate role in the
+AOSP <i>per se.</i></p>
+<p/>
+
+<h2>Verifier</h2>
+<p>"Verifiers" are responsible for testing change requests. After individuals
+have submitted a significant amount of high-quality code to the project, the
+Project Leads might invite them to become Verifiers.</p><p><i>Note: at this
+time, generally Verifiers are the same as Approvers.</i></p>
+<p/>
+
+<h2>Approver</h2>
+"Approvers" are experienced members of the project who have demonstrated their
+design skills and have made significant technical contributions to the
+project. In the code-review process, an Approver decides whether to include or
+exclude a change. Project Leads (who are typically employed by Google) choose
+the Approvers, sometimes promoting to this position Verifiers who have
+demonstrated their expertise within a specific project.</p>
+<p/>
+
+<h2>Project Leads</h2>
+<p>Android consists of a number of sub-projects; you can see these in the git
+repository, as individual .git files. Tech Leads are senior Contributors who
+oversee the engineering for individual Android projects. Typically these tech
+leads will be Google employees.  A Project Lead for an individual project is
+responsible for the following:</p>
+<ul>
+  <li>Lead all technical aspects of the project; for example, the project
+  roadmap, development, release cycles, versioning, and QA.</li>
+  <li>Ensure that the project is QA-ed in time for scheduled Android platform
+  releases.</li>
+  <li>Designate Verifiers and Approvers for submitted patches.</li>
+  <li>Be fair and unbiased while reviewing changes. Accept or reject patches
+  based on technical merit and alignment with the Android platform.</li>
+  <li>Review changes in a timely manner and make best efforts to communicate
+  when changes are not accepted.</li>
+  <li>Optionally maintain a web site for the project for information and
+  documents specific to the project.</li>
+  <li>Act as a facilitator in resolving technical conflicts.</li>
+  <li>Be the public face for the project and the go-to person for questions
+  related to the project.</li>
+</ul>
diff --git a/pdk/docs/source/source_toc.cs b/pdk/docs/source/source_toc.cs
new file mode 100644
index 0000000..09c20a6
--- /dev/null
+++ b/pdk/docs/source/source_toc.cs
@@ -0,0 +1,38 @@
+<script type="text/javascript" language="JavaScript">
+<!--
+function nothing() {}
+-->
+</script>
+
+<ul>
+  <li><h2>The Project</h2><ul>
+    <li><a href="<?cs var:toroot ?>source/roles.html">People and Roles</a></li>
+    <li><a href="<?cs var:toroot ?>source/licenses.html">Licensing Information</a></li>
+    <li><a href="http://android.git.kernel.org/">Browse Source</a> <span style="font-size: 75%; font-variant: small-caps">[off-site]</span></li>
+    <li><a href="<?cs var:toroot ?>source/overview.html">Platform Overview</a></li>
+    <li><a href="<?cs var:toroot ?>source/life-of-a-bug.html">Life of a Bug</a></li>
+    <li><a href="<?cs var:toroot ?>faqs.html#aosp">FAQs</a></li>
+  </ul>
+
+  <li><h2>Getting Started</h2><ul>
+    <li><a href="<?cs var:toroot ?>source/download.html">Getting the Source</a></li>
+    <li><a href="<?cs var:toroot ?>source/git-repo.html">Using git and repo</a></li>
+    <li><a href="<?cs var:toroot ?>source/using-eclipse.html">Using Eclipse</a></li>
+    <li><a href="<?cs var:toroot ?>source/code-style.html">Code Style</a></li>
+    <li><a href="<?cs var:toroot ?>source/building-dream.html">Building for an ADP</a></li>
+  </ul>
+
+  <li><h2>Contributing</h2><ul>
+    <li><a href="<?cs var:toroot ?>source/life-of-a-patch.html">Life of a Patch</a></li>
+    <li><a href="<?cs var:toroot ?>source/submit-patches.html">Submitting Patches</a></li>
+    <li><a href="<?cs var:toroot ?>source/report-bugs.html">Reporting Bugs</a></li>
+    <li><a href="<?cs var:toroot ?>source/code-lines.html">Branches &amp; Releases</a></li>
+  </ul>
+</ul>
+
+<script type="text/javascript">
+<!--
+    buildToggleLists();
+//-->
+</script>
+
diff --git a/pdk/docs/source/submit-patches.jd b/pdk/docs/source/submit-patches.jd
new file mode 100644
index 0000000..2b7bae1
--- /dev/null
+++ b/pdk/docs/source/submit-patches.jd
@@ -0,0 +1,147 @@
+page.title=Android Contributors' Workflow
+doc.type=source
+@jd:body
+<br>This page describes how to record changes to the Android files on your local client, upload those changes to the code-review server, and use Gerrit to track changes.<br><h2>
+Prerequisites</h2>
+Before you follow the instructions on this page, you will need to set up your
+local working environment and get the Android source files. For instructions,
+see <a href="{@docRoot}source/download.html">Get source</a>
+.<br><br>Other recommended reading:<br><ul><li>For an overview of the code
+contribution and review process, see <a
+href="{@docRoot}source/life-of-a-patch.html">Life of a Patch</a>.</li>
+<li>For details about Repo, see <a href="{@docRoot}source/git-repo.html">Using Repo and Git</a>.<br></li>
+<li>For information about the different roles you can play within the Android
+Open Source community, see <a href="{@docRoot}source/roles.html">Project roles</a>.</li>
+<li>If you plan to contribute code to the Android platform, be sure to read
+the <a href="{@docRoot}source/licenses.html">AOSP's licensing information</a>.</li>
+</ul>
+<h2>
+Working with the code</h2>
+First, download the source into your working directory, as described in <a
+href="{@docRoot}source/download.html">Get source</a>
+. For information about how to choose which branch to use, see <a
+href="{@docRoot}source/code-lines.html">Android Code-Lines</a>.<br><br>To work on a particular change to the code, follow these steps:<br>
+<div><img src="{@docRoot}images/submit-patches-0.png">
+</div>
+<ol><li>Use repo start <i>branchname</i>
+to start a new topic branch.</li>
+<li>Edit the files.<br></li>
+<li><span>Use git add to stage changes.</span>
+<span>(Sometimes optional.)</span>
+<br></li>
+<li>Use repo status and git diff to view the status of your files.<i><br></i>
+</li>
+<li>Use git commit to commit changes.<br></li>
+<li><span>Use repo upload to upload changes to the review server</span>
+.<br></li>
+</ol>
+You can track your uploaded changes using the Gerrit code-review tool. When it's time to work on the code again, run repo sync, then go back to step 1 above and start another topic branch.<br><br>The steps will not always come in the order shown--for example, you might run git diff at several points in the process.<br><br><h3>
+Starting a topic branch</h3>
+Start a topic branch called default in your local work environment:<br><br>$ repo start default <br><br>For more about topic branches, see <a href="{@docRoot}source/git-repo.html">Using Repo and Git</a>.<br><h3>
+Editing the files</h3>
+You do not need to check files out before working on them. Edit the files using vim, emacs, or any other editor.<br><br><h3>
+Staging changes</h3>
+To indicate that every new and modified file in your working directory should be "staged" for inclusion in the next commit, run git add without any arguments. You can also specify files or filetypes. For example, the following command would stage all the new and modified files under the bionic directory and its subdirectories:<br><br>$ git add bionic/*<br><br>Run git help add to see more ways to use git add.<br><br><b>When is git add optional?<br></b>
+<br>If you add new files, you must stage them using git add before you run git commit. However, if you are only modifying or deleting files, you can skip git add if you use the -a option with git commit. For more details, see the "Committing changes" section further down.<br><br><h3>
+Using repo status <br></h3>
+To see the status of the current branch, run <br><br>$ repo status .<br><br>For information about how to interpret the results of repo status, see <a href="{@docRoot}source/git-repo.html#TOC-status">Using Repo and Git</a>.<br><br><h3>
+Using git diff</h3>
+To see uncommitted changes, cd into the project directory and run <br><br>$ git
+diff <br><br>Without any arguments, git diff will show you the differences
+between the files in your working directory and the committed
+files.<br><div><br><div><img src="{@docRoot}images/submit-patches-1.png">
+</div>
+<br></div>
+<div>If you add the --cached option, git diff will show you the differences between the files in your working directory and the staged files.<br><br></div>
+To see every edit that would go into the commit if you were to commit right now, make sure you are in the project directory and then run <br><br>$ git diff --cached <br><br><h3>
+Committing changes</h3>
+At intervals while you are working, commit your edits by using git commit from within the project directory:<br><span>$ cd ~/mydroid/<i>project-name</i>
+</span>
+<span><br>$ git commit</span>
+<br><br>Every file that you staged using git add will be included in this commit.<br><br>If you have not added any new files that you want to commit, you can skip git add and simply run <br><br>$ git commit -a <br><br>The -a option will stage all the files you have modified or deleted and include them in this commit. (If you have added new files and want them included in the commit, you will need to use git add before you run git commit.)<br><br>If commit <span></span>
+does not find changes to be committed, it will report "nothing to commit (working directory clean)". If commit finds changes to be committed, a file will open in which you can create a log message:<br><br><div><i>Your comments about this commit go here....</i>
+<br># Please enter the commit message for your changes. Lines starting <br># with '#' will be ignored, and an empty message aborts the commit.<br># On branch master <br># Changes to be committed:<br>#(use "git reset HEADfile..." to unstage)<br>#<br>#new file:.repo/projects/gerrit-manifests.git/FETCH_HEAD <br>#new file:.repo/projects/gerrit-manifests.git/HEAD <br>#new file:.repo/projects/gerrit-manifests.git/config <br>.<br>.<br>.<br></div>
+<br>If you do not add a log message, the commit will be aborted. Add a message and save the file.<br><br><h3>
+Committing changes during code review</h3>
+If you previously uploaded a change to Gerrit and the Approver has asked for changes, follow these steps:<br><ol><li>Edit the files to make the changes the Approver has requested.</li>
+<li>Recommit your edits using the --amend flag, for example:<br><span>$ git commit -a --amend</span>
+<br></li>
+<li>See below to upload the changes to Gerrit again for another review cycle.</li>
+</ol>
+<h3>
+Editing uploaded changes</h3>
+To update an existing change with a new patch set:<br><ol><li>Make sure the updated branch is the currently checked out branch.</li>
+<li>Use repo upload --replace <i>proj1</i>
+to open the change matching editor.</li>
+<li>For each commit in the series, enter the Gerrit change Id inside the brackets.</li>
+</ol>
+For more details, see <a href="{@docRoot}source/git-repo.html#TOC-upload">Using Repo and Git</a>
+.<br><h3>
+Uploading changes to Gerrit</h3>
+To upload your committed changes to the review server:<br><ol><li>Complete the appropriate <a href="https://review.source.android.com/#settings,new-agreement">Contributor Agreement</a>
+in Gerrit, granting the Android Open Source Project permission to distribute your changes to others.</li>
+<li>Select an <a href="https://review.source.android.com/#settings,ssh-keys">SSH Username</a>
+and upload your <a href="https://review.source.android.com/#settings,ssh-keys">public SSH key</a>
+, so that Gerrit can identify you when you upload changes.Please note that due to a bug in repo, repo upload requires your SSH Username be the local part of your email address (the text on the left of the @ sign).<br><br>These first two steps are only necessary prior to your first change.Gerrit will remember your agreement and SSH key for subsequent changes.<br><br></li>
+<li>Update to the latest revisions:<span><br></span>
+<span>$</span>
+<span>repo sync</span>
+<br><br>For information about how to handle sync conflicts and how Repo synchronization works, see <a href="{@docRoot}source/git-repo.html#TOC-sync">Using Repo and Git</a>
+.<br><br></li>
+<li>Run repo upload to examine the list of all available changes and select which topic branches will be uploaded to the review server:<br><span>$</span>
+<span>repo upload</span>
+<br><br>This will open an editor window that will let you choose which topic branch to upload.If there is only one branch available, a simple y/n prompt is instead of an editor.<br></li>
+</ol>
+After a change is uploaded successfully:<br><ul><li>Repo will give you a URL where you can view your submission.</li>
+<li>The code-review system will automatically notify the project owner about your submission.</li>
+</ul>
+For information about specifying particular projects with repo sync and repo upload, see <a href="{@docRoot}source/git-repo.html">Using Repo and Git</a>
+.<br><br><h3>
+Summary example <br></h3>
+Here is a simple example that shows how you might work with the bionic/Android.mk file:<br><br>$ cd ~/mydroid/bionic <br>$ repo start default <br>$ vi Android.mk <br><i>...edit and save the file...</i>
+<br>$ git commit -a <br>$ repo sync <br>$ repo upload <br><i>...close the editable window that opens...</i>
+<br><i>...visit the provided URL to open Gerrit and track your change...</i>
+<br><br><h3>
+Downloading changes from Gerrit</h3>
+To download a specific change from Gerrit, run <br><br>$ repo download <i>target change</i>
+<br><br>where target is the local directory into which the change should be downloaded andchange is the change number as listed in <a href="https://review.source.android.com/">Gerrit</a>
+. For more information, see <a href="{@docRoot}source/git-repo.html#TOC-download">Using Repo and Git</a>
+.<br><br><h2>
+Using the Gerrit code-review tool <br></h2>
+You can open Gerrit by visiting whatever URL is returned to you from the repo upload command, or by visiting <a href="https://review.source.android.com/">https://review.source.android.com</a>.<br><br><h3>
+Viewing the status of uploaded changes <br></h3>
+To check the status of a change that you uploaded, open <a href="https://review.source.android.com/mine">Gerrit</a>
+, sign in, and click MyChanges.<br><b><br></b>
+<h3>
+Reviewing a change <br></h3>
+If you are assigned to be the Approver for a change, you need to determine the following:<br><ul><li>Does this change fit within this project's stated purpose?<br></li>
+<li>Is this change valid within the project's existing architecture?</li>
+<li>Does this change introduce design flaws that will cause problems in the future?</li>
+<li>Does this change following the best practices that have been established for this project?</li>
+<li>Is this change a good way to perform the described function?</li>
+<li>Does this change introduce any security or instability risks?</li>
+</ul>
+If you approve of the change, you will then mark it with LGTM ("Looks Good to Me") within Gerrit.<br><br><h3>
+Verifying a change <br></h3>
+If you are assigned to be the Verifier for a change, you need to do the following:<br><ul><li>Patch the change into your local client using one of the Download commands.</li>
+<li>Build and test the change.</li>
+<li>Within Gerrit use Publish Comments to mark the commit as "Verified", or "Fails" (and add a message explaining what problems were identified).<br></li>
+</ul>
+<h3>
+Viewing diffs and comments</h3>
+To open the details of the change within Gerrit, click on the "Id number" or "Subject" of a change. To compare the established code with the updated code, click the file name under "Side-by-side diffs."<br></div>
+<div><h3>
+Adding comments</h3>
+Anyone in the community can use Gerrit to add inline comments to code submissions. A good comment will be relevant to the line or section of code to which it is attached in Gerrit. It might be a short and constructive suggestion about how a line of code could be improved, or it might be an explanation from the author about why the code makes sense the way it is.<br><br>To add an inline comment, double-click the relevant line of the code and write your comment in the text box that opens. When you click Save, only you can see your comment.<br><br>To publish your comments so that others using Gerrit will be able to see them, click the Publish Comments button. Your comments will be emailed to all relevant parties for this change, including the change owner, the patch set uploader (if different from the owner), and all current reviewers.<br><br><h3>
+After a submission is approved</h3>
+After a submission makes it through the review and verification process, Gerrit automatically merges the change into the public repository. The change will now be visible in gitweb, and others users will be able to run repo sync to pull the update into their local client.<br><br><h3>
+How do I become a Verifier or Approver?</h3>
+In short, contribute high-quality code to one or more of the Android projects.
+For details about the different roles in the Android Open Source community and
+who plays them, see <a href="{@docRoot}source/roles.html">Project roles</a>
+.<br><br><h2>
+Using GitWeb to track patch histories</h2>
+To view snapshots of the files that are in the public Android repositories and view file histories, use the <a href="http://android.git.kernel.org/">Android instance of GitWeb</a>
+.<br></div>
+</div>
+</div>
diff --git a/pdk/docs/source/using-eclipse.jd b/pdk/docs/source/using-eclipse.jd
new file mode 100644
index 0000000..56df713
--- /dev/null
+++ b/pdk/docs/source/using-eclipse.jd
@@ -0,0 +1,214 @@
+page.title=Using Eclipse
+doc.type=source
+@jd:body
+<div>
+<p>This document will help you set up the Eclipse IDE for Android platform development.</p>
+<p><i>Note: if you are looking for information on how to use
+Eclipse to develop applications that run on Android, this is not the right
+page for you. You probably would find <a
+href="http://developer.android.com/sdk/eclipse-adt.html">the Eclipse page on
+developer.android.com</a> more useful.</i></p>
+<h2><a>Enter eclipse</a>
+</h2>
+<h4>
+Basic setup
+</h4>
+<p>First, it's important to make sure the regular Android development system is set up.
+</p>
+<pre>cd /path/to/android/root <br>make     # and wait a while, if you haven't done this <br></pre>
+<p><b>Important</b>
+: You will still be using "make" to build the files you will actually run (in the emulator or on a device). You will be using Eclipse to edit files and verify that they compile, but when you want to run something you will need to make sure files are saved in Eclipse and run "make" in a shell. The Eclipse build is just for error checking.
+</p>
+<p>Eclipse needs a list of directories to search for Java files. This is called the "Java Build Path" and can be set with the .classpath file. We have a sample version to start you off.
+</p>
+<pre>cd /path/to/android/root <br>cp development/ide/eclipse/.classpath .<br>chmod u+w .classpath  # Make the copy writable <br></pre>
+<p>Now edit that copy of .classpath, if necessary.
+</p>
+<h5>
+Increase Eclipse's Memory Settings
+</h5>
+<p>The Android project is large enough that Eclipse's Java VM sometimes runs out of memory while compiling it. Avoid this problem by editing the the eclipse.ini file. On Apple OSX the eclipse.ini file is located at /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.ini
+</p>
+<p>Memory-related defaults (as of Eclipse 3.4)
+</p>
+
+<pre>-Xms40m <br>-Xmx256m <br>-XX:MaxPermSize=256m <br></pre>
+<p>Recommended settings for Android development
+</p>
+<pre>-Xms128m <br>-Xmx512m <br>-XX:MaxPermSize=256m <br></pre>
+<p>These settings set Eclipse's minimum Java heap size to 128MB, set the maximum Java heap size to 512MB, and keep the maximum permanent generation size at the default of 256MB.
+</p>
+<p>Now start Eclipse:
+</p>
+<pre>eclipse  # or you can click some clicky thing instead, if you prefer <br></pre>
+<p>Now create a project for Android development:
+</p>
+<ol><li>If Eclipse asks you for a workspace location, choose the default.
+</li>
+<li>If you have a "Welcome" screen, close it to reveal the Java perspective.
+</li>
+<li>File New Java Project
+</li>
+<li>Pick a project name, "android" or anything you like.
+</li>
+<li>Select "Create project from existing source", enter the path to your Android root directory, and click Finish.
+</li>
+<li>Wait while it sets up the project. (You'll see a subtle progress meter in the lower right corner.)
+</li>
+</ol>
+<p>Once the project workspace is created, Eclipse should start building. In theory, it should build with no errors and you should be set to go. If necessary, uncheck and re-check Project Build Automatically to force a rebuild.
+</p>
+<p><i><b>Note:</b>
+</i>
+Eclipse sometimes likes to add an "import android.R" statement at the top of your files that use resources, especially when you ask eclipse to sort or otherwise manage imports. This will cause your make to break. Look out for these erroneous import statements and delete them.
+</p>
+<h4>
+When you sync
+</h4>
+<p>Every time you repo sync, or otherwise change files outside of Eclipse (especially the .classpath), you need to refresh Eclipse's view of things:
+</p>
+<ol><li>Window Show View Navigator
+</li>
+<li>In the "Navigator", right-click on the project ("android-java" or whatever you named it)
+</li>
+<li>Click Refresh in the context menu
+</li>
+</ol>
+<h4>
+Adding apps to the build path
+</h4>
+<p>The default .classpath includes the source to the core system and a sample set of apps, but might not include the particular app you may want to work on. To add an app, you must add the app's source directory. To do this inside Eclipse:
+</p>
+<ol><li>Project Properties
+</li>
+<li>Select "Java Build Path" from the left-hand menu.
+</li>
+<li>Choose the "Source" tab.
+</li>
+<li>Click "Add Folder...".
+</li>
+<li>Add your app's "src" directory.
+</li>
+<li>Click OK.
+</li>
+</ol>
+<p>When you're done, the "source folder" path in the list should look like android/packages/apps/<i>YourAppName</i>
+/src. Depending on which app(s) you include, you may also need to include othersrc/main/java directories under android/dalvik/libcore. Do this if you find you cannot build with the default set.
+</p>
+<h4>
+Eclipse setup to work on developer tools
+</h4>
+<p>To work on Java developer tools, the principle is the same, except you specify /path/to/tool when using the option "Create project from existing source."
+</p>
+<p>Once the project is created, you need to set up the Java Build Path:
+</p>
+<ol><li>Select the project you just created.
+</li>
+<li>Project Properties
+</li>
+<li>Select "Java Build Path" from the left-hand menu.
+</li>
+<li>Choose the "Source" tab.
+</li>
+<li>Expand the single <i>toolname</i>
+/src entry.
+</li>
+<li>Double click the "Excluded: (none)" item.
+</li>
+<li>Add to the excluded (bottom) list: "MakeFile" and "resources/".
+</li>
+<li>Close the dialog.
+</li>
+<li>Back in the "Source" tab, click "Add Folder...", and add <i>toolname</i>
+/src/resources.
+</li>
+<li>Click OK.
+</li>
+</ol>
+<h4>
+Eclipse setup to work on DDMS <br></h4>
+<p>For DDMS, you will need to make a project for
+</p>
+<ol><li>development/tools/ddms/libs/ddmlib
+</li>
+<li>development/tools/ddms/libs/ddmuilib
+</li>
+<li>development/tools/ddms/app
+</li>
+</ol>
+<p>Each project will need to reference the ones before it ("ddmuilib" references "ddmlib", and "app" references both of those). To do this:
+</p>
+<ol><li>Make sure you have all 3 projects defined.
+</li>
+<li>Right click on a project, "Build Path" "Configure Build Path..."
+</li>
+<li>Choose the "Project" tab.
+</li>
+<li>Click "Add..." and check the required projects.
+</li>
+</ol>
+<h2><a>Eclipse formatting</a>
+</h2>
+<p>You can import files in development/ide/eclipse to make Eclipse
+follow the Android style rules.  Select
+"Window &rsaquo; Preferences &rsaquo; Java &rsaquo; Code Style".
+Use "Formatter &rsaquo; Import" to import android-formatting.xml
+and "Organize Imports &rsaquo; Import" to import android.importorder.
+</p>
+<h2><a>Debugging the emulator with Eclipse</a>
+</h2>
+<p>You can also use eclipse to debug the emulator and step through code. First, start the emulator running:
+</p>
+<pre>cd /path/to/android/root <br>. build/envsetup.sh <br>lunch 1   # to build the emulator <br>make      # if you didn't already do this <br>emulator  # you should see a GUI picture of a phone <br></pre>
+<p>In another shell, start DDMS (the Dalvik debug manager):
+</p>
+<pre>cd /path/to/android/root <br>ddms      # you should get a splufty debugging console <br></pre>
+<p>Now, in eclipse, you can attach to the emulator:
+</p>
+<ol><li>Run Open Debug Dialog...
+</li>
+<li>Right-click "Remote Java Application", select "New".
+</li>
+<li>Pick a name, "android-debug" or anything you like.
+</li>
+<li>Set the "Project" to your project ("android-java" or whatever).
+</li>
+<li>Keep the "Host" set to "localhost", but change "Port" to 8700.
+</li>
+<li>Click the "Debug" button and you should be all set.
+</li>
+</ol>
+<p>Note that port 8700 is attached to whatever process is currently selected in the DDMS console, so you need to sure that DDMS has selected the process you want to debug.
+</p>
+<p>You may need to open the Debug perspective (next to the "Java" perspective icon in the upper-right, click the small "Open Perspective" icon and select "Debug"). Once you do, you should see a list of threads; if you select one and break it (by clicking the "pause" icon), it should show the stack trace, source file, and line where execution is at. Breakpoints and whatnot should all work.
+</p>
+<h2><a>Bonus material</a>
+</h2>
+<p>Replace Ctrl with the Apple key on Mac.
+</p>
+
+<pre>Ctrl-Shift-o = Organize imports <br>Ctrl-Shift-t = load class by name <br>Ctrl-Shift-r = load non-class resource by name <br>Ctrl-1 = quick fix <br>Ctrl-e = Recently viewed files <br>Ctrl-space = auto complete <br>Shift-Alt-r = refactor:rename <br>Shift-Alt-v = refactor:move <br></pre>
+
+<h2><a>Useful Plugins</a>
+</h2>
+<p>Eclipse has a plugin architecture that enables third parties to extend the IDE. Here are some plugins that make Eclipse easier to use for writing Android software:
+</p>
+
+<ul><li><a href="http://andrei.gmxhome.de/anyedit/">AnyEdit</a>
+- automatically fix whitespace issues when saving files. Can convert tabs to spaces, strip blanks at end-of-line, and ensure the last line of the file has an end-of-line character.
+</li>
+</ul>
+<h2><a>"Eclipse is not working correctly, what should I do?"</a>
+</h2>
+<p>Make sure:
+</p>
+<ul><li>You followed the instructions on this page precisely.
+</li>
+<li>Your Problems view doesn't show any errors.
+</li>
+<li>Your application respects the package/directory structure.
+</li>
+</ul>
+<p>If you're still having problems, please contact one of the Android mailing lists or IRC channels.
+</p>
+</div>
diff --git a/pdk/hosting/app.yaml b/pdk/hosting/app.yaml
index b36efe8..6758539 100644
--- a/pdk/hosting/app.yaml
+++ b/pdk/hosting/app.yaml
@@ -4,8 +4,10 @@
 api_version: 1
 
 handlers:
-- url: /online-pdk
-  static_dir: online-pdk
-
 - url: /
-  script: pdk.py
+  static_files: online-pdk/index.html
+  upload: online-pdk/index.html
+
+- url: /(.*)
+  static_files: online-pdk/\1
+  upload: online-pdk/.*
diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml
index a6eff96..ec60e15 100644
--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -4,9 +4,9 @@
      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.
@@ -34,7 +34,7 @@
     <uses-permission android:name="android.permission.CAMERA" />
     <uses-feature android:name="android.hardware.camera" />
     <uses-feature android:name="android.hardware.camera.autofocus" android:required="false" />
-    
+
     <application android:name="ApiDemosApplication"
             android:label="@string/activity_sample_code"
             android:icon="@drawable/app_sample_code" >
@@ -42,7 +42,7 @@
         <!-- This is how we can request a library but still allow the app
              to be installed if it doesn't exist. -->
         <uses-library android:name="com.example.will.never.exist" android:required="false" />
-        
+
         <activity android:name="ApiDemos">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -191,11 +191,11 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".app.ReorderTwo" />
         <activity android:name=".app.ReorderThree" />
         <activity android:name=".app.ReorderFour" />
-        
+
         <activity android:name=".app.SetWallpaperActivity"
                   android:label="@string/activity_setwallpaper">
             <intent-filter>
@@ -217,14 +217,17 @@
 
         <service android:name=".app.LocalService" />
 
-        <activity android:name=".app.LocalServiceController" android:label="@string/activity_local_service_controller">
+        <activity android:name=".app.LocalService$Controller"
+                android:label="@string/activity_local_service_controller"
+                android:launchMode="singleTop">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
 
-        <activity android:name=".app.LocalServiceBinding" android:label="@string/activity_local_service_binding">
+        <activity android:name=".app.LocalService$Binding"
+                android:label="@string/activity_local_service_binding">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -243,14 +246,17 @@
             </intent-filter>
         </service>
 
-        <activity android:name=".app.RemoteServiceController" android:label="@string/activity_remote_service_controller">
+        <activity android:name=".app.RemoteService$Controller"
+                android:label="@string/activity_remote_service_controller"
+                android:launchMode="singleTop">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
 
-        <activity android:name=".app.RemoteServiceBinding" android:label="@string/activity_remote_service_binding">
+        <activity android:name=".app.RemoteService$Binding"
+                android:label="@string/activity_remote_service_binding">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -259,7 +265,9 @@
 
         <service android:name=".app.ServiceStartArguments" />
 
-        <activity android:name=".app.ServiceStartArgumentsController" android:label="@string/activity_service_start_arguments_controller">
+        <activity android:name=".app.ServiceStartArguments$Controller"
+                android:label="@string/activity_service_start_arguments_controller"
+                android:launchMode="singleTop">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -267,8 +275,10 @@
         </activity>
 
         <service android:name=".app.ForegroundService" />
-        
-        <activity android:name=".app.ForegroundServiceController" android:label="@string/activity_foreground_service_controller">
+
+        <activity android:name=".app.ForegroundService$Controller"
+                android:label="@string/activity_foreground_service_controller"
+                android:launchMode="singleTop">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
@@ -392,11 +402,11 @@
             <!-- whenever the user invokes search while in this Activity. -->
             <meta-data android:name="android.app.default_searchable"
                        android:value=".app.SearchQueryResults" />
-            
+
             <!-- This is not the typical way to define android.app.default_searchable, -->
             <!-- and we show it here only because we wish to confine the search demo to this -->
             <!-- section of the ApiDemos application. -->
-            
+
             <!-- For typical applications, it's simpler to define android.app.default_searchable -->
             <!-- just once, at the application level, where it serves as a default for all of -->
             <!-- the Activities in your package. -->
@@ -411,24 +421,24 @@
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
-            
+
             <!-- This intent-filter identifies this activity as "searchable" -->
-            
+
             <intent-filter>
                 <action android:name="android.intent.action.SEARCH" />
                 <category android:name="android.intent.category.DEFAULT" />
             </intent-filter>
-            
+
             <!-- This metadata entry provides further configuration details for searches -->
             <!-- that are handled by this activity. -->
-            
+
             <meta-data android:name="android.app.searchable"
                        android:resource="@xml/searchable" />
         </activity>
 
         <!-- This provider declaration informs the Search Manager that you have a provider of -->
         <!-- Search suggestions, and provides information about how to access it. -->
-        
+
         <provider android:name=".app.SearchSuggestionSampleProvider"
                   android:authorities="com.example.android.apis.SuggestionProvider" />
 
@@ -436,12 +446,12 @@
 
         <!-- This section of sample code shows how your application can add shortcuts to -->
         <!-- the launcher (home screen).  Shortcuts have a three step life cycle. -->
-        
+
         <!-- 1.  Your application offers to provide shortcuts to the launcher.  When -->
         <!--     the user installs a shortcut, an activity within your application -->
         <!--     generates the actual shortcut and returns it to the launcher, where it -->
         <!--     is shown to the user as an icon. -->
-        
+
         <!-- 2.  Any time the user clicks on an installed shortcut, an intent is sent. -->
         <!--     Typically this would then be handled as necessary by an activity within -->
         <!--     your application. -->
@@ -533,6 +543,28 @@
             </intent-filter>
         </activity>
 
+        <!-- Device Admin Samples -->
+
+        <activity android:name=".app.SampleDeviceAdmin$Controller"
+                android:label="@string/activity_sample_device_admin">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
+<!-- BEGIN_INCLUDE(device_admin_declaration) -->
+        <receiver android:name=".app.SampleDeviceAdmin"
+                android:label="@string/sample_device_admin"
+                android:description="@string/sample_device_admin_description"
+                android:permission="android.permission.BIND_DEVICE_ADMIN">
+            <meta-data android:name="android.app.device_admin"
+                       android:resource="@xml/sample_device_admin" />
+            <intent-filter>
+                <action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
+            </intent-filter>
+        </receiver>
+<!-- END_INCLUDE(device_admin_declaration) -->
 
         <!-- Voice Recognition Samples -->
 
@@ -1396,6 +1428,37 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".graphics.CompressedTextureActivity"
+                android:label="Graphics/OpenGL ES/Compressed Texture"
+                android:theme="@android:style/Theme.NoTitleBar"
+                android:configChanges="orientation|keyboardHidden">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".graphics.CubeMapActivity"
+                android:label="Graphics/OpenGL ES/Cube Map"
+                android:theme="@android:style/Theme.NoTitleBar"
+                android:configChanges="orientation|keyboardHidden">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
+
+        <activity android:name=".graphics.FrameBufferObjectActivity"
+                android:label="Graphics/OpenGL ES/Frame Buffer Object"
+                android:theme="@android:style/Theme.NoTitleBar"
+                android:configChanges="orientation|keyboardHidden">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
         <activity android:name=".graphics.GLSurfaceViewActivity"
                 android:label="Graphics/OpenGL ES/GLSurfaceView"
                 android:theme="@android:style/Theme.NoTitleBar"
@@ -1406,6 +1469,25 @@
             </intent-filter>
         </activity>
 
+        <activity android:name=".graphics.GLES20Activity"
+                android:label="Graphics/OpenGL ES/OpenGL ES 2.0"
+                android:theme="@android:style/Theme.NoTitleBar"
+                android:configChanges="orientation|keyboardHidden">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".graphics.MatrixPaletteActivity"
+                android:label="Graphics/OpenGL ES/Matrix Palette Skinning"
+                android:configChanges="orientation|keyboardHidden">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+        </activity>
+
         <activity android:name=".graphics.TranslucentGLSurfaceViewActivity"
                 android:label="Graphics/OpenGL ES/Translucent GLSurfaceView"
                 android:theme="@style/Theme.Translucent"
@@ -1415,7 +1497,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.TriangleActivity"
                 android:label="Graphics/OpenGL ES/Textured Triangle"
                 android:theme="@android:style/Theme.NoTitleBar"
@@ -1425,7 +1507,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.spritetext.SpriteTextActivity"
                 android:label="Graphics/OpenGL ES/Sprite Text"
                 android:theme="@android:style/Theme.NoTitleBar"
@@ -1435,7 +1517,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.TouchRotateActivity"
                 android:label="Graphics/OpenGL ES/Touch Rotate"
                 android:theme="@android:style/Theme.NoTitleBar"
@@ -1445,7 +1527,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.PolyToPoly" android:label="Graphics/PolyToPoly">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -1679,7 +1761,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".graphics.PurgeableBitmap" android:label="Graphics/PurgeableBitmap/NonPurgeable">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
@@ -1773,7 +1855,7 @@
                 <category android:name="android.intent.category.SAMPLE_CODE" />
             </intent-filter>
         </activity>
-        
+
         <activity android:name=".text.LogTextBox1" android:label="Text/LogTextBox">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
diff --git a/samples/ApiDemos/res/drawable-hdpi/robot.png b/samples/ApiDemos/res/drawable-hdpi/robot.png
deleted file mode 100755
index 3e4fd21..0000000
--- a/samples/ApiDemos/res/drawable-hdpi/robot.png
+++ /dev/null
Binary files differ
diff --git a/samples/ApiDemos/res/layout/activity_animation.xml b/samples/ApiDemos/res/layout/activity_animation.xml
index 446f735..2432c90 100644
--- a/samples/ApiDemos/res/layout/activity_animation.xml
+++ b/samples/ApiDemos/res/layout/activity_animation.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/activity_animation_msg"/>
diff --git a/samples/ApiDemos/res/layout/alarm_controller.xml b/samples/ApiDemos/res/layout/alarm_controller.xml
index 9ce4d72..97ad9f5 100644
--- a/samples/ApiDemos/res/layout/alarm_controller.xml
+++ b/samples/ApiDemos/res/layout/alarm_controller.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/alarm_controller"/>
diff --git a/samples/ApiDemos/res/layout/alarm_service.xml b/samples/ApiDemos/res/layout/alarm_service.xml
index e24369c..e7dac9d 100644
--- a/samples/ApiDemos/res/layout/alarm_service.xml
+++ b/samples/ApiDemos/res/layout/alarm_service.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/alarm_service"/>
diff --git a/samples/ApiDemos/res/layout/alert_dialog.xml b/samples/ApiDemos/res/layout/alert_dialog.xml
index 741be33..0097e7a 100644
--- a/samples/ApiDemos/res/layout/alert_dialog.xml
+++ b/samples/ApiDemos/res/layout/alert_dialog.xml
@@ -18,34 +18,34 @@
      See corresponding Java code com.example.android.apis.app.AlertDialogSamples.java. -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/screen"
-    android:layout_width="fill_parent" android:layout_height="fill_parent"
+    android:layout_width="match_parent" android:layout_height="match_parent"
     android:orientation="vertical">
     <LinearLayout
-        android:layout_width="fill_parent" android:layout_height="fill_parent"
+        android:layout_width="match_parent" android:layout_height="match_parent"
         android:orientation="vertical">
         <Button android:id="@+id/two_buttons"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:text="@string/alert_dialog_two_buttons"/>
         <Button android:id="@+id/two_buttons2"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:text="@string/alert_dialog_two_buttons2"/>
         <Button android:id="@+id/select_button"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:text="@string/alert_dialog_select_button"/>
         <Button android:id="@+id/progress_button"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:text="@string/alert_dialog_progress_button"/>
         <Button android:id="@+id/radio_button"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:text="@string/alert_dialog_single_choice"/>
         <Button android:id="@+id/checkbox_button"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:text="@string/alert_dialog_multi_choice"/>
         <Button android:id="@+id/checkbox_button2"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:text="@string/alert_dialog_multi_choice_cursor"/>
         <Button android:id="@+id/text_entry_button"
-            android:layout_width="fill_parent" android:layout_height="wrap_content"
+            android:layout_width="match_parent" android:layout_height="wrap_content"
             android:text="@string/alert_dialog_text_entry"/>
     </LinearLayout>
 </ScrollView>
diff --git a/samples/ApiDemos/res/layout/alert_dialog_text_entry.xml b/samples/ApiDemos/res/layout/alert_dialog_text_entry.xml
index adec305..1f4d093 100644
--- a/samples/ApiDemos/res/layout/alert_dialog_text_entry.xml
+++ b/samples/ApiDemos/res/layout/alert_dialog_text_entry.xml
@@ -15,7 +15,7 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical">
 
@@ -32,7 +32,7 @@
     <EditText
         android:id="@+id/username_edit"
         android:layout_height="wrap_content"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_marginLeft="20dip"
         android:layout_marginRight="20dip"
         android:scrollHorizontally="true"
@@ -54,7 +54,7 @@
     <EditText
         android:id="@+id/password_edit"
         android:layout_height="wrap_content"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_marginLeft="20dip"
         android:layout_marginRight="20dip"
         android:scrollHorizontally="true"
diff --git a/samples/ApiDemos/res/layout/animation_1.xml b/samples/ApiDemos/res/layout/animation_1.xml
index cd25e04..8380fc4 100644
--- a/samples/ApiDemos/res/layout/animation_1.xml
+++ b/samples/ApiDemos/res/layout/animation_1.xml
@@ -17,18 +17,18 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical"
     android:padding="10dip"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
     
     <TextView 
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginBottom="10dip"
         android:text="@string/animation_1_instructions"
     />
     
     <EditText android:id="@+id/pw"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:clickable="true"
         android:singleLine="true"
diff --git a/samples/ApiDemos/res/layout/animation_2.xml b/samples/ApiDemos/res/layout/animation_2.xml
index 9f37920..f72753e 100644
--- a/samples/ApiDemos/res/layout/animation_2.xml
+++ b/samples/ApiDemos/res/layout/animation_2.xml
@@ -17,34 +17,34 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:orientation="vertical"
         android:padding="10dip"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
     <ViewFlipper android:id="@+id/flipper"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:flipInterval="2000"
                 android:layout_marginBottom="20dip" >
                 <TextView
-                        android:layout_width="fill_parent"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:gravity="center_horizontal"
                         android:textSize="26sp"
                         android:text="@string/animation_2_text_1"/>
                 <TextView
-                        android:layout_width="fill_parent"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:gravity="center_horizontal"
                         android:textSize="26sp"
                         android:text="@string/animation_2_text_2"/>
                 <TextView
-                        android:layout_width="fill_parent"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:gravity="center_horizontal"
                         android:textSize="26sp"
                         android:text="@string/animation_2_text_3"/>
                 <TextView
-                        android:layout_width="fill_parent"
+                        android:layout_width="match_parent"
                         android:layout_height="wrap_content"
                         android:gravity="center_horizontal"
                         android:textSize="26sp"
@@ -52,14 +52,14 @@
     </ViewFlipper>
 
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginBottom="5dip"
         android:text="@string/animation_2_instructions"
     />
 
     <Spinner android:id="@+id/spinner"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
     />
 
diff --git a/samples/ApiDemos/res/layout/animation_3.xml b/samples/ApiDemos/res/layout/animation_3.xml
index 4d1474c..0dcf3fa 100644
--- a/samples/ApiDemos/res/layout/animation_3.xml
+++ b/samples/ApiDemos/res/layout/animation_3.xml
@@ -17,7 +17,7 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
     android:padding="10dip"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:clipToPadding="false">
 
@@ -29,7 +29,7 @@
         android:text="@string/animation_3_text"/>
 
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="20dip"
         android:layout_marginBottom="5dip"
@@ -37,7 +37,7 @@
 
     <Spinner
         android:id="@+id/spinner"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content" />
 
 </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/animations_main_screen.xml b/samples/ApiDemos/res/layout/animations_main_screen.xml
index ee9e339..88abdd0 100644
--- a/samples/ApiDemos/res/layout/animations_main_screen.xml
+++ b/samples/ApiDemos/res/layout/animations_main_screen.xml
@@ -16,21 +16,21 @@
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/container"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <ListView
         android:id="@android:id/list"
         android:persistentDrawingCache="animation|scrolling"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:layoutAnimation="@anim/layout_bottom_to_top_slide" />
 
     <ImageView
         android:id="@+id/picture"
         android:scaleType="fitCenter"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:visibility="gone" />
 
 </FrameLayout>
diff --git a/samples/ApiDemos/res/layout/appwidget_configure.xml b/samples/ApiDemos/res/layout/appwidget_configure.xml
index c041ad6..d018a7b 100644
--- a/samples/ApiDemos/res/layout/appwidget_configure.xml
+++ b/samples/ApiDemos/res/layout/appwidget_configure.xml
@@ -15,20 +15,20 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
     >
 
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/appwidget_configure_instructions"
     />
 
     <EditText
         android:id="@+id/appwidget_prefix"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
     />
 
diff --git a/samples/ApiDemos/res/layout/autocomplete_1.xml b/samples/ApiDemos/res/layout/autocomplete_1.xml
index 3c41926..95ab1fd 100644
--- a/samples/ApiDemos/res/layout/autocomplete_1.xml
+++ b/samples/ApiDemos/res/layout/autocomplete_1.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical"
-    android:layout_width="fill_parent" 
+    android:layout_width="match_parent" 
     android:layout_height="wrap_content">
 
     <TextView
@@ -26,7 +26,7 @@
 
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
         <TextView
@@ -35,7 +35,7 @@
             android:text="@string/autocomplete_1_country" />
 
         <AutoCompleteTextView android:id="@+id/edit"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
     </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/autocomplete_2.xml b/samples/ApiDemos/res/layout/autocomplete_2.xml
index 6d4ee75..40bd34c 100644
--- a/samples/ApiDemos/res/layout/autocomplete_2.xml
+++ b/samples/ApiDemos/res/layout/autocomplete_2.xml
@@ -16,8 +16,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical"
-    android:layout_width="fill_parent" 
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent"
     android:gravity="bottom">
 
     <Button
@@ -27,7 +27,7 @@
 
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
         <TextView
@@ -36,7 +36,7 @@
             android:text="@string/autocomplete_2_country" />
 
         <AutoCompleteTextView android:id="@+id/edit"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
     </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/autocomplete_3.xml b/samples/ApiDemos/res/layout/autocomplete_3.xml
index e97535a..b1e344f 100644
--- a/samples/ApiDemos/res/layout/autocomplete_3.xml
+++ b/samples/ApiDemos/res/layout/autocomplete_3.xml
@@ -15,12 +15,12 @@
 -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <LinearLayout
         android:orientation="vertical"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
         <Button
@@ -105,7 +105,7 @@
 
         <LinearLayout
             android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content">
 
             <TextView
@@ -114,7 +114,7 @@
                 android:text="@string/autocomplete_3_country" />
 
             <AutoCompleteTextView android:id="@+id/edit"
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content" />
 
         </LinearLayout>
@@ -146,7 +146,7 @@
 
         <LinearLayout
             android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content">
 
             <TextView
@@ -155,7 +155,7 @@
                 android:text="@string/autocomplete_3_country" />
 
             <AutoCompleteTextView android:id="@+id/edit2"
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content" />
 
         </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/autocomplete_4.xml b/samples/ApiDemos/res/layout/autocomplete_4.xml
index 97e5eb9..88be870 100644
--- a/samples/ApiDemos/res/layout/autocomplete_4.xml
+++ b/samples/ApiDemos/res/layout/autocomplete_4.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
     <TextView
@@ -26,7 +26,7 @@
 
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
         <TextView
@@ -36,7 +36,7 @@
 
         <AutoCompleteTextView android:id="@+id/edit"
             android:completionThreshold="1"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
     </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/autocomplete_5.xml b/samples/ApiDemos/res/layout/autocomplete_5.xml
index 34f68c6..cdce55d 100644
--- a/samples/ApiDemos/res/layout/autocomplete_5.xml
+++ b/samples/ApiDemos/res/layout/autocomplete_5.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
     <TextView
@@ -26,7 +26,7 @@
 
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
         <TextView
@@ -37,7 +37,7 @@
         <AutoCompleteTextView android:id="@+id/edit"
             android:completionThreshold="1"
             android:completionHint="@string/autocomplete_5_hint"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
     </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/autocomplete_6.xml b/samples/ApiDemos/res/layout/autocomplete_6.xml
index 24fbda1..c80706b 100644
--- a/samples/ApiDemos/res/layout/autocomplete_6.xml
+++ b/samples/ApiDemos/res/layout/autocomplete_6.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical"
-    android:layout_width="fill_parent" 
+    android:layout_width="match_parent" 
     android:layout_height="wrap_content">
 
     <TextView
@@ -26,7 +26,7 @@
 
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
         <TextView
@@ -35,7 +35,7 @@
             android:text="@string/autocomplete_7_country" />
 
         <MultiAutoCompleteTextView android:id="@+id/edit"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
 
     </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/baseline_1.xml b/samples/ApiDemos/res/layout/baseline_1.xml
index 0f1c9f6..55912ed 100644
--- a/samples/ApiDemos/res/layout/baseline_1.xml
+++ b/samples/ApiDemos/res/layout/baseline_1.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="horizontal"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
     <TextView
diff --git a/samples/ApiDemos/res/layout/baseline_2.xml b/samples/ApiDemos/res/layout/baseline_2.xml
index 8e323b6..d6bdc99 100644
--- a/samples/ApiDemos/res/layout/baseline_2.xml
+++ b/samples/ApiDemos/res/layout/baseline_2.xml
@@ -16,8 +16,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView
         android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/baseline_3.xml b/samples/ApiDemos/res/layout/baseline_3.xml
index c251703..0fc10af 100644
--- a/samples/ApiDemos/res/layout/baseline_3.xml
+++ b/samples/ApiDemos/res/layout/baseline_3.xml
@@ -16,8 +16,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView
         android:layout_width="wrap_content"
@@ -26,7 +26,7 @@
 
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_weight="1.0"
         android:layout_height="0dip">
 
diff --git a/samples/ApiDemos/res/layout/baseline_4.xml b/samples/ApiDemos/res/layout/baseline_4.xml
index 5faa9da..c6d055d 100644
--- a/samples/ApiDemos/res/layout/baseline_4.xml
+++ b/samples/ApiDemos/res/layout/baseline_4.xml
@@ -16,8 +16,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView
         android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/baseline_6.xml b/samples/ApiDemos/res/layout/baseline_6.xml
index 5418afb..88e1404 100644
--- a/samples/ApiDemos/res/layout/baseline_6.xml
+++ b/samples/ApiDemos/res/layout/baseline_6.xml
@@ -15,12 +15,12 @@
 -->
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <EditText android:id="@+id/anchor"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:textSize="20sp"
         android:text="@string/baseline_6_multi_line" />
 
diff --git a/samples/ApiDemos/res/layout/baseline_7.xml b/samples/ApiDemos/res/layout/baseline_7.xml
index 2dc9439..55ab59b 100644
--- a/samples/ApiDemos/res/layout/baseline_7.xml
+++ b/samples/ApiDemos/res/layout/baseline_7.xml
@@ -15,8 +15,8 @@
 -->
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView android:id="@+id/anchor"
         android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/baseline_nested_1.xml b/samples/ApiDemos/res/layout/baseline_nested_1.xml
index b940239..160c738 100644
--- a/samples/ApiDemos/res/layout/baseline_nested_1.xml
+++ b/samples/ApiDemos/res/layout/baseline_nested_1.xml
@@ -16,8 +16,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView
         android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/baseline_nested_2.xml b/samples/ApiDemos/res/layout/baseline_nested_2.xml
index 5bc8361..4bb75c2 100644
--- a/samples/ApiDemos/res/layout/baseline_nested_2.xml
+++ b/samples/ApiDemos/res/layout/baseline_nested_2.xml
@@ -16,8 +16,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView
         android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/baseline_nested_3.xml b/samples/ApiDemos/res/layout/baseline_nested_3.xml
index c01c947..eda47a2 100644
--- a/samples/ApiDemos/res/layout/baseline_nested_3.xml
+++ b/samples/ApiDemos/res/layout/baseline_nested_3.xml
@@ -16,8 +16,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView
         android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/buttons_1.xml b/samples/ApiDemos/res/layout/buttons_1.xml
index dc657ef..c25c1b4 100644
--- a/samples/ApiDemos/res/layout/buttons_1.xml
+++ b/samples/ApiDemos/res/layout/buttons_1.xml
@@ -16,8 +16,8 @@
 
 <!-- Lots of buttons = need scrolling -->
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     
     <LinearLayout
         android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/chronometer.xml b/samples/ApiDemos/res/layout/chronometer.xml
index b38c2b6..63dc67f 100644
--- a/samples/ApiDemos/res/layout/chronometer.xml
+++ b/samples/ApiDemos/res/layout/chronometer.xml
@@ -16,8 +16,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <Chronometer android:id="@+id/chronometer"
         android:format="@string/chronometer_initial_format"
diff --git a/samples/ApiDemos/res/layout/contacts_filter.xml b/samples/ApiDemos/res/layout/contacts_filter.xml
index e8d1615..c120151 100644
--- a/samples/ApiDemos/res/layout/contacts_filter.xml
+++ b/samples/ApiDemos/res/layout/contacts_filter.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/contacts_filter"/>
diff --git a/samples/ApiDemos/res/layout/controls_1.xml b/samples/ApiDemos/res/layout/controls_1.xml
index 29658d7..1aaef3d 100644
--- a/samples/ApiDemos/res/layout/controls_1.xml
+++ b/samples/ApiDemos/res/layout/controls_1.xml
@@ -16,12 +16,12 @@
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <LinearLayout
         android:orientation="vertical"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
     
         <Button android:id="@+id/button"
@@ -30,7 +30,7 @@
             android:layout_height="wrap_content"/>
     
         <EditText android:id="@+id/edit"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"/>
             
         <CheckBox android:id="@+id/check1"
@@ -46,7 +46,7 @@
             android:text="@string/controls_1_checkbox_2" />
     
         <RadioGroup
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:orientation="vertical">
     
@@ -77,13 +77,13 @@
             android:layout_height="wrap_content" />
              
         <Spinner android:id="@+id/spinner1"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:drawSelectorOnTop="true"
         />
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="5dip"
             android:text="@string/textColorPrimary"
@@ -92,7 +92,7 @@
         />
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="5dip"
             android:text="@string/textColorSecondary"
@@ -102,7 +102,7 @@
         />
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:layout_marginTop="5dip"
             android:text="@string/textColorTertiary"
diff --git a/samples/ApiDemos/res/layout/custom_dialog_activity.xml b/samples/ApiDemos/res/layout/custom_dialog_activity.xml
index d706018..971ac0d 100644
--- a/samples/ApiDemos/res/layout/custom_dialog_activity.xml
+++ b/samples/ApiDemos/res/layout/custom_dialog_activity.xml
@@ -19,6 +19,6 @@
 
 <!-- This screen consists of a single text field that displays some text. -->
 <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
-    android:layout_width="fill_parent" android:layout_height="fill_parent"
+    android:layout_width="match_parent" android:layout_height="match_parent"
     android:gravity="center_vertical|center_horizontal"
     android:text="@string/custom_dialog_activity_text"/>
diff --git a/samples/ApiDemos/res/layout/custom_title.xml b/samples/ApiDemos/res/layout/custom_title.xml
index dbe8cb6..8cdc584 100644
--- a/samples/ApiDemos/res/layout/custom_title.xml
+++ b/samples/ApiDemos/res/layout/custom_title.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/screen"
-    android:layout_width="fill_parent" 
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent"
     android:orientation="vertical">
-    <LinearLayout android:layout_width="fill_parent" 
+    <LinearLayout android:layout_width="match_parent" 
         android:layout_height="wrap_content"
         android:baselineAligned="false">
         <EditText android:id="@+id/left_text_edit"
@@ -38,7 +38,7 @@
             android:layout_gravity="center_vertical"
             android:text="@string/custom_title_left_button"/>
     </LinearLayout>
-    <LinearLayout android:layout_width="fill_parent" 
+    <LinearLayout android:layout_width="match_parent" 
         android:layout_height="wrap_content"
         android:baselineAligned="false">
         <EditText android:id="@+id/right_text_edit"
diff --git a/samples/ApiDemos/res/layout/custom_title_1.xml b/samples/ApiDemos/res/layout/custom_title_1.xml
index f794332..812fbb0 100644
--- a/samples/ApiDemos/res/layout/custom_title_1.xml
+++ b/samples/ApiDemos/res/layout/custom_title_1.xml
@@ -18,7 +18,7 @@
      See corresponding Java code com.example.android.apis.app.CustomTitle.java. -->
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/screen"
-    android:layout_width="fill_parent" android:layout_height="fill_parent"
+    android:layout_width="match_parent" android:layout_height="match_parent"
     android:orientation="vertical">
     <TextView android:id="@+id/left_text"
         android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/custom_view_1.xml b/samples/ApiDemos/res/layout/custom_view_1.xml
index cac91ad..cb8e0f6 100644
--- a/samples/ApiDemos/res/layout/custom_view_1.xml
+++ b/samples/ApiDemos/res/layout/custom_view_1.xml
@@ -19,24 +19,24 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:app="http://schemas.android.com/apk/res/com.example.android.apis"
         android:orientation="vertical"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
     
     <com.example.android.apis.view.LabelView
             android:background="@drawable/red"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content" 
             app:text="Red"/>
     
     <com.example.android.apis.view.LabelView
             android:background="@drawable/blue"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content" 
             app:text="Blue" app:textSize="20dp"/>
     
     <com.example.android.apis.view.LabelView
             android:background="@drawable/green"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content" 
             app:text="Green" app:textColor="#ffffffff" />
 
diff --git a/samples/ApiDemos/res/layout/date_widgets_example_2.xml b/samples/ApiDemos/res/layout/date_widgets_example_2.xml
index 50b182d..0c99522 100644
--- a/samples/ApiDemos/res/layout/date_widgets_example_2.xml
+++ b/samples/ApiDemos/res/layout/date_widgets_example_2.xml
@@ -22,7 +22,7 @@
 
     <TimePicker android:id="@+id/timePicker"
         android:layout_height="wrap_content"
-        android:layout_width="fill_parent"/>
+        android:layout_width="match_parent"/>
 
     <TextView android:id="@+id/dateDisplay"
             android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/dialog_activity.xml b/samples/ApiDemos/res/layout/dialog_activity.xml
index 88c4b07..2b27d9a 100644
--- a/samples/ApiDemos/res/layout/dialog_activity.xml
+++ b/samples/ApiDemos/res/layout/dialog_activity.xml
@@ -19,6 +19,6 @@
 
 <!-- This screen consists of a single text field that displays some text. -->
 <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
-    android:layout_width="fill_parent" android:layout_height="fill_parent"
+    android:layout_width="match_parent" android:layout_height="match_parent"
     android:gravity="center_vertical|center_horizontal"
     android:text="@string/dialog_activity_text"/>
diff --git a/samples/ApiDemos/res/layout/focus_1.xml b/samples/ApiDemos/res/layout/focus_1.xml
index 12af0a9..96ab467 100644
--- a/samples/ApiDemos/res/layout/focus_1.xml
+++ b/samples/ApiDemos/res/layout/focus_1.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_height="wrap_content"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:orientation="vertical">
 
     <TextView android:id="@+id/txtStatus"
@@ -27,12 +27,12 @@
     <ListView android:id="@+id/rssListView"
         android:background="#7700CC00"
         android:layout_height="wrap_content"
-        android:layout_width="fill_parent" />
+        android:layout_width="match_parent" />
 
    <WebView android:id="@+id/rssWebView"
         android:background="#77CC0000"
         android:layout_height="50dip"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:focusable="false" />
 
     <Button android:layout_height="wrap_content"
diff --git a/samples/ApiDemos/res/layout/focus_2.xml b/samples/ApiDemos/res/layout/focus_2.xml
index 6351de2..0720d5b 100644
--- a/samples/ApiDemos/res/layout/focus_2.xml
+++ b/samples/ApiDemos/res/layout/focus_2.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_height="wrap_content"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:orientation="horizontal">
 
     <Button android:id="@+id/leftButton"
diff --git a/samples/ApiDemos/res/layout/focus_3.xml b/samples/ApiDemos/res/layout/focus_3.xml
index f08c3f8..f871695 100644
--- a/samples/ApiDemos/res/layout/focus_3.xml
+++ b/samples/ApiDemos/res/layout/focus_3.xml
@@ -18,8 +18,8 @@
      focus behavior that would be difficult with default focus calculation alg.-->
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:padding="10dip">
 
     <Button android:id="@+id/top"
diff --git a/samples/ApiDemos/res/layout/foreground_service_controller.xml b/samples/ApiDemos/res/layout/foreground_service_controller.xml
index 4493200..20ce103 100644
--- a/samples/ApiDemos/res/layout/foreground_service_controller.xml
+++ b/samples/ApiDemos/res/layout/foreground_service_controller.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/foreground_service_controller"/>
diff --git a/samples/ApiDemos/res/layout/forward_target.xml b/samples/ApiDemos/res/layout/forward_target.xml
index 6d56ae2..b122955 100644
--- a/samples/ApiDemos/res/layout/forward_target.xml
+++ b/samples/ApiDemos/res/layout/forward_target.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:text="@string/forward_target"/>
 
diff --git a/samples/ApiDemos/res/layout/forwarding.xml b/samples/ApiDemos/res/layout/forwarding.xml
index a860d88..6f0d8a8 100644
--- a/samples/ApiDemos/res/layout/forwarding.xml
+++ b/samples/ApiDemos/res/layout/forwarding.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/forwarding"/>
diff --git a/samples/ApiDemos/res/layout/gallery_1.xml b/samples/ApiDemos/res/layout/gallery_1.xml
index 40f3443..9b9c4bb 100644
--- a/samples/ApiDemos/res/layout/gallery_1.xml
+++ b/samples/ApiDemos/res/layout/gallery_1.xml
@@ -15,7 +15,7 @@
 -->
 
 <Gallery xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gallery"
-	android:layout_width="fill_parent"
+	android:layout_width="match_parent"
 	android:layout_height="wrap_content"
 />
        
diff --git a/samples/ApiDemos/res/layout/gallery_2.xml b/samples/ApiDemos/res/layout/gallery_2.xml
index 37e5d11..1192bb2 100644
--- a/samples/ApiDemos/res/layout/gallery_2.xml
+++ b/samples/ApiDemos/res/layout/gallery_2.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
     <Button
@@ -28,7 +28,7 @@
     />
 
     <Gallery android:id="@+id/gallery"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:gravity="center_vertical"
         android:spacing="16dp"
diff --git a/samples/ApiDemos/res/layout/google_login.xml b/samples/ApiDemos/res/layout/google_login.xml
index 9ab2f62..8f1fd8a 100644
--- a/samples/ApiDemos/res/layout/google_login.xml
+++ b/samples/ApiDemos/res/layout/google_login.xml
@@ -18,8 +18,8 @@
      See corresponding Java code com.android.sdk.content.StyledText -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
 
     <Button
@@ -46,14 +46,14 @@
     <TextView
         android:id="@+id/username_label"
         android:visibility="gone"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/googlelogin_user"/>
 
     <TextView
         android:id="@+id/username"
         android:visibility="gone"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/google_login_username_text"/>
 
diff --git a/samples/ApiDemos/res/layout/grid_1.xml b/samples/ApiDemos/res/layout/grid_1.xml
index ca60320..765d44b 100644
--- a/samples/ApiDemos/res/layout/grid_1.xml
+++ b/samples/ApiDemos/res/layout/grid_1.xml
@@ -15,8 +15,8 @@
 -->
 
 <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/myGrid"
-	android:layout_width="fill_parent" 
-	android:layout_height="fill_parent"
+	android:layout_width="match_parent" 
+	android:layout_height="match_parent"
     android:padding="10dp"
     android:verticalSpacing="10dp"
     
diff --git a/samples/ApiDemos/res/layout/grid_2.xml b/samples/ApiDemos/res/layout/grid_2.xml
index 4640ab6..eaea658 100644
--- a/samples/ApiDemos/res/layout/grid_2.xml
+++ b/samples/ApiDemos/res/layout/grid_2.xml
@@ -16,8 +16,8 @@
 
 <GridView xmlns:android="http://schemas.android.com/apk/res/android" 
     android:id="@+id/myGrid"
-	android:layout_width="fill_parent" 
-	android:layout_height="fill_parent"
+	android:layout_width="match_parent" 
+	android:layout_height="match_parent"
     android:padding="10dp"
     android:verticalSpacing="10dp"
     
diff --git a/samples/ApiDemos/res/layout/hello_world.xml b/samples/ApiDemos/res/layout/hello_world.xml
index 364a83a..0282076 100644
--- a/samples/ApiDemos/res/layout/hello_world.xml
+++ b/samples/ApiDemos/res/layout/hello_world.xml
@@ -20,6 +20,6 @@
 <!-- This screen consists of a single text field that
      displays our "Hello, World!" text. -->
 <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
-    android:layout_width="fill_parent" android:layout_height="fill_parent"
+    android:layout_width="match_parent" android:layout_height="match_parent"
     android:gravity="center_vertical|center_horizontal"
     android:text="@string/hello_world"/>
diff --git a/samples/ApiDemos/res/layout/image_button_1.xml b/samples/ApiDemos/res/layout/image_button_1.xml
index 114163e..463e706 100644
--- a/samples/ApiDemos/res/layout/image_button_1.xml
+++ b/samples/ApiDemos/res/layout/image_button_1.xml
@@ -15,8 +15,8 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
 
     <ImageButton
diff --git a/samples/ApiDemos/res/layout/image_switcher_1.xml b/samples/ApiDemos/res/layout/image_switcher_1.xml
index d9cd080..0fdf3f9 100644
--- a/samples/ApiDemos/res/layout/image_switcher_1.xml
+++ b/samples/ApiDemos/res/layout/image_switcher_1.xml
@@ -15,19 +15,19 @@
 -->
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
-    android:layout_width="fill_parent" 
-    android:layout_height="fill_parent"> 
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent"> 
     
     <ImageSwitcher android:id="@+id/switcher"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:layout_alignParentTop="true"
         android:layout_alignParentLeft="true"
     />
     
     <Gallery android:id="@+id/gallery"
         android:background="#55000000"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="60dp"
         android:layout_alignParentBottom="true"
         android:layout_alignParentLeft="true"
diff --git a/samples/ApiDemos/res/layout/image_view_1.xml b/samples/ApiDemos/res/layout/image_view_1.xml
index 36b926d..c5e2240 100644
--- a/samples/ApiDemos/res/layout/image_view_1.xml
+++ b/samples/ApiDemos/res/layout/image_view_1.xml
@@ -15,18 +15,18 @@
 -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     
     <LinearLayout
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:orientation="vertical">
         
         <!-- The following four examples use a large image -->
         <!-- 1. Non-scaled view, for reference -->
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:paddingTop="10dip"
             android:text="@string/image_view_large_normal"/>
@@ -38,7 +38,7 @@
             
         <!-- 2. Limit to at most 50x50 -->
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:paddingTop="10dip"
             android:text="@string/image_view_large_at_most"/>
@@ -52,7 +52,7 @@
 
        <!-- 3. Limit to at most 70x70, with 10 pixels of padding all around -->
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:paddingTop="10dip"
             android:text="@string/image_view_large_at_most_padded"/>
@@ -68,7 +68,7 @@
             
         <!-- 4. Limit to exactly 70x70, with 10 pixels of padding all around -->
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:paddingTop="10dip"
             android:text="@string/image_view_large_exactly_padded"/>
@@ -83,7 +83,7 @@
         <!-- Repeating the previous four examples with small image -->
         <!-- 1. Non-scaled view, for reference -->
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:paddingTop="10dip"
             android:text="@string/image_view_small_normal"/>
@@ -96,7 +96,7 @@
             
         <!-- 2. Limit to at most 50x50 -->
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:paddingTop="10dip"
             android:text="@string/image_view_small_at_most"/>
@@ -111,7 +111,7 @@
 
        <!-- 3. Limit to at most 70x70, with 10 pixels of padding all around -->
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:paddingTop="10dip"
             android:text="@string/image_view_small_at_most_padded"/>
@@ -127,7 +127,7 @@
             
         <!-- 4. Limit to exactly 70x70, with 10 pixels of padding all around -->
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:paddingTop="10dip"
             android:text="@string/image_view_small_exactly_padded"/>
diff --git a/samples/ApiDemos/res/layout/incoming_message.xml b/samples/ApiDemos/res/layout/incoming_message.xml
index 01ea04a..3c0d92a 100644
--- a/samples/ApiDemos/res/layout/incoming_message.xml
+++ b/samples/ApiDemos/res/layout/incoming_message.xml
@@ -16,8 +16,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <Button
         android:id="@+id/notify"
diff --git a/samples/ApiDemos/res/layout/incoming_message_info.xml b/samples/ApiDemos/res/layout/incoming_message_info.xml
index 723a4da..fef2556 100644
--- a/samples/ApiDemos/res/layout/incoming_message_info.xml
+++ b/samples/ApiDemos/res/layout/incoming_message_info.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="horizontal"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
 		<ImageView
diff --git a/samples/ApiDemos/res/layout/incoming_message_panel.xml b/samples/ApiDemos/res/layout/incoming_message_panel.xml
index 3120e4e..bdd808e 100644
--- a/samples/ApiDemos/res/layout/incoming_message_panel.xml
+++ b/samples/ApiDemos/res/layout/incoming_message_panel.xml
@@ -15,13 +15,13 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:background="@android:drawable/toast_frame">
 
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
             <ImageView
diff --git a/samples/ApiDemos/res/layout/incoming_message_view.xml b/samples/ApiDemos/res/layout/incoming_message_view.xml
index b286e6e..b2daf4e 100644
--- a/samples/ApiDemos/res/layout/incoming_message_view.xml
+++ b/samples/ApiDemos/res/layout/incoming_message_view.xml
@@ -16,8 +16,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:paddingLeft="4dip"
     android:paddingRight="4dip"
     android:paddingTop="4dip"
@@ -25,7 +25,7 @@
 
         <LinearLayout
             android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             >
 
diff --git a/samples/ApiDemos/res/layout/intents.xml b/samples/ApiDemos/res/layout/intents.xml
index 023e4e8..5531235 100644
--- a/samples/ApiDemos/res/layout/intents.xml
+++ b/samples/ApiDemos/res/layout/intents.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/intents"/>
diff --git a/samples/ApiDemos/res/layout/launcher_shortcuts.xml b/samples/ApiDemos/res/layout/launcher_shortcuts.xml
index c8fbb2a..1debbd3 100644
--- a/samples/ApiDemos/res/layout/launcher_shortcuts.xml
+++ b/samples/ApiDemos/res/layout/launcher_shortcuts.xml
@@ -17,13 +17,13 @@
 <!-- This activity provides information about launcher shortcuts -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
     
     <!--  Section: Information -->
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:paddingBottom="4dip"
         android:text="@string/msg_launcher_shortcuts" />
diff --git a/samples/ApiDemos/res/layout/layout_animation_1.xml b/samples/ApiDemos/res/layout/layout_animation_1.xml
index 2b25485..d70a583 100644
--- a/samples/ApiDemos/res/layout/layout_animation_1.xml
+++ b/samples/ApiDemos/res/layout/layout_animation_1.xml
@@ -17,8 +17,8 @@
 <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/grid"
     android:layoutAnimation="@anim/layout_grid_fade"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:padding="10dp"
     android:verticalSpacing="10dp"
 
diff --git a/samples/ApiDemos/res/layout/layout_animation_3.xml b/samples/ApiDemos/res/layout/layout_animation_3.xml
index 051fa8e..3ddaab7 100644
--- a/samples/ApiDemos/res/layout/layout_animation_3.xml
+++ b/samples/ApiDemos/res/layout/layout_animation_3.xml
@@ -16,6 +16,6 @@
 
 <ListView xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@android:id/list"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:layoutAnimation="@anim/layout_bottom_to_top_slide" />
diff --git a/samples/ApiDemos/res/layout/layout_animation_4.xml b/samples/ApiDemos/res/layout/layout_animation_4.xml
index 73b99b0..0b74898 100644
--- a/samples/ApiDemos/res/layout/layout_animation_4.xml
+++ b/samples/ApiDemos/res/layout/layout_animation_4.xml
@@ -17,8 +17,8 @@
 <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/grid"
     android:layoutAnimation="@anim/layout_random_fade"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:padding="10dp"
     android:verticalSpacing="10dp"
 
diff --git a/samples/ApiDemos/res/layout/layout_animation_5.xml b/samples/ApiDemos/res/layout/layout_animation_5.xml
index 602fb18..ff34b43 100644
--- a/samples/ApiDemos/res/layout/layout_animation_5.xml
+++ b/samples/ApiDemos/res/layout/layout_animation_5.xml
@@ -17,8 +17,8 @@
 <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/grid"
     android:layoutAnimation="@anim/layout_grid_inverse_fade"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:padding="10dp"
     android:verticalSpacing="10dp"
 
diff --git a/samples/ApiDemos/res/layout/layout_animation_6.xml b/samples/ApiDemos/res/layout/layout_animation_6.xml
index 026797e..f6cfad8 100644
--- a/samples/ApiDemos/res/layout/layout_animation_6.xml
+++ b/samples/ApiDemos/res/layout/layout_animation_6.xml
@@ -17,8 +17,8 @@
 <GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/grid"
     android:layoutAnimation="@anim/layout_wave_scale"
 
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:verticalSpacing="10dp"
 
     android:horizontalSpacing="10dp"
diff --git a/samples/ApiDemos/res/layout/layout_animation_7.xml b/samples/ApiDemos/res/layout/layout_animation_7.xml
index 38260c7..b672c37 100644
--- a/samples/ApiDemos/res/layout/layout_animation_7.xml
+++ b/samples/ApiDemos/res/layout/layout_animation_7.xml
@@ -19,8 +19,8 @@
     android:animationCache="false"
     android:clipToPadding="false"
     android:padding="12dp"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:stretchColumns="1">
 
     <TableRow
diff --git a/samples/ApiDemos/res/layout/linear_layout_1.xml b/samples/ApiDemos/res/layout/linear_layout_1.xml
index ef01ced..be3e77d 100644
--- a/samples/ApiDemos/res/layout/linear_layout_1.xml
+++ b/samples/ApiDemos/res/layout/linear_layout_1.xml
@@ -19,27 +19,27 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
     android:background="@drawable/blue"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
     <!-- view1 goes on top -->
     <TextView
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_1_top"/>
 
     <!-- view2 goes in the middle -->
     <TextView
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_1_middle"/>
 
     <!-- view3 goes on the bottom -->
     <TextView
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_1_bottom"/>
 
diff --git a/samples/ApiDemos/res/layout/linear_layout_10.xml b/samples/ApiDemos/res/layout/linear_layout_10.xml
index eb793fd..4c04474 100644
--- a/samples/ApiDemos/res/layout/linear_layout_10.xml
+++ b/samples/ApiDemos/res/layout/linear_layout_10.xml
@@ -18,14 +18,14 @@
      TextViews, EditTexts, and Buttons. -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical">
 
     <!-- Top label/button text field. -->
 
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:addStatesFromChildren="true"
         android:gravity="center_vertical"
@@ -74,7 +74,7 @@
          except for the label.)  -->
 
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:addStatesFromChildren="true"
         android:gravity="center_vertical"
diff --git a/samples/ApiDemos/res/layout/linear_layout_2.xml b/samples/ApiDemos/res/layout/linear_layout_2.xml
index 3cacccc..6ccfd75 100644
--- a/samples/ApiDemos/res/layout/linear_layout_2.xml
+++ b/samples/ApiDemos/res/layout/linear_layout_2.xml
@@ -19,27 +19,27 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
     android:background="@drawable/blue"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <!-- view1 goes on top -->
     <TextView
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_2_top"/>
 
     <!-- view2 goes in the middle -->
     <TextView
        android:background="@drawable/box"
-       android:layout_width="fill_parent"
+       android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_2_middle"/>
 
     <!-- view3 goes on the bottom -->
     <TextView
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_2_bottom"/>
 
diff --git a/samples/ApiDemos/res/layout/linear_layout_3.xml b/samples/ApiDemos/res/layout/linear_layout_3.xml
index 2b9b327..683b7eb 100644
--- a/samples/ApiDemos/res/layout/linear_layout_3.xml
+++ b/samples/ApiDemos/res/layout/linear_layout_3.xml
@@ -23,20 +23,20 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
     android:background="@drawable/blue"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <!-- view1 goes on top -->
     <TextView
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_3_top"/>
 
     <!-- view2 goes in the middle -->
     <TextView
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_weight="1"
         android:text="@string/linear_layout_3_middle"/>
@@ -44,7 +44,7 @@
     <!-- view3 goes on the bottom -->
     <TextView
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_3_bottom"/>
 
diff --git a/samples/ApiDemos/res/layout/linear_layout_4.xml b/samples/ApiDemos/res/layout/linear_layout_4.xml
index 139fb57..3ba0282 100644
--- a/samples/ApiDemos/res/layout/linear_layout_4.xml
+++ b/samples/ApiDemos/res/layout/linear_layout_4.xml
@@ -20,31 +20,31 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView
         android:background="@drawable/red"
         android:layout_width="0dip"
-        android:layout_height="fill_parent"
+        android:layout_height="match_parent"
         android:layout_weight="1"/>
 
     <TextView
         android:background="@drawable/green"
         android:layout_width="0dip"
-        android:layout_height="fill_parent"
+        android:layout_height="match_parent"
         android:layout_weight="1"/>
 
     <TextView
         android:background="@drawable/blue"
         android:layout_width="0dip"
-        android:layout_height="fill_parent"
+        android:layout_height="match_parent"
         android:layout_weight="1"/>
 
     <TextView
         android:background="@drawable/yellow"
         android:layout_width="0dip"
-        android:layout_height="fill_parent"
+        android:layout_height="match_parent"
         android:layout_weight="1"/>
 
 </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/linear_layout_5.xml b/samples/ApiDemos/res/layout/linear_layout_5.xml
index 832a103..b5d45c0 100644
--- a/samples/ApiDemos/res/layout/linear_layout_5.xml
+++ b/samples/ApiDemos/res/layout/linear_layout_5.xml
@@ -21,7 +21,7 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
     android:background="@drawable/blue"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:padding="10dip">
 
@@ -29,7 +29,7 @@
         TextView goes on top...
     -->
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_5_instructions"/>
 
@@ -42,7 +42,7 @@
         an application resource.
     -->
     <EditText
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@android:drawable/editbox_background"/>
 
@@ -51,7 +51,7 @@
         This item has layout_gravity="right". This means the whole
         horizontal LinearLayout is right aligned, not the individual
         items within it. The horizontal LinearLayout's width is set to
-        wrap_content. (If it was fill_parent it would not have any
+        wrap_content. (If it was match_parent it would not have any
         room to slide to the right.)
     -->
     <LinearLayout
diff --git a/samples/ApiDemos/res/layout/linear_layout_6.xml b/samples/ApiDemos/res/layout/linear_layout_6.xml
index f4bb6a7..da9d814 100644
--- a/samples/ApiDemos/res/layout/linear_layout_6.xml
+++ b/samples/ApiDemos/res/layout/linear_layout_6.xml
@@ -16,7 +16,7 @@
 
 <!--
     LinearLayout which uses a combination of wrap_content on itself and
-    fill_parent on its children to get every item to be the same width.
+    match_parent on its children to get every item to be the same width.
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
@@ -28,25 +28,25 @@
 
     <TextView
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_6_one"/>
 
     <TextView
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_6_two"/>
 
     <TextView
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_6_three"/>
 
     <TextView
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_6_four"/>
 
diff --git a/samples/ApiDemos/res/layout/linear_layout_7.xml b/samples/ApiDemos/res/layout/linear_layout_7.xml
index 19b22e5..5986565 100644
--- a/samples/ApiDemos/res/layout/linear_layout_7.xml
+++ b/samples/ApiDemos/res/layout/linear_layout_7.xml
@@ -20,27 +20,27 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="horizontal"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
     <TextView
         android:background="@drawable/red"
         android:layout_width="0dip"
-        android:layout_height="fill_parent"
+        android:layout_height="match_parent"
         android:layout_weight="1"
         android:text="@string/linear_layout_7_small"/>
 
     <TextView
         android:background="@drawable/green"
         android:layout_width="0dip"
-        android:layout_height="fill_parent"
+        android:layout_height="match_parent"
         android:layout_weight="1"
         android:text="@string/linear_layout_7_big"/>
 
     <TextView
         android:background="@drawable/blue"
         android:layout_width="0dip"
-        android:layout_height="fill_parent"
+        android:layout_height="match_parent"
         android:layout_weight="1"
         android:text="@string/linear_layout_7_small" />
 
diff --git a/samples/ApiDemos/res/layout/linear_layout_8.xml b/samples/ApiDemos/res/layout/linear_layout_8.xml
index f226043..763edca 100644
--- a/samples/ApiDemos/res/layout/linear_layout_8.xml
+++ b/samples/ApiDemos/res/layout/linear_layout_8.xml
@@ -19,15 +19,15 @@
     children stacked from the top.
     -->
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:padding="30dip">
   <LinearLayout
       android:id="@+id/layout"
       android:orientation="vertical"
       android:background="@drawable/blue"
-      android:layout_width="fill_parent"
-      android:layout_height="fill_parent"
+      android:layout_width="match_parent"
+      android:layout_height="match_parent"
       android:padding="30dip">
 
     <TextView
diff --git a/samples/ApiDemos/res/layout/linear_layout_9.xml b/samples/ApiDemos/res/layout/linear_layout_9.xml
index eb91147..67eaf00 100644
--- a/samples/ApiDemos/res/layout/linear_layout_9.xml
+++ b/samples/ApiDemos/res/layout/linear_layout_9.xml
@@ -21,16 +21,16 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <ListView android:id="@+id/list"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_weight="1.0" />
 
     <Button
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/linear_layout_9_button" />
 
diff --git a/samples/ApiDemos/res/layout/link.xml b/samples/ApiDemos/res/layout/link.xml
index a65d000..d4eaf0c 100644
--- a/samples/ApiDemos/res/layout/link.xml
+++ b/samples/ApiDemos/res/layout/link.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
               android:orientation="vertical"
-              android:layout_width="fill_parent"
+              android:layout_width="match_parent"
               android:layout_height="wrap_content">
 
   <!-- Four TextView widgets, each one displaying text containing links. -->
@@ -24,8 +24,8 @@
   <!-- text1 automatically linkifies things like URLs and phone numbers. -->
   <TextView xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/text1"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
             android:autoLink="all"
             android:text="@string/link_text_auto"
             />
@@ -34,23 +34,23 @@
        specify links. -->
   <TextView xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/text2"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
             android:text="@string/link_text_manual"
             />
 
   <!-- text3 builds the text in the Java code using HTML. -->
   <TextView xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/text3"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
             />
 
   <!-- text4 builds the text in the Java code without using HTML. -->
   <TextView xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/text4"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
             />
 
 </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/list_12.xml b/samples/ApiDemos/res/layout/list_12.xml
index 7f19b58..eef6481 100644
--- a/samples/ApiDemos/res/layout/list_12.xml
+++ b/samples/ApiDemos/res/layout/list_12.xml
@@ -16,20 +16,20 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent" 
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent"
     android:paddingLeft="8dip"
     android:paddingRight="8dip">
     
     <ListView android:id="@android:id/list"
-        android:layout_width="fill_parent" 
+        android:layout_width="match_parent" 
         android:layout_height="0dip"
         android:layout_weight="1"
         android:stackFromBottom="true"
         android:transcriptMode="normal"/>
         
     <EditText android:id="@+id/userText"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content" />
         
 </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/list_13.xml b/samples/ApiDemos/res/layout/list_13.xml
index 681b46e..72f2f58 100644
--- a/samples/ApiDemos/res/layout/list_13.xml
+++ b/samples/ApiDemos/res/layout/list_13.xml
@@ -16,17 +16,17 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent" 
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent">
     
     <ListView android:id="@android:id/list"
-        android:layout_width="fill_parent" 
+        android:layout_width="match_parent" 
         android:layout_height="0dip"
         android:layout_weight="1"
         android:drawSelectorOnTop="false"/>
         
     <TextView android:id="@+id/status"
-        android:layout_width="fill_parent" 
+        android:layout_width="match_parent" 
         android:layout_height="wrap_content"
         android:paddingLeft="8dip"
         android:paddingRight="8dip"/>
diff --git a/samples/ApiDemos/res/layout/list_7.xml b/samples/ApiDemos/res/layout/list_7.xml
index 2dc7777..c16c9ac 100644
--- a/samples/ApiDemos/res/layout/list_7.xml
+++ b/samples/ApiDemos/res/layout/list_7.xml
@@ -16,20 +16,20 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 	android:orientation="vertical"
-	android:layout_width="fill_parent" 
-    android:layout_height="fill_parent"
+	android:layout_width="match_parent" 
+    android:layout_height="match_parent"
 	android:paddingLeft="8dip"
 	android:paddingRight="8dip">
-	
+
 	<ListView android:id="@android:id/list"
-	    android:layout_width="fill_parent" 
+	    android:layout_width="match_parent" 
 	    android:layout_height="0dip"
 	    android:layout_weight="1"
 	    android:drawSelectorOnTop="false"/>
 	    
     <TextView android:id="@+id/phone"
-    	android:layout_width="fill_parent" 
+    	android:layout_width="match_parent" 
     	android:layout_height="wrap_content"
     	android:background="@drawable/blue"/>
-    	
+
 </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/list_8.xml b/samples/ApiDemos/res/layout/list_8.xml
index a88b67c..ef5410c 100644
--- a/samples/ApiDemos/res/layout/list_8.xml
+++ b/samples/ApiDemos/res/layout/list_8.xml
@@ -16,12 +16,12 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent" 
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent">
     
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent" 
+        android:layout_width="match_parent" 
         android:layout_height="wrap_content">
         
         <Button android:id="@+id/add"
@@ -39,21 +39,21 @@
     <!-- The frame layout is here since we will be showing either
     the empty view or the list view.  -->
     <FrameLayout
-        android:layout_width="fill_parent" 
+        android:layout_width="match_parent" 
         android:layout_height="0dip"
         android:layout_weight="1" >
         <!-- Here is the list. Since we are using a ListActivity, we
              have to call it "@android:id/list" so ListActivity will
              find it -->
         <ListView android:id="@android:id/list"
-            android:layout_width="fill_parent" 
-            android:layout_height="fill_parent"
+            android:layout_width="match_parent" 
+            android:layout_height="match_parent"
             android:drawSelectorOnTop="false"/>
         
         <!-- Here is the view to show if the list is emtpy -->
         <TextView android:id="@+id/empty"
-            android:layout_width="fill_parent" 
-            android:layout_height="fill_parent"
+            android:layout_width="match_parent" 
+            android:layout_height="match_parent"
             android:text="@string/list_8_no_photos"/>
             
     </FrameLayout>
diff --git a/samples/ApiDemos/res/layout/list_item_checkbox.xml b/samples/ApiDemos/res/layout/list_item_checkbox.xml
index fa1d2d8..a26f6f6 100644
--- a/samples/ApiDemos/res/layout/list_item_checkbox.xml
+++ b/samples/ApiDemos/res/layout/list_item_checkbox.xml
@@ -16,7 +16,7 @@
 
 <CheckBox xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@android:id/text1"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="?android:attr/listPreferredItemHeight"
     android:textAppearance="?android:attr/textAppearanceLarge"
 />
diff --git a/samples/ApiDemos/res/layout/list_item_icon_text.xml b/samples/ApiDemos/res/layout/list_item_icon_text.xml
index 7206c04..85eda7a 100644
--- a/samples/ApiDemos/res/layout/list_item_icon_text.xml
+++ b/samples/ApiDemos/res/layout/list_item_icon_text.xml
@@ -16,8 +16,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <ImageView android:id="@+id/icon"
         android:layout_width="48dip"
diff --git a/samples/ApiDemos/res/layout/local_sample.xml b/samples/ApiDemos/res/layout/local_sample.xml
index e662921..70a9c6b 100644
--- a/samples/ApiDemos/res/layout/local_sample.xml
+++ b/samples/ApiDemos/res/layout/local_sample.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/local_sample"/>
diff --git a/samples/ApiDemos/res/layout/local_service_binding.xml b/samples/ApiDemos/res/layout/local_service_binding.xml
index 775b8fb..6f04ab1 100644
--- a/samples/ApiDemos/res/layout/local_service_binding.xml
+++ b/samples/ApiDemos/res/layout/local_service_binding.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/local_service_binding"/>
diff --git a/samples/ApiDemos/res/layout/local_service_controller.xml b/samples/ApiDemos/res/layout/local_service_controller.xml
index 7bb02ca..30298d0 100644
--- a/samples/ApiDemos/res/layout/local_service_controller.xml
+++ b/samples/ApiDemos/res/layout/local_service_controller.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/local_service_controller"/>
diff --git a/samples/ApiDemos/res/layout/log_text_box_1.xml b/samples/ApiDemos/res/layout/log_text_box_1.xml
index f06619d..4d2c774 100644
--- a/samples/ApiDemos/res/layout/log_text_box_1.xml
+++ b/samples/ApiDemos/res/layout/log_text_box_1.xml
@@ -17,8 +17,8 @@
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <Button
         android:id="@+id/add"
@@ -29,7 +29,7 @@
     <com.example.android.apis.text.LogTextBox
         android:id="@+id/text"
         android:background="@drawable/box"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="0dip"
         android:layout_weight="1"
         android:scrollbars="vertical"/>
diff --git a/samples/ApiDemos/res/layout/mapview.xml b/samples/ApiDemos/res/layout/mapview.xml
index 97ef7ff..664d8f6 100644
--- a/samples/ApiDemos/res/layout/mapview.xml
+++ b/samples/ApiDemos/res/layout/mapview.xml
@@ -19,11 +19,11 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/main"
-    android:layout_width="fill_parent" 
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent">
     <com.google.android.maps.MapView
-        android:layout_width="fill_parent" 
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent" 
+        android:layout_height="match_parent"
         android:enabled="true"
         android:clickable="true"
         android:apiKey="apisamples"
diff --git a/samples/ApiDemos/res/layout/marquee.xml b/samples/ApiDemos/res/layout/marquee.xml
index 6d40c84..6266ff2 100644
--- a/samples/ApiDemos/res/layout/marquee.xml
+++ b/samples/ApiDemos/res/layout/marquee.xml
@@ -17,8 +17,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent" 
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent">
     
     <Button
         android:layout_width="150dip" 
diff --git a/samples/ApiDemos/res/layout/mediaplayer_1.xml b/samples/ApiDemos/res/layout/mediaplayer_1.xml
index 16ae61b..7411e40 100644
--- a/samples/ApiDemos/res/layout/mediaplayer_1.xml
+++ b/samples/ApiDemos/res/layout/mediaplayer_1.xml
@@ -1,30 +1,30 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     >
     <Button android:id="@+id/localvideo"
         android:layout_height="wrap_content"
-        android:layout_width="fill_parent" 
+        android:layout_width="match_parent" 
         android:text="@string/local_video" 
     />
     
     <Button android:id="@+id/streamvideo"
         android:layout_height="wrap_content"
-        android:layout_width="fill_parent" 
+        android:layout_width="match_parent" 
         android:text="@string/stream_video" 
     />
     
     <Button android:id="@+id/localaudio"
         android:layout_height="wrap_content"
-        android:layout_width="fill_parent" 
+        android:layout_width="match_parent" 
         android:text="@string/local_audio" 
     />
     
     <Button android:id="@+id/resourcesaudio"
         android:layout_height="wrap_content"
-        android:layout_width="fill_parent" 
+        android:layout_width="match_parent" 
         android:text="@string/res_audio" 
     />
     
diff --git a/samples/ApiDemos/res/layout/mediaplayer_2.xml b/samples/ApiDemos/res/layout/mediaplayer_2.xml
index e1e49dd..a7f78f6 100644
--- a/samples/ApiDemos/res/layout/mediaplayer_2.xml
+++ b/samples/ApiDemos/res/layout/mediaplayer_2.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <SurfaceView android:id="@+id/surface"
         android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/morse_code.xml b/samples/ApiDemos/res/layout/morse_code.xml
index f536da2..3c7993c 100644
--- a/samples/ApiDemos/res/layout/morse_code.xml
+++ b/samples/ApiDemos/res/layout/morse_code.xml
@@ -17,13 +17,13 @@
 <!-- This activity exercises search invocation options -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
     
     <EditText
         android:id="@+id/text"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:paddingBottom="4dip"
         />
diff --git a/samples/ApiDemos/res/layout/notify_with_text.xml b/samples/ApiDemos/res/layout/notify_with_text.xml
index 6cba90d..e1b6834 100644
--- a/samples/ApiDemos/res/layout/notify_with_text.xml
+++ b/samples/ApiDemos/res/layout/notify_with_text.xml
@@ -16,8 +16,8 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <Button
         android:id="@+id/short_notify"
diff --git a/samples/ApiDemos/res/layout/notifying_controller.xml b/samples/ApiDemos/res/layout/notifying_controller.xml
index 54cef17..30cdb24 100644
--- a/samples/ApiDemos/res/layout/notifying_controller.xml
+++ b/samples/ApiDemos/res/layout/notifying_controller.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/notifying_service_controller"/>
diff --git a/samples/ApiDemos/res/layout/progressbar_1.xml b/samples/ApiDemos/res/layout/progressbar_1.xml
index 0383de9..9e3acb1 100644
--- a/samples/ApiDemos/res/layout/progressbar_1.xml
+++ b/samples/ApiDemos/res/layout/progressbar_1.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
     <ProgressBar android:id="@+id/progress_horizontal"
@@ -34,7 +34,7 @@
 
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
         <Button android:id="@+id/decrease"
@@ -56,7 +56,7 @@
 
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
         <Button android:id="@+id/decrease_secondary"
diff --git a/samples/ApiDemos/res/layout/progressbar_2.xml b/samples/ApiDemos/res/layout/progressbar_2.xml
index 2d43622..0c3f63c 100644
--- a/samples/ApiDemos/res/layout/progressbar_2.xml
+++ b/samples/ApiDemos/res/layout/progressbar_2.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
     <ProgressBar android:id="@+android:id/progress_large"
diff --git a/samples/ApiDemos/res/layout/progressbar_3.xml b/samples/ApiDemos/res/layout/progressbar_3.xml
index ac10a30..0c43708 100644
--- a/samples/ApiDemos/res/layout/progressbar_3.xml
+++ b/samples/ApiDemos/res/layout/progressbar_3.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
     <Button android:id="@+id/showIndeterminate"
diff --git a/samples/ApiDemos/res/layout/progressbar_4.xml b/samples/ApiDemos/res/layout/progressbar_4.xml
index 5e577a0..6bacf7a 100644
--- a/samples/ApiDemos/res/layout/progressbar_4.xml
+++ b/samples/ApiDemos/res/layout/progressbar_4.xml
@@ -16,7 +16,7 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
     android:orientation="vertical"
-    android:layout_width="fill_parent" 
+    android:layout_width="match_parent" 
     android:layout_height="wrap_content">
 
     <Button android:id="@+id/toggle"
diff --git a/samples/ApiDemos/res/layout/quick_contacts.xml b/samples/ApiDemos/res/layout/quick_contacts.xml
index ffb19ed..a34fea2 100644
--- a/samples/ApiDemos/res/layout/quick_contacts.xml
+++ b/samples/ApiDemos/res/layout/quick_contacts.xml
@@ -16,7 +16,7 @@
 
 <RelativeLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:paddingLeft="0dip"
     android:paddingRight="9dip"
     android:layout_height= "wrap_content"
@@ -41,7 +41,7 @@
         android:paddingLeft="2dip"
         android:layout_centerVertical="true"
         android:layout_toRightOf="@id/badge"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content" />
 
 </RelativeLayout>
diff --git a/samples/ApiDemos/res/layout/radio_group_1.xml b/samples/ApiDemos/res/layout/radio_group_1.xml
index 3029207..a17f9d3 100644
--- a/samples/ApiDemos/res/layout/radio_group_1.xml
+++ b/samples/ApiDemos/res/layout/radio_group_1.xml
@@ -15,11 +15,11 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
     <RadioGroup
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="vertical"
         android:checkedButton="@+id/lunch"
diff --git a/samples/ApiDemos/res/layout/ratingbar_1.xml b/samples/ApiDemos/res/layout/ratingbar_1.xml
index 3256d3c..9f81505 100644
--- a/samples/ApiDemos/res/layout/ratingbar_1.xml
+++ b/samples/ApiDemos/res/layout/ratingbar_1.xml
@@ -17,8 +17,8 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
     android:paddingLeft="10dip"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <RatingBar android:id="@+id/ratingbar1"
         android:layout_width="wrap_content"
@@ -33,7 +33,7 @@
         android:rating="2.25" />
 
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="10dip">
         
diff --git a/samples/ApiDemos/res/layout/read_asset.xml b/samples/ApiDemos/res/layout/read_asset.xml
index 79b8bb6..c3423bf 100644
--- a/samples/ApiDemos/res/layout/read_asset.xml
+++ b/samples/ApiDemos/res/layout/read_asset.xml
@@ -18,11 +18,11 @@
      See corresponding Java code com.android.sdk.content.StyledText -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent" android:layout_height="fill_parent"
+    android:layout_width="match_parent" android:layout_height="match_parent"
     android:orientation="vertical">
 
     <TextView android:id="@+id/text"
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:gravity="center_horizontal"
         android:textStyle="normal"/>
 
diff --git a/samples/ApiDemos/res/layout/receive_result.xml b/samples/ApiDemos/res/layout/receive_result.xml
index 461be6c..a894612 100644
--- a/samples/ApiDemos/res/layout/receive_result.xml
+++ b/samples/ApiDemos/res/layout/receive_result.xml
@@ -21,16 +21,16 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/receive_result_instructions"/>
 
     <TextView android:id="@+id/results"
-        android:layout_width="fill_parent" android:layout_height="10dip"
+        android:layout_width="match_parent" android:layout_height="10dip"
         android:layout_weight="1"
         android:paddingBottom="4dip"
         android:background="@drawable/green">
diff --git a/samples/ApiDemos/res/layout/redirect_enter.xml b/samples/ApiDemos/res/layout/redirect_enter.xml
index f73d999..6b4493e 100644
--- a/samples/ApiDemos/res/layout/redirect_enter.xml
+++ b/samples/ApiDemos/res/layout/redirect_enter.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/redirect_enter"/>
diff --git a/samples/ApiDemos/res/layout/redirect_getter.xml b/samples/ApiDemos/res/layout/redirect_getter.xml
index 9879b78..c4e3bd7 100644
--- a/samples/ApiDemos/res/layout/redirect_getter.xml
+++ b/samples/ApiDemos/res/layout/redirect_getter.xml
@@ -19,16 +19,16 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/redirect_getter"/>
 
     <EditText android:id="@+id/text"
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip">
         <requestFocus />
diff --git a/samples/ApiDemos/res/layout/redirect_main.xml b/samples/ApiDemos/res/layout/redirect_main.xml
index 74de502..a54a9df 100644
--- a/samples/ApiDemos/res/layout/redirect_main.xml
+++ b/samples/ApiDemos/res/layout/redirect_main.xml
@@ -19,16 +19,16 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/redirect_main"/>
 
     <TextView android:id="@+id/text"
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip" />
 
diff --git a/samples/ApiDemos/res/layout/relative_layout_1.xml b/samples/ApiDemos/res/layout/relative_layout_1.xml
index 122e718..94f76e8 100644
--- a/samples/ApiDemos/res/layout/relative_layout_1.xml
+++ b/samples/ApiDemos/res/layout/relative_layout_1.xml
@@ -19,14 +19,14 @@
 -->
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <!-- view1 goes on top -->
     <TextView
         android:id="@+id/view1"
         android:background="@drawable/red"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_alignParentTop="true"
         android:text="@string/relative_layout_1_top"/>
@@ -35,7 +35,7 @@
     <TextView
         android:id="@+id/view2"
         android:background="@drawable/green"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
         android:text="@string/relative_layout_1_bottom"/>
@@ -44,7 +44,7 @@
     <TextView
         android:id="@+id/view3"
         android:background="@drawable/yellow"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="0dip"
         android:layout_above="@id/view2"
         android:layout_below="@id/view1"
diff --git a/samples/ApiDemos/res/layout/relative_layout_2.xml b/samples/ApiDemos/res/layout/relative_layout_2.xml
index dc613e6..083953a 100644
--- a/samples/ApiDemos/res/layout/relative_layout_2.xml
+++ b/samples/ApiDemos/res/layout/relative_layout_2.xml
@@ -17,7 +17,7 @@
 <!-- Demonstrates using a relative layout to create a form -->
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:background="@drawable/blue"
     android:padding="10dip">
@@ -27,7 +27,7 @@
     -->
     <TextView
         android:id="@+id/label"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/relative_layout_2_instructions"/>
 
@@ -40,7 +40,7 @@
     -->
     <EditText
         android:id="@+id/entry"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@android:drawable/editbox_background"
         android:layout_below="@id/label"/>
diff --git a/samples/ApiDemos/res/layout/remote_service_binding.xml b/samples/ApiDemos/res/layout/remote_service_binding.xml
index a353efb..cc408d1 100644
--- a/samples/ApiDemos/res/layout/remote_service_binding.xml
+++ b/samples/ApiDemos/res/layout/remote_service_binding.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/remote_service_binding"/>
@@ -44,7 +44,7 @@
     </Button>
 
     <TextView android:id="@+id/callback"
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:gravity="center_horizontal" android:paddingTop="4dip"/>
 
diff --git a/samples/ApiDemos/res/layout/remote_service_controller.xml b/samples/ApiDemos/res/layout/remote_service_controller.xml
index 48e4c95..61d770f 100644
--- a/samples/ApiDemos/res/layout/remote_service_controller.xml
+++ b/samples/ApiDemos/res/layout/remote_service_controller.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/remote_service_controller"/>
diff --git a/samples/ApiDemos/res/layout/reorder_four.xml b/samples/ApiDemos/res/layout/reorder_four.xml
index 45f13a3..a5c22b5 100644
--- a/samples/ApiDemos/res/layout/reorder_four.xml
+++ b/samples/ApiDemos/res/layout/reorder_four.xml
@@ -21,11 +21,11 @@
     android:orientation="vertical"
     android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/reorder_four_text"/>
diff --git a/samples/ApiDemos/res/layout/reorder_on_launch.xml b/samples/ApiDemos/res/layout/reorder_on_launch.xml
index 850a2f5..981b3f4 100644
--- a/samples/ApiDemos/res/layout/reorder_on_launch.xml
+++ b/samples/ApiDemos/res/layout/reorder_on_launch.xml
@@ -21,11 +21,11 @@
     android:orientation="vertical"
     android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/reorder_on_launch"/>
diff --git a/samples/ApiDemos/res/layout/reorder_three.xml b/samples/ApiDemos/res/layout/reorder_three.xml
index 30ef41b..51a8d0c 100644
--- a/samples/ApiDemos/res/layout/reorder_three.xml
+++ b/samples/ApiDemos/res/layout/reorder_three.xml
@@ -21,11 +21,11 @@
     android:orientation="vertical"
     android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/reorder_three_text"/>
diff --git a/samples/ApiDemos/res/layout/reorder_two.xml b/samples/ApiDemos/res/layout/reorder_two.xml
index 7132561..6fadca0 100644
--- a/samples/ApiDemos/res/layout/reorder_two.xml
+++ b/samples/ApiDemos/res/layout/reorder_two.xml
@@ -21,11 +21,11 @@
     android:orientation="vertical"
     android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/reorder_two_text"/>
diff --git a/samples/ApiDemos/res/layout/resources.xml b/samples/ApiDemos/res/layout/resources.xml
index 60ec581..ee9dac0 100644
--- a/samples/ApiDemos/res/layout/resources.xml
+++ b/samples/ApiDemos/res/layout/resources.xml
@@ -22,13 +22,13 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
 
     <TextView
         android:id="@+id/styled_text"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:gravity="center_horizontal"
         android:textStyle="normal"
@@ -36,7 +36,7 @@
 
     <TextView
         android:id="@+id/plain_text"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:gravity="center_horizontal"
         android:textStyle="normal"
@@ -44,7 +44,7 @@
 
     <TextView
         android:id="@+id/res1"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:gravity="center_horizontal"
         android:textStyle="normal"
diff --git a/samples/ApiDemos/res/layout/sample_device_admin.xml b/samples/ApiDemos/res/layout/sample_device_admin.xml
new file mode 100644
index 0000000..cbd4dc9
--- /dev/null
+++ b/samples/ApiDemos/res/layout/sample_device_admin.xml
@@ -0,0 +1,120 @@
+<?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.
+-->
+
+<!-- Demonstrates implementation of a DeviceAdmin. -->
+
+<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="4dip"
+        android:text="@string/sample_device_admin_summary"/>
+
+	<LinearLayout android:orientation="horizontal" android:gravity="center"
+	    android:layout_width="match_parent" android:layout_height="wrap_content">
+
+	    <Button android:id="@+id/enable"
+	        android:layout_width="wrap_content" android:layout_height="wrap_content" 
+	        android:text="@string/enable_admin">
+	        <requestFocus />
+	    </Button>
+	
+	    <Button android:id="@+id/disable"
+	        android:layout_width="wrap_content" android:layout_height="wrap_content" 
+	        android:text="@string/disable_admin">
+	    </Button>
+	    
+    </LinearLayout>
+
+    <LinearLayout android:orientation="horizontal" android:gravity="center"
+        android:layout_width="match_parent" android:layout_height="wrap_content">
+
+	    <Spinner android:id="@+id/password_quality"
+	        android:layout_width="wrap_content"
+	        android:layout_height="wrap_content"
+	        android:drawSelectorOnTop="true"
+	        android:prompt="@string/password_quality">
+	    </Spinner>
+    
+        <EditText android:id="@+id/password_length"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:hint="@string/password_length_hint"
+            android:inputType="number">
+        </EditText>
+            
+    </LinearLayout>
+
+    <Button android:id="@+id/set_password"
+        android:layout_width="wrap_content" android:layout_height="wrap_content" 
+        android_layout_gravity="east|center_vertical"
+        android:text="@string/set_password">
+    </Button>
+        
+    <LinearLayout android:orientation="horizontal" android:gravity="center"
+        android:layout_width="match_parent" android:layout_height="wrap_content">
+
+        <EditText android:id="@+id/password"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_weight="1"
+            android:hint="@string/password_hint"
+            android:freezesText="true">
+        </EditText>
+            
+        <Button android:id="@+id/reset_password"
+            android:layout_width="wrap_content" android:layout_height="wrap_content" 
+            android:layout_weight="0"
+            android:text="@string/reset_password">
+        </Button>
+        
+    </LinearLayout>
+        
+    <LinearLayout android:orientation="horizontal" android:gravity="center"
+        android:layout_width="match_parent" android:layout_height="wrap_content">
+
+        <EditText android:id="@+id/max_failed_pw"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:hint="@string/max_failed_pw_hint"
+            android:inputType="number">
+        </EditText>
+            
+    </LinearLayout>
+        
+    <LinearLayout android:orientation="horizontal" android:gravity="center"
+        android:layout_width="match_parent" android:layout_height="wrap_content">
+
+        <Button android:id="@+id/force_lock"
+            android:layout_width="wrap_content" android:layout_height="wrap_content" 
+            android:layout_weight="0"
+            android:text="@string/force_lock">
+        </Button>
+        
+        <Button android:id="@+id/wipe_data"
+            android:layout_width="wrap_content" android:layout_height="wrap_content" 
+            android:layout_weight="0"
+            android:text="@string/wipe_data">
+        </Button>
+        
+    </LinearLayout>
+    
+</LinearLayout>
+
diff --git a/samples/ApiDemos/res/layout/save_restore_state.xml b/samples/ApiDemos/res/layout/save_restore_state.xml
index 4f3f8ee..4b489ed 100644
--- a/samples/ApiDemos/res/layout/save_restore_state.xml
+++ b/samples/ApiDemos/res/layout/save_restore_state.xml
@@ -18,21 +18,21 @@
      See corresponding Java code com.android.sdk.app.SaveRestoreState.java. -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView android:id="@+id/msg"
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip" />
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/saves_state"/>
 
     <EditText android:id="@+id/saved"
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="1"
         android:background="@drawable/green"
         android:text="@string/initial_text"
@@ -41,14 +41,14 @@
     </EditText>
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingTop="8dip"
         android:paddingBottom="4dip"
         android:text="@string/no_saves_state"/>
 
     <EditText 
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="1"
         android:background="@drawable/red"
         android:text="@string/initial_text">
diff --git a/samples/ApiDemos/res/layout/scroll_view_1.xml b/samples/ApiDemos/res/layout/scroll_view_1.xml
index 0552807..4792e21 100644
--- a/samples/ApiDemos/res/layout/scroll_view_1.xml
+++ b/samples/ApiDemos/res/layout/scroll_view_1.xml
@@ -17,72 +17,72 @@
 <!-- Demonstrates scrolling with a ScrollView. -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:scrollbars="none">
 
     <LinearLayout
         android:id="@+id/layout"
         android:orientation="vertical"
-        android:layout_width="fill_parent" android:layout_height="wrap_content">
+        android:layout_width="match_parent" android:layout_height="wrap_content">
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_1_text_1"/>
 
         <Button
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_1_button_1"/>
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_1_text_2"/>
 
         <Button
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_1_button_2"/>
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_1_text_3"/>
 
         <Button
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_1_button_3"/>
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_1_text_4"/>
 
         <Button
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_1_button_4"/>
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_1_text_5"/>
 
         <Button
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_1_button_5"/>
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_1_text_6"/>
 
         <Button
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_1_button_6"/>
 
diff --git a/samples/ApiDemos/res/layout/scroll_view_2.xml b/samples/ApiDemos/res/layout/scroll_view_2.xml
index 0107e46..d8587cf 100644
--- a/samples/ApiDemos/res/layout/scroll_view_2.xml
+++ b/samples/ApiDemos/res/layout/scroll_view_2.xml
@@ -17,23 +17,23 @@
 <!-- Demonstrates scrolling with a ScrollView. -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:scrollbars="none">
 
     <LinearLayout
         android:id="@+id/layout"
         android:orientation="vertical"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_2_text_1"/>
 
         <Button
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scroll_view_2_button_1"/>
 
diff --git a/samples/ApiDemos/res/layout/scrollbar1.xml b/samples/ApiDemos/res/layout/scrollbar1.xml
index 7221b3e..7a5b86e 100644
--- a/samples/ApiDemos/res/layout/scrollbar1.xml
+++ b/samples/ApiDemos/res/layout/scrollbar1.xml
@@ -17,152 +17,152 @@
 <!-- Demonstrates scrolling with a ScrollView. -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
     <LinearLayout
         android:orientation="vertical"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_1_text"/>
     </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/scrollbar2.xml b/samples/ApiDemos/res/layout/scrollbar2.xml
index 4882a72..92ad19f 100644
--- a/samples/ApiDemos/res/layout/scrollbar2.xml
+++ b/samples/ApiDemos/res/layout/scrollbar2.xml
@@ -17,7 +17,7 @@
 <!-- Demonstrates scrolling with a ScrollView. -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:scrollbarTrackVertical="@drawable/scrollbar_vertical_track"
     android:scrollbarThumbVertical="@drawable/scrollbar_vertical_thumb"
@@ -25,147 +25,147 @@
 
     <LinearLayout
         android:orientation="vertical"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
         <TextView
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/scrollbar_2_text"/>
     </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/scrollbar3.xml b/samples/ApiDemos/res/layout/scrollbar3.xml
index c272e45..fa20db0 100644
--- a/samples/ApiDemos/res/layout/scrollbar3.xml
+++ b/samples/ApiDemos/res/layout/scrollbar3.xml
@@ -18,12 +18,12 @@
 
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
 
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal">
 
@@ -33,47 +33,47 @@
             android:background="#FF0000">
             <LinearLayout
                 android:orientation="vertical"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent">
+                android:layout_width="match_parent"
+                android:layout_height="match_parent">
 
                 <TextView
-                    android:layout_width="fill_parent"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:text="@string/scrollbar_2_text" />
                 <TextView
-                    android:layout_width="fill_parent"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:text="@string/scrollbar_2_text" />
                 <TextView
-                    android:layout_width="fill_parent"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:text="@string/scrollbar_2_text" />
                 <TextView
-                    android:layout_width="fill_parent"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:text="@string/scrollbar_2_text" />
                 <TextView
-                    android:layout_width="fill_parent"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:text="@string/scrollbar_2_text" />
                 <TextView
-                    android:layout_width="fill_parent"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:text="@string/scrollbar_2_text" />
                 <TextView
-                    android:layout_width="fill_parent"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:text="@string/scrollbar_2_text" />
                 <TextView
-                    android:layout_width="fill_parent"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:text="@string/scrollbar_2_text" />
                 <TextView
-                    android:layout_width="fill_parent"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:text="@string/scrollbar_2_text" />
                 <TextView
-                    android:layout_width="fill_parent"
+                    android:layout_width="match_parent"
                     android:layout_height="wrap_content"
                     android:text="@string/scrollbar_2_text" />
             </LinearLayout>
@@ -85,7 +85,7 @@
             android:background="#00FF00"
             android:paddingRight="12dip">
             <TextView
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:text="@string/scrollbar_3_text"
                 android:textColor="#000000"
@@ -98,7 +98,7 @@
             android:layout_height="120dip"
             android:background="@android:drawable/edit_text">
             <TextView
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:textColor="#000000"
                 android:text="@string/scrollbar_3_text" />
@@ -106,7 +106,7 @@
     </LinearLayout>
 
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
         <ScrollView
             android:id="@+id/view4"
@@ -115,7 +115,7 @@
             android:scrollbarStyle="outsideOverlay"
             android:background="@android:drawable/edit_text">
             <TextView
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:textColor="#000000"
                 android:text="@string/scrollbar_3_text" />
@@ -127,7 +127,7 @@
             android:scrollbarStyle="outsideInset"
             android:background="@android:drawable/edit_text">
             <TextView
-                android:layout_width="fill_parent"
+                android:layout_width="match_parent"
                 android:layout_height="wrap_content"
                 android:textColor="#000000"
                 android:text="@string/scrollbar_3_text" />
diff --git a/samples/ApiDemos/res/layout/search_invoke.xml b/samples/ApiDemos/res/layout/search_invoke.xml
index b78a616..66bf2e8 100644
--- a/samples/ApiDemos/res/layout/search_invoke.xml
+++ b/samples/ApiDemos/res/layout/search_invoke.xml
@@ -17,13 +17,13 @@
 <!-- This activity exercises search invocation options -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
     
     <!--  Section: Information -->
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:paddingBottom="4dip"
         android:text="@string/msg_search" />
@@ -40,7 +40,7 @@
         android:layout_height="wrap_content"/>
             
     <Spinner android:id="@+id/spinner_menu_mode"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:drawSelectorOnTop="true" />
             
@@ -50,12 +50,12 @@
         android:layout_height="wrap_content"
         android:text="@string/search_sect_options" />
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal">
 
         <LinearLayout
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:gravity="center_horizontal"
             android:orientation="horizontal">
@@ -72,11 +72,11 @@
     </LinearLayout>
     
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal">
         <LinearLayout
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:gravity="center_horizontal"
             android:orientation="horizontal">
diff --git a/samples/ApiDemos/res/layout/search_query_results.xml b/samples/ApiDemos/res/layout/search_query_results.xml
index 03f1ae6..cd92f2d 100644
--- a/samples/ApiDemos/res/layout/search_query_results.xml
+++ b/samples/ApiDemos/res/layout/search_query_results.xml
@@ -17,20 +17,20 @@
 <!-- This activity displays search queries and "results" -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
     
     <!--  Section: Information -->
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:paddingBottom="4dip"
         android:text="@string/msg_search_results" />
     
     <!--  Section: Search Query String -->
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal">
 
@@ -45,7 +45,7 @@
 
     <!--  Section: Search Query application context data -->
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal">
 
@@ -60,7 +60,7 @@
 
     <!--  Section: How the query was delivered -->
     <LinearLayout
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal">
 
diff --git a/samples/ApiDemos/res/layout/seekbar_1.xml b/samples/ApiDemos/res/layout/seekbar_1.xml
index 513114e..d3140b2 100644
--- a/samples/ApiDemos/res/layout/seekbar_1.xml
+++ b/samples/ApiDemos/res/layout/seekbar_1.xml
@@ -16,21 +16,21 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <SeekBar android:id="@+id/seek"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:max="100"
         android:progress="50"
         android:secondaryProgress="75" />
 
     <TextView android:id="@+id/progress"
-       	android:layout_width="fill_parent"
+       	android:layout_width="match_parent"
         android:layout_height="wrap_content" />
 
     <TextView android:id="@+id/tracking"
-       	android:layout_width="fill_parent"
+       	android:layout_width="match_parent"
         android:layout_height="wrap_content" />
 </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/select_dialog.xml b/samples/ApiDemos/res/layout/select_dialog.xml
index ad826af..dbf9fb7 100644
--- a/samples/ApiDemos/res/layout/select_dialog.xml
+++ b/samples/ApiDemos/res/layout/select_dialog.xml
@@ -18,12 +18,12 @@
      See corresponding Java code com.android.sdk.app.SelectDialogSamples.java. -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/screen"
-    android:layout_width="fill_parent" android:layout_height="fill_parent"
+    android:layout_width="match_parent" android:layout_height="match_parent"
     android:orientation="vertical">
     <Button android:id="@+id/show_dialog"
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:text="@string/select_dialog_show"/>
     <TextView android:id="@+id/message"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"/>
 </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/send_result.xml b/samples/ApiDemos/res/layout/send_result.xml
index 386c3fc..34b3693 100644
--- a/samples/ApiDemos/res/layout/send_result.xml
+++ b/samples/ApiDemos/res/layout/send_result.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="8dip"
         android:text="@string/pick_result"/>
diff --git a/samples/ApiDemos/res/layout/service_start_arguments_controller.xml b/samples/ApiDemos/res/layout/service_start_arguments_controller.xml
index 19b7498..556dffc 100644
--- a/samples/ApiDemos/res/layout/service_start_arguments_controller.xml
+++ b/samples/ApiDemos/res/layout/service_start_arguments_controller.xml
@@ -19,10 +19,10 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
     android:gravity="center_horizontal"
-    android:layout_width="fill_parent" android:layout_height="fill_parent">
+    android:layout_width="match_parent" android:layout_height="match_parent">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:layout_weight="0"
         android:paddingBottom="4dip"
         android:text="@string/service_start_arguments_controller"/>
diff --git a/samples/ApiDemos/res/layout/shape_drawable_1.xml b/samples/ApiDemos/res/layout/shape_drawable_1.xml
index 037e844..b0ad479 100644
--- a/samples/ApiDemos/res/layout/shape_drawable_1.xml
+++ b/samples/ApiDemos/res/layout/shape_drawable_1.xml
@@ -17,56 +17,56 @@
 <!-- Demonstrates scrolling with a ScrollView. -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android" 
-	android:layout_width="fill_parent"
+	android:layout_width="match_parent"
 	android:layout_height="wrap_content">
 	
     <LinearLayout
     	android:orientation="vertical"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
         
 		<ImageView
-			android:layout_width="fill_parent"
+			android:layout_width="match_parent"
 			android:layout_height="50dip"
 			android:src="@drawable/shape_1" />
 			
 		<ImageView
-			android:layout_width="fill_parent"
+			android:layout_width="match_parent"
 			android:layout_height="wrap_content"
 			android:src="@drawable/line" />
 			
 		<ImageView
-			android:layout_width="fill_parent"
+			android:layout_width="match_parent"
 			android:layout_height="50dip"
 			android:src="@drawable/shape_2" />
 			
 		<ImageView
-			android:layout_width="fill_parent"
+			android:layout_width="match_parent"
 			android:layout_height="wrap_content"
 			android:src="@drawable/line" />
 			
 		<ImageView
-			android:layout_width="fill_parent"
+			android:layout_width="match_parent"
 			android:layout_height="50dip"
 			android:src="@drawable/shape_3" />
 			
 		<ImageView
-			android:layout_width="fill_parent"
+			android:layout_width="match_parent"
 			android:layout_height="wrap_content"
 			android:src="@drawable/line" />
 					
 		<ImageView
-			android:layout_width="fill_parent"
+			android:layout_width="match_parent"
 			android:layout_height="50dip"
 			android:src="@drawable/shape_4" />
 			
 		<ImageView
-			android:layout_width="fill_parent"
+			android:layout_width="match_parent"
 			android:layout_height="wrap_content"
 			android:src="@drawable/line" />
 							
 		<ImageView
-			android:layout_width="fill_parent"
+			android:layout_width="match_parent"
 			android:layout_height="50dip"
 			android:src="@drawable/shape_5" />
 	</LinearLayout>
diff --git a/samples/ApiDemos/res/layout/spinner_1.xml b/samples/ApiDemos/res/layout/spinner_1.xml
index 3d5f3c1..b7166f3 100644
--- a/samples/ApiDemos/res/layout/spinner_1.xml
+++ b/samples/ApiDemos/res/layout/spinner_1.xml
@@ -17,31 +17,31 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
     android:padding="10dip"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/spinner_1_color"
     />
 
     <Spinner android:id="@+id/spinner1"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:drawSelectorOnTop="true"
         android:prompt="@string/spinner_1_color_prompt"
     />
 
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="10dip"
         android:text="@string/spinner_1_planet"
     />
 
     <Spinner android:id="@+id/spinner2"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:drawSelectorOnTop="true"
         android:prompt="@string/spinner_1_planet_prompt"
diff --git a/samples/ApiDemos/res/layout/status_bar_notifications.xml b/samples/ApiDemos/res/layout/status_bar_notifications.xml
index 11f3c96..0a291bc 100644
--- a/samples/ApiDemos/res/layout/status_bar_notifications.xml
+++ b/samples/ApiDemos/res/layout/status_bar_notifications.xml
@@ -15,12 +15,12 @@
 -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     
     <LinearLayout
         android:orientation="vertical"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
     
         <TextView
@@ -30,7 +30,7 @@
             
         <LinearLayout
             android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content">
         
             <Button
@@ -61,7 +61,7 @@
             
         <LinearLayout
             android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content">
         
             <Button
@@ -92,7 +92,7 @@
             
         <LinearLayout
             android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content">
         
             <Button
@@ -123,7 +123,7 @@
 
         <LinearLayout
             android:orientation="horizontal"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content">
         
             <Button
diff --git a/samples/ApiDemos/res/layout/styled_text.xml b/samples/ApiDemos/res/layout/styled_text.xml
index 610ea64..a8975de 100644
--- a/samples/ApiDemos/res/layout/styled_text.xml
+++ b/samples/ApiDemos/res/layout/styled_text.xml
@@ -18,32 +18,32 @@
      See corresponding Java code com.android.sdk.content.StyledText -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent" android:layout_height="fill_parent"
+    android:layout_width="match_parent" android:layout_height="match_parent"
     android:orientation="vertical">
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:gravity="center_horizontal"
         android:text="@string/styled_text_rsrc"/>
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:gravity="center_horizontal"
         android:textStyle="normal"
         android:text="@string/styled_text"/>
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:gravity="center_horizontal"
         />
 
     <TextView
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:gravity="center_horizontal"
         android:text="@string/styled_text_prog"/>
 
     <TextView android:id="@+id/text"
-        android:layout_width="fill_parent" android:layout_height="wrap_content"
+        android:layout_width="match_parent" android:layout_height="wrap_content"
         android:gravity="center_horizontal"
         android:textStyle="normal"/>
 
diff --git a/samples/ApiDemos/res/layout/surface_view_overlay.xml b/samples/ApiDemos/res/layout/surface_view_overlay.xml
index a557e22..dcb9824 100644
--- a/samples/ApiDemos/res/layout/surface_view_overlay.xml
+++ b/samples/ApiDemos/res/layout/surface_view_overlay.xml
@@ -18,27 +18,27 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:orientation="vertical"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
 
     <!-- Here is where we put the SurfaceView, in a frame so that we can
          stack other views on top of it. -->
     <FrameLayout
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="0px"
             android:layout_weight="1">
 
         <android.opengl.GLSurfaceView android:id="@+id/glsurfaceview"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent" />
+                android:layout_width="match_parent"
+                android:layout_height="match_parent" />
 
         <LinearLayout android:id="@+id/hidecontainer"
                 android:orientation="vertical"
                 android:visibility="gone"
                 android:background="@drawable/translucent_background"
                 android:gravity="center"
-                android:layout_width="fill_parent"
-                android:layout_height="fill_parent">
+                android:layout_width="match_parent"
+                android:layout_height="match_parent">
 
             <Button android:id="@+id/hideme1"
                     android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/table_layout_1.xml b/samples/ApiDemos/res/layout/table_layout_1.xml
index 8d95e82..24609c4 100644
--- a/samples/ApiDemos/res/layout/table_layout_1.xml
+++ b/samples/ApiDemos/res/layout/table_layout_1.xml
@@ -15,8 +15,8 @@
 -->
 
 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TableRow>
         <TextView
diff --git a/samples/ApiDemos/res/layout/table_layout_10.xml b/samples/ApiDemos/res/layout/table_layout_10.xml
index 6c558e7..75573a0 100644
--- a/samples/ApiDemos/res/layout/table_layout_10.xml
+++ b/samples/ApiDemos/res/layout/table_layout_10.xml
@@ -15,8 +15,8 @@
 -->
 
 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-   android:layout_width="fill_parent"
-   android:layout_height="fill_parent"
+   android:layout_width="match_parent"
+   android:layout_height="match_parent"
    android:stretchColumns="1">
 
    <TableRow>
diff --git a/samples/ApiDemos/res/layout/table_layout_11.xml b/samples/ApiDemos/res/layout/table_layout_11.xml
index e40e28a..638b712 100644
--- a/samples/ApiDemos/res/layout/table_layout_11.xml
+++ b/samples/ApiDemos/res/layout/table_layout_11.xml
@@ -15,7 +15,7 @@
 -->
 
 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:stretchColumns="1">
 
diff --git a/samples/ApiDemos/res/layout/table_layout_12.xml b/samples/ApiDemos/res/layout/table_layout_12.xml
index 423e34e..17c63ae 100644
--- a/samples/ApiDemos/res/layout/table_layout_12.xml
+++ b/samples/ApiDemos/res/layout/table_layout_12.xml
@@ -15,7 +15,7 @@
 -->
 
 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content">
 
     <TableRow>
diff --git a/samples/ApiDemos/res/layout/table_layout_2.xml b/samples/ApiDemos/res/layout/table_layout_2.xml
index c5134d3..f7cd206 100644
--- a/samples/ApiDemos/res/layout/table_layout_2.xml
+++ b/samples/ApiDemos/res/layout/table_layout_2.xml
@@ -15,8 +15,8 @@
 -->
 
 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TableRow>
         <Button
diff --git a/samples/ApiDemos/res/layout/table_layout_3.xml b/samples/ApiDemos/res/layout/table_layout_3.xml
index 44415fc..691f824 100644
--- a/samples/ApiDemos/res/layout/table_layout_3.xml
+++ b/samples/ApiDemos/res/layout/table_layout_3.xml
@@ -15,8 +15,8 @@
 -->
 
 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:shrinkColumns="2, 3">
 
     <!-- Rows have different number of columns and content doesn't fit on
diff --git a/samples/ApiDemos/res/layout/table_layout_4.xml b/samples/ApiDemos/res/layout/table_layout_4.xml
index a9b7b42..3b50bec 100644
--- a/samples/ApiDemos/res/layout/table_layout_4.xml
+++ b/samples/ApiDemos/res/layout/table_layout_4.xml
@@ -16,8 +16,8 @@
 
 <!-- Stretch some columns -->
 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:stretchColumns="1">
 
     <TableRow>
diff --git a/samples/ApiDemos/res/layout/table_layout_5.xml b/samples/ApiDemos/res/layout/table_layout_5.xml
index 773d729..b618129 100644
--- a/samples/ApiDemos/res/layout/table_layout_5.xml
+++ b/samples/ApiDemos/res/layout/table_layout_5.xml
@@ -16,8 +16,8 @@
 
 <!-- Stretch some columns -->
 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:stretchColumns="1">
 
     <TableRow>
diff --git a/samples/ApiDemos/res/layout/table_layout_6.xml b/samples/ApiDemos/res/layout/table_layout_6.xml
index 9607f1c..cbb6d8d 100644
--- a/samples/ApiDemos/res/layout/table_layout_6.xml
+++ b/samples/ApiDemos/res/layout/table_layout_6.xml
@@ -16,8 +16,8 @@
 
 <!-- Stretch some columns -->
 <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:stretchColumns="1">
 
     <TableRow>
diff --git a/samples/ApiDemos/res/layout/table_layout_7.xml b/samples/ApiDemos/res/layout/table_layout_7.xml
index 88c4910..ae8ba1f 100644
--- a/samples/ApiDemos/res/layout/table_layout_7.xml
+++ b/samples/ApiDemos/res/layout/table_layout_7.xml
@@ -16,11 +16,11 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     <TableLayout
         android:id="@+id/menu"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:stretchColumns="1"
         android:collapseColumns="2">
diff --git a/samples/ApiDemos/res/layout/table_layout_8.xml b/samples/ApiDemos/res/layout/table_layout_8.xml
index a63a8e8..0871432 100644
--- a/samples/ApiDemos/res/layout/table_layout_8.xml
+++ b/samples/ApiDemos/res/layout/table_layout_8.xml
@@ -16,11 +16,11 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     <TableLayout
         android:id="@+id/menu"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
 
         <TableRow>
diff --git a/samples/ApiDemos/res/layout/table_layout_9.xml b/samples/ApiDemos/res/layout/table_layout_9.xml
index a2d6564..edb4029 100644
--- a/samples/ApiDemos/res/layout/table_layout_9.xml
+++ b/samples/ApiDemos/res/layout/table_layout_9.xml
@@ -15,15 +15,15 @@
 -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     <LinearLayout
         android:orientation="vertical"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
         <TableLayout
             android:id="@+id/menu"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content">
 
             <TableRow>
diff --git a/samples/ApiDemos/res/layout/tabs1.xml b/samples/ApiDemos/res/layout/tabs1.xml
index 5a17693..603fe82 100644
--- a/samples/ApiDemos/res/layout/tabs1.xml
+++ b/samples/ApiDemos/res/layout/tabs1.xml
@@ -15,25 +15,25 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <TextView android:id="@+id/view1"
         android:background="@drawable/blue"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:text="@string/tabs_1_tab_1"/>
 
     <TextView android:id="@+id/view2"
         android:background="@drawable/red"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:text="@string/tabs_1_tab_2"/>
 
     <TextView android:id="@+id/view3"
         android:background="@drawable/green"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:text="@string/tabs_1_tab_3"/>
 
 </FrameLayout>
diff --git a/samples/ApiDemos/res/layout/text_switcher_1.xml b/samples/ApiDemos/res/layout/text_switcher_1.xml
index d7be743..00ae307 100644
--- a/samples/ApiDemos/res/layout/text_switcher_1.xml
+++ b/samples/ApiDemos/res/layout/text_switcher_1.xml
@@ -15,8 +15,8 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
 
     <Button android:id="@+id/next"
@@ -25,7 +25,7 @@
         android:text="@string/text_switcher_1_next_text" />
 
     <TextSwitcher android:id="@+id/switcher"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content" />
 
 </LinearLayout>
diff --git a/samples/ApiDemos/res/layout/text_to_speech.xml b/samples/ApiDemos/res/layout/text_to_speech.xml
index 0ba60e1..48295df 100644
--- a/samples/ApiDemos/res/layout/text_to_speech.xml
+++ b/samples/ApiDemos/res/layout/text_to_speech.xml
@@ -15,8 +15,8 @@
 -->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     >
     <Button android:id="@+id/again_button"
         android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/translucent_background.xml b/samples/ApiDemos/res/layout/translucent_background.xml
index 6b6e1cf..c4a1acf 100644
--- a/samples/ApiDemos/res/layout/translucent_background.xml
+++ b/samples/ApiDemos/res/layout/translucent_background.xml
@@ -19,6 +19,6 @@
 
 <!-- This screen consists of a single text field that displays some text. -->
 <TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
-    android:layout_width="fill_parent" android:layout_height="fill_parent"
+    android:layout_width="match_parent" android:layout_height="match_parent"
     android:gravity="center_vertical|center_horizontal"
     android:text="@string/translucent_background"/>
diff --git a/samples/ApiDemos/res/layout/videoview.xml b/samples/ApiDemos/res/layout/videoview.xml
index 4f35ace..db97a11 100644
--- a/samples/ApiDemos/res/layout/videoview.xml
+++ b/samples/ApiDemos/res/layout/videoview.xml
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     >
     
     <VideoView 
diff --git a/samples/ApiDemos/res/layout/visibility_1.xml b/samples/ApiDemos/res/layout/visibility_1.xml
index ad94602..1027772 100644
--- a/samples/ApiDemos/res/layout/visibility_1.xml
+++ b/samples/ApiDemos/res/layout/visibility_1.xml
@@ -18,30 +18,30 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <LinearLayout
       android:orientation="vertical"
       android:background="@drawable/box"
-      android:layout_width="fill_parent"
+      android:layout_width="match_parent"
       android:layout_height="wrap_content">
 
       <TextView
           android:background="@drawable/red"
-          android:layout_width="fill_parent"
+          android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:text="@string/visibility_1_view_1"/>
 
       <TextView android:id="@+id/victim"
           android:background="@drawable/green"
-          android:layout_width="fill_parent"
+          android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:text="@string/visibility_1_view_2"/>
 
       <TextView
           android:background="@drawable/blue"
-          android:layout_width="fill_parent"
+          android:layout_width="match_parent"
           android:layout_height="wrap_content"
           android:text="@string/visibility_1_view_3"/>
 
diff --git a/samples/ApiDemos/res/layout/voice_recognition.xml b/samples/ApiDemos/res/layout/voice_recognition.xml
index 2db4a72..66175ed 100644
--- a/samples/ApiDemos/res/layout/voice_recognition.xml
+++ b/samples/ApiDemos/res/layout/voice_recognition.xml
@@ -18,23 +18,23 @@
 <!-- This activity displays UI for launching voice recognition -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
     
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:paddingBottom="4dip"
         android:text="@string/voice_recognition_prompt" />
         
     <Button android:id="@+id/btn_speak"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/speak_button" />
         
     <ListView android:id="@+id/list"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="0dip"
         android:layout_weight="1" />
 
diff --git a/samples/ApiDemos/res/layout/wallpaper_2.xml b/samples/ApiDemos/res/layout/wallpaper_2.xml
index 85161c9..324d749 100644
--- a/samples/ApiDemos/res/layout/wallpaper_2.xml
+++ b/samples/ApiDemos/res/layout/wallpaper_2.xml
@@ -10,7 +10,7 @@
     <LinearLayout
         android:orientation="horizontal"
         android:layout_width="wrap_content"
-        android:layout_height="fill_parent">
+        android:layout_height="match_parent">
         <Button
             android:id="@+id/randomize"
             android:layout_width="wrap_content"
diff --git a/samples/ApiDemos/res/layout/webview_1.xml b/samples/ApiDemos/res/layout/webview_1.xml
index 91fca39..67cea3a 100644
--- a/samples/ApiDemos/res/layout/webview_1.xml
+++ b/samples/ApiDemos/res/layout/webview_1.xml
@@ -15,64 +15,64 @@
 -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent" 
+    android:layout_width="match_parent" 
     android:layout_height="wrap_content"
     android:orientation="vertical">
     
     
     <LinearLayout
         android:orientation="vertical"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content">
         
         <WebView android:id="@+id/wv1"
             android:layout_height="wrap_content"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             />
             
         <WebView android:id="@+id/wv2"
             android:layout_height="wrap_content"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             />
             
         <WebView android:id="@+id/wv3"
             android:layout_height="wrap_content"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             />
             
         <WebView android:id="@+id/wv4"
             android:layout_height="wrap_content"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             />
             
         <WebView android:id="@+id/wv5"
             android:layout_height="wrap_content"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             />
             
         <WebView android:id="@+id/wv6"
             android:layout_height="wrap_content"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             />
     
         <WebView android:id="@+id/wv7"
             android:layout_height="wrap_content"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             />
             
         <WebView android:id="@+id/wv8"
             android:layout_height="wrap_content"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             />
             
         <WebView android:id="@+id/wv9"
             android:layout_height="wrap_content"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             />
             
         <WebView android:id="@+id/wv10"
             android:layout_height="wrap_content"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             />
     </LinearLayout>
         
diff --git a/samples/ApiDemos/res/raw/androids.pkm b/samples/ApiDemos/res/raw/androids.pkm
new file mode 100644
index 0000000..7807e7e
--- /dev/null
+++ b/samples/ApiDemos/res/raw/androids.pkm
Binary files differ
diff --git a/samples/ApiDemos/res/drawable-mdpi/robot.png b/samples/ApiDemos/res/raw/robot.png
similarity index 100%
rename from samples/ApiDemos/res/drawable-mdpi/robot.png
rename to samples/ApiDemos/res/raw/robot.png
Binary files differ
diff --git a/samples/ApiDemos/res/raw/skycubemap0.jpg b/samples/ApiDemos/res/raw/skycubemap0.jpg
new file mode 100644
index 0000000..db87df9
--- /dev/null
+++ b/samples/ApiDemos/res/raw/skycubemap0.jpg
Binary files differ
diff --git a/samples/ApiDemos/res/raw/skycubemap1.jpg b/samples/ApiDemos/res/raw/skycubemap1.jpg
new file mode 100644
index 0000000..20a06bc
--- /dev/null
+++ b/samples/ApiDemos/res/raw/skycubemap1.jpg
Binary files differ
diff --git a/samples/ApiDemos/res/raw/skycubemap2.jpg b/samples/ApiDemos/res/raw/skycubemap2.jpg
new file mode 100644
index 0000000..2bd886a
--- /dev/null
+++ b/samples/ApiDemos/res/raw/skycubemap2.jpg
Binary files differ
diff --git a/samples/ApiDemos/res/raw/skycubemap3.jpg b/samples/ApiDemos/res/raw/skycubemap3.jpg
new file mode 100644
index 0000000..3700219
--- /dev/null
+++ b/samples/ApiDemos/res/raw/skycubemap3.jpg
Binary files differ
diff --git a/samples/ApiDemos/res/raw/skycubemap4.jpg b/samples/ApiDemos/res/raw/skycubemap4.jpg
new file mode 100644
index 0000000..a8bc543
--- /dev/null
+++ b/samples/ApiDemos/res/raw/skycubemap4.jpg
Binary files differ
diff --git a/samples/ApiDemos/res/raw/skycubemap5.jpg b/samples/ApiDemos/res/raw/skycubemap5.jpg
new file mode 100644
index 0000000..a69ed1b
--- /dev/null
+++ b/samples/ApiDemos/res/raw/skycubemap5.jpg
Binary files differ
diff --git a/samples/ApiDemos/res/values/arrays.xml b/samples/ApiDemos/res/values/arrays.xml
index ca3003f..76bf518 100644
--- a/samples/ApiDemos/res/values/arrays.xml
+++ b/samples/ApiDemos/res/values/arrays.xml
@@ -85,4 +85,12 @@
         <item>charlie</item>  
     </string-array>
     
+    <!-- Used in app/Sample Device Admin -->
+    <string-array name="password_qualities">
+        <item>Unspecified</item>
+        <item>Something</item>
+        <item>Numeric</item>
+        <item>Alphanumeric</item>
+    </string-array>
+
 </resources>
diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml
index bdcb7a7..415e681 100644
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -434,6 +434,30 @@
     <string name="label_intent">Intent:</string>
     
     <!-- ============================== -->
+    <!--  app/device policies examples strings     -->
+    <!-- ============================== -->
+    
+    <string name="activity_sample_device_admin">App/Device Admin</string>
+    <string name="sample_device_admin">Sample Device Admin</string>
+    <string name="sample_device_admin_description">Sample code for writing
+        a DeviceAdmin class.  This implementation provides a UI (in ApiDemos)
+        for you to directly control what the DeviceAdmin does with the
+        system.</string>
+        
+    <string name="sample_device_admin_summary">Demonstration of a DeviceAdmin
+        class for administering the user\'s device.</string>
+    <string name="enable_admin">Enable Admin</string>
+    <string name="disable_admin">Disable Admin</string>
+    <string name="password_quality">Password Quality</string>
+    <string name="password_length_hint">Minimum Length</string>
+    <string name="set_password">Set Password</string>
+    <string name="password_hint">Password</string>
+    <string name="reset_password">Reset Password</string>
+    <string name="max_failed_pw_hint">Password Attempts Wipe Data</string>
+    <string name="force_lock">Force Lock</string>
+    <string name="wipe_data">Wipe Data</string>
+    
+    <!-- ============================== -->
     <!--  app/voice recognition examples strings  -->
     <!-- ============================== -->
 
diff --git a/samples/ApiDemos/res/xml/sample_device_admin.xml b/samples/ApiDemos/res/xml/sample_device_admin.xml
new file mode 100644
index 0000000..bfd6c5f
--- /dev/null
+++ b/samples/ApiDemos/res/xml/sample_device_admin.xml
@@ -0,0 +1,28 @@
+<?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.
+-->
+
+<!-- BEGIN_INCLUDE(meta_data) -->
+<device-admin xmlns:android="http://schemas.android.com/apk/res/android">
+    <uses-policies>
+        <limit-password />
+        <watch-login />
+        <reset-password />
+        <limit-unlock />
+        <force-lock />
+        <wipe-data />
+    </uses-policies>
+</device-admin>
+<!-- END_INCLUDE(meta_data) -->
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java b/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
index 27708f4..c7a2dfb 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
@@ -16,13 +16,18 @@
 
 package com.example.android.apis.app;
 
+import android.app.Activity;
 import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
 import android.content.Intent;
+import android.os.Bundle;
 import android.os.IBinder;
 import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
 
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -43,6 +48,7 @@
     static final String ACTION_FOREGROUND = "com.example.android.apis.FOREGROUND";
     static final String ACTION_BACKGROUND = "com.example.android.apis.BACKGROUND";
     
+ // BEGIN_INCLUDE(foreground_compatibility)
     private static final Class[] mStartForegroundSignature = new Class[] {
         int.class, Notification.class};
     private static final Class[] mStopForegroundSignature = new Class[] {
@@ -54,60 +60,6 @@
     private Object[] mStartForegroundArgs = new Object[2];
     private Object[] mStopForegroundArgs = new Object[1];
     
-    @Override
-    public void onCreate() {
-        mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
-        try {
-            mStartForeground = getClass().getMethod("startForeground",
-                    mStartForegroundSignature);
-            mStopForeground = getClass().getMethod("stopForeground",
-                    mStopForegroundSignature);
-        } catch (NoSuchMethodException e) {
-            // Running on an older platform.
-            mStartForeground = mStopForeground = null;
-        }
-    }
-
-    // This is the old onStart method that will be called on the pre-2.0
-    // platform.  On 2.0 or later we override onStartCommand() so this
-    // method will not be called.
-    @Override
-    public void onStart(Intent intent, int startId) {
-        handleCommand(intent);
-    }
-
-    @Override
-    public int onStartCommand(Intent intent, int flags, int startId) {
-        handleCommand(intent);
-        // We want this service to continue running until it is explicitly
-        // stopped, so return sticky.
-        return START_STICKY;
-    }
-
-    void handleCommand(Intent intent) {
-        if (ACTION_FOREGROUND.equals(intent.getAction())) {
-            // In this sample, we'll use the same text for the ticker and the expanded notification
-            CharSequence text = getText(R.string.foreground_service_started);
-
-            // Set the icon, scrolling text and timestamp
-            Notification notification = new Notification(R.drawable.stat_sample, text,
-                    System.currentTimeMillis());
-
-            // The PendingIntent to launch our activity if the user selects this notification
-            PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
-                    new Intent(this, ForegroundServiceController.class), 0);
-
-            // Set the info for the views that show in the notification panel.
-            notification.setLatestEventInfo(this, getText(R.string.local_service_label),
-                           text, contentIntent);
-            
-            startForegroundCompat(R.string.foreground_service_started, notification);
-            
-        } else if (ACTION_BACKGROUND.equals(intent.getAction())) {
-            stopForegroundCompat(R.string.foreground_service_started);
-        }
-    }
-    
     /**
      * This is a wrapper around the new startForeground method, using the older
      * APIs if it is not available.
@@ -161,13 +113,118 @@
     }
     
     @Override
+    public void onCreate() {
+        mNM = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
+        try {
+            mStartForeground = getClass().getMethod("startForeground",
+                    mStartForegroundSignature);
+            mStopForeground = getClass().getMethod("stopForeground",
+                    mStopForegroundSignature);
+        } catch (NoSuchMethodException e) {
+            // Running on an older platform.
+            mStartForeground = mStopForeground = null;
+        }
+    }
+
+    @Override
     public void onDestroy() {
         // Make sure our notification is gone.
         stopForegroundCompat(R.string.foreground_service_started);
     }
+// END_INCLUDE(foreground_compatibility)
 
+// BEGIN_INCLUDE(start_compatibility)
+    // This is the old onStart method that will be called on the pre-2.0
+    // platform.  On 2.0 or later we override onStartCommand() so this
+    // method will not be called.
+    @Override
+    public void onStart(Intent intent, int startId) {
+        handleCommand(intent);
+    }
+
+    @Override
+    public int onStartCommand(Intent intent, int flags, int startId) {
+        handleCommand(intent);
+        // We want this service to continue running until it is explicitly
+        // stopped, so return sticky.
+        return START_STICKY;
+    }
+// END_INCLUDE(start_compatibility)
+
+    void handleCommand(Intent intent) {
+        if (ACTION_FOREGROUND.equals(intent.getAction())) {
+            // In this sample, we'll use the same text for the ticker and the expanded notification
+            CharSequence text = getText(R.string.foreground_service_started);
+
+            // Set the icon, scrolling text and timestamp
+            Notification notification = new Notification(R.drawable.stat_sample, text,
+                    System.currentTimeMillis());
+
+            // The PendingIntent to launch our activity if the user selects this notification
+            PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
+                    new Intent(this, Controller.class), 0);
+
+            // Set the info for the views that show in the notification panel.
+            notification.setLatestEventInfo(this, getText(R.string.local_service_label),
+                           text, contentIntent);
+            
+            startForegroundCompat(R.string.foreground_service_started, notification);
+            
+        } else if (ACTION_BACKGROUND.equals(intent.getAction())) {
+            stopForegroundCompat(R.string.foreground_service_started);
+        }
+    }
+    
     @Override
     public IBinder onBind(Intent intent) {
         return null;
     }
+    
+    // ----------------------------------------------------------------------
+
+    /**
+     * <p>Example of explicitly starting and stopping the {@link ForegroundService}.
+     * 
+     * <p>Note that this is implemented as an inner class only keep the sample
+     * all together; typically this code would appear in some separate class.
+     */
+    public static class Controller extends Activity {
+        @Override
+        protected void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+
+            setContentView(R.layout.foreground_service_controller);
+
+            // Watch for button clicks.
+            Button button = (Button)findViewById(R.id.start_foreground);
+            button.setOnClickListener(mForegroundListener);
+            button = (Button)findViewById(R.id.start_background);
+            button.setOnClickListener(mBackgroundListener);
+            button = (Button)findViewById(R.id.stop);
+            button.setOnClickListener(mStopListener);
+        }
+
+        private OnClickListener mForegroundListener = new OnClickListener() {
+            public void onClick(View v) {
+                Intent intent = new Intent(ForegroundService.ACTION_FOREGROUND);
+                intent.setClass(Controller.this, ForegroundService.class);
+                startService(intent);
+            }
+        };
+
+        private OnClickListener mBackgroundListener = new OnClickListener() {
+            public void onClick(View v) {
+                Intent intent = new Intent(ForegroundService.ACTION_BACKGROUND);
+                intent.setClass(Controller.this, ForegroundService.class);
+                startService(intent);
+            }
+        };
+
+        private OnClickListener mStopListener = new OnClickListener() {
+            public void onClick(View v) {
+                stopService(new Intent(Controller.this,
+                        ForegroundService.class));
+            }
+        };
+    }
 }
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ForegroundServiceController.java b/samples/ApiDemos/src/com/example/android/apis/app/ForegroundServiceController.java
deleted file mode 100644
index a6a6ef3..0000000
--- a/samples/ApiDemos/src/com/example/android/apis/app/ForegroundServiceController.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Copyright (C) 2009 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.apis.app;
-
-// Need the following import to get access to the app resources, since this
-// class is in a sub-package.
-import com.example.android.apis.R;
-
-import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-
-
-/**
- * <p>Example of explicitly starting and stopping the {@link ForegroundService}.
- */
-public class ForegroundServiceController extends Activity {
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.foreground_service_controller);
-
-        // Watch for button clicks.
-        Button button = (Button)findViewById(R.id.start_foreground);
-        button.setOnClickListener(mForegroundListener);
-        button = (Button)findViewById(R.id.start_background);
-        button.setOnClickListener(mBackgroundListener);
-        button = (Button)findViewById(R.id.stop);
-        button.setOnClickListener(mStopListener);
-    }
-
-    private OnClickListener mForegroundListener = new OnClickListener() {
-        public void onClick(View v) {
-            Intent intent = new Intent(ForegroundService.ACTION_FOREGROUND);
-            intent.setClass(ForegroundServiceController.this, ForegroundService.class);
-            startService(intent);
-        }
-    };
-
-    private OnClickListener mBackgroundListener = new OnClickListener() {
-        public void onClick(View v) {
-            Intent intent = new Intent(ForegroundService.ACTION_BACKGROUND);
-            intent.setClass(ForegroundServiceController.this, ForegroundService.class);
-            startService(intent);
-        }
-    };
-
-    private OnClickListener mStopListener = new OnClickListener() {
-        public void onClick(View v) {
-            stopService(new Intent(ForegroundServiceController.this,
-                    ForegroundService.class));
-        }
-    };
-}
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/LaunchingPreferences.java b/samples/ApiDemos/src/com/example/android/apis/app/LaunchingPreferences.java
index aa151fe..4aa1522 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/LaunchingPreferences.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/LaunchingPreferences.java
@@ -28,7 +28,6 @@
 import android.widget.Button;
 import android.widget.LinearLayout;
 import android.widget.TextView;
-import android.widget.Toast;
 import android.widget.LinearLayout.LayoutParams;
 
 /**
@@ -63,11 +62,11 @@
         Button launchPreferences = new Button(this);
         launchPreferences.setText(getString(R.string.launch_preference_activity));
         launchPreferences.setOnClickListener(this);
-        layout.addView(launchPreferences, new LayoutParams(LayoutParams.FILL_PARENT,
+        layout.addView(launchPreferences, new LayoutParams(LayoutParams.MATCH_PARENT,
                 LayoutParams.WRAP_CONTENT));
         
         mCounterText = new TextView(this);
-        layout.addView(mCounterText, new LayoutParams(LayoutParams.FILL_PARENT,
+        layout.addView(mCounterText, new LayoutParams(LayoutParams.MATCH_PARENT,
                 LayoutParams.WRAP_CONTENT));
         
         updateCounterText();
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/LocalService.java b/samples/ApiDemos/src/com/example/android/apis/app/LocalService.java
index 79324a4..4a4f324 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/LocalService.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/LocalService.java
@@ -16,15 +16,22 @@
 
 package com.example.android.apis.app;
 
+import android.app.Activity;
 import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
+import android.content.ComponentName;
+import android.content.Context;
 import android.content.Intent;
+import android.content.ServiceConnection;
 import android.os.Binder;
+import android.os.Bundle;
 import android.os.IBinder;
-import android.os.Parcel;
 import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
 import android.widget.Toast;
 
 // Need the following import to get access to the app resources, since this
@@ -33,8 +40,8 @@
 
 /**
  * This is an example of implementing an application service that runs locally
- * in the same process as the application.  The {@link LocalServiceController}
- * and {@link LocalServiceBinding} classes show how to interact with the
+ * in the same process as the application.  The {@link Controller}
+ * and {@link Binding} classes show how to interact with the
  * service.
  *
  * <p>Notice the use of the {@link NotificationManager} when interesting things
@@ -103,7 +110,7 @@
 
         // The PendingIntent to launch our activity if the user selects this notification
         PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
-                new Intent(this, LocalServiceController.class), 0);
+                new Intent(this, Controller.class), 0);
 
         // Set the info for the views that show in the notification panel.
         notification.setLatestEventInfo(this, getText(R.string.local_service_label),
@@ -113,5 +120,127 @@
         // We use a layout id because it is a unique number.  We use it later to cancel.
         mNM.notify(R.string.local_service_started, notification);
     }
-}
+    
+    // ----------------------------------------------------------------------
+    
+    /**
+     * <p>Example of explicitly starting and stopping the local service.
+     * This demonstrates the implementation of a service that runs in the same
+     * process as the rest of the application, which is explicitly started and stopped
+     * as desired.</p>
+     * 
+     * <p>Note that this is implemented as an inner class only keep the sample
+     * all together; typically this code would appear in some separate class.
+     */
+    public static class Controller extends Activity {
+        @Override
+        protected void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
 
+            setContentView(R.layout.local_service_controller);
+
+            // Watch for button clicks.
+            Button button = (Button)findViewById(R.id.start);
+            button.setOnClickListener(mStartListener);
+            button = (Button)findViewById(R.id.stop);
+            button.setOnClickListener(mStopListener);
+        }
+
+        private OnClickListener mStartListener = new OnClickListener() {
+            public void onClick(View v) {
+                // Make sure the service is started.  It will continue running
+                // until someone calls stopService().  The Intent we use to find
+                // the service explicitly specifies our service component, because
+                // we want it running in our own process and don't want other
+                // applications to replace it.
+                startService(new Intent(Controller.this,
+                        LocalService.class));
+            }
+        };
+
+        private OnClickListener mStopListener = new OnClickListener() {
+            public void onClick(View v) {
+                // Cancel a previous call to startService().  Note that the
+                // service will not actually stop at this point if there are
+                // still bound clients.
+                stopService(new Intent(Controller.this,
+                        LocalService.class));
+            }
+        };
+    }
+
+    // ----------------------------------------------------------------------
+    
+    /**
+     * Example of binding and unbinding to the local service.
+     * This demonstrates the implementation of a service which the client will
+     * bind to, receiving an object through which it can communicate with the service.</p>
+     * 
+     * <p>Note that this is implemented as an inner class only keep the sample
+     * all together; typically this code would appear in some separate class.
+     */
+    public static class Binding extends Activity {
+        private boolean mIsBound;
+        private LocalService mBoundService;
+
+        @Override
+        protected void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+
+            setContentView(R.layout.local_service_binding);
+
+            // Watch for button clicks.
+            Button button = (Button)findViewById(R.id.bind);
+            button.setOnClickListener(mBindListener);
+            button = (Button)findViewById(R.id.unbind);
+            button.setOnClickListener(mUnbindListener);
+        }
+
+        private ServiceConnection mConnection = new ServiceConnection() {
+            public void onServiceConnected(ComponentName className, IBinder service) {
+                // This is called when the connection with the service has been
+                // established, giving us the service object we can use to
+                // interact with the service.  Because we have bound to a explicit
+                // service that we know is running in our own process, we can
+                // cast its IBinder to a concrete class and directly access it.
+                mBoundService = ((LocalService.LocalBinder)service).getService();
+                
+                // Tell the user about this for our demo.
+                Toast.makeText(Binding.this, R.string.local_service_connected,
+                        Toast.LENGTH_SHORT).show();
+            }
+
+            public void onServiceDisconnected(ComponentName className) {
+                // This is called when the connection with the service has been
+                // unexpectedly disconnected -- that is, its process crashed.
+                // Because it is running in our same process, we should never
+                // see this happen.
+                mBoundService = null;
+                Toast.makeText(Binding.this, R.string.local_service_disconnected,
+                        Toast.LENGTH_SHORT).show();
+            }
+        };
+
+        private OnClickListener mBindListener = new OnClickListener() {
+            public void onClick(View v) {
+                // Establish a connection with the service.  We use an explicit
+                // class name because we want a specific service implementation that
+                // we know will be running in our own process (and thus won't be
+                // supporting component replacement by other applications).
+                bindService(new Intent(Binding.this, 
+                        LocalService.class), mConnection, Context.BIND_AUTO_CREATE);
+                mIsBound = true;
+            }
+        };
+
+        private OnClickListener mUnbindListener = new OnClickListener() {
+            public void onClick(View v) {
+                if (mIsBound) {
+                    // Detach our existing connection.
+                    unbindService(mConnection);
+                    mIsBound = false;
+                }
+            }
+        };
+    }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/LocalServiceBinding.java b/samples/ApiDemos/src/com/example/android/apis/app/LocalServiceBinding.java
deleted file mode 100644
index ddcfad5..0000000
--- a/samples/ApiDemos/src/com/example/android/apis/app/LocalServiceBinding.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2007 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.apis.app;
-
-import com.example.android.apis.R;
-
-import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.IBinder;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.Toast;
-
-
-/**
- * <p>Example of binding and unbinding to the {@link LocalService}.
- * This demonstrates the implementation of a service which the client will
- * bind to, receiving an object through which it can communicate with the service.</p>
- */
-public class LocalServiceBinding extends Activity {
-    private boolean mIsBound;
-    private LocalService mBoundService;
-
-    @Override
-	protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.local_service_binding);
-
-        // Watch for button clicks.
-        Button button = (Button)findViewById(R.id.bind);
-        button.setOnClickListener(mBindListener);
-        button = (Button)findViewById(R.id.unbind);
-        button.setOnClickListener(mUnbindListener);
-    }
-
-    private ServiceConnection mConnection = new ServiceConnection() {
-        public void onServiceConnected(ComponentName className, IBinder service) {
-            // This is called when the connection with the service has been
-            // established, giving us the service object we can use to
-            // interact with the service.  Because we have bound to a explicit
-            // service that we know is running in our own process, we can
-            // cast its IBinder to a concrete class and directly access it.
-            mBoundService = ((LocalService.LocalBinder)service).getService();
-            
-            // Tell the user about this for our demo.
-            Toast.makeText(LocalServiceBinding.this, R.string.local_service_connected,
-                    Toast.LENGTH_SHORT).show();
-        }
-
-        public void onServiceDisconnected(ComponentName className) {
-            // This is called when the connection with the service has been
-            // unexpectedly disconnected -- that is, its process crashed.
-            // Because it is running in our same process, we should never
-            // see this happen.
-            mBoundService = null;
-            Toast.makeText(LocalServiceBinding.this, R.string.local_service_disconnected,
-                    Toast.LENGTH_SHORT).show();
-        }
-    };
-
-    private OnClickListener mBindListener = new OnClickListener() {
-        public void onClick(View v) {
-            // Establish a connection with the service.  We use an explicit
-            // class name because we want a specific service implementation that
-            // we know will be running in our own process (and thus won't be
-            // supporting component replacement by other applications).
-            bindService(new Intent(LocalServiceBinding.this, 
-                    LocalService.class), mConnection, Context.BIND_AUTO_CREATE);
-            mIsBound = true;
-        }
-    };
-
-    private OnClickListener mUnbindListener = new OnClickListener() {
-        public void onClick(View v) {
-            if (mIsBound) {
-                // Detach our existing connection.
-                unbindService(mConnection);
-                mIsBound = false;
-            }
-        }
-    };
-}
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/LocalServiceController.java b/samples/ApiDemos/src/com/example/android/apis/app/LocalServiceController.java
deleted file mode 100644
index 6041249..0000000
--- a/samples/ApiDemos/src/com/example/android/apis/app/LocalServiceController.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 2007 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.apis.app;
-
-// Need the following import to get access to the app resources, since this
-// class is in a sub-package.
-import com.example.android.apis.R;
-
-import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-
-
-/**
- * <p>Example of explicitly starting and stopping the {@link LocalService}.
- * This demonstrates the implementation of a service that runs in the same
- * process as the rest of the application, which is explicitly started and stopped
- * as desired.</p>
- */
-public class LocalServiceController extends Activity {
-    @Override
-	protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.local_service_controller);
-
-        // Watch for button clicks.
-        Button button = (Button)findViewById(R.id.start);
-        button.setOnClickListener(mStartListener);
-        button = (Button)findViewById(R.id.stop);
-        button.setOnClickListener(mStopListener);
-    }
-
-    private OnClickListener mStartListener = new OnClickListener() {
-        public void onClick(View v)
-        {
-            // Make sure the service is started.  It will continue running
-            // until someone calls stopService().  The Intent we use to find
-            // the service explicitly specifies our service component, because
-            // we want it running in our own process and don't want other
-            // applications to replace it.
-            startService(new Intent(LocalServiceController.this,
-                    LocalService.class));
-        }
-    };
-
-    private OnClickListener mStopListener = new OnClickListener() {
-        public void onClick(View v)
-        {
-            // Cancel a previous call to startService().  Note that the
-            // service will not actually stop at this point if there are
-            // still bound clients.
-            stopService(new Intent(LocalServiceController.this,
-                    LocalService.class));
-        }
-    };
-}
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/MenuInflateFromXml.java b/samples/ApiDemos/src/com/example/android/apis/app/MenuInflateFromXml.java
index f51b3b8..fc7b62a 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/MenuInflateFromXml.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/MenuInflateFromXml.java
@@ -19,14 +19,11 @@
 import com.example.android.apis.R;
 
 import android.app.Activity;
-import android.app.NotificationManager;
-import android.content.Context;
 import android.os.Bundle;
 import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.widget.ArrayAdapter;
-import android.widget.FrameLayout;
 import android.widget.LinearLayout;
 import android.widget.Spinner;
 import android.widget.TextView;
@@ -93,7 +90,7 @@
         // Add the spinner
         layout.addView(mSpinner,
                 new LinearLayout.LayoutParams(
-                        LinearLayout.LayoutParams.FILL_PARENT,
+                        LinearLayout.LayoutParams.MATCH_PARENT,
                         LinearLayout.LayoutParams.WRAP_CONTENT));
 
         // Create help text
@@ -103,7 +100,7 @@
         
         // Add the help, make it look decent
         LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
-                LinearLayout.LayoutParams.FILL_PARENT,
+                LinearLayout.LayoutParams.MATCH_PARENT,
                 LinearLayout.LayoutParams.WRAP_CONTENT);
         lp.setMargins(10, 10, 10, 10);
         layout.addView(mInstructionsText, lp);
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/RemoteService.java b/samples/ApiDemos/src/com/example/android/apis/app/RemoteService.java
index c0debbc..a62a524 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/RemoteService.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/RemoteService.java
@@ -16,21 +16,28 @@
 
 package com.example.android.apis.app;
 
+import android.app.Activity;
 import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
 import android.app.Service;
+import android.content.ComponentName;
+import android.content.Context;
 import android.content.Intent;
+import android.content.ServiceConnection;
+import android.os.Bundle;
 import android.os.RemoteException;
 import android.os.Handler;
 import android.os.IBinder;
 import android.os.Message;
 import android.os.Process;
 import android.os.RemoteCallbackList;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
+import android.widget.TextView;
 import android.widget.Toast;
 
-import java.util.HashMap;
-
 // Need the following import to get access to the app resources, since this
 // class is in a sub-package.
 import com.example.android.apis.R;
@@ -39,8 +46,13 @@
  * This is an example of implementing an application service that runs in a
  * different process than the application.  Because it can be in another
  * process, we must use IPC to interact with it.  The
- * {@link RemoteServiceController} and {@link RemoteServiceBinding} classes
+ * {@link Controller} and {@link Binding} classes
  * show how to interact with the service.
+ * 
+ * <p>Note that most applications <strong>do not</strong> need to deal with
+ * the complexity shown here.  If your application simply has a service
+ * running in its own process, the {@link LocalService} sample shows a much
+ * simpler way to interact with it.
  */
 public class RemoteService extends Service {
     /**
@@ -172,7 +184,7 @@
 
         // The PendingIntent to launch our activity if the user selects this notification
         PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
-                new Intent(this, LocalServiceController.class), 0);
+                new Intent(this, Controller.class), 0);
 
         // Set the info for the views that show in the notification panel.
         notification.setLatestEventInfo(this, getText(R.string.remote_service_label),
@@ -182,4 +194,266 @@
         // We use a string id because it is a unique number.  We use it later to cancel.
         mNM.notify(R.string.remote_service_started, notification);
     }
+    
+    // ----------------------------------------------------------------------
+    
+    /**
+     * <p>Example of explicitly starting and stopping the remove service.
+     * This demonstrates the implementation of a service that runs in a different
+     * process than the rest of the application, which is explicitly started and stopped
+     * as desired.</p>
+     * 
+     * <p>Note that this is implemented as an inner class only keep the sample
+     * all together; typically this code would appear in some separate class.
+     */
+    public static class Controller extends Activity {
+        @Override
+        protected void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+
+            setContentView(R.layout.remote_service_controller);
+
+            // Watch for button clicks.
+            Button button = (Button)findViewById(R.id.start);
+            button.setOnClickListener(mStartListener);
+            button = (Button)findViewById(R.id.stop);
+            button.setOnClickListener(mStopListener);
+        }
+
+        private OnClickListener mStartListener = new OnClickListener() {
+            public void onClick(View v) {
+                // Make sure the service is started.  It will continue running
+                // until someone calls stopService().
+                // We use an action code here, instead of explictly supplying
+                // the component name, so that other packages can replace
+                // the service.
+                startService(new Intent(
+                        "com.example.android.apis.app.REMOTE_SERVICE"));
+            }
+        };
+
+        private OnClickListener mStopListener = new OnClickListener() {
+            public void onClick(View v) {
+                // Cancel a previous call to startService().  Note that the
+                // service will not actually stop at this point if there are
+                // still bound clients.
+                stopService(new Intent(
+                        "com.example.android.apis.app.REMOTE_SERVICE"));
+            }
+        };
+    }
+    
+    // ----------------------------------------------------------------------
+    
+    /**
+     * Example of binding and unbinding to the remote service.
+     * This demonstrates the implementation of a service which the client will
+     * bind to, interacting with it through an aidl interface.</p>
+     * 
+     * <p>Note that this is implemented as an inner class only keep the sample
+     * all together; typically this code would appear in some separate class.
+     */
+ // BEGIN_INCLUDE(calling_a_service)
+    public static class Binding extends Activity {
+        /** The primary interface we will be calling on the service. */
+        IRemoteService mService = null;
+        /** Another interface we use on the service. */
+        ISecondary mSecondaryService = null;
+        
+        Button mKillButton;
+        TextView mCallbackText;
+
+        private boolean mIsBound;
+
+        /**
+         * Standard initialization of this activity.  Set up the UI, then wait
+         * for the user to poke it before doing anything.
+         */
+        @Override
+        protected void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+
+            setContentView(R.layout.remote_service_binding);
+
+            // Watch for button clicks.
+            Button button = (Button)findViewById(R.id.bind);
+            button.setOnClickListener(mBindListener);
+            button = (Button)findViewById(R.id.unbind);
+            button.setOnClickListener(mUnbindListener);
+            mKillButton = (Button)findViewById(R.id.kill);
+            mKillButton.setOnClickListener(mKillListener);
+            mKillButton.setEnabled(false);
+            
+            mCallbackText = (TextView)findViewById(R.id.callback);
+            mCallbackText.setText("Not attached.");
+        }
+
+        /**
+         * Class for interacting with the main interface of the service.
+         */
+        private ServiceConnection mConnection = new ServiceConnection() {
+            public void onServiceConnected(ComponentName className,
+                    IBinder service) {
+                // This is called when the connection with the service has been
+                // established, giving us the service object we can use to
+                // interact with the service.  We are communicating with our
+                // service through an IDL interface, so get a client-side
+                // representation of that from the raw service object.
+                mService = IRemoteService.Stub.asInterface(service);
+                mKillButton.setEnabled(true);
+                mCallbackText.setText("Attached.");
+
+                // We want to monitor the service for as long as we are
+                // connected to it.
+                try {
+                    mService.registerCallback(mCallback);
+                } catch (RemoteException e) {
+                    // In this case the service has crashed before we could even
+                    // do anything with it; we can count on soon being
+                    // disconnected (and then reconnected if it can be restarted)
+                    // so there is no need to do anything here.
+                }
+                
+                // As part of the sample, tell the user what happened.
+                Toast.makeText(Binding.this, R.string.remote_service_connected,
+                        Toast.LENGTH_SHORT).show();
+            }
+
+            public void onServiceDisconnected(ComponentName className) {
+                // This is called when the connection with the service has been
+                // unexpectedly disconnected -- that is, its process crashed.
+                mService = null;
+                mKillButton.setEnabled(false);
+                mCallbackText.setText("Disconnected.");
+
+                // As part of the sample, tell the user what happened.
+                Toast.makeText(Binding.this, R.string.remote_service_disconnected,
+                        Toast.LENGTH_SHORT).show();
+            }
+        };
+
+        /**
+         * Class for interacting with the secondary interface of the service.
+         */
+        private ServiceConnection mSecondaryConnection = new ServiceConnection() {
+            public void onServiceConnected(ComponentName className,
+                    IBinder service) {
+                // Connecting to a secondary interface is the same as any
+                // other interface.
+                mSecondaryService = ISecondary.Stub.asInterface(service);
+                mKillButton.setEnabled(true);
+            }
+
+            public void onServiceDisconnected(ComponentName className) {
+                mSecondaryService = null;
+                mKillButton.setEnabled(false);
+            }
+        };
+
+        private OnClickListener mBindListener = new OnClickListener() {
+            public void onClick(View v) {
+                // Establish a couple connections with the service, binding
+                // by interface names.  This allows other applications to be
+                // installed that replace the remote service by implementing
+                // the same interface.
+                bindService(new Intent(IRemoteService.class.getName()),
+                        mConnection, Context.BIND_AUTO_CREATE);
+                bindService(new Intent(ISecondary.class.getName()),
+                        mSecondaryConnection, Context.BIND_AUTO_CREATE);
+                mIsBound = true;
+                mCallbackText.setText("Binding.");
+            }
+        };
+
+        private OnClickListener mUnbindListener = new OnClickListener() {
+            public void onClick(View v) {
+                if (mIsBound) {
+                    // If we have received the service, and hence registered with
+                    // it, then now is the time to unregister.
+                    if (mService != null) {
+                        try {
+                            mService.unregisterCallback(mCallback);
+                        } catch (RemoteException e) {
+                            // There is nothing special we need to do if the service
+                            // has crashed.
+                        }
+                    }
+                    
+                    // Detach our existing connection.
+                    unbindService(mConnection);
+                    unbindService(mSecondaryConnection);
+                    mKillButton.setEnabled(false);
+                    mIsBound = false;
+                    mCallbackText.setText("Unbinding.");
+                }
+            }
+        };
+
+        private OnClickListener mKillListener = new OnClickListener() {
+            public void onClick(View v) {
+                // To kill the process hosting our service, we need to know its
+                // PID.  Conveniently our service has a call that will return
+                // to us that information.
+                if (mSecondaryService != null) {
+                    try {
+                        int pid = mSecondaryService.getPid();
+                        // Note that, though this API allows us to request to
+                        // kill any process based on its PID, the kernel will
+                        // still impose standard restrictions on which PIDs you
+                        // are actually able to kill.  Typically this means only
+                        // the process running your application and any additional
+                        // processes created by that app as shown here; packages
+                        // sharing a common UID will also be able to kill each
+                        // other's processes.
+                        Process.killProcess(pid);
+                        mCallbackText.setText("Killed service process.");
+                    } catch (RemoteException ex) {
+                        // Recover gracefully from the process hosting the
+                        // server dying.
+                        // Just for purposes of the sample, put up a notification.
+                        Toast.makeText(Binding.this,
+                                R.string.remote_call_failed,
+                                Toast.LENGTH_SHORT).show();
+                    }
+                }
+            }
+        };
+        
+        // ----------------------------------------------------------------------
+        // Code showing how to deal with callbacks.
+        // ----------------------------------------------------------------------
+        
+        /**
+         * This implementation is used to receive callbacks from the remote
+         * service.
+         */
+        private IRemoteServiceCallback mCallback = new IRemoteServiceCallback.Stub() {
+            /**
+             * This is called by the remote service regularly to tell us about
+             * new values.  Note that IPC calls are dispatched through a thread
+             * pool running in each process, so the code executing here will
+             * NOT be running in our main thread like most other things -- so,
+             * to update the UI, we need to use a Handler to hop over there.
+             */
+            public void valueChanged(int value) {
+                mHandler.sendMessage(mHandler.obtainMessage(BUMP_MSG, value, 0));
+            }
+        };
+        
+        private static final int BUMP_MSG = 1;
+        
+        private Handler mHandler = new Handler() {
+            @Override public void handleMessage(Message msg) {
+                switch (msg.what) {
+                    case BUMP_MSG:
+                        mCallbackText.setText("Received from service: " + msg.arg1);
+                        break;
+                    default:
+                        super.handleMessage(msg);
+                }
+            }
+            
+        };
+    }
+// END_INCLUDE(calling_a_service)
 }
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/RemoteServiceBinding.java b/samples/ApiDemos/src/com/example/android/apis/app/RemoteServiceBinding.java
deleted file mode 100644
index f9ad4e5..0000000
--- a/samples/ApiDemos/src/com/example/android/apis/app/RemoteServiceBinding.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*
- * Copyright (C) 2007 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.apis.app;
-
-import com.example.android.apis.R;
-
-import android.app.Activity;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.os.Bundle;
-import android.os.RemoteException;
-import android.os.Handler;
-import android.os.IBinder;
-import android.os.Message;
-import android.os.Process;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-import android.widget.TextView;
-import android.widget.Toast;
-
-// BEGIN_INCLUDE(exposing_a_service)
-public class RemoteServiceBinding extends Activity {
-    /** The primary interface we will be calling on the service. */
-    IRemoteService mService = null;
-    /** Another interface we use on the service. */
-    ISecondary mSecondaryService = null;
-    
-    Button mKillButton;
-    TextView mCallbackText;
-
-    private boolean mIsBound;
-
-    /**
-     * Standard initialization of this activity.  Set up the UI, then wait
-     * for the user to poke it before doing anything.
-     */
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.remote_service_binding);
-
-        // Watch for button clicks.
-        Button button = (Button)findViewById(R.id.bind);
-        button.setOnClickListener(mBindListener);
-        button = (Button)findViewById(R.id.unbind);
-        button.setOnClickListener(mUnbindListener);
-        mKillButton = (Button)findViewById(R.id.kill);
-        mKillButton.setOnClickListener(mKillListener);
-        mKillButton.setEnabled(false);
-        
-        mCallbackText = (TextView)findViewById(R.id.callback);
-        mCallbackText.setText("Not attached.");
-    }
-
-    /**
-     * Class for interacting with the main interface of the service.
-     */
-    private ServiceConnection mConnection = new ServiceConnection() {
-        public void onServiceConnected(ComponentName className,
-                IBinder service) {
-            // This is called when the connection with the service has been
-            // established, giving us the service object we can use to
-            // interact with the service.  We are communicating with our
-            // service through an IDL interface, so get a client-side
-            // representation of that from the raw service object.
-            mService = IRemoteService.Stub.asInterface(service);
-            mKillButton.setEnabled(true);
-            mCallbackText.setText("Attached.");
-
-            // We want to monitor the service for as long as we are
-            // connected to it.
-            try {
-                mService.registerCallback(mCallback);
-            } catch (RemoteException e) {
-                // In this case the service has crashed before we could even
-                // do anything with it; we can count on soon being
-                // disconnected (and then reconnected if it can be restarted)
-                // so there is no need to do anything here.
-            }
-            
-            // As part of the sample, tell the user what happened.
-            Toast.makeText(RemoteServiceBinding.this, R.string.remote_service_connected,
-                    Toast.LENGTH_SHORT).show();
-        }
-
-        public void onServiceDisconnected(ComponentName className) {
-            // This is called when the connection with the service has been
-            // unexpectedly disconnected -- that is, its process crashed.
-            mService = null;
-            mKillButton.setEnabled(false);
-            mCallbackText.setText("Disconnected.");
-
-            // As part of the sample, tell the user what happened.
-            Toast.makeText(RemoteServiceBinding.this, R.string.remote_service_disconnected,
-                    Toast.LENGTH_SHORT).show();
-        }
-    };
-
-    /**
-     * Class for interacting with the secondary interface of the service.
-     */
-    private ServiceConnection mSecondaryConnection = new ServiceConnection() {
-        public void onServiceConnected(ComponentName className,
-                IBinder service) {
-            // Connecting to a secondary interface is the same as any
-            // other interface.
-            mSecondaryService = ISecondary.Stub.asInterface(service);
-            mKillButton.setEnabled(true);
-        }
-
-        public void onServiceDisconnected(ComponentName className) {
-            mSecondaryService = null;
-            mKillButton.setEnabled(false);
-        }
-    };
-
-    private OnClickListener mBindListener = new OnClickListener() {
-        public void onClick(View v) {
-            // Establish a couple connections with the service, binding
-            // by interface names.  This allows other applications to be
-            // installed that replace the remote service by implementing
-            // the same interface.
-            bindService(new Intent(IRemoteService.class.getName()),
-                    mConnection, Context.BIND_AUTO_CREATE);
-            bindService(new Intent(ISecondary.class.getName()),
-                    mSecondaryConnection, Context.BIND_AUTO_CREATE);
-            mIsBound = true;
-            mCallbackText.setText("Binding.");
-        }
-    };
-
-    private OnClickListener mUnbindListener = new OnClickListener() {
-        public void onClick(View v) {
-            if (mIsBound) {
-                // If we have received the service, and hence registered with
-                // it, then now is the time to unregister.
-                if (mService != null) {
-                    try {
-                        mService.unregisterCallback(mCallback);
-                    } catch (RemoteException e) {
-                        // There is nothing special we need to do if the service
-                        // has crashed.
-                    }
-                }
-                
-                // Detach our existing connection.
-                unbindService(mConnection);
-                unbindService(mSecondaryConnection);
-                mKillButton.setEnabled(false);
-                mIsBound = false;
-                mCallbackText.setText("Unbinding.");
-            }
-        }
-    };
-
-    private OnClickListener mKillListener = new OnClickListener() {
-        public void onClick(View v) {
-            // To kill the process hosting our service, we need to know its
-            // PID.  Conveniently our service has a call that will return
-            // to us that information.
-            if (mSecondaryService != null) {
-                try {
-                    int pid = mSecondaryService.getPid();
-                    // Note that, though this API allows us to request to
-                    // kill any process based on its PID, the kernel will
-                    // still impose standard restrictions on which PIDs you
-                    // are actually able to kill.  Typically this means only
-                    // the process running your application and any additional
-                    // processes created by that app as shown here; packages
-                    // sharing a common UID will also be able to kill each
-                    // other's processes.
-                    Process.killProcess(pid);
-                    mCallbackText.setText("Killed service process.");
-                } catch (RemoteException ex) {
-                    // Recover gracefully from the process hosting the
-                    // server dying.
-                    // Just for purposes of the sample, put up a notification.
-                    Toast.makeText(RemoteServiceBinding.this,
-                            R.string.remote_call_failed,
-                            Toast.LENGTH_SHORT).show();
-                }
-            }
-        }
-    };
-    
-    // ----------------------------------------------------------------------
-    // Code showing how to deal with callbacks.
-    // ----------------------------------------------------------------------
-    
-    /**
-     * This implementation is used to receive callbacks from the remote
-     * service.
-     */
-    private IRemoteServiceCallback mCallback = new IRemoteServiceCallback.Stub() {
-        /**
-         * This is called by the remote service regularly to tell us about
-         * new values.  Note that IPC calls are dispatched through a thread
-         * pool running in each process, so the code executing here will
-         * NOT be running in our main thread like most other things -- so,
-         * to update the UI, we need to use a Handler to hop over there.
-         */
-        public void valueChanged(int value) {
-            mHandler.sendMessage(mHandler.obtainMessage(BUMP_MSG, value, 0));
-        }
-    };
-    
-    private static final int BUMP_MSG = 1;
-    
-    private Handler mHandler = new Handler() {
-        @Override public void handleMessage(Message msg) {
-            switch (msg.what) {
-                case BUMP_MSG:
-                    mCallbackText.setText("Received from service: " + msg.arg1);
-                    break;
-                default:
-                    super.handleMessage(msg);
-            }
-        }
-        
-    };
-}
-// END_INCLUDE(exposing_a_service)
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/RemoteServiceController.java b/samples/ApiDemos/src/com/example/android/apis/app/RemoteServiceController.java
deleted file mode 100644
index 681d411..0000000
--- a/samples/ApiDemos/src/com/example/android/apis/app/RemoteServiceController.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2007 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.apis.app;
-
-// Need the following import to get access to the app resources, since this
-// class is in a sub-package.
-import com.example.android.apis.R;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-
-public class RemoteServiceController extends Activity {
-    @Override
-	protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.remote_service_controller);
-
-        // Watch for button clicks.
-        Button button = (Button)findViewById(R.id.start);
-        button.setOnClickListener(mStartListener);
-        button = (Button)findViewById(R.id.stop);
-        button.setOnClickListener(mStopListener);
-    }
-
-    private OnClickListener mStartListener = new OnClickListener() {
-        public void onClick(View v) {
-            // Make sure the service is started.  It will continue running
-            // until someone calls stopService().
-            // We use an action code here, instead of explictly supplying
-            // the component name, so that other packages can replace
-            // the service.
-            startService(new Intent(
-                    "com.example.android.apis.app.REMOTE_SERVICE"));
-        }
-    };
-
-    private OnClickListener mStopListener = new OnClickListener() {
-        public void onClick(View v) {
-            // Cancel a previous call to startService().  Note that the
-            // service will not actually stop at this point if there are
-            // still bound clients.
-            stopService(new Intent(
-                    "com.example.android.apis.app.REMOTE_SERVICE"));
-        }
-    };
-}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/SampleDeviceAdmin.java b/samples/ApiDemos/src/com/example/android/apis/app/SampleDeviceAdmin.java
new file mode 100644
index 0000000..b8fb784
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/app/SampleDeviceAdmin.java
@@ -0,0 +1,395 @@
+/*
+ * 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.apis.app;
+
+import com.example.android.apis.R;
+
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.app.AlertDialog;
+import android.app.DeviceAdmin;
+import android.app.DevicePolicyManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.DialogInterface;
+import android.content.Intent;
+import android.content.SharedPreferences;
+import android.os.Bundle;
+import android.os.Debug;
+import android.text.Editable;
+import android.text.TextWatcher;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.AdapterView;
+import android.widget.ArrayAdapter;
+import android.widget.Button;
+import android.widget.EditText;
+import android.widget.Spinner;
+import android.widget.Toast;
+import android.widget.AdapterView.OnItemSelectedListener;
+
+/**
+ * Example of a do-nothing admin class.  When enabled, it lets you control
+ * some of its policy and reports when there is interesting activity.
+ */
+public class SampleDeviceAdmin extends DeviceAdmin {
+
+    static SharedPreferences getSamplePreferences(Context context) {
+        return context.getSharedPreferences(DeviceAdmin.class.getName(), 0);
+    }
+    
+    static String PREF_PASSWORD_QUALITY = "password_quality";
+    static String PREF_PASSWORD_LENGTH = "password_length";
+    static String PREF_MAX_FAILED_PW = "max_failed_pw";
+    
+    void showToast(Context context, CharSequence msg) {
+        Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
+    }
+    
+    @Override
+    public void onEnabled(Context context, Intent intent) {
+        showToast(context, "Sample Device Admin: enabled");
+    }
+
+    @Override
+    public CharSequence onDisableRequested(Context context, Intent intent) {
+        return "This is an optional message to warn the user about disabling.";
+    }
+
+    @Override
+    public void onDisabled(Context context, Intent intent) {
+        showToast(context, "Sample Device Admin: disabled");
+    }
+
+    @Override
+    public void onPasswordChanged(Context context, Intent intent) {
+        showToast(context, "Sample Device Admin: pw changed");
+    }
+
+    @Override
+    public void onPasswordFailed(Context context, Intent intent) {
+        showToast(context, "Sample Device Admin: pw failed");
+    }
+
+    @Override
+    public void onPasswordSucceeded(Context context, Intent intent) {
+        showToast(context, "Sample Device Admin: pw succeeded");
+    }
+
+    /**
+     * <p>UI control for the sample device admin.  This provides an interface
+     * to enable, disable, and perform other operations with it to see
+     * their effect.</p>
+     * 
+     * <p>Note that this is implemented as an inner class only keep the sample
+     * all together; typically this code would appear in some separate class.
+     */
+    public static class Controller extends Activity {
+        static final int RESULT_ENABLE = 1;
+        
+        DevicePolicyManager mDPM;
+        ActivityManager mAM;
+        ComponentName mSampleDeviceAdmin;
+        
+        Button mEnableButton;
+        Button mDisableButton;
+        
+        // Password quality spinner choices
+        // This list must match the list found in samples/ApiDemos/res/values/arrays.xml
+        final static int mPasswordQualityValues[] = new int[] {
+            DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED,
+            DevicePolicyManager.PASSWORD_QUALITY_SOMETHING,
+            DevicePolicyManager.PASSWORD_QUALITY_NUMERIC,
+            DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC
+        };
+        Spinner mPasswordQuality;
+        EditText mPasswordLength;
+        Button mSetPasswordButton;
+        
+        EditText mPassword;
+        Button mResetPasswordButton;
+        
+        EditText mMaxFailedPw;
+        
+        Button mForceLockButton;
+        Button mWipeDataButton;
+        
+        @Override
+        protected void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+
+            mDPM = (DevicePolicyManager)getSystemService(Context.DEVICE_POLICY_SERVICE);
+            mAM = (ActivityManager)getSystemService(Context.ACTIVITY_SERVICE);
+            mSampleDeviceAdmin = new ComponentName(Controller.this, SampleDeviceAdmin.class);
+            
+            setContentView(R.layout.sample_device_admin);
+
+            // Watch for button clicks.
+            mEnableButton = (Button)findViewById(R.id.enable);
+            mEnableButton.setOnClickListener(mEnableListener);
+            mDisableButton = (Button)findViewById(R.id.disable);
+            mDisableButton.setOnClickListener(mDisableListener);
+            
+            mPasswordQuality = (Spinner)findViewById(R.id.password_quality);
+            ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(
+                    this, R.array.password_qualities, android.R.layout.simple_spinner_item);
+            adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
+            mPasswordQuality.setAdapter(adapter);
+            mPasswordQuality.setOnItemSelectedListener(
+                    new OnItemSelectedListener() {
+                        public void onItemSelected(
+                                AdapterView<?> parent, View view, int position, long id) {
+                            setPasswordQuality(mPasswordQualityValues[position]);
+                        }
+
+                        public void onNothingSelected(AdapterView<?> parent) {
+                            setPasswordQuality(DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
+                        }
+                    });
+            mPasswordLength = (EditText)findViewById(R.id.password_length);
+            mPasswordLength.addTextChangedListener(new TextWatcher() {
+                public void afterTextChanged(Editable s) {
+                }
+                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+                }
+                public void onTextChanged(CharSequence s, int start, int before, int count) {
+                    try {
+                        setPasswordLength(Integer.parseInt(s.toString()));
+                    } catch (NumberFormatException e) {
+                    }
+                }
+            });
+            mSetPasswordButton = (Button)findViewById(R.id.set_password);
+            mSetPasswordButton.setOnClickListener(mSetPasswordListener);
+            
+            mPassword = (EditText)findViewById(R.id.password);
+            mResetPasswordButton = (Button)findViewById(R.id.reset_password);
+            mResetPasswordButton.setOnClickListener(mResetPasswordListener);
+            
+            mMaxFailedPw = (EditText)findViewById(R.id.max_failed_pw);
+            mMaxFailedPw.addTextChangedListener(new TextWatcher() {
+                public void afterTextChanged(Editable s) {
+                }
+                public void beforeTextChanged(CharSequence s, int start, int count, int after) {
+                }
+                public void onTextChanged(CharSequence s, int start, int before, int count) {
+                    try {
+                        setMaxFailedPw(Integer.parseInt(s.toString()));
+                    } catch (NumberFormatException e) {
+                    }
+                }
+            });
+            
+            mForceLockButton = (Button)findViewById(R.id.force_lock);
+            mForceLockButton.setOnClickListener(mForceLockListener);
+            mWipeDataButton = (Button)findViewById(R.id.wipe_data);
+            mWipeDataButton.setOnClickListener(mWipeDataListener);
+        }
+
+        void updateButtonStates() {
+            boolean active = mDPM.isAdminActive(mSampleDeviceAdmin);
+            if (active) {
+                mEnableButton.setEnabled(false);
+                mDisableButton.setEnabled(true);
+                mPasswordQuality.setEnabled(true);
+                mPasswordLength.setEnabled(true);
+                mSetPasswordButton.setEnabled(true);
+                mPassword.setEnabled(true);
+                mResetPasswordButton.setEnabled(true);
+                mForceLockButton.setEnabled(true);
+                mWipeDataButton.setEnabled(true);
+            } else {
+                mEnableButton.setEnabled(true);
+                mDisableButton.setEnabled(false);
+                mPasswordQuality.setEnabled(false);
+                mPasswordLength.setEnabled(false);
+                mSetPasswordButton.setEnabled(false);
+                mPassword.setEnabled(false);
+                mResetPasswordButton.setEnabled(false);
+                mForceLockButton.setEnabled(false);
+                mWipeDataButton.setEnabled(false);
+            }
+        }
+        
+        void updateControls() {
+            SharedPreferences prefs = getSamplePreferences(this);
+            final int pwQuality = prefs.getInt(PREF_PASSWORD_QUALITY,
+                    DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
+            final int pwLength = prefs.getInt(PREF_PASSWORD_LENGTH, 0);
+            final int maxFailedPw = prefs.getInt(PREF_MAX_FAILED_PW, 0);
+            
+            for (int i=0; i<mPasswordQualityValues.length; i++) {
+                if (mPasswordQualityValues[i] == pwQuality) {
+                    mPasswordQuality.setSelection(i);
+                }
+            }
+            mPasswordLength.setText(Integer.toString(pwLength));
+            mMaxFailedPw.setText(Integer.toString(maxFailedPw));
+        }
+        
+        void updatePolicies() {
+            SharedPreferences prefs = getSamplePreferences(this);
+            final int pwQuality = prefs.getInt(PREF_PASSWORD_QUALITY,
+                    DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
+            final int pwLength = prefs.getInt(PREF_PASSWORD_LENGTH, 0);
+            final int maxFailedPw = prefs.getInt(PREF_PASSWORD_LENGTH, 0);
+            
+            boolean active = mDPM.isAdminActive(mSampleDeviceAdmin);
+            if (active) {
+                mDPM.setPasswordQuality(mSampleDeviceAdmin, pwQuality);
+                mDPM.setPasswordMinimumLength(mSampleDeviceAdmin, pwLength);
+                mDPM.setMaximumFailedPasswordsForWipe(mSampleDeviceAdmin, maxFailedPw);
+            }
+        }
+        
+        void setPasswordQuality(int quality) {
+            SharedPreferences prefs = getSamplePreferences(this);
+            prefs.edit().putInt(PREF_PASSWORD_QUALITY, quality).commit();
+            updatePolicies();
+        }
+        
+        void setPasswordLength(int length) {
+            SharedPreferences prefs = getSamplePreferences(this);
+            prefs.edit().putInt(PREF_PASSWORD_LENGTH, length).commit();
+            updatePolicies();
+        }
+        
+        void setMaxFailedPw(int length) {
+            SharedPreferences prefs = getSamplePreferences(this);
+            prefs.edit().putInt(PREF_MAX_FAILED_PW, length).commit();
+            updatePolicies();
+        }
+        
+        @Override
+        protected void onResume() {
+            super.onResume();
+            updateButtonStates();
+        }
+
+        @Override
+        protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+            switch (requestCode) {
+                case RESULT_ENABLE:
+                    if (resultCode == Activity.RESULT_OK) {
+                        Log.i("SampleDeviceAdmin", "Admin enabled!");
+                    } else {
+                        Log.i("SampleDeviceAdmin", "Admin enable FAILED!");
+                    }
+                    return;
+            }
+            
+            super.onActivityResult(requestCode, resultCode, data);
+        }
+
+        private OnClickListener mEnableListener = new OnClickListener() {
+            public void onClick(View v) {
+                // Launch the activity to have the user enable our admin.
+                Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
+                intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
+                        mSampleDeviceAdmin);
+                intent.putExtra(DevicePolicyManager.EXTRA_ADD_EXPLANATION,
+                        "Additional text explaining why this needs to be added.");
+                startActivityForResult(intent, RESULT_ENABLE);
+            }
+        };
+
+        private OnClickListener mDisableListener = new OnClickListener() {
+            public void onClick(View v) {
+                mDPM.removeActiveAdmin(mSampleDeviceAdmin);
+                updateButtonStates();
+            }
+        };
+
+        private OnClickListener mSetPasswordListener = new OnClickListener() {
+            public void onClick(View v) {
+                // Launch the activity to have the user set a new password.
+                Intent intent = new Intent(DevicePolicyManager.ACTION_SET_NEW_PASSWORD);
+                startActivity(intent);
+            }
+        };
+
+        private OnClickListener mResetPasswordListener = new OnClickListener() {
+            public void onClick(View v) {
+                if (mAM.isUserAMonkey()) {
+                    // Don't trust monkeys to do the right thing!
+                    AlertDialog.Builder builder = new AlertDialog.Builder(Controller.this);
+                    builder.setMessage("You can't reset my password because you are a monkey!");
+                    builder.setPositiveButton("I admit defeat", null);
+                    builder.show();
+                    return;
+                }
+                boolean active = mDPM.isAdminActive(mSampleDeviceAdmin);
+                if (active) {
+                    mDPM.resetPassword(mPassword.getText().toString());
+                }
+            }
+        };
+
+        private OnClickListener mForceLockListener = new OnClickListener() {
+            public void onClick(View v) {
+                if (mAM.isUserAMonkey()) {
+                    // Don't trust monkeys to do the right thing!
+                    AlertDialog.Builder builder = new AlertDialog.Builder(Controller.this);
+                    builder.setMessage("You can't lock my screen because you are a monkey!");
+                    builder.setPositiveButton("I admit defeat", null);
+                    builder.show();
+                    return;
+                }
+                boolean active = mDPM.isAdminActive(mSampleDeviceAdmin);
+                if (active) {
+                    mDPM.lockNow();
+                }
+            }
+        };
+
+        private OnClickListener mWipeDataListener = new OnClickListener() {
+            public void onClick(View v) {
+                if (mAM.isUserAMonkey()) {
+                    // Don't trust monkeys to do the right thing!
+                    AlertDialog.Builder builder = new AlertDialog.Builder(Controller.this);
+                    builder.setMessage("You can't wipe my data because you are a monkey!");
+                    builder.setPositiveButton("I admit defeat", null);
+                    builder.show();
+                    return;
+                }
+                AlertDialog.Builder builder = new AlertDialog.Builder(Controller.this);
+                builder.setMessage("This will erase all of your data.  Are you sure?");
+                builder.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
+                    public void onClick(DialogInterface dialog, int which) {
+                        AlertDialog.Builder builder = new AlertDialog.Builder(Controller.this);
+                        builder.setMessage("This is not a test.  "
+                                + "This WILL erase all of your data!  "
+                                + "Are you really absolutely sure?");
+                        builder.setPositiveButton("BOOM!", new DialogInterface.OnClickListener() {
+                            public void onClick(DialogInterface dialog, int which) {
+                                boolean active = mDPM.isAdminActive(mSampleDeviceAdmin);
+                                if (active) {
+                                    mDPM.wipeData(0);
+                                }
+                            }
+                        });
+                        builder.setNegativeButton("Oops, run away!", null);
+                        builder.show();
+                    }
+                });
+                builder.setNegativeButton("No way!", null);
+                builder.show();
+            }
+        };
+    }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArguments.java b/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArguments.java
index f4f9af1..f551447 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArguments.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArguments.java
@@ -16,6 +16,7 @@
 
 package com.example.android.apis.app;
 
+import android.app.Activity;
 import android.app.Notification;
 import android.app.NotificationManager;
 import android.app.PendingIntent;
@@ -29,13 +30,16 @@
 import android.os.Message;
 import android.os.Process;
 import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.widget.Button;
 import android.widget.Toast;
 
 import com.example.android.apis.R;
 
 /**
  * This is an example of implementing an application service that runs locally
- * in the same process as the application.  The {@link ServiceStartArgumentsController}
+ * in the same process as the application.  The {@link Controller}
  * class shows how to interact with the service. 
  *
  * <p>Notice the use of the {@link NotificationManager} when interesting things
@@ -44,7 +48,7 @@
  * calling startActivity().
  * 
  * <p>For applications targeting Android 1.5 or beyond, you may want consider
- * using the android.app.IntentService class, which takes care of all the
+ * using the {@link android.app.IntentService} class, which takes care of all the
  * work of creating the extra thread and dispatching commands to it.
  */
 public class ServiceStartArguments extends Service {
@@ -59,8 +63,7 @@
         }
         
         @Override
-        public void handleMessage(Message msg)
-        {
+        public void handleMessage(Message msg) {
             Bundle arguments = (Bundle)msg.obj;
         
             String txt = arguments.getString("name");
@@ -105,7 +108,7 @@
         
         // This is who should be launched if the user selects our persistent
         // notification.
-        mInvokeIntent = new Intent(this, ServiceStartArgumentsController.class);
+        mInvokeIntent = new Intent(this, Controller.class);
 
         // Start up the thread running the service.  Note that we create a
         // separate thread because the service normally runs in the process's
@@ -177,7 +180,7 @@
 
         // The PendingIntent to launch our activity if the user selects this notification
         PendingIntent contentIntent = PendingIntent.getActivity(this, 0,
-                new Intent(this, AlarmService.class), 0);
+                new Intent(this, Controller.class), 0);
 
         // Set the info for the views that show in the notification panel.
         notification.setLatestEventInfo(this, getText(R.string.service_start_arguments_label),
@@ -194,5 +197,76 @@
     private void hideNotification() {
         mNM.cancel(R.string.service_created);
     }
+    
+    // ----------------------------------------------------------------------
+
+    /**
+     * Example of explicitly starting the {@link ServiceStartArguments}.
+     * 
+     * <p>Note that this is implemented as an inner class only keep the sample
+     * all together; typically this code would appear in some separate class.
+     */
+    public static class Controller extends Activity {
+        @Override
+        protected void onCreate(Bundle savedInstanceState) {
+            super.onCreate(savedInstanceState);
+
+            setContentView(R.layout.service_start_arguments_controller);
+
+            // Watch for button clicks.
+            Button button = (Button)findViewById(R.id.start1);
+            button.setOnClickListener(mStart1Listener);
+            button = (Button)findViewById(R.id.start2);
+            button.setOnClickListener(mStart2Listener);
+            button = (Button)findViewById(R.id.start3);
+            button.setOnClickListener(mStart3Listener);
+            button = (Button)findViewById(R.id.startfail);
+            button.setOnClickListener(mStartFailListener);
+            button = (Button)findViewById(R.id.kill);
+            button.setOnClickListener(mKillListener);
+        }
+
+        private OnClickListener mStart1Listener = new OnClickListener() {
+            public void onClick(View v) {
+                startService(new Intent(Controller.this,
+                        ServiceStartArguments.class)
+                                .putExtra("name", "One"));
+            }
+        };
+
+        private OnClickListener mStart2Listener = new OnClickListener() {
+            public void onClick(View v) {
+                startService(new Intent(Controller.this,
+                        ServiceStartArguments.class)
+                                .putExtra("name", "Two"));
+            }
+        };
+
+        private OnClickListener mStart3Listener = new OnClickListener() {
+            public void onClick(View v) {
+                startService(new Intent(Controller.this,
+                        ServiceStartArguments.class)
+                                .putExtra("name", "Three")
+                                .putExtra("redeliver", true));
+            }
+        };
+
+        private OnClickListener mStartFailListener = new OnClickListener() {
+            public void onClick(View v) {
+                startService(new Intent(Controller.this,
+                        ServiceStartArguments.class)
+                                .putExtra("name", "Failure")
+                                .putExtra("fail", true));
+            }
+        };
+
+        private OnClickListener mKillListener = new OnClickListener() {
+            public void onClick(View v) {
+                // This is to simulate the service being killed while it is
+                // running in the background.
+                Process.killProcess(Process.myPid());
+            }
+        };
+    }
 }
 
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArgumentsController.java b/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArgumentsController.java
deleted file mode 100644
index 9d79e2e..0000000
--- a/samples/ApiDemos/src/com/example/android/apis/app/ServiceStartArgumentsController.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2007 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.apis.app;
-
-// Need the following import to get access to the app resources, since this
-// class is in a sub-package.
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Process;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.widget.Button;
-
-import com.example.android.apis.R;
-
-/**
- * Example of explicitly starting the {@link ServiceStartArguments}.
- */
-public class ServiceStartArgumentsController extends Activity {
-    @Override
-	protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.service_start_arguments_controller);
-
-        // Watch for button clicks.
-        Button button = (Button)findViewById(R.id.start1);
-        button.setOnClickListener(mStart1Listener);
-        button = (Button)findViewById(R.id.start2);
-        button.setOnClickListener(mStart2Listener);
-        button = (Button)findViewById(R.id.start3);
-        button.setOnClickListener(mStart3Listener);
-        button = (Button)findViewById(R.id.startfail);
-        button.setOnClickListener(mStartFailListener);
-        button = (Button)findViewById(R.id.kill);
-        button.setOnClickListener(mKillListener);
-    }
-
-    private OnClickListener mStart1Listener = new OnClickListener() {
-        public void onClick(View v) {
-            startService(new Intent(ServiceStartArgumentsController.this,
-                    ServiceStartArguments.class)
-                            .putExtra("name", "One"));
-        }
-    };
-
-    private OnClickListener mStart2Listener = new OnClickListener() {
-        public void onClick(View v) {
-            startService(new Intent(ServiceStartArgumentsController.this,
-                    ServiceStartArguments.class)
-                            .putExtra("name", "Two"));
-        }
-    };
-
-    private OnClickListener mStart3Listener = new OnClickListener() {
-        public void onClick(View v) {
-            startService(new Intent(ServiceStartArgumentsController.this,
-                    ServiceStartArguments.class)
-                            .putExtra("name", "Three")
-                            .putExtra("redeliver", true));
-        }
-    };
-
-    private OnClickListener mStartFailListener = new OnClickListener() {
-        public void onClick(View v) {
-            startService(new Intent(ServiceStartArgumentsController.this,
-                    ServiceStartArguments.class)
-                            .putExtra("name", "Failure")
-                            .putExtra("fail", true));
-        }
-    };
-
-    private OnClickListener mKillListener = new OnClickListener() {
-        public void onClick(View v) {
-            // This is to simulate the service being killed while it is
-            // running in the background.
-            Process.killProcess(Process.myPid());
-        }
-    };
-}
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/_index.html b/samples/ApiDemos/src/com/example/android/apis/app/_index.html
index 2454bad..fff5ce2 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/_index.html
+++ b/samples/ApiDemos/src/com/example/android/apis/app/_index.html
@@ -41,55 +41,44 @@
 
 <h3>Service</h3>
 <dl>
-  <dt><a href="LocalServiceController.html">Local Service Controller</a></dt>
-  <dd>Starts and stops the service class
-  <a href="LocalService.html">LocalService</a> that runs in the same
-  process as the activity, to demonstrate a service's
-  lifecycle when using {@link android.content.Context#startService
+  <dt><a href="LocalService.html">Local Service Controller and
+        Local Service Binding</a></dt>
+  <dd>Demonstrate the implementation of a service that runs in the same
+  process as its client(s).  Shows how those clients can either start/stop it
+  with {@link android.content.Context#startService
   Context.startService} and {@link android.content.Context#stopService
-  Context.stopService}.</dd>
-
-  <dt><a href="LocalServiceBinding.html">Local Service Binding</a></dt>
-  <dd>Demonstrates binding to a service class
-  <a href="LocalService.html">LocalService</a> that runs in the same
-  process as the activity, to demonstrate using the
+  Context.stopService}, or bind and call it with
   {@link android.content.Context#bindService Context.bindService} and
-  {@link android.content.Context#unbindService Context.unindService}
-  methods with a service.  This also shows how you can simplify working
+  {@link android.content.Context#unbindService Context.unindService}.
+  This also shows how you can simplify working
   with a service when you know it will only run in your own process.</dd>
-
-  <dt><a href="RemoteServiceController.html">Remote Service Controller</a></dt>
+  
+  <dt><a href="RemoteService.html">Remote Service Controller and
+        Remove Service Binding</a></dt>
   <dd>Demonstrates starting a service in a separate process, by assigning
   <code>android:process=&quot;:remote&quot;</code> to the service in the
-  AndroidManifest.xml file. </dd>
-
-  <dt><a href="RemoteServiceBinding.html">Remote Service Binding</a></dt>
-  <dd>Demonstrates binding to a remote service, similar to the Local Service
-  Binding sample, but illustrating the additional work (defining aidl
+  AndroidManifest.xml file.  Shows how those clients can either start/stop it
+  with {@link android.content.Context#startService
+  Context.startService} and {@link android.content.Context#stopService
+  Context.stopService}, or bind and call it with
+  {@link android.content.Context#bindService Context.bindService} and
+  {@link android.content.Context#unbindService Context.unindService}.
+  Binding is similar to the local service sample,
+  but illustrates the additional work (defining aidl
   interfaces) needed to interact with a service in another process.  Also
   shows how a service can publish multiple interfaces and implement
   callbacks to its clients.</dd>
 
-  <dt><a href="ServiceStartArgumentsController.html">Service Start Arguments Controller</a></dt>
+  <dt><a href="ServiceStartArguments.html">Service Start Arguments Controller</a></dt>
   <dd>Demonstrates how you can use a Service as a job queue, where you 
   submit jobs to it with {@link android.content.Context#startService
   Context.startService} instead of binding to the service.  Such a service
   automatically stops itself once all jobs have been processed.  This can be
   a very convenient way to interact with a service when you do not need
-  a result back from it.
-  <dl>
-  <dt>Code:
-  <dd> <a href="ServiceStartArgumentsController.html">ServiceStartArgumentsController.java</a>
-  <dd> <a href="ServiceStartArguments.html">ServiceStartArguments.java</a>
-  <dt>Layout:
-  <dd> <a href="../../../../../../res/layout/service_start_arguments_controller.html">
-  service_start_arguments_controller.xml</a>
-  </dl>
-  </dd>
+  a result back from it.</dd>
   
-  <dt><a href="ForegroundServiceController.html">Foreground Service Controller</a></dt>
-  <dd>Controls the service class 
-  <a href="ForegroundService.html">ForegroundService</a>, which shows how you
+  <dt><a href="ForegroundService.html">Foreground Service Controller</a></dt>
+  <dd>Shows how you
   can write a Service that runs in the foreground and works on both pre-2.0
   and post-2.0 versions of the platform.  This example will selectively use
   the new foreground APIs that were introduced in Android 2.0 if they are
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/CameraPreview.java b/samples/ApiDemos/src/com/example/android/apis/graphics/CameraPreview.java
index e3cf976..171c885 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/CameraPreview.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/CameraPreview.java
@@ -19,24 +19,27 @@
 import android.app.Activity;
 import android.content.Context;
 import android.hardware.Camera;
+import android.hardware.Camera.Size;
 import android.os.Bundle;
 import android.view.SurfaceHolder;
 import android.view.SurfaceView;
 import android.view.Window;
+
 import java.io.IOException;
+import java.util.List;
 
 // ----------------------------------------------------------------------
 
-public class CameraPreview extends Activity {    
+public class CameraPreview extends Activity {
     private Preview mPreview;
-    
+
     @Override
 	protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        
+
         // Hide the window title.
         requestWindowFeature(Window.FEATURE_NO_TITLE);
-    
+
         // Create our Preview view and set it as the content of our activity.
         mPreview = new Preview(this);
         setContentView(mPreview);
@@ -49,10 +52,10 @@
 class Preview extends SurfaceView implements SurfaceHolder.Callback {
     SurfaceHolder mHolder;
     Camera mCamera;
-    
+
     Preview(Context context) {
         super(context);
-        
+
         // Install a SurfaceHolder.Callback so we get notified when the
         // underlying surface is created and destroyed.
         mHolder = getHolder();
@@ -82,11 +85,49 @@
         mCamera = null;
     }
 
+
+    private Size getOptimalPreviewSize(List<Size> sizes, int w, int h) {
+        final double ASPECT_TOLERANCE = 0.05;
+        double targetRatio = (double) w / h;
+        if (sizes == null) return null;
+
+        Size optimalSize = null;
+        double minDiff = Double.MAX_VALUE;
+
+        int targetHeight = h;
+
+        // Try to find an size match aspect ratio and size
+        for (Size size : sizes) {
+            double ratio = (double) size.width / size.height;
+            if (Math.abs(ratio - targetRatio) > ASPECT_TOLERANCE) continue;
+            if (Math.abs(size.height - targetHeight) < minDiff) {
+                optimalSize = size;
+                minDiff = Math.abs(size.height - targetHeight);
+            }
+        }
+
+        // Cannot find the one match the aspect ratio, ignore the requirement
+        if (optimalSize == null) {
+            minDiff = Double.MAX_VALUE;
+            for (Size size : sizes) {
+                if (Math.abs(size.height - targetHeight) < minDiff) {
+                    optimalSize = size;
+                    minDiff = Math.abs(size.height - targetHeight);
+                }
+            }
+        }
+        return optimalSize;
+    }
+
     public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
         // Now that the size is known, set up the camera parameters and begin
         // the preview.
         Camera.Parameters parameters = mCamera.getParameters();
-        parameters.setPreviewSize(w, h);
+
+        List<Size> sizes = parameters.getSupportedPreviewSizes();
+        Size optimalSize = getOptimalPreviewSize(sizes, w, h);
+        parameters.setPreviewSize(optimalSize.width, optimalSize.height);
+
         mCamera.setParameters(parameters);
         mCamera.startPreview();
     }
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/CompressedTextureActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/CompressedTextureActivity.java
new file mode 100644
index 0000000..f3b5478
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/CompressedTextureActivity.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2008 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.apis.graphics;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.Buffer;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+
+import javax.microedition.khronos.opengles.GL10;
+
+import android.app.Activity;
+import android.opengl.ETC1Util;
+import android.opengl.GLES10;
+import android.opengl.GLSurfaceView;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.example.android.apis.R;
+
+/**
+ * Demonstrate how to use ETC1 format compressed textures.
+ * This sample can be recompiled to use either resource-based
+ * textures (compressed offline using the etc1tool), or
+ * textures created on the fly by compressing images.
+ *
+ */
+public class CompressedTextureActivity extends Activity {
+    private final static String TAG = "CompressedTextureActivity";
+    /**
+     * Choose between creating a compressed texture on the fly or
+     * loading a compressed texture from a resource.
+     */
+    private final static boolean TEST_CREATE_TEXTURE = false;
+    /**
+     * When creating a compressed texture on the fly, choose
+     * whether or not to use the i/o stream APIs.
+     */
+    private final static boolean USE_STREAM_IO = false;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mGLView = new GLSurfaceView(this);
+        mGLView.setEGLConfigChooser(false);
+        StaticTriangleRenderer.TextureLoader loader;
+        if (TEST_CREATE_TEXTURE) {
+            loader = new SyntheticCompressedTextureLoader();
+        } else {
+            loader = new CompressedTextureLoader();
+        }
+        mGLView.setRenderer(new StaticTriangleRenderer(this, loader));
+        setContentView(mGLView);
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        mGLView.onPause();
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        mGLView.onResume();
+    }
+
+    /**
+     * Demonstrate how to load a compressed texture from an APK resource.
+     *
+     */
+    private class CompressedTextureLoader implements StaticTriangleRenderer.TextureLoader {
+        public void load(GL10 gl) {
+            Log.w(TAG, "ETC1 texture support: " + ETC1Util.isETC1Supported());
+            InputStream input = getResources().openRawResource(R.raw.androids);
+            try {
+                ETC1Util.loadTexture(GLES10.GL_TEXTURE_2D, 0, 0,
+                        GLES10.GL_RGB, GLES10.GL_UNSIGNED_SHORT_5_6_5, input);
+            } catch (IOException e) {
+                Log.w(TAG, "Could not load texture: " + e);
+            } finally {
+                try {
+                    input.close();
+                } catch (IOException e) {
+                    // ignore exception thrown from close.
+                }
+            }
+        }
+    }
+
+    /**
+     * Demonstrate how to create a compressed texture on the fly.
+     */
+    private class SyntheticCompressedTextureLoader implements StaticTriangleRenderer.TextureLoader {
+        public void load(GL10 gl) {
+            int width = 128;
+            int height = 128;
+            Buffer image = createImage(width, height);
+            ETC1Util.ETC1Texture etc1Texture = ETC1Util.compressTexture(image, width, height, 3, 3 * width);
+            if (USE_STREAM_IO) {
+                // Test the ETC1Util APIs for reading and writing compressed textures to I/O streams.
+                try {
+                    ByteArrayOutputStream bos = new ByteArrayOutputStream();
+                    ETC1Util.writeTexture(etc1Texture, bos);
+                    ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+                    ETC1Util.loadTexture(GLES10.GL_TEXTURE_2D, 0, 0,
+                            GLES10.GL_RGB, GLES10.GL_UNSIGNED_SHORT_5_6_5, bis);
+                } catch (IOException e) {
+                    Log.w(TAG, "Could not load texture: " + e);
+                }
+            } else {
+                ETC1Util.loadTexture(GLES10.GL_TEXTURE_2D, 0, 0,
+                        GLES10.GL_RGB, GLES10.GL_UNSIGNED_SHORT_5_6_5, etc1Texture);
+            }
+        }
+
+        private Buffer createImage(int width, int height) {
+            int stride = 3 * width;
+            ByteBuffer image = ByteBuffer.allocateDirect(height * stride)
+                .order(ByteOrder.nativeOrder());
+
+            // Fill with a pretty "munching squares" pattern:
+            for (int t = 0; t < height; t++) {
+                byte red = (byte)(255-2*t);
+                byte green = (byte)(2*t);
+                byte blue = 0;
+                for (int x = 0; x < width; x++) {
+                    int y = x ^ t;
+                    image.position(stride*y+x*3);
+                    image.put(red);
+                    image.put(green);
+                    image.put(blue);
+                }
+            }
+            image.position(0);
+            return image;
+        }
+    }
+    private GLSurfaceView mGLView;
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/CubeMapActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/CubeMapActivity.java
new file mode 100644
index 0000000..5e3e0fd
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/CubeMapActivity.java
@@ -0,0 +1,416 @@
+/*
+ * Copyright (C) 2007 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.apis.graphics;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.FloatBuffer;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL;
+import javax.microedition.khronos.opengles.GL10;
+import javax.microedition.khronos.opengles.GL11;
+import javax.microedition.khronos.opengles.GL11Ext;
+import javax.microedition.khronos.opengles.GL11ExtensionPack;
+
+import android.app.Activity;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.opengl.GLSurfaceView;
+import android.opengl.GLU;
+import android.opengl.GLUtils;
+import android.os.Bundle;
+import android.util.Log;
+
+import com.example.android.apis.R;
+
+/**
+ * Demonstrate how to use the OES_texture_cube_map extension, available on some
+ * high-end OpenGL ES 1.x GPUs.
+ */
+public class CubeMapActivity extends Activity {
+    private GLSurfaceView mGLSurfaceView;
+    private class Renderer implements GLSurfaceView.Renderer {
+        private boolean mContextSupportsCubeMap;
+        private Grid mGrid;
+        private int mCubeMapTextureID;
+        private boolean mUseTexGen = false;
+        private float mAngle;
+
+        public void onDrawFrame(GL10 gl) {
+            checkGLError(gl);
+            if (mContextSupportsCubeMap) {
+                gl.glClearColor(0,0,1,0);
+            } else {
+                // Current context doesn't support cube maps.
+                // Indicate this by drawing a red background.
+                gl.glClearColor(1,0,0,0);
+            }
+            gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
+            gl.glEnable(GL10.GL_DEPTH_TEST);
+            gl.glMatrixMode(GL10.GL_MODELVIEW);
+            gl.glLoadIdentity();
+
+            GLU.gluLookAt(gl, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
+            gl.glRotatef(mAngle,        0, 1, 0);
+            gl.glRotatef(mAngle*0.25f,  1, 0, 0);
+
+            gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
+
+            checkGLError(gl);
+
+            if (mContextSupportsCubeMap) {
+                gl.glActiveTexture(GL10.GL_TEXTURE0);
+                checkGLError(gl);
+                gl.glEnable(GL11ExtensionPack.GL_TEXTURE_CUBE_MAP);
+                checkGLError(gl);
+                gl.glBindTexture(GL11ExtensionPack.GL_TEXTURE_CUBE_MAP, mCubeMapTextureID);
+                checkGLError(gl);
+                GL11ExtensionPack gl11ep = (GL11ExtensionPack) gl;
+                gl11ep.glTexGeni(GL11ExtensionPack.GL_TEXTURE_GEN_STR,
+                        GL11ExtensionPack.GL_TEXTURE_GEN_MODE,
+                        GL11ExtensionPack.GL_REFLECTION_MAP);
+                checkGLError(gl);
+                gl.glEnable(GL11ExtensionPack.GL_TEXTURE_GEN_STR);
+                checkGLError(gl);
+                gl.glTexEnvx(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_DECAL);
+            }
+
+            checkGLError(gl);
+            mGrid.draw(gl);
+
+            if (mContextSupportsCubeMap) {
+                gl.glDisable(GL11ExtensionPack.GL_TEXTURE_GEN_STR);
+            }
+            checkGLError(gl);
+
+            mAngle += 1.2f;
+        }
+
+        public void onSurfaceChanged(GL10 gl, int width, int height) {
+            checkGLError(gl);
+            gl.glViewport(0, 0, width, height);
+            float ratio = (float) width / height;
+            gl.glMatrixMode(GL10.GL_PROJECTION);
+            gl.glLoadIdentity();
+            gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
+            checkGLError(gl);
+        }
+
+        public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+            checkGLError(gl);
+            // This test needs to be done each time a context is created,
+            // because different contexts may support different extensions.
+            mContextSupportsCubeMap = checkIfContextSupportsCubeMap(gl);
+
+            mGrid = generateTorusGrid(gl, 60, 60, 3.0f, 0.75f);
+
+            if (mContextSupportsCubeMap) {
+                int[] cubeMapResourceIds = new int[]{
+                        R.raw.skycubemap0, R.raw.skycubemap1, R.raw.skycubemap2,
+                        R.raw.skycubemap3, R.raw.skycubemap4, R.raw.skycubemap5};
+                mCubeMapTextureID = generateCubeMap(gl, cubeMapResourceIds);
+            }
+            checkGLError(gl);
+        }
+
+        private int generateCubeMap(GL10 gl, int[] resourceIds) {
+            checkGLError(gl);
+            int[] ids = new int[1];
+            gl.glGenTextures(1, ids, 0);
+            int cubeMapTextureId = ids[0];
+            gl.glBindTexture(GL11ExtensionPack.GL_TEXTURE_CUBE_MAP, cubeMapTextureId);
+            gl.glTexParameterf(GL11ExtensionPack.GL_TEXTURE_CUBE_MAP,
+                    GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
+            gl.glTexParameterf(GL11ExtensionPack.GL_TEXTURE_CUBE_MAP,
+                    GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
+
+            for (int face = 0; face < 6; face++) {
+                InputStream is = getResources().openRawResource(resourceIds[face]);
+                Bitmap bitmap;
+                try {
+                    bitmap = BitmapFactory.decodeStream(is);
+                } finally {
+                    try {
+                        is.close();
+                    } catch(IOException e) {
+                        Log.e("CubeMap", "Could not decode texture for face " + Integer.toString(face));
+                    }
+                }
+                GLUtils.texImage2D(GL11ExtensionPack.GL_TEXTURE_CUBE_MAP_POSITIVE_X + face, 0,
+                        bitmap, 0);
+                bitmap.recycle();
+            }
+            checkGLError(gl);
+            return cubeMapTextureId;
+        }
+
+        private Grid generateTorusGrid(GL gl, int uSteps, int vSteps, float majorRadius, float minorRadius) {
+            Grid grid = new Grid(uSteps + 1, vSteps + 1);
+            for (int j = 0; j <= vSteps; j++) {
+                double angleV = Math.PI * 2 * j / vSteps;
+                float cosV = (float) Math.cos(angleV);
+                float sinV = (float) Math.sin(angleV);
+                for (int i = 0; i <= uSteps; i++) {
+                    double angleU = Math.PI * 2 * i / uSteps;
+                    float cosU = (float) Math.cos(angleU);
+                    float sinU = (float) Math.sin(angleU);
+                    float d = majorRadius+minorRadius*cosU;
+                    float x = d*cosV;
+                    float y = d*(-sinV);
+                    float z = minorRadius * sinU;
+
+                    float nx = cosV * cosU;
+                    float ny = -sinV * cosU;
+                    float nz = sinU;
+
+                    float length = (float) Math.sqrt(nx*nx + ny*ny + nz*nz);
+                    nx /= length;
+                    ny /= length;
+                    nz /= length;
+
+                    grid.set(i, j, x, y, z, nx, ny, nz);
+                }
+            }
+            grid.createBufferObjects(gl);
+            return grid;
+        }
+
+        private boolean checkIfContextSupportsCubeMap(GL10 gl) {
+            return checkIfContextSupportsExtension(gl, "GL_OES_texture_cube_map");
+        }
+
+        /**
+         * This is not the fastest way to check for an extension, but fine if
+         * we are only checking for a few extensions each time a context is created.
+         * @param gl
+         * @param extension
+         * @return true if the extension is present in the current context.
+         */
+        private boolean checkIfContextSupportsExtension(GL10 gl, String extension) {
+            String extensions = " " + gl.glGetString(GL10.GL_EXTENSIONS) + " ";
+            // The extensions string is padded with spaces between extensions, but not
+            // necessarily at the beginning or end. For simplicity, add spaces at the
+            // beginning and end of the extensions string and the extension string.
+            // This means we can avoid special-case checks for the first or last
+            // extension, as well as avoid special-case checks when an extension name
+            // is the same as the first part of another extension name.
+            return extensions.indexOf(" " + extension + " ") >= 0;
+        }
+    }
+
+    /** A grid is a topologically rectangular array of vertices.
+     *
+     * This grid class is customized for the vertex data required for this
+     * example.
+     *
+     * The vertex and index data are held in VBO objects because on most
+     * GPUs VBO objects are the fastest way of rendering static vertex
+     * and index data.
+     *
+     */
+
+    private static class Grid {
+        // Size of vertex data elements in bytes:
+        final static int FLOAT_SIZE = 4;
+        final static int CHAR_SIZE = 2;
+
+        // Vertex structure:
+        // float x, y, z;
+        // float nx, ny, nx;
+
+        final static int VERTEX_SIZE = 6 * FLOAT_SIZE;
+        final static int VERTEX_NORMAL_BUFFER_INDEX_OFFSET = 3;
+
+        private int mVertexBufferObjectId;
+        private int mElementBufferObjectId;
+
+        // These buffers are used to hold the vertex and index data while
+        // constructing the grid. Once createBufferObjects() is called
+        // the buffers are nulled out to save memory.
+
+        private ByteBuffer mVertexByteBuffer;
+        private FloatBuffer mVertexBuffer;
+        private CharBuffer mIndexBuffer;
+
+        private int mW;
+        private int mH;
+        private int mIndexCount;
+
+        public Grid(int w, int h) {
+            if (w < 0 || w >= 65536) {
+                throw new IllegalArgumentException("w");
+            }
+            if (h < 0 || h >= 65536) {
+                throw new IllegalArgumentException("h");
+            }
+            if (w * h >= 65536) {
+                throw new IllegalArgumentException("w * h >= 65536");
+            }
+
+            mW = w;
+            mH = h;
+            int size = w * h;
+
+            mVertexByteBuffer = ByteBuffer.allocateDirect(VERTEX_SIZE * size)
+            .order(ByteOrder.nativeOrder());
+            mVertexBuffer = mVertexByteBuffer.asFloatBuffer();
+
+            int quadW = mW - 1;
+            int quadH = mH - 1;
+            int quadCount = quadW * quadH;
+            int indexCount = quadCount * 6;
+            mIndexCount = indexCount;
+            mIndexBuffer = ByteBuffer.allocateDirect(CHAR_SIZE * indexCount)
+            .order(ByteOrder.nativeOrder()).asCharBuffer();
+
+            /*
+             * Initialize triangle list mesh.
+             *
+             *     [0]-----[  1] ...
+             *      |    /   |
+             *      |   /    |
+             *      |  /     |
+             *     [w]-----[w+1] ...
+             *      |       |
+             *
+             */
+
+            {
+                int i = 0;
+                for (int y = 0; y < quadH; y++) {
+                    for (int x = 0; x < quadW; x++) {
+                        char a = (char) (y * mW + x);
+                        char b = (char) (y * mW + x + 1);
+                        char c = (char) ((y + 1) * mW + x);
+                        char d = (char) ((y + 1) * mW + x + 1);
+
+                        mIndexBuffer.put(i++, a);
+                        mIndexBuffer.put(i++, c);
+                        mIndexBuffer.put(i++, b);
+
+                        mIndexBuffer.put(i++, b);
+                        mIndexBuffer.put(i++, c);
+                        mIndexBuffer.put(i++, d);
+                    }
+                }
+            }
+        }
+
+        public void set(int i, int j, float x, float y, float z, float nx, float ny, float nz) {
+            if (i < 0 || i >= mW) {
+                throw new IllegalArgumentException("i");
+            }
+            if (j < 0 || j >= mH) {
+                throw new IllegalArgumentException("j");
+            }
+
+            int index = mW * j + i;
+
+            mVertexBuffer.position(index * VERTEX_SIZE / FLOAT_SIZE);
+            mVertexBuffer.put(x);
+            mVertexBuffer.put(y);
+            mVertexBuffer.put(z);
+            mVertexBuffer.put(nx);
+            mVertexBuffer.put(ny);
+            mVertexBuffer.put(nz);
+        }
+
+        public void createBufferObjects(GL gl) {
+            checkGLError(gl);
+            // Generate a the vertex and element buffer IDs
+            int[] vboIds = new int[2];
+            GL11 gl11 = (GL11) gl;
+            gl11.glGenBuffers(2, vboIds, 0);
+            mVertexBufferObjectId = vboIds[0];
+            mElementBufferObjectId = vboIds[1];
+
+            // Upload the vertex data
+            gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertexBufferObjectId);
+            mVertexByteBuffer.position(0);
+            gl11.glBufferData(GL11.GL_ARRAY_BUFFER, mVertexByteBuffer.capacity(), mVertexByteBuffer, GL11.GL_STATIC_DRAW);
+
+            gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mElementBufferObjectId);
+            mIndexBuffer.position(0);
+            gl11.glBufferData(GL11.GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer.capacity() * CHAR_SIZE, mIndexBuffer, GL11.GL_STATIC_DRAW);
+
+            // We don't need the in-memory data any more
+            mVertexBuffer = null;
+            mVertexByteBuffer = null;
+            mIndexBuffer = null;
+            checkGLError(gl);
+        }
+
+        public void draw(GL10 gl) {
+            checkGLError(gl);
+            GL11 gl11 = (GL11) gl;
+
+            gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
+
+            gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertexBufferObjectId);
+            gl11.glVertexPointer(3, GL10.GL_FLOAT, VERTEX_SIZE, 0);
+
+            gl.glEnableClientState(GL10.GL_NORMAL_ARRAY);
+            gl11.glNormalPointer(GL10.GL_FLOAT, VERTEX_SIZE, VERTEX_NORMAL_BUFFER_INDEX_OFFSET * FLOAT_SIZE);
+
+            gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mElementBufferObjectId);
+            gl11.glDrawElements(GL10.GL_TRIANGLES, mIndexCount, GL10.GL_UNSIGNED_SHORT, 0);
+            gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
+            gl.glDisableClientState(GL10.GL_NORMAL_ARRAY);
+            gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
+            gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0);
+            checkGLError(gl);
+        }
+    }
+
+    static void checkGLError(GL gl) {
+        int error = ((GL10) gl).glGetError();
+        if (error != GL10.GL_NO_ERROR) {
+            throw new RuntimeException("GLError 0x" + Integer.toHexString(error));
+        }
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // Create our surface view and set it as the content of our
+        // Activity
+        mGLSurfaceView = new GLSurfaceView(this);
+        mGLSurfaceView.setRenderer(new Renderer());
+        setContentView(mGLSurfaceView);
+    }
+
+    @Override
+    protected void onResume() {
+        // Ideally a game should implement onResume() and onPause()
+        // to take appropriate action when the activity looses focus
+        super.onResume();
+        mGLSurfaceView.onResume();
+    }
+
+    @Override
+    protected void onPause() {
+        // Ideally a game should implement onResume() and onPause()
+        // to take appropriate action when the activity looses focus
+        super.onPause();
+        mGLSurfaceView.onPause();
+    }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/DensityActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/DensityActivity.java
index 10c42a7..8c5c93a 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/DensityActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/DensityActivity.java
@@ -21,7 +21,6 @@
 import com.example.android.apis.R;
 
 import android.app.Activity;
-import android.app.Application;
 import android.os.Bundle;
 import android.graphics.BitmapFactory;
 import android.graphics.Bitmap;
@@ -34,8 +33,6 @@
 import android.view.LayoutInflater;
 import android.view.View;
 import android.content.Context;
-import android.content.pm.ApplicationInfo;
-import android.content.pm.PackageManager;
 import android.util.DisplayMetrics;
 import android.util.Log;
 
@@ -117,20 +114,20 @@
 
     private View scrollWrap(View view) {
         ScrollView scroller = new ScrollView(this);
-        scroller.addView(view, new ScrollView.LayoutParams(ScrollView.LayoutParams.FILL_PARENT,
-                ScrollView.LayoutParams.FILL_PARENT));
+        scroller.addView(view, new ScrollView.LayoutParams(ScrollView.LayoutParams.MATCH_PARENT,
+                ScrollView.LayoutParams.MATCH_PARENT));
         return scroller;
     }
 
     private void addLabelToRoot(LinearLayout root, String text) {
         TextView label = new TextView(this);
         label.setText(text);
-        root.addView(label, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
+        root.addView(label, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                 LinearLayout.LayoutParams.WRAP_CONTENT));
     }
 
     private void addChildToRoot(LinearLayout root, LinearLayout layout) {
-        root.addView(layout, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT,
+        root.addView(layout, new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT,
                 LinearLayout.LayoutParams.WRAP_CONTENT));
     }
 
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java
new file mode 100644
index 0000000..e3d4a28
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/FrameBufferObjectActivity.java
@@ -0,0 +1,282 @@
+/*
+ * Copyright (C) 2007 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.apis.graphics;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL;
+import javax.microedition.khronos.opengles.GL10;
+import javax.microedition.khronos.opengles.GL11ExtensionPack;
+
+import android.app.Activity;
+import android.opengl.GLSurfaceView;
+import android.opengl.GLU;
+import android.os.Bundle;
+import android.os.SystemClock;
+
+/**
+ * Demonstrate the Frame Buffer Object OpenGL ES extension.
+ * <p>
+ * This sample renders a scene into an offscreen frame buffer, and then
+ * uses the resulting image as a texture to render an onscreen scene.
+ */
+public class FrameBufferObjectActivity extends Activity {
+    private GLSurfaceView mGLSurfaceView;
+
+    private class Renderer implements GLSurfaceView.Renderer {
+        private boolean mContextSupportsFrameBufferObject;
+        private int mTargetTexture;
+        private int mFramebuffer;
+        private int mFramebufferWidth = 256;
+        private int mFramebufferHeight = 256;
+        private int mSurfaceWidth;
+        private int mSurfaceHeight;
+
+        private Triangle mTriangle;
+        private Cube mCube;
+        private float mAngle;
+        /**
+         * Setting this to true will change the behavior  of this sample. It
+         * will suppress the normally onscreen rendering, and it will cause the
+         * rendering that would normally be done to the offscreen FBO
+         * be rendered onscreen instead. This can be helpful in debugging the
+         * rendering algorithm.
+         */
+        private static final boolean DEBUG_RENDER_OFFSCREEN_ONSCREEN = false;
+
+        public void onDrawFrame(GL10 gl) {
+            checkGLError(gl);
+            if (mContextSupportsFrameBufferObject) {
+                GL11ExtensionPack gl11ep = (GL11ExtensionPack) gl;
+                if (DEBUG_RENDER_OFFSCREEN_ONSCREEN) {
+                    drawOffscreenImage(gl, mSurfaceWidth, mSurfaceHeight);
+                } else {
+                    gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, mFramebuffer);
+                    drawOffscreenImage(gl, mFramebufferWidth, mFramebufferHeight);
+                    gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, 0);
+                    drawOnscreen(gl, mSurfaceWidth, mSurfaceHeight);
+                }
+            } else {
+                // Current context doesn't support frame buffer objects.
+                // Indicate this by drawing a red background.
+                gl.glClearColor(1,0,0,0);
+                gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
+            }
+        }
+
+        public void onSurfaceChanged(GL10 gl, int width, int height) {
+            checkGLError(gl);
+            mSurfaceWidth = width;
+            mSurfaceHeight = height;
+            gl.glViewport(0, 0, width, height);
+        }
+
+        public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+            mContextSupportsFrameBufferObject = checkIfContextSupportsFrameBufferObject(gl);
+            if (mContextSupportsFrameBufferObject) {
+                mTargetTexture = createTargetTexture(gl, mFramebufferWidth, mFramebufferHeight);
+                mFramebuffer = createFrameBuffer(gl, mFramebufferWidth, mFramebufferHeight, mTargetTexture);
+
+                mCube = new Cube();
+                mTriangle = new Triangle();
+            }
+        }
+
+        private void drawOnscreen(GL10 gl, int width, int height) {
+            gl.glViewport(0, 0, width, height);
+            float ratio = (float) width / height;
+            gl.glMatrixMode(GL10.GL_PROJECTION);
+            gl.glLoadIdentity();
+            gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7);
+
+            gl.glClearColor(0,0,1,0);
+            gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
+            gl.glBindTexture(GL10.GL_TEXTURE_2D, mTargetTexture);
+
+            gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
+                    GL10.GL_REPLACE);
+
+            gl.glMatrixMode(GL10.GL_MODELVIEW);
+            gl.glLoadIdentity();
+
+            GLU.gluLookAt(gl, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
+
+            gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
+            gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
+
+            gl.glActiveTexture(GL10.GL_TEXTURE0);
+
+            long time = SystemClock.uptimeMillis() % 4000L;
+            float angle = 0.090f * ((int) time);
+
+            gl.glRotatef(angle, 0, 0, 1.0f);
+
+            mTriangle.draw(gl);
+
+            // Restore default state so the other renderer is not affected.
+
+            gl.glBindTexture(GL10.GL_TEXTURE_2D, 0);
+            gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
+            gl.glDisableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
+        }
+
+        private void drawOffscreenImage(GL10 gl, int width, int height) {
+            gl.glViewport(0, 0, width, height);
+            float ratio = (float) width / height;
+            gl.glMatrixMode(GL10.GL_PROJECTION);
+            gl.glLoadIdentity();
+            gl.glFrustumf(-ratio, ratio, -1, 1, 1, 10);
+
+            gl.glEnable(GL10.GL_CULL_FACE);
+            gl.glEnable(GL10.GL_DEPTH_TEST);
+
+            gl.glClearColor(0,0.5f,1,0);
+            gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
+            gl.glMatrixMode(GL10.GL_MODELVIEW);
+            gl.glLoadIdentity();
+            gl.glTranslatef(0, 0, -3.0f);
+            gl.glRotatef(mAngle,        0, 1, 0);
+            gl.glRotatef(mAngle*0.25f,  1, 0, 0);
+
+            gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
+            gl.glEnableClientState(GL10.GL_COLOR_ARRAY);
+
+            mCube.draw(gl);
+
+            gl.glRotatef(mAngle*2.0f, 0, 1, 1);
+            gl.glTranslatef(0.5f, 0.5f, 0.5f);
+
+            mCube.draw(gl);
+
+            mAngle += 1.2f;
+
+            // Restore default state so the other renderer is not affected.
+
+            gl.glDisable(GL10.GL_CULL_FACE);
+            gl.glDisable(GL10.GL_DEPTH_TEST);
+            gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
+            gl.glDisableClientState(GL10.GL_COLOR_ARRAY);
+        }
+
+        private int createTargetTexture(GL10 gl, int width, int height) {
+            int texture;
+            int[] textures = new int[1];
+            gl.glGenTextures(1, textures, 0);
+            texture = textures[0];
+            gl.glBindTexture(GL10.GL_TEXTURE_2D, texture);
+            gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, width, height, 0,
+                    GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, null);
+            gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,
+                    GL10.GL_NEAREST);
+            gl.glTexParameterf(GL10.GL_TEXTURE_2D,
+                    GL10.GL_TEXTURE_MAG_FILTER,
+                    GL10.GL_LINEAR);
+            gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
+                    GL10.GL_REPEAT);
+            gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
+                    GL10.GL_REPEAT);
+;            return texture;
+        }
+
+        private int createFrameBuffer(GL10 gl, int width, int height, int targetTextureId) {
+            GL11ExtensionPack gl11ep = (GL11ExtensionPack) gl;
+            int framebuffer;
+            int[] framebuffers = new int[1];
+            gl11ep.glGenFramebuffersOES(1, framebuffers, 0);
+            framebuffer = framebuffers[0];
+            gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, framebuffer);
+
+            int depthbuffer;
+            int[] renderbuffers = new int[1];
+            gl11ep.glGenRenderbuffersOES(1, renderbuffers, 0);
+            depthbuffer = renderbuffers[0];
+
+            gl11ep.glBindRenderbufferOES(GL11ExtensionPack.GL_RENDERBUFFER_OES, depthbuffer);
+            gl11ep.glRenderbufferStorageOES(GL11ExtensionPack.GL_RENDERBUFFER_OES,
+                    GL11ExtensionPack.GL_DEPTH_COMPONENT16, width, height);
+            gl11ep.glFramebufferRenderbufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES,
+                    GL11ExtensionPack.GL_DEPTH_ATTACHMENT_OES,
+                    GL11ExtensionPack.GL_RENDERBUFFER_OES, depthbuffer);
+
+            gl11ep.glFramebufferTexture2DOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES,
+                    GL11ExtensionPack.GL_COLOR_ATTACHMENT0_OES, GL10.GL_TEXTURE_2D,
+                    targetTextureId, 0);
+            int status = gl11ep.glCheckFramebufferStatusOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES);
+            if (status != GL11ExtensionPack.GL_FRAMEBUFFER_COMPLETE_OES) {
+                throw new RuntimeException("Framebuffer is not complete: " +
+                        Integer.toHexString(status));
+            }
+            gl11ep.glBindFramebufferOES(GL11ExtensionPack.GL_FRAMEBUFFER_OES, 0);
+            return framebuffer;
+        }
+
+        private boolean checkIfContextSupportsFrameBufferObject(GL10 gl) {
+            return checkIfContextSupportsExtension(gl, "GL_OES_framebuffer_object");
+        }
+
+        /**
+         * This is not the fastest way to check for an extension, but fine if
+         * we are only checking for a few extensions each time a context is created.
+         * @param gl
+         * @param extension
+         * @return true if the extension is present in the current context.
+         */
+        private boolean checkIfContextSupportsExtension(GL10 gl, String extension) {
+            String extensions = " " + gl.glGetString(GL10.GL_EXTENSIONS) + " ";
+            // The extensions string is padded with spaces between extensions, but not
+            // necessarily at the beginning or end. For simplicity, add spaces at the
+            // beginning and end of the extensions string and the extension string.
+            // This means we can avoid special-case checks for the first or last
+            // extension, as well as avoid special-case checks when an extension name
+            // is the same as the first part of another extension name.
+            return extensions.indexOf(" " + extension + " ") >= 0;
+        }
+    }
+
+    static void checkGLError(GL gl) {
+        int error = ((GL10) gl).glGetError();
+        if (error != GL10.GL_NO_ERROR) {
+            throw new RuntimeException("GLError 0x" + Integer.toHexString(error));
+        }
+    }
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // Create our surface view and set it as the content of our
+        // Activity
+        mGLSurfaceView = new GLSurfaceView(this);
+        mGLSurfaceView.setRenderer(new Renderer());
+        setContentView(mGLSurfaceView);
+    }
+
+    @Override
+    protected void onResume() {
+        // Ideally a game should implement onResume() and onPause()
+        // to take appropriate action when the activity looses focus
+        super.onResume();
+        mGLSurfaceView.onResume();
+    }
+
+    @Override
+    protected void onPause() {
+        // Ideally a game should implement onResume() and onPause()
+        // to take appropriate action when the activity looses focus
+        super.onPause();
+        mGLSurfaceView.onPause();
+    }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/GLES20Activity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/GLES20Activity.java
new file mode 100644
index 0000000..f5573cf
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/GLES20Activity.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2009 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.apis.graphics;
+
+import android.app.Activity;
+import android.app.ActivityManager;
+import android.content.Context;
+import android.content.pm.ConfigurationInfo;
+import android.opengl.GLSurfaceView;
+import android.os.Bundle;
+
+/**
+ * This sample shows how to check for OpenGL ES 2.0 support at runtime, and then
+ * use either OpenGL ES 1.0 or OpenGL ES 2.0, as appropriate.
+ */
+public class GLES20Activity extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mGLSurfaceView = new GLSurfaceView(this);
+        if (detectOpenGLES20()) {
+            // Tell the surface view we want to create an OpenGL ES 2.0-compatible
+            // context, and set an OpenGL ES 2.0-compatible renderer.
+            mGLSurfaceView.setEGLContextClientVersion(2);
+            mGLSurfaceView.setRenderer(new GLES20TriangleRenderer(this));
+        } else {
+            // Set an OpenGL ES 1.x-compatible renderer. In a real application
+            // this renderer might approximate the same output as the 2.0 renderer.
+            mGLSurfaceView.setRenderer(new TriangleRenderer(this));
+        }
+        setContentView(mGLSurfaceView);
+    }
+
+    private boolean detectOpenGLES20() {
+        ActivityManager am =
+            (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE);
+        ConfigurationInfo info = am.getDeviceConfigurationInfo();
+        return (info.reqGlEsVersion >= 0x20000);
+    }
+
+    @Override
+    protected void onResume() {
+        // Ideally a game should implement onResume() and onPause()
+        // to take appropriate action when the activity looses focus
+        super.onResume();
+        mGLSurfaceView.onResume();
+    }
+
+    @Override
+    protected void onPause() {
+        // Ideally a game should implement onResume() and onPause()
+        // to take appropriate action when the activity looses focus
+        super.onPause();
+        mGLSurfaceView.onPause();
+    }
+
+    private GLSurfaceView mGLSurfaceView;
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/GLES20TriangleRenderer.java b/samples/ApiDemos/src/com/example/android/apis/graphics/GLES20TriangleRenderer.java
new file mode 100644
index 0000000..956eb68
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/GLES20TriangleRenderer.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright (C) 2009 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.apis.graphics;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.FloatBuffer;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL10;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.opengl.GLES20;
+import android.opengl.GLSurfaceView;
+import android.opengl.GLUtils;
+import android.opengl.Matrix;
+import android.os.SystemClock;
+import android.util.Log;
+
+import com.example.android.apis.R;
+
+class GLES20TriangleRenderer implements GLSurfaceView.Renderer {
+
+    public GLES20TriangleRenderer(Context context) {
+        mContext = context;
+        mTriangleVertices = ByteBuffer.allocateDirect(mTriangleVerticesData.length
+                * FLOAT_SIZE_BYTES).order(ByteOrder.nativeOrder()).asFloatBuffer();
+        mTriangleVertices.put(mTriangleVerticesData).position(0);
+    }
+
+    public void onDrawFrame(GL10 glUnused) {
+        // Ignore the passed-in GL10 interface, and use the GLES20
+        // class's static methods instead.
+        GLES20.glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
+        GLES20.glClear( GLES20.GL_DEPTH_BUFFER_BIT | GLES20.GL_COLOR_BUFFER_BIT);
+        GLES20.glUseProgram(mProgram);
+        checkGlError("glUseProgram");
+
+        GLES20.glActiveTexture(GLES20.GL_TEXTURE0);
+        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureID);
+
+        mTriangleVertices.position(TRIANGLE_VERTICES_DATA_POS_OFFSET);
+        GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT, false,
+                TRIANGLE_VERTICES_DATA_STRIDE_BYTES, mTriangleVertices);
+        checkGlError("glVertexAttribPointer maPosition");
+        mTriangleVertices.position(TRIANGLE_VERTICES_DATA_UV_OFFSET);
+        GLES20.glEnableVertexAttribArray(maPositionHandle);
+        checkGlError("glEnableVertexAttribArray maPositionHandle");
+        GLES20.glVertexAttribPointer(maTextureHandle, 2, GLES20.GL_FLOAT, false,
+                TRIANGLE_VERTICES_DATA_STRIDE_BYTES, mTriangleVertices);
+        checkGlError("glVertexAttribPointer maTextureHandle");
+        GLES20.glEnableVertexAttribArray(maTextureHandle);
+        checkGlError("glEnableVertexAttribArray maTextureHandle");
+
+        long time = SystemClock.uptimeMillis() % 4000L;
+        float angle = 0.090f * ((int) time);
+        Matrix.setRotateM(mMMatrix, 0, angle, 0, 0, 1.0f);
+        Matrix.multiplyMM(mMVPMatrix, 0, mVMatrix, 0, mMMatrix, 0);
+        Matrix.multiplyMM(mMVPMatrix, 0, mProjMatrix, 0, mMVPMatrix, 0);
+
+        GLES20.glUniformMatrix4fv(muMVPMatrixHandle, 1, false, mMVPMatrix, 0);
+        GLES20.glDrawArrays(GLES20.GL_TRIANGLES, 0, 3);
+        checkGlError("glDrawArrays");
+    }
+
+    public void onSurfaceChanged(GL10 glUnused, int width, int height) {
+        // Ignore the passed-in GL10 interface, and use the GLES20
+        // class's static methods instead.
+        GLES20.glViewport(0, 0, width, height);
+        float ratio = (float) width / height;
+        Matrix.frustumM(mProjMatrix, 0, -ratio, ratio, -1, 1, 3, 7);
+    }
+
+    public void onSurfaceCreated(GL10 glUnused, EGLConfig config) {
+        // Ignore the passed-in GL10 interface, and use the GLES20
+        // class's static methods instead.
+        mProgram = createProgram(mVertexShader, mFragmentShader);
+        if (mProgram == 0) {
+            return;
+        }
+        maPositionHandle = GLES20.glGetAttribLocation(mProgram, "aPosition");
+        checkGlError("glGetAttribLocation aPosition");
+        if (maPositionHandle == -1) {
+            throw new RuntimeException("Could not get attrib location for aPosition");
+        }
+        maTextureHandle = GLES20.glGetAttribLocation(mProgram, "aTextureCoord");
+        checkGlError("glGetAttribLocation aTextureCoord");
+        if (maTextureHandle == -1) {
+            throw new RuntimeException("Could not get attrib location for aTextureCoord");
+        }
+
+        muMVPMatrixHandle = GLES20.glGetUniformLocation(mProgram, "uMVPMatrix");
+        checkGlError("glGetUniformLocation uMVPMatrix");
+        if (muMVPMatrixHandle == -1) {
+            throw new RuntimeException("Could not get attrib location for uMVPMatrix");
+        }
+
+        /*
+         * Create our texture. This has to be done each time the
+         * surface is created.
+         */
+
+        int[] textures = new int[1];
+        GLES20.glGenTextures(1, textures, 0);
+
+        mTextureID = textures[0];
+        GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, mTextureID);
+
+        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_MIN_FILTER,
+                GLES20.GL_NEAREST);
+        GLES20.glTexParameterf(GLES20.GL_TEXTURE_2D,
+                GLES20.GL_TEXTURE_MAG_FILTER,
+                GLES20.GL_LINEAR);
+
+        GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_S,
+                GLES20.GL_REPEAT);
+        GLES20.glTexParameteri(GLES20.GL_TEXTURE_2D, GLES20.GL_TEXTURE_WRAP_T,
+                GLES20.GL_REPEAT);
+
+        InputStream is = mContext.getResources()
+            .openRawResource(R.raw.robot);
+        Bitmap bitmap;
+        try {
+            bitmap = BitmapFactory.decodeStream(is);
+        } finally {
+            try {
+                is.close();
+            } catch(IOException e) {
+                // Ignore.
+            }
+        }
+
+        GLUtils.texImage2D(GLES20.GL_TEXTURE_2D, 0, bitmap, 0);
+        bitmap.recycle();
+
+        Matrix.setLookAtM(mVMatrix, 0, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
+    }
+
+    private int loadShader(int shaderType, String source) {
+        int shader = GLES20.glCreateShader(shaderType);
+        if (shader != 0) {
+            GLES20.glShaderSource(shader, source);
+            GLES20.glCompileShader(shader);
+            int[] compiled = new int[1];
+            GLES20.glGetShaderiv(shader, GLES20.GL_COMPILE_STATUS, compiled, 0);
+            if (compiled[0] == 0) {
+                Log.e(TAG, "Could not compile shader " + shaderType + ":");
+                Log.e(TAG, GLES20.glGetShaderInfoLog(shader));
+                GLES20.glDeleteShader(shader);
+                shader = 0;
+            }
+        }
+        return shader;
+    }
+
+    private int createProgram(String vertexSource, String fragmentSource) {
+        int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource);
+        if (vertexShader == 0) {
+            return 0;
+        }
+
+        int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource);
+        if (pixelShader == 0) {
+            return 0;
+        }
+
+        int program = GLES20.glCreateProgram();
+        if (program != 0) {
+            GLES20.glAttachShader(program, vertexShader);
+            checkGlError("glAttachShader");
+            GLES20.glAttachShader(program, pixelShader);
+            checkGlError("glAttachShader");
+            GLES20.glLinkProgram(program);
+            int[] linkStatus = new int[1];
+            GLES20.glGetProgramiv(program, GLES20.GL_LINK_STATUS, linkStatus, 0);
+            if (linkStatus[0] != GLES20.GL_TRUE) {
+                Log.e(TAG, "Could not link program: ");
+                Log.e(TAG, GLES20.glGetProgramInfoLog(program));
+                GLES20.glDeleteProgram(program);
+                program = 0;
+            }
+        }
+        return program;
+    }
+
+    private void checkGlError(String op) {
+        int error;
+        while ((error = GLES20.glGetError()) != GLES20.GL_NO_ERROR) {
+            Log.e(TAG, op + ": glError " + error);
+            throw new RuntimeException(op + ": glError " + error);
+        }
+    }
+
+    private static final int FLOAT_SIZE_BYTES = 4;
+    private static final int TRIANGLE_VERTICES_DATA_STRIDE_BYTES = 5 * FLOAT_SIZE_BYTES;
+    private static final int TRIANGLE_VERTICES_DATA_POS_OFFSET = 0;
+    private static final int TRIANGLE_VERTICES_DATA_UV_OFFSET = 3;
+    private final float[] mTriangleVerticesData = {
+            // X, Y, Z, U, V
+            -1.0f, -0.5f, 0, -0.5f, 0.0f,
+            1.0f, -0.5f, 0, 1.5f, -0.0f,
+            0.0f,  1.11803399f, 0, 0.5f,  1.61803399f };
+
+    private FloatBuffer mTriangleVertices;
+
+    private final String mVertexShader =
+        "uniform mat4 uMVPMatrix;\n" +
+        "attribute vec4 aPosition;\n" +
+        "attribute vec2 aTextureCoord;\n" +
+        "varying vec2 vTextureCoord;\n" +
+        "void main() {\n" +
+        "  gl_Position = uMVPMatrix * aPosition;\n" +
+        "  vTextureCoord = aTextureCoord;\n" +
+        "}\n";
+
+    private final String mFragmentShader =
+        "precision mediump float;\n" +
+        "varying vec2 vTextureCoord;\n" +
+        "uniform sampler2D sTexture;\n" +
+        "void main() {\n" +
+        "  gl_FragColor = texture2D(sTexture, vTextureCoord);\n" +
+        "}\n";
+
+    private float[] mMVPMatrix = new float[16];
+    private float[] mProjMatrix = new float[16];
+    private float[] mMMatrix = new float[16];
+    private float[] mVMatrix = new float[16];
+
+    private int mProgram;
+    private int mTextureID;
+    private int muMVPMatrixHandle;
+    private int maPositionHandle;
+    private int maTextureHandle;
+
+    private Context mContext;
+    private static String TAG = "GLES20TriangleRenderer";
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/MatrixPaletteActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/MatrixPaletteActivity.java
new file mode 100644
index 0000000..520e0e1
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/MatrixPaletteActivity.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 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.apis.graphics;
+
+import android.app.Activity;
+import android.opengl.GLSurfaceView;
+import android.os.Bundle;
+
+/**
+ * This sample shows how to implement a Matrix Palette
+ */
+public class MatrixPaletteActivity extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mGLSurfaceView = new GLSurfaceView(this);
+        mGLSurfaceView.setRenderer(new MatrixPaletteRenderer(this));
+        setContentView(mGLSurfaceView);
+    }
+
+    @Override
+    protected void onResume() {
+        // Ideally a game should implement onResume() and onPause()
+        // to take appropriate action when the activity looses focus
+        super.onResume();
+        mGLSurfaceView.onResume();
+    }
+
+    @Override
+    protected void onPause() {
+        // Ideally a game should implement onResume() and onPause()
+        // to take appropriate action when the activity looses focus
+        super.onPause();
+        mGLSurfaceView.onPause();
+    }
+
+    private GLSurfaceView mGLSurfaceView;
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/MatrixPaletteRenderer.java b/samples/ApiDemos/src/com/example/android/apis/graphics/MatrixPaletteRenderer.java
new file mode 100644
index 0000000..e0e2db1
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/MatrixPaletteRenderer.java
@@ -0,0 +1,408 @@
+/*
+ * Copyright (C) 2009 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.apis.graphics;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.CharBuffer;
+import java.nio.FloatBuffer;
+
+import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.opengles.GL;
+import javax.microedition.khronos.opengles.GL10;
+import javax.microedition.khronos.opengles.GL11;
+import javax.microedition.khronos.opengles.GL11Ext;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+import android.opengl.GLSurfaceView;
+import android.opengl.GLU;
+import android.opengl.GLUtils;
+import android.os.SystemClock;
+
+import com.example.android.apis.R;
+
+public class MatrixPaletteRenderer implements GLSurfaceView.Renderer{
+    private Context mContext;
+    private Grid mGrid;
+    private int mTextureID;
+
+    /** A grid is a topologically rectangular array of vertices.
+     *
+     * This grid class is customized for the vertex data required for this
+     * example.
+     *
+     * The vertex and index data are held in VBO objects because on most
+     * GPUs VBO objects are the fastest way of rendering static vertex
+     * and index data.
+     *
+     */
+
+    private static class Grid {
+        // Size of vertex data elements in bytes:
+        final static int FLOAT_SIZE = 4;
+        final static int CHAR_SIZE = 2;
+
+        // Vertex structure:
+        // float x, y, z;
+        // float u, v;
+        // float weight0, weight1;
+        // byte palette0, palette1, pad0, pad1;
+
+        final static int VERTEX_SIZE = 8 * FLOAT_SIZE;
+        final static int VERTEX_TEXTURE_BUFFER_INDEX_OFFSET = 3;
+        final static int VERTEX_WEIGHT_BUFFER_INDEX_OFFSET = 5;
+        final static int VERTEX_PALETTE_INDEX_OFFSET = 7 * FLOAT_SIZE;
+
+        private int mVertexBufferObjectId;
+        private int mElementBufferObjectId;
+
+        // These buffers are used to hold the vertex and index data while
+        // constructing the grid. Once createBufferObjects() is called
+        // the buffers are nulled out to save memory.
+
+        private ByteBuffer mVertexByteBuffer;
+        private FloatBuffer mVertexBuffer;
+        private CharBuffer mIndexBuffer;
+
+        private int mW;
+        private int mH;
+        private int mIndexCount;
+
+        public Grid(int w, int h) {
+            if (w < 0 || w >= 65536) {
+                throw new IllegalArgumentException("w");
+            }
+            if (h < 0 || h >= 65536) {
+                throw new IllegalArgumentException("h");
+            }
+            if (w * h >= 65536) {
+                throw new IllegalArgumentException("w * h >= 65536");
+            }
+
+            mW = w;
+            mH = h;
+            int size = w * h;
+
+            mVertexByteBuffer = ByteBuffer.allocateDirect(VERTEX_SIZE * size)
+                .order(ByteOrder.nativeOrder());
+            mVertexBuffer = mVertexByteBuffer.asFloatBuffer();
+
+            int quadW = mW - 1;
+            int quadH = mH - 1;
+            int quadCount = quadW * quadH;
+            int indexCount = quadCount * 6;
+            mIndexCount = indexCount;
+            mIndexBuffer = ByteBuffer.allocateDirect(CHAR_SIZE * indexCount)
+                .order(ByteOrder.nativeOrder()).asCharBuffer();
+
+            /*
+             * Initialize triangle list mesh.
+             *
+             *     [0]-----[  1] ...
+             *      |    /   |
+             *      |   /    |
+             *      |  /     |
+             *     [w]-----[w+1] ...
+             *      |       |
+             *
+             */
+
+            {
+                int i = 0;
+                for (int y = 0; y < quadH; y++) {
+                    for (int x = 0; x < quadW; x++) {
+                        char a = (char) (y * mW + x);
+                        char b = (char) (y * mW + x + 1);
+                        char c = (char) ((y + 1) * mW + x);
+                        char d = (char) ((y + 1) * mW + x + 1);
+
+                        mIndexBuffer.put(i++, a);
+                        mIndexBuffer.put(i++, c);
+                        mIndexBuffer.put(i++, b);
+
+                        mIndexBuffer.put(i++, b);
+                        mIndexBuffer.put(i++, c);
+                        mIndexBuffer.put(i++, d);
+                    }
+                }
+            }
+
+        }
+
+        public void set(int i, int j, float x, float y, float z,
+                float u, float v,
+                float w0, float w1,
+                int p0, int p1) {
+            if (i < 0 || i >= mW) {
+                throw new IllegalArgumentException("i");
+            }
+            if (j < 0 || j >= mH) {
+                throw new IllegalArgumentException("j");
+            }
+
+            if (w0 + w1 != 1.0f) {
+                throw new IllegalArgumentException("Weights must add up to 1.0f");
+            }
+
+            int index = mW * j + i;
+
+            mVertexBuffer.position(index * VERTEX_SIZE / FLOAT_SIZE);
+            mVertexBuffer.put(x);
+            mVertexBuffer.put(y);
+            mVertexBuffer.put(z);
+            mVertexBuffer.put(u);
+            mVertexBuffer.put(v);
+            mVertexBuffer.put(w0);
+            mVertexBuffer.put(w1);
+
+            mVertexByteBuffer.position(index * VERTEX_SIZE + VERTEX_PALETTE_INDEX_OFFSET);
+            mVertexByteBuffer.put((byte) p0);
+            mVertexByteBuffer.put((byte) p1);
+        }
+
+        public void createBufferObjects(GL gl) {
+            // Generate a the vertex and element buffer IDs
+            int[] vboIds = new int[2];
+            GL11 gl11 = (GL11) gl;
+            gl11.glGenBuffers(2, vboIds, 0);
+            mVertexBufferObjectId = vboIds[0];
+            mElementBufferObjectId = vboIds[1];
+
+            // Upload the vertex data
+            gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertexBufferObjectId);
+            mVertexByteBuffer.position(0);
+            gl11.glBufferData(GL11.GL_ARRAY_BUFFER, mVertexByteBuffer.capacity(), mVertexByteBuffer, GL11.GL_STATIC_DRAW);
+
+            gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mElementBufferObjectId);
+            mIndexBuffer.position(0);
+            gl11.glBufferData(GL11.GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer.capacity() * CHAR_SIZE, mIndexBuffer, GL11.GL_STATIC_DRAW);
+
+            // We don't need the in-memory data any more
+            mVertexBuffer = null;
+            mVertexByteBuffer = null;
+            mIndexBuffer = null;
+        }
+
+        public void draw(GL10 gl) {
+            GL11 gl11 = (GL11) gl;
+            GL11Ext gl11Ext = (GL11Ext) gl;
+
+            gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
+
+            gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, mVertexBufferObjectId);
+            gl11.glVertexPointer(3, GL10.GL_FLOAT, VERTEX_SIZE, 0);
+            gl11.glTexCoordPointer(2, GL10.GL_FLOAT, VERTEX_SIZE, VERTEX_TEXTURE_BUFFER_INDEX_OFFSET * FLOAT_SIZE);
+
+            gl.glEnableClientState(GL11Ext.GL_MATRIX_INDEX_ARRAY_OES);
+            gl.glEnableClientState(GL11Ext.GL_WEIGHT_ARRAY_OES);
+
+            gl11Ext.glWeightPointerOES(2, GL10.GL_FLOAT, VERTEX_SIZE, VERTEX_WEIGHT_BUFFER_INDEX_OFFSET  * FLOAT_SIZE);
+            gl11Ext.glMatrixIndexPointerOES(2, GL10.GL_UNSIGNED_BYTE, VERTEX_SIZE, VERTEX_PALETTE_INDEX_OFFSET );
+
+            gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, mElementBufferObjectId);
+            gl11.glDrawElements(GL10.GL_TRIANGLES, mIndexCount, GL10.GL_UNSIGNED_SHORT, 0);
+            gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
+            gl.glDisableClientState(GL11Ext.GL_MATRIX_INDEX_ARRAY_OES);
+            gl.glDisableClientState(GL11Ext.GL_WEIGHT_ARRAY_OES);
+            gl11.glBindBuffer(GL11.GL_ARRAY_BUFFER, 0);
+            gl11.glBindBuffer(GL11.GL_ELEMENT_ARRAY_BUFFER, 0);
+        }
+    }
+
+    public MatrixPaletteRenderer(Context context) {
+        mContext = context;
+    }
+
+    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
+        /*
+         * By default, OpenGL enables features that improve quality
+         * but reduce performance. One might want to tweak that
+         * especially on software renderer.
+         */
+        gl.glDisable(GL10.GL_DITHER);
+
+        /*
+         * Some one-time OpenGL initialization can be made here
+         * probably based on features of this particular context
+         */
+        gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT,
+                GL10.GL_FASTEST);
+
+        gl.glClearColor(.5f, .5f, .5f, 1);
+        gl.glShadeModel(GL10.GL_SMOOTH);
+        gl.glEnable(GL10.GL_DEPTH_TEST);
+        gl.glEnable(GL10.GL_TEXTURE_2D);
+
+        /*
+         * Create our texture. This has to be done each time the
+         * surface is created.
+         */
+
+        int[] textures = new int[1];
+        gl.glGenTextures(1, textures, 0);
+
+        mTextureID = textures[0];
+        gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureID);
+
+        gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,
+                GL10.GL_NEAREST);
+        gl.glTexParameterf(GL10.GL_TEXTURE_2D,
+                GL10.GL_TEXTURE_MAG_FILTER,
+                GL10.GL_LINEAR);
+
+        gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
+                GL10.GL_CLAMP_TO_EDGE);
+        gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
+                GL10.GL_CLAMP_TO_EDGE);
+
+        gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
+                GL10.GL_REPLACE);
+
+        InputStream is = mContext.getResources()
+                .openRawResource(R.raw.robot);
+        Bitmap bitmap;
+        try {
+            bitmap = BitmapFactory.decodeStream(is);
+        } finally {
+            try {
+                is.close();
+            } catch(IOException e) {
+                // Ignore.
+            }
+        }
+
+        GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);
+        bitmap.recycle();
+
+        mGrid = generateWeightedGrid(gl);
+    }
+
+    public void onDrawFrame(GL10 gl) {
+        /*
+         * By default, OpenGL enables features that improve quality
+         * but reduce performance. One might want to tweak that
+         * especially on software renderer.
+         */
+        gl.glDisable(GL10.GL_DITHER);
+
+        gl.glTexEnvx(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
+                GL10.GL_MODULATE);
+
+        /*
+         * Usually, the first thing one might want to do is to clear
+         * the screen. The most efficient way of doing this is to use
+         * glClear().
+         */
+
+        gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
+
+        gl.glEnable(GL10.GL_DEPTH_TEST);
+
+        gl.glEnable(GL10.GL_CULL_FACE);
+
+        /*
+         * Now we're ready to draw some 3D objects
+         */
+
+        gl.glMatrixMode(GL10.GL_MODELVIEW);
+        gl.glLoadIdentity();
+
+        GLU.gluLookAt(gl, 0, 0, -5, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
+
+        gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
+        gl.glEnableClientState(GL10.GL_TEXTURE_COORD_ARRAY);
+
+        gl.glActiveTexture(GL10.GL_TEXTURE0);
+        gl.glBindTexture(GL10.GL_TEXTURE_2D, mTextureID);
+        gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
+                GL10.GL_REPEAT);
+        gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
+                GL10.GL_REPEAT);
+
+        long time = SystemClock.uptimeMillis() % 4000L;
+
+        // Rock back and forth
+        double animationUnit = ((double) time) / 4000;
+        float unitAngle = (float) Math.cos(animationUnit * 2 * Math.PI);
+        float angle = unitAngle * 135f;
+
+        gl.glEnable(GL11Ext.GL_MATRIX_PALETTE_OES);
+        gl.glMatrixMode(GL11Ext.GL_MATRIX_PALETTE_OES);
+
+        GL11Ext gl11Ext = (GL11Ext) gl;
+
+        // matrix 0: no transformation
+        gl11Ext.glCurrentPaletteMatrixOES(0);
+        gl11Ext.glLoadPaletteFromModelViewMatrixOES();
+
+
+        // matrix 1: rotate by "angle"
+        gl.glRotatef(angle, 0, 0, 1.0f);
+
+        gl11Ext.glCurrentPaletteMatrixOES(1);
+        gl11Ext.glLoadPaletteFromModelViewMatrixOES();
+
+        mGrid.draw(gl);
+
+        gl.glDisable(GL11Ext.GL_MATRIX_PALETTE_OES);
+    }
+
+    public void onSurfaceChanged(GL10 gl, int w, int h) {
+        gl.glViewport(0, 0, w, h);
+
+        /*
+        * Set our projection matrix. This doesn't have to be done
+        * each time we draw, but usually a new projection needs to
+        * be set when the viewport is resized.
+        */
+
+        float ratio = (float) w / h;
+        gl.glMatrixMode(GL10.GL_PROJECTION);
+        gl.glLoadIdentity();
+        gl.glFrustumf(-ratio, ratio, -1, 1, 3, 7);
+    }
+
+    private Grid generateWeightedGrid(GL gl) {
+        final int uSteps = 20;
+        final int vSteps = 20;
+
+        float radius = 0.25f;
+        float height = 2.0f;
+        Grid grid = new Grid(uSteps + 1, vSteps + 1);
+
+        for (int j = 0; j <= vSteps; j++) {
+            for (int i = 0; i <= uSteps; i++) {
+                double angle = Math.PI * 2 * i / uSteps;
+                float x = radius * (float) Math.cos(angle);
+                float y = height * ((float) j / vSteps - 0.5f);
+                float z = radius * (float) Math.sin(angle);
+                float u = -4.0f * (float) i / uSteps;
+                float v = -4.0f * (float) j / vSteps;
+                float w0 = (float) j / vSteps;
+                float w1 = 1.0f - w0;
+                grid.set(i, j, x, y, z, u, v, w0, w1, 0, 1);
+            }
+        }
+
+        grid.createBufferObjects(gl);
+        return grid;
+    }
+}
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/PictureLayout.java b/samples/ApiDemos/src/com/example/android/apis/graphics/PictureLayout.java
index 9bdb49a..cfa3c29 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/PictureLayout.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/PictureLayout.java
@@ -76,7 +76,7 @@
 
     @Override
     protected LayoutParams generateDefaultLayoutParams() {
-        return new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
+        return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
     }
 
     @Override
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/StaticTriangleRenderer.java b/samples/ApiDemos/src/com/example/android/apis/graphics/StaticTriangleRenderer.java
index c492e3f..7ef0841 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/StaticTriangleRenderer.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/StaticTriangleRenderer.java
@@ -50,9 +50,25 @@
  */
 public class StaticTriangleRenderer implements GLSurfaceView.Renderer{
 
+    public interface TextureLoader {
+        /**
+         * Load a texture into the currently bound OpenGL texture.
+         */
+        void load(GL10 gl);
+    }
+
     public StaticTriangleRenderer(Context context) {
+        init(context, new RobotTextureLoader());
+    }
+
+    public StaticTriangleRenderer(Context context, TextureLoader loader) {
+        init(context, loader);
+    }
+
+    private void init(Context context, TextureLoader loader) {
         mContext = context;
         mTriangle = new Triangle();
+        mTextureLoader = loader;
     }
 
     public void onSurfaceCreated(GL10 gl, EGLConfig config) {
@@ -99,22 +115,7 @@
 
         glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE,
                 GL_REPLACE);
-
-        InputStream is = mContext.getResources()
-                .openRawResource(R.drawable.robot);
-        Bitmap bitmap;
-        try {
-            bitmap = BitmapFactory.decodeStream(is);
-        } finally {
-            try {
-                is.close();
-            } catch(IOException e) {
-                // Ignore.
-            }
-        }
-
-        GLUtils.texImage2D(GL_TEXTURE_2D, 0, bitmap, 0);
-        bitmap.recycle();
+        mTextureLoader.load(gl);
     }
 
     public void onDrawFrame(GL10 gl) {
@@ -181,6 +182,27 @@
     private Context mContext;
     private Triangle mTriangle;
     private int mTextureID;
+    private TextureLoader mTextureLoader;
+
+    private class RobotTextureLoader implements TextureLoader {
+        public void load(GL10 gl) {
+            InputStream is = mContext.getResources().openRawResource(
+                    R.raw.robot);
+            Bitmap bitmap;
+            try {
+                bitmap = BitmapFactory.decodeStream(is);
+            } finally {
+                try {
+                    is.close();
+                } catch (IOException e) {
+                    // Ignore.
+                }
+            }
+
+            GLUtils.texImage2D(GL_TEXTURE_2D, 0, bitmap, 0);
+            bitmap.recycle();
+        }
+    }
 
     static class Triangle {
         public Triangle() {
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleRenderer.java b/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleRenderer.java
index e5299b3..ede6ef5 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleRenderer.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleRenderer.java
@@ -90,7 +90,7 @@
                 GL10.GL_REPLACE);
 
         InputStream is = mContext.getResources()
-                .openRawResource(R.drawable.robot);
+                .openRawResource(R.raw.robot);
         Bitmap bitmap;
         try {
             bitmap = BitmapFactory.decodeStream(is);
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/LabelMaker.java b/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/LabelMaker.java
index 4bf87f7..6481397 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/LabelMaker.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/LabelMaker.java
@@ -351,17 +351,12 @@
      */
     public void draw(GL10 gl, float x, float y, int labelID) {
         checkState(STATE_DRAWING, STATE_DRAWING);
-        gl.glPushMatrix();
-        float snappedX = (float) Math.floor(x);
-        float snappedY = (float) Math.floor(y);
-        gl.glTranslatef(snappedX, snappedY, 0.0f);
         Label label = mLabels.get(labelID);
         gl.glEnable(GL10.GL_TEXTURE_2D);
         ((GL11)gl).glTexParameteriv(GL10.GL_TEXTURE_2D,
                 GL11Ext.GL_TEXTURE_CROP_RECT_OES, label.mCrop, 0);
-        ((GL11Ext)gl).glDrawTexiOES((int) snappedX, (int) snappedY, 0,
+        ((GL11Ext)gl).glDrawTexiOES((int) x, (int) y, 0,
                 (int) label.width, (int) label.height);
-        gl.glPopMatrix();
     }
 
     /**
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/SpriteTextRenderer.java b/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/SpriteTextRenderer.java
index 223300a..e01d6ef 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/SpriteTextRenderer.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/spritetext/SpriteTextRenderer.java
@@ -35,6 +35,7 @@
 import android.opengl.GLU;
 import android.opengl.GLUtils;
 import android.os.SystemClock;
+import android.util.Log;
 
 import com.example.android.apis.R;
 
@@ -96,7 +97,7 @@
                 GL10.GL_REPLACE);
 
         InputStream is = mContext.getResources()
-                .openRawResource(R.drawable.robot);
+                .openRawResource(R.raw.robot);
         Bitmap bitmap;
         try {
             bitmap = BitmapFactory.decodeStream(is);
@@ -172,6 +173,15 @@
         gl.glTexParameterx(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
                 GL10.GL_REPEAT);
 
+        if (false) {
+            long time = SystemClock.uptimeMillis();
+            if (mLastTime != 0) {
+                long delta = time - mLastTime;
+                Log.w("time", Long.toString(delta));
+            }
+            mLastTime = time;
+        }
+
         long time = SystemClock.uptimeMillis() % 4000L;
         float angle = 0.090f * ((int) time);
 
@@ -266,6 +276,7 @@
     private Projector mProjector;
     private NumericSprite mNumericSprite;
     private float[] mScratch = new float[8];
+    private long mLastTime;
 }
 
 class Triangle {
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.java b/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.java
index 944db64..bda366b 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList1.java
@@ -24,7 +24,6 @@
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.ContextMenu.ContextMenuInfo;
-import android.view.ViewGroup.MarginLayoutParams;
 import android.widget.AbsListView;
 import android.widget.BaseExpandableListAdapter;
 import android.widget.ExpandableListAdapter;
@@ -112,7 +111,7 @@
         public TextView getGenericView() {
             // Layout parameters for the ExpandableListView
             AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
-                    ViewGroup.LayoutParams.FILL_PARENT, 64);
+                    ViewGroup.LayoutParams.MATCH_PARENT, 64);
 
             TextView textView = new TextView(ExpandableList1.this);
             textView.setLayoutParams(lp);
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/ImageSwitcher1.java b/samples/ApiDemos/src/com/example/android/apis/view/ImageSwitcher1.java
index f72b623..66ef282 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/ImageSwitcher1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/ImageSwitcher1.java
@@ -67,8 +67,8 @@
         ImageView i = new ImageView(this);
         i.setBackgroundColor(0xFF000000);
         i.setScaleType(ImageView.ScaleType.FIT_CENTER);
-        i.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.FILL_PARENT,
-                LayoutParams.FILL_PARENT));
+        i.setLayoutParams(new ImageSwitcher.LayoutParams(LayoutParams.MATCH_PARENT,
+                LayoutParams.MATCH_PARENT));
         return i;
     }
 
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/InternalSelectionFocus.java b/samples/ApiDemos/src/com/example/android/apis/view/InternalSelectionFocus.java
index a664ab9..876af8d 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/InternalSelectionFocus.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/InternalSelectionFocus.java
@@ -46,11 +46,11 @@
         final LinearLayout layout = new LinearLayout(this);
         layout.setOrientation(LinearLayout.HORIZONTAL);
         layout.setLayoutParams(new ViewGroup.LayoutParams(
-                ViewGroup.LayoutParams.FILL_PARENT,
-                ViewGroup.LayoutParams.FILL_PARENT));
+                ViewGroup.LayoutParams.MATCH_PARENT,
+                ViewGroup.LayoutParams.MATCH_PARENT));
 
         LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(0,
-                ViewGroup.LayoutParams.FILL_PARENT, 1);
+                ViewGroup.LayoutParams.MATCH_PARENT, 1);
 
         final InternalSelectionView leftColumn = new InternalSelectionView(this, 5, "left column");
         leftColumn.setLayoutParams(params);
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/InternalSelectionScroll.java b/samples/ApiDemos/src/com/example/android/apis/view/InternalSelectionScroll.java
index fe607e2..987eaed 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/InternalSelectionScroll.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/InternalSelectionScroll.java
@@ -44,7 +44,7 @@
 
         ScrollView sv = new ScrollView(this);
         ViewGroup.LayoutParams svLp = new ScrollView.LayoutParams(
-                ViewGroup.LayoutParams.FILL_PARENT,
+                ViewGroup.LayoutParams.MATCH_PARENT,
                 ViewGroup.LayoutParams.WRAP_CONTENT);
 
         LinearLayout ll = new LinearLayout(this);
@@ -54,7 +54,7 @@
         InternalSelectionView isv = new InternalSelectionView(this, 10);
         int screenHeight = getWindowManager().getDefaultDisplay().getHeight();
         LinearLayout.LayoutParams llLp = new LinearLayout.LayoutParams(
-                ViewGroup.LayoutParams.FILL_PARENT,
+                ViewGroup.LayoutParams.MATCH_PARENT,
                 2 * screenHeight);  // 2x screen height to ensure scrolling
         isv.setLayoutParams(llLp);
         ll.addView(isv);
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout7.java b/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout7.java
index 32c787f..a7edf2e 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout7.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/LinearLayout7.java
@@ -25,7 +25,7 @@
 
 
 /**
- * Demonstrates using fill_parent within a linear layout whose size is not fixed.
+ * Demonstrates using match_parent within a linear layout whose size is not fixed.
  *
  */
 public class LinearLayout7 extends Activity {
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/List4.java b/samples/ApiDemos/src/com/example/android/apis/view/List4.java
index 2bd589d..a140e60 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/List4.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/List4.java
@@ -346,12 +346,12 @@
             mTitle = new TextView(context);
             mTitle.setText(title);
             addView(mTitle, new LinearLayout.LayoutParams(
-                    LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
+                    LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
 
             mDialogue = new TextView(context);
             mDialogue.setText(words);
             addView(mDialogue, new LinearLayout.LayoutParams(
-                    LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
+                    LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
         }
 
         /**
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/List6.java b/samples/ApiDemos/src/com/example/android/apis/view/List6.java
index 9bb5b14..2d4536f 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/List6.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/List6.java
@@ -374,11 +374,11 @@
             
             mTitle = new TextView(context);
             mTitle.setText(title);
-            addView(mTitle, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
+            addView(mTitle, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
             
             mDialogue = new TextView(context);
             mDialogue.setText(dialogue);
-            addView(mDialogue, new LinearLayout.LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT));
+            addView(mDialogue, new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
             
             mDialogue.setVisibility(expanded ? VISIBLE : GONE);
         }
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/List7.java b/samples/ApiDemos/src/com/example/android/apis/view/List7.java
index d44ed56..e773db6 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/List7.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/List7.java
@@ -16,15 +16,12 @@
 
 package com.example.android.apis.view;
 
-// Need the following import to get access to the app resources, since this
-// class is in a sub-package.
 import com.example.android.apis.R;
 
-
 import android.app.ListActivity;
 import android.database.Cursor;
-import android.provider.Contacts.People;
 import android.os.Bundle;
+import android.provider.ContactsContract;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.AdapterView.OnItemSelectedListener;
@@ -36,46 +33,69 @@
  * A list view example where the data comes from a cursor.
  */
 public class List7 extends ListActivity implements OnItemSelectedListener {
-    private static String[] PROJECTION = new String[] {
-        People._ID, People.NAME, People.NUMBER
+    private static final String[] PROJECTION = new String[] {
+            ContactsContract.Contacts._ID,
+            ContactsContract.Contacts.DISPLAY_NAME,
+            ContactsContract.Contacts.HAS_PHONE_NUMBER,
+            ContactsContract.Contacts.LOOKUP_KEY
     };
 
+    private int mIdColumnIndex;
+    private int mHasPhoneColumnIndex;
+
+    private TextView mPhone;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+
         setContentView(R.layout.list_7);
+
         mPhone = (TextView) findViewById(R.id.phone);
         getListView().setOnItemSelectedListener(this);
 
         // Get a cursor with all people
-        Cursor c = getContentResolver().query(People.CONTENT_URI, PROJECTION, null, null, null);
-        startManagingCursor(c);
-        mPhoneColumnIndex = c.getColumnIndex(People.NUMBER);
+        Cursor c = managedQuery(ContactsContract.Contacts.CONTENT_URI,
+                PROJECTION, null, null, null);
+        mIdColumnIndex = c.getColumnIndex(ContactsContract.Contacts._ID);
+        mHasPhoneColumnIndex = c.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER);
 
         ListAdapter adapter = new SimpleCursorAdapter(this,
                 android.R.layout.simple_list_item_1, // Use a template
-                                                        // that displays a
-                                                        // text view
-                c, // Give the cursor to the list adatper
-                new String[] {People.NAME}, // Map the NAME column in the
-                                            // people database to...
-                new int[] {android.R.id.text1}); // The "text1" view defined in
-                                            // the XML template
+                                                     // that displays a
+                                                     // text view
+                c, // Give the cursor to the list adapter
+                new String[] { ContactsContract.Contacts.DISPLAY_NAME }, // Map the NAME column in the
+                                                                         // people database to...
+                new int[] { android.R.id.text1 }); // The "text1" view defined in
+                                                   // the XML template
         setListAdapter(adapter);
     }
 
     public void onItemSelected(AdapterView parent, View v, int position, long id) {
         if (position >= 0) {
-            Cursor c = (Cursor) parent.getItemAtPosition(position);
-            mPhone.setText(c.getString(mPhoneColumnIndex));
+            final Cursor c = (Cursor) parent.getItemAtPosition(position);
+            if (c.getInt(mHasPhoneColumnIndex) > 0) {
+                final long contactId = c.getLong(mIdColumnIndex);
+                final Cursor phones = getContentResolver().query(
+                        ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
+                        new String[] { ContactsContract.CommonDataKinds.Phone.NUMBER },
+                        ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=" + contactId, null,
+                        ContactsContract.CommonDataKinds.Phone.IS_SUPER_PRIMARY + " DESC");
+
+                try {
+                    phones.moveToFirst();
+                    mPhone.setText(phones.getString(0));
+                } finally {
+                    phones.close();
+                }
+            } else {
+                mPhone.setText(R.string.list_7_nothing);                
+            }
         }
     }
 
     public void onNothingSelected(AdapterView parent) {
         mPhone.setText(R.string.list_7_nothing);
-
     }
-
-    private int mPhoneColumnIndex;
-    private TextView mPhone;
 }
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/ScrollView2.java b/samples/ApiDemos/src/com/example/android/apis/view/ScrollView2.java
index 89e4003..1af3c81 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/ScrollView2.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/ScrollView2.java
@@ -20,7 +20,6 @@
 
 import android.app.Activity;
 import android.os.Bundle;
-import android.view.View;
 import android.widget.LinearLayout;
 import android.widget.TextView;
 import android.widget.Button;
@@ -41,7 +40,7 @@
             TextView textView = new TextView(this);
             textView.setText("Text View " + i);
             LinearLayout.LayoutParams p = new LinearLayout.LayoutParams(
-                    LinearLayout.LayoutParams.FILL_PARENT,
+                    LinearLayout.LayoutParams.MATCH_PARENT,
                     LinearLayout.LayoutParams.WRAP_CONTENT
             );
             layout.addView(textView, p);
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/Spinner1.java b/samples/ApiDemos/src/com/example/android/apis/view/Spinner1.java
index a35a909..c5b4bd9 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/Spinner1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/Spinner1.java
@@ -22,12 +22,20 @@
 
 import android.app.Activity;
 import android.os.Bundle;
+import android.view.View;
+import android.widget.AdapterView;
 import android.widget.ArrayAdapter;
 import android.widget.Spinner;
+import android.widget.Toast;
+import android.widget.AdapterView.OnItemSelectedListener;
 
 
 public class Spinner1 extends Activity {
 
+    void showToast(CharSequence msg) {
+        Toast.makeText(this, msg, Toast.LENGTH_SHORT).show();
+    }
+    
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -38,11 +46,33 @@
                 this, R.array.colors, android.R.layout.simple_spinner_item);
         adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
         s1.setAdapter(adapter);
+        s1.setOnItemSelectedListener(
+                new OnItemSelectedListener() {
+                    public void onItemSelected(
+                            AdapterView<?> parent, View view, int position, long id) {
+                        showToast("Spinner1: position=" + position + " id=" + id);
+                    }
+
+                    public void onNothingSelected(AdapterView<?> parent) {
+                        showToast("Spinner1: unselected");
+                    }
+                });
 
         Spinner s2 = (Spinner) findViewById(R.id.spinner2);
         adapter = ArrayAdapter.createFromResource(this, R.array.planets,
                 android.R.layout.simple_spinner_item);
         adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
         s2.setAdapter(adapter);
+        s2.setOnItemSelectedListener(
+                new OnItemSelectedListener() {
+                    public void onItemSelected(
+                            AdapterView<?> parent, View view, int position, long id) {
+                        showToast("Spinner2: position=" + position + " id=" + id);
+                    }
+
+                    public void onNothingSelected(AdapterView<?> parent) {
+                        showToast("Spinner2: unselected");
+                    }
+                });
     }
 }
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/_index.html b/samples/ApiDemos/src/com/example/android/apis/view/_index.html
index 1561729..a462bc1 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/_index.html
+++ b/samples/ApiDemos/src/com/example/android/apis/view/_index.html
@@ -13,7 +13,7 @@
   <dd>Demonstrates a simple LinearLayout, with child width set to WRAP_CONTENT. </dd>
 
   <dt><a href="LinearLayout2.html">2. Vertical (Fill Screen)</a></dt>
-  <dd>Demonstrates a simple LinearLayout, with child width set to FILL_PARENT.</dd>
+  <dd>Demonstrates a simple LinearLayout, with child width set to MATCH_PARENT.</dd>
 
   <dt><a href="LinearLayout3.html">3. Vertical (Padded)</a></dt>
   <dd>Demonstrates a LinearLayout where one of the elements can expand to fill any remaining screen space (weight=1). </dd>
@@ -25,7 +25,7 @@
   <dd>Demonstrates nested layouts to create a user form.</dd>
 
   <dt><a href="LinearLayout6.html">6. Uniform Size</a></dt>
-  <dd>LinearLayout which uses a combination of wrap_content on itself and fill_parent on its children to get every item to be the same width.</dd>
+  <dd>LinearLayout which uses a combination of wrap_content on itself and match_parent on its children to get every item to be the same width.</dd>
 
   <dt><a href="LinearLayout7.html">7. Fill Parent</a></dt>
   <dd>Demonstrates a horizontal linear layout with equally sized columns. Some columns force their height to match the parent.</dd>
diff --git a/samples/BluetoothChat/res/layout/custom_title.xml b/samples/BluetoothChat/res/layout/custom_title.xml
index 6b7dca5..57eb6b4 100644
--- a/samples/BluetoothChat/res/layout/custom_title.xml
+++ b/samples/BluetoothChat/res/layout/custom_title.xml
@@ -14,8 +14,8 @@
      limitations under the License.
 -->
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:gravity="center_vertical"
   >
   <TextView android:id="@+id/title_left_text"
@@ -24,7 +24,7 @@
       android:singleLine="true"
       style="?android:attr/windowTitleStyle"
       android:layout_width="wrap_content"
-      android:layout_height="fill_parent"
+      android:layout_height="match_parent"
       android:layout_weight="1"
     />
     <TextView android:id="@+id/title_right_text"
@@ -32,7 +32,7 @@
         android:ellipsize="end"
         android:singleLine="true"
         android:layout_width="wrap_content"
-        android:layout_height="fill_parent"
+        android:layout_height="match_parent"
         android:textColor="#fff"
         android:layout_weight="1" 
     />
diff --git a/samples/BluetoothChat/res/layout/device_list.xml b/samples/BluetoothChat/res/layout/device_list.xml
index e7b84b9..395695f 100644
--- a/samples/BluetoothChat/res/layout/device_list.xml
+++ b/samples/BluetoothChat/res/layout/device_list.xml
@@ -15,11 +15,11 @@
 -->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     >
     <TextView android:id="@+id/title_paired_devices"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/title_paired_devices"
         android:visibility="gone"
@@ -28,13 +28,13 @@
         android:paddingLeft="5dp"
     />
     <ListView android:id="@+id/paired_devices"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:stackFromBottom="true"
         android:layout_weight="1"
     />
     <TextView android:id="@+id/title_new_devices"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/title_other_devices"
         android:visibility="gone"
@@ -43,13 +43,13 @@
         android:paddingLeft="5dp"
     />
     <ListView android:id="@+id/new_devices"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:stackFromBottom="true"
         android:layout_weight="2"
     />
     <Button android:id="@+id/button_scan"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:text="@string/button_scan"
     />
diff --git a/samples/BluetoothChat/res/layout/device_name.xml b/samples/BluetoothChat/res/layout/device_name.xml
index c693f3a..8fa358c 100644
--- a/samples/BluetoothChat/res/layout/device_name.xml
+++ b/samples/BluetoothChat/res/layout/device_name.xml
@@ -14,7 +14,7 @@
      limitations under the License.
 -->
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:textSize="18sp"
     android:padding="5dp"
diff --git a/samples/BluetoothChat/res/layout/main.xml b/samples/BluetoothChat/res/layout/main.xml
index 307f5a5..17025f6 100644
--- a/samples/BluetoothChat/res/layout/main.xml
+++ b/samples/BluetoothChat/res/layout/main.xml
@@ -16,19 +16,19 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     >
     <ListView android:id="@+id/in"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:stackFromBottom="true"
         android:transcriptMode="alwaysScroll"
         android:layout_weight="1"
     />
     <LinearLayout
         android:orientation="horizontal"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         >
         <EditText android:id="@+id/edit_text_out"
diff --git a/samples/BluetoothChat/res/layout/message.xml b/samples/BluetoothChat/res/layout/message.xml
index c693f3a..8fa358c 100644
--- a/samples/BluetoothChat/res/layout/message.xml
+++ b/samples/BluetoothChat/res/layout/message.xml
@@ -14,7 +14,7 @@
      limitations under the License.
 -->
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:textSize="18sp"
     android:padding="5dp"
diff --git a/samples/BrowserPlugin/AndroidManifest.xml b/samples/BrowserPlugin/AndroidManifest.xml
index ae6b5db..d926729 100644
--- a/samples/BrowserPlugin/AndroidManifest.xml
+++ b/samples/BrowserPlugin/AndroidManifest.xml
@@ -24,11 +24,12 @@
     <uses-sdk android:minSdkVersion="3" />
 
     <application android:icon="@drawable/sample_browser_plugin"
-                android:label="@string/sample_browser_plugin">
-        <service android:name="SamplePlugin">
+                 android:label="@string/sample_browser_plugin">
+        <service android:name=".SamplePlugin">
             <intent-filter>
                 <action android:name="android.webkit.PLUGIN" />
             </intent-filter>
+            <meta-data android:name="type" android:value="native" />
         </service>
     </application>
 
diff --git a/samples/BrowserPlugin/README b/samples/BrowserPlugin/README
index 08b04a5..29797b2 100644
--- a/samples/BrowserPlugin/README
+++ b/samples/BrowserPlugin/README
@@ -57,10 +57,14 @@
             shared libraries to include.
 
 AndroidManifest.xml: similar to a standard android manifest file, except that it
-                     must contain the "uses-permission" and "intent-filter"
-                     elements that are plugin specific.
+                     must contain the "uses-permission" and "service"
+                     elements that are plugin specific. The "service" element
+                     contains sub-elements that describe the java component of
+                     the service.
 
-src/*: location of the java files which in our case is just an empty service
+src/*: location of the java source files.  This contains the SamplePlugin.class
+       which is the java component of our plugin.  The component must exist and
+       implement the required interfaces, though simply returning null is valid.
 
 res/*: location of the static resources (e.g. an icon for the plugin)
 
diff --git a/samples/BrowserPlugin/jni/Android.mk b/samples/BrowserPlugin/jni/Android.mk
index cbd8a15..d444bb0 100644
--- a/samples/BrowserPlugin/jni/Android.mk
+++ b/samples/BrowserPlugin/jni/Android.mk
@@ -34,7 +34,9 @@
 	audio/AudioPlugin.cpp \
 	background/BackgroundPlugin.cpp \
 	form/FormPlugin.cpp \
+	navigation/NavigationPlugin.cpp \
 	paint/PaintPlugin.cpp \
+	video/VideoPlugin.cpp \
 	jni-bridge.cpp \
 
 LOCAL_C_INCLUDES += \
@@ -44,7 +46,9 @@
 	$(LOCAL_PATH)/audio \
 	$(LOCAL_PATH)/background \
 	$(LOCAL_PATH)/form \
+	$(LOCAL_PATH)/navigation \
 	$(LOCAL_PATH)/paint \
+	$(LOCAL_PATH)/video \
 	external/webkit/WebCore/bridge \
 	external/webkit/WebCore/plugins \
 	external/webkit/WebCore/platform/android/JavaVM \
diff --git a/samples/BrowserPlugin/jni/PluginObject.cpp b/samples/BrowserPlugin/jni/PluginObject.cpp
index 80f5e7c..dd0fbac 100644
--- a/samples/BrowserPlugin/jni/PluginObject.cpp
+++ b/samples/BrowserPlugin/jni/PluginObject.cpp
@@ -6,7 +6,7 @@
  redistribute this Apple software.
 
  In consideration of your agreement to abide by the following terms, and subject to these
- terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in
+ terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in
  this original Apple software (the "Apple Software"), to use, reproduce, modify and
  redistribute the Apple Software, with or without modifications, in source and/or binary
  forms; provided that if you redistribute the Apple Software in its entirety and without
@@ -35,6 +35,40 @@
 #include "main.h"
 #include "PluginObject.h"
 
+int SubPlugin::getPluginWidth() {
+    PluginObject *obj = (PluginObject*) inst()->pdata;
+    return obj->window->width;
+}
+
+int SubPlugin::getPluginHeight() {
+    PluginObject *obj = (PluginObject*) inst()->pdata;
+    return obj->window->height;
+}
+
+bool SurfaceSubPlugin::supportsDrawingModel(ANPDrawingModel model) {
+    return (model == kSurface_ANPDrawingModel);
+}
+
+void SurfaceSubPlugin::setContext(jobject context) {
+    JNIEnv* env = NULL;
+    if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
+
+        // if one exists then free its global reference
+        if (m_context) {
+            env->DeleteGlobalRef(m_context);
+            m_context = NULL;
+        }
+
+        // create a new global ref
+        if (context) {
+            context = env->NewGlobalRef(context);
+        }
+
+        // set the value
+        m_context = context;
+    }
+}
+
 static void pluginInvalidate(NPObject *obj);
 static bool pluginHasProperty(NPObject *obj, NPIdentifier name);
 static bool pluginHasMethod(NPObject *obj, NPIdentifier name);
diff --git a/samples/BrowserPlugin/jni/PluginObject.h b/samples/BrowserPlugin/jni/PluginObject.h
index 61486d5..0ebed28 100644
--- a/samples/BrowserPlugin/jni/PluginObject.h
+++ b/samples/BrowserPlugin/jni/PluginObject.h
@@ -6,7 +6,7 @@
  redistribute this Apple software.
 
  In consideration of your agreement to abide by the following terms, and subject to these
- terms, Apple grants you a personal, non-exclusive license, under AppleÕs copyrights in
+ terms, Apple grants you a personal, non-exclusive license, under Apple�s copyrights in
  this original Apple software (the "Apple Software"), to use, reproduce, modify and
  redistribute the Apple Software, with or without modifications, in source and/or binary
  forms; provided that if you redistribute the Apple Software in its entirety and without
@@ -37,6 +37,13 @@
 #include "main.h"
 #include <jni.h>
 
+enum CustomEventTypes {
+    kSurfaceCreated_CustomEvent     = 0,
+    kSurfaceChanged_CustomEvent     = 1,
+    kSurfaceDestroyed_CustomEvent   = 2,
+};
+typedef int32_t CustomEventType;
+
 class SubPlugin {
 public:
     SubPlugin(NPP inst) : m_inst(inst) {}
@@ -44,6 +51,9 @@
     virtual int16 handleEvent(const ANPEvent* evt) = 0;
     virtual bool supportsDrawingModel(ANPDrawingModel) = 0;
 
+    int getPluginWidth();
+    int getPluginHeight();
+
     NPP inst() const { return m_inst; }
 
 private:
@@ -52,12 +62,14 @@
 
 class SurfaceSubPlugin : public SubPlugin {
 public:
-    SurfaceSubPlugin(NPP inst) : SubPlugin(inst) {}
+    SurfaceSubPlugin(NPP inst) : SubPlugin(inst) { m_context = NULL; }
     virtual ~SurfaceSubPlugin() {}
-    virtual bool isFixedSurface() = 0;
-    virtual void surfaceCreated(JNIEnv*, jobject) = 0;
-    virtual void surfaceChanged(int format, int width, int height) = 0;
-    virtual void surfaceDestroyed() = 0;
+    virtual jobject getSurface() = 0;
+    virtual bool supportsDrawingModel(ANPDrawingModel);
+
+    void setContext(jobject context);
+
+    jobject m_context;
 };
 
 enum PluginTypes {
@@ -67,6 +79,8 @@
     kForm_PluginType       = 4,
     kText_PluginType       = 5,
     kPaint_PluginType      = 6,
+    kVideo_PluginType      = 7,
+    kNavigation_PluginType = 8,
 };
 typedef uint32_t PluginType;
 
diff --git a/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp b/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp
index b6175c1..72a11c9 100644
--- a/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp
+++ b/samples/BrowserPlugin/jni/animation/AnimationPlugin.cpp
@@ -85,7 +85,7 @@
     ANPEventFlags flags = kTouch_ANPEventFlag;
     NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
     if (err != NPERR_NO_ERROR) {
-        gLogI.log(inst, kError_ANPLogType, "Error selecting input events.");
+        gLogI.log(kError_ANPLogType, "Error selecting input events.");
     }
 }
 
diff --git a/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp b/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp
index 58d340c..9731f19 100644
--- a/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp
+++ b/samples/BrowserPlugin/jni/audio/AudioPlugin.cpp
@@ -99,7 +99,7 @@
 
     // open a file stream
     FILE* f = fopen(path, "r");
-    gLogI.log(inst, kDebug_ANPLogType, "--- path %s FILE %p", path, f);
+    gLogI.log(kDebug_ANPLogType, "--- path %s FILE %p", path, f);
 
     // setup our private audio struct's default values
     m_soundPlay = new SoundPlay;
@@ -123,13 +123,13 @@
     struct stat fileStatus;
 
     if(fileDescriptor <= 0) {
-        gLogI.log(inst, kError_ANPLogType, "fopen error");
+        gLogI.log(kError_ANPLogType, "fopen error");
     }
     else if (fstat(fileDescriptor, &fileStatus) != 0) {
-        gLogI.log(inst, kDebug_ANPLogType, "File Size: %d", fileStatus.st_size);
+        gLogI.log(kDebug_ANPLogType, "File Size: %d", fileStatus.st_size);
         m_soundPlay->fileSize = fileStatus.st_size;
     } else {
-        gLogI.log(inst, kError_ANPLogType, "fstat error");
+        gLogI.log(kError_ANPLogType, "fstat error");
     }
 
     // configure the UI elements
@@ -169,7 +169,7 @@
     ANPEventFlags flags = kTouch_ANPEventFlag;
     NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
     if (err != NPERR_NO_ERROR) {
-        gLogI.log(inst, kError_ANPLogType, "Error selecting input events.");
+        gLogI.log(kError_ANPLogType, "Error selecting input events.");
     }
 }
 
@@ -203,10 +203,10 @@
 }
 
 void AudioPlugin::draw(ANPCanvas* canvas) {
-    NPP instance = this->inst();
-    PluginObject *obj = (PluginObject*) instance->pdata;
 
-    gLogI.log(instance, kError_ANPLogType, "Drawing");
+    PluginObject *obj = (PluginObject*) this->inst()->pdata;
+
+    gLogI.log(kError_ANPLogType, "Drawing");
 
     const float trackHeight = 30;
     const float buttonWidth = 60;
@@ -332,7 +332,7 @@
 
     // if the track is null then return
     if (NULL == m_soundPlay->track) {
-        gLogI.log(instance, kError_ANPLogType, "---- %p unable to create track",
+        gLogI.log(kError_ANPLogType, "---- %p unable to create track",
                   instance);
         return;
     }
@@ -344,7 +344,7 @@
 
     if (currentRect == &m_playRect) {
 
-        gLogI.log(instance, kDebug_ANPLogType, "---- %p starting track (%d)",
+        gLogI.log(kDebug_ANPLogType, "---- %p starting track (%d)",
                   m_soundPlay->track, gSoundI.isStopped(m_soundPlay->track));
 
         if (gSoundI.isStopped(m_soundPlay->track)) {
@@ -353,7 +353,7 @@
     }
     else if (currentRect == &m_pauseRect) {
 
-        gLogI.log(instance, kDebug_ANPLogType, "---- %p pausing track (%d)",
+        gLogI.log(kDebug_ANPLogType, "---- %p pausing track (%d)",
                   m_soundPlay->track, gSoundI.isStopped(m_soundPlay->track));
 
         if (!gSoundI.isStopped(m_soundPlay->track)) {
@@ -362,7 +362,7 @@
     }
     else if (currentRect == &m_stopRect) {
 
-        gLogI.log(instance, kDebug_ANPLogType, "---- %p stopping track (%d)",
+        gLogI.log(kDebug_ANPLogType, "---- %p stopping track (%d)",
                   m_soundPlay->track, gSoundI.isStopped(m_soundPlay->track));
 
         if (!gSoundI.isStopped(m_soundPlay->track)) {
diff --git a/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp b/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp
index 2a65b4f..578fe6d 100644
--- a/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp
+++ b/samples/BrowserPlugin/jni/background/BackgroundPlugin.cpp
@@ -38,7 +38,9 @@
 extern ANPLogInterfaceV0       gLogI;
 extern ANPPaintInterfaceV0     gPaintI;
 extern ANPSurfaceInterfaceV0   gSurfaceI;
+extern ANPSystemInterfaceV0    gSystemI;
 extern ANPTypefaceInterfaceV0  gTypefaceI;
+extern ANPWindowInterfaceV0    gWindowI;
 
 #define ARRAY_COUNT(array)      (sizeof(array) / sizeof(array[0]))
 
@@ -54,7 +56,6 @@
 
     // initialize the drawing surface
     m_surface = NULL;
-    m_vm = NULL;
 
     //initialize bitmap transparency variables
     mFinishedStageOne   = false;
@@ -67,30 +68,57 @@
     test_bitmaps(); // android bitmaps
     test_domAccess();
     test_javascript();
+    test_loadJavaClass();
+
+    //register for touch events
+    ANPEventFlags flags = kTouch_ANPEventFlag;
+    NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
+    if (err != NPERR_NO_ERROR) {
+        gLogI.log(kError_ANPLogType, "Error selecting input events.");
+    }
 }
 
-BackgroundPlugin::~BackgroundPlugin() { }
-
-bool BackgroundPlugin::supportsDrawingModel(ANPDrawingModel model) {
-    return (model == kSurface_ANPDrawingModel);
+BackgroundPlugin::~BackgroundPlugin() {
+    setContext(NULL);
+    destroySurface();
 }
 
-bool BackgroundPlugin::isFixedSurface() {
-    return false;
-}
+jobject BackgroundPlugin::getSurface() {
 
-void BackgroundPlugin::surfaceCreated(JNIEnv* env, jobject surface) {
-    env->GetJavaVM(&m_vm);
-    m_surface = env->NewGlobalRef(surface);
-}
+    if (m_surface) {
+        return m_surface;
+    }
 
-void BackgroundPlugin::surfaceChanged(int format, int width, int height) {
-    drawPlugin(width, height);
-}
-
-void BackgroundPlugin::surfaceDestroyed() {
+    // load the appropriate java class and instantiate it
     JNIEnv* env = NULL;
-    if (m_surface && m_vm->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
+    if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
+        gLogI.log(kError_ANPLogType, " ---- getSurface: failed to get env");
+        return NULL;
+    }
+
+    const char* className = "com.android.sampleplugin.BackgroundSurface";
+    jclass backgroundClass = gSystemI.loadJavaClass(inst(), className);
+
+    if(!backgroundClass) {
+        gLogI.log(kError_ANPLogType, " ---- getSurface: failed to load class");
+        return NULL;
+    }
+
+    jmethodID constructor = env->GetMethodID(backgroundClass, "<init>", "(Landroid/content/Context;)V");
+    jobject backgroundSurface = env->NewObject(backgroundClass, constructor, m_context);
+
+    if(!backgroundSurface) {
+        gLogI.log(kError_ANPLogType, " ---- getSurface: failed to construct object");
+        return NULL;
+    }
+
+    m_surface = env->NewGlobalRef(backgroundSurface);
+    return m_surface;
+}
+
+void BackgroundPlugin::destroySurface() {
+    JNIEnv* env = NULL;
+    if (m_surface && gVM->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
         env->DeleteGlobalRef(m_surface);
         m_surface = NULL;
     }
@@ -109,7 +137,7 @@
 
     // check to make sure the zoom level is uniform
     if (zoomFactorW + .01 < zoomFactorH && zoomFactorW - .01 > zoomFactorH)
-        gLogI.log(inst(), kError_ANPLogType, " ------ %p zoom is out of sync (%f,%f)",
+        gLogI.log(kError_ANPLogType, " ------ %p zoom is out of sync (%f,%f)",
                   inst(), zoomFactorW, zoomFactorH);
 
     // scale the variables based on the zoom level
@@ -119,9 +147,9 @@
     // lock the surface
     ANPBitmap bitmap;
     JNIEnv* env = NULL;
-    if (!m_surface || m_vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK ||
+    if (!m_surface || gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK ||
         !gSurfaceI.lock(env, m_surface, &bitmap, NULL)) {
-        gLogI.log(inst(), kError_ANPLogType, " ------ %p unable to lock the plugin", inst());
+        gLogI.log(kError_ANPLogType, " ------ %p unable to lock the plugin", inst());
         return;
     }
 
@@ -154,19 +182,26 @@
 int16 BackgroundPlugin::handleEvent(const ANPEvent* evt) {
     switch (evt->eventType) {
         case kDraw_ANPEventType:
-            gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request draw events", inst());
+            gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request draw events", inst());
             break;
         case kLifecycle_ANPEventType:
             if (evt->data.lifecycle.action == kOnLoad_ANPLifecycleAction) {
-                gLogI.log(inst(), kDebug_ANPLogType, " ------ %p the plugin received an onLoad event", inst());
+                gLogI.log(kDebug_ANPLogType, " ------ %p the plugin received an onLoad event", inst());
                 return 1;
             }
             break;
         case kTouch_ANPEventType:
-            gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request touch events", inst());
+            if (kDown_ANPTouchAction == evt->data.touch.action)
+                return kHandleLongPress_ANPTouchResult | kHandleDoubleTap_ANPTouchResult;
+            else if (kLongPress_ANPTouchAction == evt->data.touch.action) {
+                browser->geturl(inst(), "javascript:alert('Detected long press event.')", 0);
+                gWindowI.requestFullScreen(inst());
+            }
+            else if (kDoubleTap_ANPTouchAction == evt->data.touch.action)
+                browser->geturl(inst(), "javascript:alert('Detected double tap event.')", 0);
             break;
         case kKey_ANPEventType:
-            gLogI.log(inst(), kError_ANPLogType, " ------ %p the plugin did not request key events", inst());
+            gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request key events", inst());
             break;
         default:
             break;
@@ -183,9 +218,9 @@
     NPP instance = this->inst();
 
     //LOG_ERROR(instance, " ------ %p Testing Log Error", instance);
-    gLogI.log(instance, kError_ANPLogType, " ------ %p Testing Log Error", instance);
-    gLogI.log(instance, kWarning_ANPLogType, " ------ %p Testing Log Warning", instance);
-    gLogI.log(instance, kDebug_ANPLogType, " ------ %p Testing Log Debug", instance);
+    gLogI.log(kError_ANPLogType, " ------ %p Testing Log Error", instance);
+    gLogI.log(kWarning_ANPLogType, " ------ %p Testing Log Warning", instance);
+    gLogI.log(kDebug_ANPLogType, " ------ %p Testing Log Debug", instance);
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -223,13 +258,13 @@
 }
 
 static void timer_oneshot(NPP instance, uint32 timerID) {
-    gLogI.log(instance, kDebug_ANPLogType, "-------- oneshot timer\n");
+    gLogI.log(kDebug_ANPLogType, "-------- oneshot timer\n");
 }
 
 static void timer_repeat(NPP instance, uint32 timerID) {
     BackgroundPlugin *obj = ((BackgroundPlugin*) ((PluginObject*) instance->pdata)->activePlugin);
 
-    gLogI.log(instance, kDebug_ANPLogType, "-------- repeat timer %d\n",
+    gLogI.log(kDebug_ANPLogType, "-------- repeat timer %d\n",
               obj->mTimerRepeatCount);
     if (--obj->mTimerRepeatCount == 0) {
         browser->unscheduletimer(instance, timerID);
@@ -237,7 +272,7 @@
 }
 
 static void timer_neverfires(NPP instance, uint32 timerID) {
-    gLogI.log(instance, kError_ANPLogType, "-------- timer_neverfires!!!\n");
+    gLogI.log(kError_ANPLogType, "-------- timer_neverfires!!!\n");
 }
 
 static void timer_latency(NPP instance, uint32 timerID) {
@@ -254,7 +289,7 @@
 
     obj->mPrevTime = now;
 
-    gLogI.log(instance, kDebug_ANPLogType,
+    gLogI.log(kDebug_ANPLogType,
               "-------- latency test: [%3d] interval %d expected %d, total %d expected %d, drift %d avg %d\n",
               obj->mTimerLatencyCurrentCount, interval, TIMER_INTERVAL, dur,
               expectedDur, drift, avgDrift);
@@ -289,7 +324,7 @@
     ANPPixelPacking packing;
     for (size_t i = 0; i < ARRAY_COUNT(gRecs); i++) {
         if (gBitmapI.getPixelPacking(gRecs[i].fFormat, &packing)) {
-            gLogI.log(instance, kDebug_ANPLogType,
+            gLogI.log(kDebug_ANPLogType,
                       "pixel format [%d] %s has packing ARGB [%d %d] [%d %d] [%d %d] [%d %d]\n",
                       gRecs[i].fFormat, gRecs[i].fName,
                       packing.AShift, packing.ABits,
@@ -297,7 +332,7 @@
                       packing.GShift, packing.GBits,
                       packing.BShift, packing.BBits);
         } else {
-            gLogI.log(instance, kDebug_ANPLogType,
+            gLogI.log(kDebug_ANPLogType,
                       "pixel format [%d] %s has no packing\n",
                       gRecs[i].fFormat, gRecs[i].fName);
         }
@@ -310,18 +345,18 @@
     // check default & set transparent
     if (!mFinishedStageOne) {
 
-        gLogI.log(instance, kDebug_ANPLogType, "BEGIN: testing bitmap transparency");
+        gLogI.log(kDebug_ANPLogType, "BEGIN: testing bitmap transparency");
 
         //check to make sure it is not transparent
         if (evt->data.draw.data.bitmap.format == kRGBA_8888_ANPBitmapFormat) {
-            gLogI.log(instance, kError_ANPLogType, "bitmap default format is transparent");
+            gLogI.log(kError_ANPLogType, "bitmap default format is transparent");
         }
 
         //make it transparent (any non-null value will set it to true)
         bool value = true;
         NPError err = browser->setvalue(instance, NPPVpluginTransparentBool, &value);
         if (err != NPERR_NO_ERROR) {
-            gLogI.log(instance, kError_ANPLogType, "Error setting transparency.");
+            gLogI.log(kError_ANPLogType, "Error setting transparency.");
         }
 
         mFinishedStageOne = true;
@@ -332,13 +367,13 @@
 
         //check to make sure it is transparent
         if (evt->data.draw.data.bitmap.format != kRGBA_8888_ANPBitmapFormat) {
-            gLogI.log(instance, kError_ANPLogType, "bitmap did not change to transparent format");
+            gLogI.log(kError_ANPLogType, "bitmap did not change to transparent format");
         }
 
         //make it opaque
         NPError err = browser->setvalue(instance, NPPVpluginTransparentBool, NULL);
         if (err != NPERR_NO_ERROR) {
-            gLogI.log(instance, kError_ANPLogType, "Error setting transparency.");
+            gLogI.log(kError_ANPLogType, "Error setting transparency.");
         }
 
         mFinishedStageTwo = true;
@@ -348,10 +383,10 @@
 
         //check to make sure it is not transparent
         if (evt->data.draw.data.bitmap.format == kRGBA_8888_ANPBitmapFormat) {
-            gLogI.log(instance, kError_ANPLogType, "bitmap default format is transparent");
+            gLogI.log(kError_ANPLogType, "bitmap default format is transparent");
         }
 
-        gLogI.log(instance, kDebug_ANPLogType, "END: testing bitmap transparency");
+        gLogI.log(kDebug_ANPLogType, "END: testing bitmap transparency");
 
         mFinishedStageThree = true;
     }
@@ -364,14 +399,14 @@
 void BackgroundPlugin::test_domAccess() {
     NPP instance = this->inst();
 
-    gLogI.log(instance, kDebug_ANPLogType, " ------ %p Testing DOM Access", instance);
+    gLogI.log(kDebug_ANPLogType, " ------ %p Testing DOM Access", instance);
 
     // Get the plugin's DOM object
     NPObject* windowObject = NULL;
     browser->getvalue(instance, NPNVWindowNPObject, &windowObject);
 
     if (!windowObject)
-        gLogI.log(instance, kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", instance);
+        gLogI.log(kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", instance);
 
     // Retrieve a property from the plugin's DOM object
     NPIdentifier topIdentifier = browser->getstringidentifier("top");
@@ -379,7 +414,7 @@
     browser->getproperty(instance, windowObject, topIdentifier, &topObjectVariant);
 
     if (topObjectVariant.type != NPVariantType_Object)
-        gLogI.log(instance, kError_ANPLogType, " ------ %p Invalid Variant type for DOM Property: %d,%d", instance, topObjectVariant.type, NPVariantType_Object);
+        gLogI.log(kError_ANPLogType, " ------ %p Invalid Variant type for DOM Property: %d,%d", instance, topObjectVariant.type, NPVariantType_Object);
 }
 
 
@@ -391,14 +426,14 @@
 void BackgroundPlugin::test_javascript() {
     NPP instance = this->inst();
 
-    gLogI.log(instance, kDebug_ANPLogType, " ------ %p Testing JavaScript Access", instance);
+    gLogI.log(kDebug_ANPLogType, " ------ %p Testing JavaScript Access", instance);
 
     // Get the plugin's DOM object
     NPObject* windowObject = NULL;
     browser->getvalue(instance, NPNVWindowNPObject, &windowObject);
 
     if (!windowObject)
-        gLogI.log(instance, kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", instance);
+        gLogI.log(kError_ANPLogType, " ------ %p Unable to retrieve DOM Window", instance);
 
     // create a string (JS code) that is stored in memory allocated by the browser
     const char* jsString = "1200 + 34";
@@ -409,15 +444,51 @@
     NPString script = { (char*)stringMem, strlen(jsString) };
     NPVariant scriptVariant;
     if (!browser->evaluate(instance, windowObject, &script, &scriptVariant))
-        gLogI.log(instance, kError_ANPLogType, " ------ %p Unable to eval the JS.", instance);
+        gLogI.log(kError_ANPLogType, " ------ %p Unable to eval the JS.", instance);
 
     if (scriptVariant.type == NPVariantType_Int32) {
         if (scriptVariant.value.intValue != 1234)
-            gLogI.log(instance, kError_ANPLogType, " ------ %p Invalid Value for JS Return: %d,1234", instance, scriptVariant.value.intValue);
+            gLogI.log(kError_ANPLogType, " ------ %p Invalid Value for JS Return: %d,1234", instance, scriptVariant.value.intValue);
     } else {
-        gLogI.log(instance, kError_ANPLogType, " ------ %p Invalid Variant type for JS Return: %d,%d", instance, scriptVariant.type, NPVariantType_Int32);
+        gLogI.log(kError_ANPLogType, " ------ %p Invalid Variant type for JS Return: %d,%d", instance, scriptVariant.type, NPVariantType_Int32);
     }
 
     // free the memory allocated within the browser
     browser->memfree(stringMem);
 }
+
+///////////////////////////////////////////////////////////////////////////////
+// Load Java Classes Tests
+///////////////////////////////////////////////////////////////////////////////
+
+void BackgroundPlugin::test_loadJavaClass() {
+
+    JNIEnv* env = NULL;
+    if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
+        gLogI.log(kError_ANPLogType, " ---- LoadJavaTest: failed to get env");
+        return;
+    }
+
+    const char* className = "com.android.sampleplugin.BackgroundTest";
+    jclass backgroundClass = gSystemI.loadJavaClass(inst(), className);
+
+    if(!backgroundClass) {
+        gLogI.log(kError_ANPLogType, " ---- LoadJavaTest: failed to load class");
+        return;
+    }
+
+    jmethodID constructor = env->GetMethodID(backgroundClass, "<init>", "()V");
+    jmethodID addMethod = env->GetMethodID(backgroundClass, "addInt", "(II)I");
+    jobject backgroundObject = env->NewObject(backgroundClass, constructor);
+
+    if(!backgroundObject) {
+        gLogI.log(kError_ANPLogType, " ---- LoadJavaTest: failed to construct object");
+        return;
+    }
+
+    jint result = env->CallIntMethod(backgroundObject, addMethod, 2, 2);
+
+    if (result != 4) {
+        gLogI.log(kError_ANPLogType, " ---- LoadJavaTest: invalid result (%d != 4)", result);
+    }
+}
diff --git a/samples/BrowserPlugin/jni/background/BackgroundPlugin.h b/samples/BrowserPlugin/jni/background/BackgroundPlugin.h
index 3b9c7ba..ebd77d1 100644
--- a/samples/BrowserPlugin/jni/background/BackgroundPlugin.h
+++ b/samples/BrowserPlugin/jni/background/BackgroundPlugin.h
@@ -32,12 +32,8 @@
 public:
     BackgroundPlugin(NPP inst);
     virtual ~BackgroundPlugin();
-    virtual bool supportsDrawingModel(ANPDrawingModel);
     virtual int16 handleEvent(const ANPEvent* evt);
-    virtual void surfaceCreated(JNIEnv* env, jobject surface);
-    virtual void surfaceChanged(int format, int width, int height);
-    virtual void surfaceDestroyed();
-    virtual bool isFixedSurface();
+    virtual jobject getSurface();
 
     // Timer Testing Variables
     uint32_t mStartTime;
@@ -53,9 +49,9 @@
 
 private:
     void drawPlugin(int surfaceWidth, int surfaceHeight);
+    void destroySurface();
 
     jobject     m_surface;
-    JavaVM*     m_vm;
 
     void test_logging();
     void test_timers();
@@ -63,6 +59,7 @@
     void test_bitmap_transparency(const ANPEvent* evt);
     void test_domAccess();
     void test_javascript();
+    void test_loadJavaClass();
 
 };
 
diff --git a/samples/BrowserPlugin/jni/form/FormPlugin.cpp b/samples/BrowserPlugin/jni/form/FormPlugin.cpp
index a92d447..5a536d9 100644
--- a/samples/BrowserPlugin/jni/form/FormPlugin.cpp
+++ b/samples/BrowserPlugin/jni/form/FormPlugin.cpp
@@ -100,7 +100,7 @@
     ANPEventFlags flags = kKey_ANPEventFlag;
     NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
     if (err != NPERR_NO_ERROR) {
-        gLogI.log(inst, kError_ANPLogType, "Error selecting input events.");
+        gLogI.log(kError_ANPLogType, "Error selecting input events.");
     }
 }
 
@@ -215,7 +215,7 @@
 
         case kLifecycle_ANPEventType:
             if (evt->data.lifecycle.action == kLoseFocus_ANPLifecycleAction) {
-                gLogI.log(instance, kDebug_ANPLogType, "----%p Loosing Focus", instance);
+                gLogI.log(kDebug_ANPLogType, "----%p Loosing Focus", instance);
 
                 if (m_activeInput) {
                     // hide the keyboard
@@ -230,7 +230,7 @@
                 return 1;
             }
             else if (evt->data.lifecycle.action == kGainFocus_ANPLifecycleAction) {
-                gLogI.log(instance, kDebug_ANPLogType, "----%p Gaining Focus", instance);
+                gLogI.log(kDebug_ANPLogType, "----%p Gaining Focus", instance);
                 m_hasFocus = true;
                 inval(instance);
                 return 1;
@@ -300,7 +300,7 @@
 bool FormPlugin::handleNavigation(ANPKeyCode keyCode) {
     NPP instance = this->inst();
 
-    gLogI.log(instance, kDebug_ANPLogType, "----%p Recvd Nav Key %d", instance, keyCode);
+    gLogI.log(kDebug_ANPLogType, "----%p Recvd Nav Key %d", instance, keyCode);
 
     if (!m_activeInput) {
         gWindowI.showKeyboard(instance, true);
@@ -350,7 +350,7 @@
     input->text[input->charPtr] = static_cast<char>(unichar);
     input->charPtr++;
 
-    gLogI.log(instance, kDebug_ANPLogType, "----%p Text:  %c", instance, unichar);
+    gLogI.log(kDebug_ANPLogType, "----%p Text:  %c", instance, unichar);
 }
 
 void FormPlugin::scrollIntoView(TextInput* input) {
diff --git a/samples/BrowserPlugin/jni/hello-jni.cpp b/samples/BrowserPlugin/jni/hello-jni.cpp
deleted file mode 100644
index 0789b7e..0000000
--- a/samples/BrowserPlugin/jni/hello-jni.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2009 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.
- *
- */
-#include <string.h>
-#include <jni.h>
-#include <JNIHelp.h>
-#include <utils/Log.h>
-
-#define EXPORT __attribute__((visibility("default")))
-
-static jstring stringFromJNI( JNIEnv* env, jobject thiz )
-{
-    return env->NewStringUTF("Hello from JNI !");
-}
-
-/*
- * JNI registration.
- */
-static JNINativeMethod gJavaSamplePluginStubMethods[] = {
-    { "nativeStringFromJNI", "()Ljava/lang/String;", (void*) stringFromJNI },
-};
-
-EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
-
-    JNIEnv* env = NULL;
-
-    if (vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
-        return -1;
-    }
-
-    jniRegisterNativeMethods(env, "com/android/sampleplugin/SamplePluginStub",
-                             gJavaSamplePluginStubMethods, NELEM(gJavaSamplePluginStubMethods));
-
-    return JNI_VERSION_1_4;
-}
diff --git a/samples/BrowserPlugin/jni/jni-bridge.cpp b/samples/BrowserPlugin/jni/jni-bridge.cpp
index 45ecd54..9ba8a32 100644
--- a/samples/BrowserPlugin/jni/jni-bridge.cpp
+++ b/samples/BrowserPlugin/jni/jni-bridge.cpp
@@ -23,51 +23,48 @@
 
 #define EXPORT __attribute__((visibility("default")))
 
-static SurfaceSubPlugin* getPluginObject(int npp) {
-    NPP instance = (NPP)npp;
-    PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
-    if (obj && obj->activePlugin
-            && obj->activePlugin->supportsDrawingModel(kSurface_ANPDrawingModel)) {
-        return static_cast<SurfaceSubPlugin*>(obj->activePlugin);
-    }
-    return NULL;
-}
+extern ANPEventInterfaceV0         gEventI;
 
 static void surfaceCreated(JNIEnv* env, jobject thiz, jint npp, jobject surface) {
-    SurfaceSubPlugin* obj = getPluginObject(npp);
 
-    //TODO why is this VM different from the one in NP_INIT...
-    JavaVM* vm = NULL;
-    env->GetJavaVM(&vm);
+    // send custom event
+    ANPEvent event;
+    event.inSize = sizeof(ANPEvent);
+    event.eventType = kCustom_ANPEventType;
+    event.data.other[0] = kSurfaceCreated_CustomEvent;
 
-    obj->surfaceCreated(env, surface);
+    gEventI.postEvent((NPP)npp, &event);
 }
 
 static void surfaceChanged(JNIEnv* env, jobject thiz, jint npp, jint format, jint width, jint height) {
-    SurfaceSubPlugin* obj = getPluginObject(npp);
-    obj->surfaceChanged(format, width, height);
+    // send custom event
+    ANPEvent event;
+    event.inSize = sizeof(ANPEvent);
+    event.eventType = kCustom_ANPEventType;
+    event.data.other[0] = kSurfaceChanged_CustomEvent;
+    event.data.other[1] = width;
+    event.data.other[2] = height;
+
+    gEventI.postEvent((NPP)npp, &event);
 }
 
 static void surfaceDestroyed(JNIEnv* env, jobject thiz, jint npp) {
-    SurfaceSubPlugin* obj = getPluginObject(npp);
-    if (obj) {
-        obj->surfaceDestroyed();
-    }
-}
+    // send custom event
+    ANPEvent event;
+    event.inSize = sizeof(ANPEvent);
+    event.eventType = kCustom_ANPEventType;
+    event.data.other[0] = kSurfaceDestroyed_CustomEvent;
 
-static jboolean isFixedSurface(JNIEnv* env, jobject thiz, jint npp) {
-    SurfaceSubPlugin* obj = getPluginObject(npp);
-    return obj->isFixedSurface();
+    gEventI.postEvent((NPP)npp, &event);
 }
 
 /*
  * JNI registration.
  */
-static JNINativeMethod gJavaSamplePluginStubMethods[] = {
-    { "nativeSurfaceCreated", "(ILandroid/view/View;)V", (void*) surfaceCreated },
+static JNINativeMethod gPaintSurfaceMethods[] = {
+    { "nativeSurfaceCreated", "(I)V", (void*) surfaceCreated },
     { "nativeSurfaceChanged", "(IIII)V", (void*) surfaceChanged },
     { "nativeSurfaceDestroyed", "(I)V", (void*) surfaceDestroyed },
-    { "nativeIsFixedSurface", "(I)Z", (void*) isFixedSurface },
 };
 
 EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) {
@@ -78,8 +75,8 @@
         return -1;
     }
 
-    jniRegisterNativeMethods(env, "com/android/sampleplugin/SamplePluginStub",
-                             gJavaSamplePluginStubMethods, NELEM(gJavaSamplePluginStubMethods));
+    jniRegisterNativeMethods(env, "com/android/sampleplugin/PaintSurface",
+                             gPaintSurfaceMethods, NELEM(gPaintSurfaceMethods));
 
     return JNI_VERSION_1_4;
 }
diff --git a/samples/BrowserPlugin/jni/main.cpp b/samples/BrowserPlugin/jni/main.cpp
index d00091f..3e8fee7 100644
--- a/samples/BrowserPlugin/jni/main.cpp
+++ b/samples/BrowserPlugin/jni/main.cpp
@@ -32,9 +32,13 @@
 #include "AudioPlugin.h"
 #include "BackgroundPlugin.h"
 #include "FormPlugin.h"
+#include "NavigationPlugin.h"
 #include "PaintPlugin.h"
+#include "VideoPlugin.h"
 
 NPNetscapeFuncs* browser;
+JavaVM* gVM;
+
 #define EXPORT __attribute__((visibility("default")))
 
 NPError NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
@@ -56,7 +60,7 @@
 NPError NPP_SetValue(NPP instance, NPNVariable variable, void *value);
 
 extern "C" {
-EXPORT NPError NP_Initialize(NPNetscapeFuncs* browserFuncs, NPPluginFuncs* pluginFuncs, void *java_env, void *application_context);
+EXPORT NPError NP_Initialize(NPNetscapeFuncs* browserFuncs, NPPluginFuncs* pluginFuncs, void *java_env);
 EXPORT NPError NP_GetValue(NPP instance, NPPVariable variable, void *value);
 EXPORT const char* NP_GetMIMEDescription(void);
 EXPORT void NP_Shutdown(void);
@@ -65,6 +69,7 @@
 ANPAudioTrackInterfaceV0    gSoundI;
 ANPBitmapInterfaceV0        gBitmapI;
 ANPCanvasInterfaceV0        gCanvasI;
+ANPEventInterfaceV0         gEventI;
 ANPLogInterfaceV0           gLogI;
 ANPPaintInterfaceV0         gPaintI;
 ANPPathInterfaceV0          gPathI;
@@ -76,7 +81,7 @@
 #define ARRAY_COUNT(array)      (sizeof(array) / sizeof(array[0]))
 #define DEBUG_PLUGIN_EVENTS     0
 
-NPError NP_Initialize(NPNetscapeFuncs* browserFuncs, NPPluginFuncs* pluginFuncs, void *java_env, void *application_context)
+NPError NP_Initialize(NPNetscapeFuncs* browserFuncs, NPPluginFuncs* pluginFuncs, void *java_env)
 {
     // Make sure we have a function table equal or larger than we are built against.
     if (browserFuncs->size < sizeof(NPNetscapeFuncs)) {
@@ -112,6 +117,7 @@
         { kAudioTrackInterfaceV0_ANPGetValue,   sizeof(gSoundI),    &gSoundI },
         { kBitmapInterfaceV0_ANPGetValue,       sizeof(gBitmapI),   &gBitmapI },
         { kCanvasInterfaceV0_ANPGetValue,       sizeof(gCanvasI),   &gCanvasI },
+        { kEventInterfaceV0_ANPGetValue,        sizeof(gEventI),    &gEventI },
         { kLogInterfaceV0_ANPGetValue,          sizeof(gLogI),      &gLogI },
         { kPaintInterfaceV0_ANPGetValue,        sizeof(gPaintI),    &gPaintI },
         { kPathInterfaceV0_ANPGetValue,         sizeof(gPathI),     &gPathI },
@@ -128,6 +134,10 @@
         }
     }
 
+    // store the JavaVM for the plugin
+    JNIEnv* env = (JNIEnv*)java_env;
+    env->GetJavaVM(&gVM);
+
     return NPERR_NO_ERROR;
 }
 
@@ -150,9 +160,8 @@
 
     // Scripting functions appeared in NPAPI version 14
     if (browser->version >= 14) {
-    instance->pdata = browser->createobject (instance, getPluginClass());
-    obj = static_cast<PluginObject*>(instance->pdata);
-    bzero(obj, sizeof(*obj));
+        instance->pdata = browser->createobject (instance, getPluginClass());
+        obj = static_cast<PluginObject*>(instance->pdata);
     }
     /* END: STANDARD PLUGIN FRAMEWORK */
 
@@ -167,34 +176,25 @@
             else if (!strcmp(argv[i], "Surface")) {
                model = kSurface_ANPDrawingModel;
             }
-            gLogI.log(instance, kDebug_ANPLogType, "------ %p DrawingModel is %d", instance, model);
+            gLogI.log(kDebug_ANPLogType, "------ %p DrawingModel is %d", instance, model);
             break;
         }
     }
 
-    // notify the plugin API of the location of the java interface
-    char* className = "com.android.sampleplugin.SamplePluginStub";
-    NPError npErr = browser->setvalue(instance, kSetPluginStubJavaClassName_ANPSetValue,
-                                      reinterpret_cast<void*>(className));
-    if (npErr) {
-        gLogI.log(instance, kError_ANPLogType, "set class err %d", npErr);
-        return npErr;
-    }
-
     // notify the plugin API of the drawing model we wish to use. This must be
     // done prior to creating certain subPlugin objects (e.g. surfaceViews)
     NPError err = browser->setvalue(instance, kRequestDrawingModel_ANPSetValue,
                             reinterpret_cast<void*>(model));
     if (err) {
-        gLogI.log(instance, kError_ANPLogType, "request model %d err %d", model, err);
+        gLogI.log(kError_ANPLogType, "request model %d err %d", model, err);
         return err;
     }
 
     const char* path = gSystemI.getApplicationDataDirectory();
     if (path) {
-        gLogI.log(instance, kDebug_ANPLogType, "Application data dir is %s", path);
+        gLogI.log(kDebug_ANPLogType, "Application data dir is %s", path);
     } else {
-        gLogI.log(instance, kError_ANPLogType, "Can't find Application data dir");
+        gLogI.log(kError_ANPLogType, "Can't find Application data dir");
     }
 
     // select the pluginType
@@ -216,35 +216,62 @@
                 obj->pluginType = kForm_PluginType;
                 obj->activePlugin = new FormPlugin(instance);
             }
+            else if (!strcmp(argv[i], "Navigation")) {
+                obj->pluginType = kNavigation_PluginType;
+                obj->activePlugin = new NavigationPlugin(instance);
+            }
             else if (!strcmp(argv[i], "Paint")) {
                 obj->pluginType = kPaint_PluginType;
                 obj->activePlugin = new PaintPlugin(instance);
             }
-            gLogI.log(instance, kDebug_ANPLogType, "------ %p PluginType is %d", instance, obj->pluginType);
+            else if (!strcmp(argv[i], "Video")) {
+                obj->pluginType = kVideo_PluginType;
+                obj->activePlugin = new VideoPlugin(instance);
+            }
+            gLogI.log(kDebug_ANPLogType, "------ %p PluginType is %d", instance, obj->pluginType);
             break;
         }
     }
 
     // if no pluginType is specified then default to Animation
     if (!obj->pluginType) {
-        gLogI.log(instance, kError_ANPLogType, "------ %p No PluginType attribute was found", instance);
+        gLogI.log(kError_ANPLogType, "------ %p No PluginType attribute was found", instance);
         obj->pluginType = kAnimation_PluginType;
         obj->activePlugin = new BallAnimation(instance);
     }
 
     // check to ensure the pluginType supports the model
     if (!obj->activePlugin->supportsDrawingModel(model)) {
-        gLogI.log(instance, kError_ANPLogType, "------ %p Unsupported DrawingModel (%d)", instance, model);
+        gLogI.log(kError_ANPLogType, "------ %p Unsupported DrawingModel (%d)", instance, model);
         return NPERR_GENERIC_ERROR;
     }
 
+    // if the plugin uses the surface drawing model then set the java context
+    if (model == kSurface_ANPDrawingModel) {
+        SurfaceSubPlugin* surfacePlugin = static_cast<SurfaceSubPlugin*>(obj->activePlugin);
+
+        jobject context;
+        NPError err = browser->getvalue(instance, kJavaContext_ANPGetValue,
+                                        static_cast<void*>(&context));
+        if (err) {
+            gLogI.log(kError_ANPLogType, "request context err: %d", err);
+            return err;
+        }
+
+        surfacePlugin->setContext(context);
+    }
+
+
     return NPERR_NO_ERROR;
 }
 
 NPError NPP_Destroy(NPP instance, NPSavedData** save)
 {
     PluginObject *obj = (PluginObject*) instance->pdata;
-    delete obj->activePlugin;
+    if (obj) {
+        delete obj->activePlugin;
+        browser->releaseobject(&obj->header);
+    }
 
     return NPERR_NO_ERROR;
 }
@@ -306,7 +333,7 @@
                 static ANPBitmapFormat currentFormat = -1;
                 if (evt->data.draw.data.bitmap.format != currentFormat) {
                     currentFormat = evt->data.draw.data.bitmap.format;
-                    gLogI.log(instance, kDebug_ANPLogType, "---- %p Draw (bitmap)"
+                    gLogI.log(kDebug_ANPLogType, "---- %p Draw (bitmap)"
                               " clip=%d,%d,%d,%d format=%d", instance,
                               evt->data.draw.clip.left,
                               evt->data.draw.clip.top,
@@ -318,7 +345,7 @@
             break;
 
         case kKey_ANPEventType:
-            gLogI.log(instance, kDebug_ANPLogType, "---- %p Key action=%d"
+            gLogI.log(kDebug_ANPLogType, "---- %p Key action=%d"
                       " code=%d vcode=%d unichar=%d repeat=%d mods=%x", instance,
                       evt->data.key.action,
                       evt->data.key.nativeCode,
@@ -329,37 +356,37 @@
             break;
 
         case kLifecycle_ANPEventType:
-            gLogI.log(instance, kDebug_ANPLogType, "---- %p Lifecycle action=%d",
+            gLogI.log(kDebug_ANPLogType, "---- %p Lifecycle action=%d",
                                 instance, evt->data.lifecycle.action);
             break;
 
        case kTouch_ANPEventType:
-            gLogI.log(instance, kDebug_ANPLogType, "---- %p Touch action=%d [%d %d]",
+            gLogI.log(kDebug_ANPLogType, "---- %p Touch action=%d [%d %d]",
                       instance, evt->data.touch.action, evt->data.touch.x,
                       evt->data.touch.y);
             break;
 
        case kMouse_ANPEventType:
-            gLogI.log(instance, kDebug_ANPLogType, "---- %p Mouse action=%d [%d %d]",
+            gLogI.log(kDebug_ANPLogType, "---- %p Mouse action=%d [%d %d]",
                       instance, evt->data.mouse.action, evt->data.mouse.x,
                       evt->data.mouse.y);
             break;
 
        case kVisibleRect_ANPEventType:
-            gLogI.log(instance, kDebug_ANPLogType, "---- %p VisibleRect [%d %d %d %d]",
+            gLogI.log(kDebug_ANPLogType, "---- %p VisibleRect [%d %d %d %d]",
                       instance, evt->data.visibleRect.rect.left, evt->data.visibleRect.rect.top,
                       evt->data.visibleRect.rect.right, evt->data.visibleRect.rect.bottom);
             break;
 
         default:
-            gLogI.log(instance, kError_ANPLogType, "---- %p Unknown Event [%d]",
+            gLogI.log(kError_ANPLogType, "---- %p Unknown Event [%d]",
                       instance, evt->eventType);
             break;
     }
 #endif
 
     if(!obj->activePlugin) {
-        gLogI.log(instance, kError_ANPLogType, "the active plugin is null.");
+        gLogI.log(kError_ANPLogType, "the active plugin is null.");
         return 0; // unknown or unhandled event
     }
     else {
@@ -389,19 +416,37 @@
     return NPERR_GENERIC_ERROR;
 }
 
-NPError NPP_GetValue(NPP instance, NPPVariable variable, void *value)
+NPError NPP_GetValue(NPP instance, NPPVariable variable, void* value)
 {
     if (variable == NPPVpluginScriptableNPObject) {
         void **v = (void **)value;
         PluginObject *obj = (PluginObject*) instance->pdata;
 
         if (obj)
-            browser->retainobject((NPObject*)obj);
+            browser->retainobject(&obj->header);
 
-        *v = obj;
+        *v = &(obj->header);
         return NPERR_NO_ERROR;
     }
 
+    if (variable == kJavaSurface_ANPGetValue) {
+        //get the surface sub-plugin
+        PluginObject* obj = static_cast<PluginObject*>(instance->pdata);
+        if (obj && obj->activePlugin) {
+
+            if(obj->activePlugin->supportsDrawingModel(kSurface_ANPDrawingModel)) {
+                SurfaceSubPlugin* plugin = static_cast<SurfaceSubPlugin*>(obj->activePlugin);
+                jobject* surface = static_cast<jobject*>(value);
+                *surface = plugin->getSurface();
+                return NPERR_NO_ERROR;
+            } else {
+                gLogI.log(kError_ANPLogType,
+                          "-- %p Tried to retrieve surface for non-surface plugin",
+                          instance);
+            }
+        }
+    }
+
     return NPERR_GENERIC_ERROR;
 }
 
diff --git a/samples/BrowserPlugin/jni/main.h b/samples/BrowserPlugin/jni/main.h
index 8ad2cce..66629e6 100644
--- a/samples/BrowserPlugin/jni/main.h
+++ b/samples/BrowserPlugin/jni/main.h
@@ -28,5 +28,7 @@
 #include <npruntime.h>
 #include "android_npapi.h"
 #include "ANPSurface_npapi.h"
+#include "ANPSystem_npapi.h"
 
 extern NPNetscapeFuncs* browser;
+extern JavaVM* gVM;
diff --git a/samples/BrowserPlugin/jni/navigation/NavigationPlugin.cpp b/samples/BrowserPlugin/jni/navigation/NavigationPlugin.cpp
new file mode 100644
index 0000000..99667a4
--- /dev/null
+++ b/samples/BrowserPlugin/jni/navigation/NavigationPlugin.cpp
@@ -0,0 +1,242 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "NavigationPlugin.h"
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+extern NPNetscapeFuncs*         browser;
+extern ANPLogInterfaceV0        gLogI;
+extern ANPCanvasInterfaceV0     gCanvasI;
+extern ANPPaintInterfaceV0      gPaintI;
+extern ANPTypefaceInterfaceV0   gTypefaceI;
+extern ANPWindowInterfaceV0     gWindowI;
+
+
+static void inval(NPP instance) {
+    browser->invalidaterect(instance, NULL);
+}
+
+static uint16 rnd16(float x, int inset) {
+    int ix = (int)roundf(x) + inset;
+    if (ix < 0) {
+        ix = 0;
+    }
+    return static_cast<uint16>(ix);
+}
+
+static void inval(NPP instance, const ANPRectF& r, bool doAA) {
+    const int inset = doAA ? -1 : 0;
+
+    PluginObject *obj = reinterpret_cast<PluginObject*>(instance->pdata);
+    NPRect inval;
+    inval.left = rnd16(r.left, inset);
+    inval.top = rnd16(r.top, inset);
+    inval.right = rnd16(r.right, -inset);
+    inval.bottom = rnd16(r.bottom, -inset);
+    browser->invalidaterect(instance, &inval);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+NavigationPlugin::NavigationPlugin(NPP inst) : SubPlugin(inst) {
+
+    m_hasFocus = false;
+    m_activeNav = NULL;
+
+    m_paintDisabled = gPaintI.newPaint();
+    gPaintI.setFlags(m_paintDisabled, gPaintI.getFlags(m_paintDisabled) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paintDisabled, 0xFFFFFFFF);
+
+    m_paintActive = gPaintI.newPaint();
+    gPaintI.setFlags(m_paintActive, gPaintI.getFlags(m_paintActive) | kAntiAlias_ANPPaintFlag);
+    gPaintI.setColor(m_paintActive, 0xFFFFFF00);
+
+    //register for key events
+    ANPEventFlags flags = kKey_ANPEventFlag;
+    NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
+    if (err != NPERR_NO_ERROR) {
+        gLogI.log(kError_ANPLogType, "Error selecting input events.");
+    }
+}
+
+NavigationPlugin::~NavigationPlugin() {
+    gPaintI.deletePaint(m_paintDisabled);
+    gPaintI.deletePaint(m_paintActive);
+}
+
+bool NavigationPlugin::supportsDrawingModel(ANPDrawingModel model) {
+    return (model == kBitmap_ANPDrawingModel);
+}
+
+void NavigationPlugin::drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip) {
+    ANPCanvas* canvas = gCanvasI.newCanvas(&bitmap);
+
+    ANPRectF clipR;
+    clipR.left = clip.left;
+    clipR.top = clip.top;
+    clipR.right = clip.right;
+    clipR.bottom = clip.bottom;
+    gCanvasI.clipRect(canvas, &clipR);
+
+    draw(canvas);
+    gCanvasI.deleteCanvas(canvas);
+}
+
+void NavigationPlugin::draw(ANPCanvas* canvas) {
+    NPP instance = this->inst();
+    PluginObject *obj = (PluginObject*) instance->pdata;
+
+    const int W = obj->window->width;
+    const int H = obj->window->height;
+    const int Wm = W/2;
+    const int Hm = H/2;
+
+    // color the plugin canvas
+    gCanvasI.drawColor(canvas, (m_hasFocus) ? 0xFFCDCDCD : 0xFF545454);
+
+    // draw the nav up box (5 px from the top edge)
+    m_navUp.left = Wm - 15;
+    m_navUp.top = 5;
+    m_navUp.right = m_navUp.left + 30;
+    m_navUp.bottom = m_navUp.top + 30;
+    gCanvasI.drawRect(canvas, &m_navUp, getPaint(&m_navUp));
+
+    // draw the nav down box (5 px from the bottom edge)
+    m_navDown.left = Wm - 15;
+    m_navDown.top = H - (30 + 5);
+    m_navDown.right = m_navDown.left + 30;
+    m_navDown.bottom = m_navDown.top + 30;
+    gCanvasI.drawRect(canvas, &m_navDown, getPaint(&m_navDown));
+
+    // draw the nav left box (5 px from the left edge)
+    m_navLeft.left = 5;
+    m_navLeft.top = Hm - 15;
+    m_navLeft.right = m_navLeft.left + 30;
+    m_navLeft.bottom = m_navLeft.top + 30;
+    gCanvasI.drawRect(canvas, &m_navLeft, getPaint(&m_navLeft));
+
+    // draw the nav right box (5 px from the right edge)
+    m_navRight.left = W - (30 + 5);
+    m_navRight.top = Hm - 15;
+    m_navRight.right = m_navRight.left + 30;
+    m_navRight.bottom = m_navRight.top + 30;
+    gCanvasI.drawRect(canvas, &m_navRight, getPaint(&m_navRight));
+
+    // draw the nav center box
+    m_navCenter.left = Wm - 15;
+    m_navCenter.top = Hm - 15;
+    m_navCenter.right = m_navCenter.left + 30;
+    m_navCenter.bottom = m_navCenter.top + 30;
+    gCanvasI.drawRect(canvas, &m_navCenter, getPaint(&m_navCenter));
+
+    gLogI.log(kDebug_ANPLogType, "----%p Drawing Plugin", inst());
+}
+
+ANPPaint* NavigationPlugin::getPaint(ANPRectF* input) {
+    return (input == m_activeNav) ? m_paintActive : m_paintDisabled;
+}
+
+int16 NavigationPlugin::handleEvent(const ANPEvent* evt) {
+    NPP instance = this->inst();
+
+    switch (evt->eventType) {
+        case kDraw_ANPEventType:
+            switch (evt->data.draw.model) {
+                case kBitmap_ANPDrawingModel:
+                    drawPlugin(evt->data.draw.data.bitmap, evt->data.draw.clip);
+                    return 1;
+                default:
+                    break;   // unknown drawing model
+            }
+            break;
+
+        case kLifecycle_ANPEventType:
+            if (evt->data.lifecycle.action == kLoseFocus_ANPLifecycleAction) {
+                gLogI.log(kDebug_ANPLogType, "----%p Loosing Focus", instance);
+                m_hasFocus = false;
+                inval(instance);
+                return 1;
+            }
+            else if (evt->data.lifecycle.action == kGainFocus_ANPLifecycleAction) {
+                gLogI.log(kDebug_ANPLogType, "----%p Gaining Focus", instance);
+                m_hasFocus = true;
+                inval(instance);
+                return 1;
+            }
+            break;
+
+        case kMouse_ANPEventType:
+            return 1;
+
+        case kKey_ANPEventType:
+            if (evt->data.key.action == kDown_ANPKeyAction) {
+            	bool result = handleNavigation(evt->data.key.nativeCode);
+            	inval(instance);
+            	return result;
+            }
+            return 1;
+
+        default:
+            break;
+    }
+    return 0;   // unknown or unhandled event
+}
+
+bool NavigationPlugin::handleNavigation(ANPKeyCode keyCode) {
+    NPP instance = this->inst();
+
+    gLogI.log(kDebug_ANPLogType, "----%p Received Key %d", instance, keyCode);
+
+    switch (keyCode) {
+		case kDpadUp_ANPKeyCode:
+			m_activeNav = &m_navUp;
+			break;
+		case kDpadDown_ANPKeyCode:
+			m_activeNav = &m_navDown;
+			break;
+		case kDpadLeft_ANPKeyCode:
+			m_activeNav = &m_navLeft;
+			break;
+		case kDpadRight_ANPKeyCode:
+			m_activeNav = &m_navRight;
+			break;
+		case kDpadCenter_ANPKeyCode:
+			m_activeNav = &m_navCenter;
+			break;
+		case kQ_ANPKeyCode:
+		case kDel_ANPKeyCode:
+			m_activeNav = NULL;
+			return false;
+		default:
+			m_activeNav = NULL;
+			break;
+    }
+    return true;
+}
diff --git a/samples/BrowserPlugin/jni/navigation/NavigationPlugin.h b/samples/BrowserPlugin/jni/navigation/NavigationPlugin.h
new file mode 100644
index 0000000..ca12ae7
--- /dev/null
+++ b/samples/BrowserPlugin/jni/navigation/NavigationPlugin.h
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2010, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PluginObject.h"
+
+#ifndef navigationPlugin__DEFINED
+#define navigationPlugin__DEFINED
+
+class NavigationPlugin : public SubPlugin {
+public:
+	NavigationPlugin(NPP inst);
+    virtual ~NavigationPlugin();
+    virtual bool supportsDrawingModel(ANPDrawingModel);
+    virtual int16 handleEvent(const ANPEvent* evt);
+private:
+    void draw(ANPCanvas*);
+    void drawPlugin(const ANPBitmap& bitmap, const ANPRectI& clip);
+
+    bool        m_hasFocus;
+
+    ANPRectF*	m_activeNav;
+    ANPRectF	m_navUp;
+    ANPRectF	m_navDown;
+    ANPRectF	m_navLeft;
+    ANPRectF	m_navRight;
+    ANPRectF	m_navCenter;
+
+    ANPPaint*   m_paintDisabled;
+    ANPPaint*   m_paintActive;
+
+    bool handleNavigation(ANPKeyCode keyCode);
+    ANPPaint* getPaint(ANPRectF*);
+};
+
+#endif // navigationPlugin__DEFINED
diff --git a/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp b/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp
index 5b00dba..e478897 100644
--- a/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp
+++ b/samples/BrowserPlugin/jni/paint/PaintPlugin.cpp
@@ -35,6 +35,7 @@
 extern ANPPaintInterfaceV0      gPaintI;
 extern ANPPathInterfaceV0       gPathI;
 extern ANPSurfaceInterfaceV0    gSurfaceI;
+extern ANPSystemInterfaceV0     gSystemI;
 extern ANPTypefaceInterfaceV0   gTypefaceI;
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -52,12 +53,11 @@
 
     // initialize the drawing surface
     m_surface = NULL;
-    m_vm = NULL;
 
     // initialize the path
     m_touchPath = gPathI.newPath();
     if(!m_touchPath)
-        gLogI.log(inst, kError_ANPLogType, "----%p Unable to create the touch path", inst);
+        gLogI.log(kError_ANPLogType, "----%p Unable to create the touch path", inst);
 
     // initialize the paint colors
     m_paintSurface = gPaintI.newPaint();
@@ -78,7 +78,7 @@
     ANPEventFlags flags = kTouch_ANPEventFlag;
     NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
     if (err != NPERR_NO_ERROR) {
-        gLogI.log(inst, kError_ANPLogType, "Error selecting input events.");
+        gLogI.log(kError_ANPLogType, "Error selecting input events.");
     }
 }
 
@@ -86,18 +86,16 @@
     gPathI.deletePath(m_touchPath);
     gPaintI.deletePaint(m_paintSurface);
     gPaintI.deletePaint(m_paintButton);
-    surfaceDestroyed();
-}
 
-bool PaintPlugin::supportsDrawingModel(ANPDrawingModel model) {
-    return (model == kSurface_ANPDrawingModel);
+    setContext(NULL);
+    destroySurface();
 }
 
 ANPCanvas* PaintPlugin::getCanvas(ANPRectI* dirtyRect) {
 
     ANPBitmap bitmap;
     JNIEnv* env = NULL;
-    if (!m_surface || m_vm->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK ||
+    if (!m_surface || gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK ||
         !gSurfaceI.lock(env, m_surface, &bitmap, dirtyRect)) {
             return NULL;
         }
@@ -132,7 +130,7 @@
 
 void PaintPlugin::releaseCanvas(ANPCanvas* canvas) {
     JNIEnv* env = NULL;
-    if (m_surface && m_vm->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
+    if (m_surface && gVM->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
         gSurfaceI.unlock(env, m_surface);
     }
     gCanvasI.deleteCanvas(canvas);
@@ -212,30 +210,51 @@
         return "Red";
 }
 
-bool PaintPlugin::isFixedSurface() {
-    return true;
-}
+jobject PaintPlugin::getSurface() {
+    if (m_surface) {
+        return m_surface;
+    }
 
-void PaintPlugin::surfaceCreated(JNIEnv* env, jobject surface) {
-    env->GetJavaVM(&m_vm);
-    m_surface = env->NewGlobalRef(surface);
-    drawCleanPlugin();
-}
+    // load the appropriate java class and instantiate it
+    JNIEnv* env = NULL;
+    if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
+        gLogI.log(kError_ANPLogType, " ---- getSurface: failed to get env");
+        return NULL;
+    }
 
-void PaintPlugin::surfaceChanged(int format, int width, int height) {
-    // get the plugin's dimensions according to the DOM
+    const char* className = "com.android.sampleplugin.PaintSurface";
+    jclass paintClass = gSystemI.loadJavaClass(inst(), className);
+
+    if(!paintClass) {
+        gLogI.log(kError_ANPLogType, " ---- getSurface: failed to load class");
+        return NULL;
+    }
+
     PluginObject *obj = (PluginObject*) inst()->pdata;
     const int pW = obj->window->width;
     const int pH = obj->window->height;
-    // compare to the plugin's surface dimensions
-    if (pW != width || pH != height)
-        gLogI.log(inst(), kError_ANPLogType,
-                  "----%p Invalid Surface Dimensions (%d,%d):(%d,%d)",
-                  inst(), pW, pH, width, height);
+
+    jmethodID constructor = env->GetMethodID(paintClass, "<init>", "(Landroid/content/Context;III)V");
+    jobject paintSurface = env->NewObject(paintClass, constructor, m_context, (int)inst(), pW, pH);
+
+    if(!paintSurface) {
+        gLogI.log(kError_ANPLogType, " ---- getSurface: failed to construct object");
+        return NULL;
+    }
+
+    m_surface = env->NewGlobalRef(paintSurface);
+    return m_surface;
 }
-void PaintPlugin::surfaceDestroyed() {
+
+void PaintPlugin::destroySurface() {
     JNIEnv* env = NULL;
-    if (m_surface && m_vm->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
+    if (m_surface && gVM->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
+
+        // detach the native code from the object
+        jclass javaClass = env->GetObjectClass(m_surface);
+        jmethodID invalMethod = env->GetMethodID(javaClass, "invalidateNPP", "()V");
+        env->CallVoidMethod(m_surface, invalMethod);
+
         env->DeleteGlobalRef(m_surface);
         m_surface = NULL;
     }
@@ -277,7 +296,7 @@
         case kMouse_ANPEventType: {
 
             if (m_isTouchActive)
-                gLogI.log(inst(), kError_ANPLogType, "----%p Received unintended mouse event", inst());
+                gLogI.log(kError_ANPLogType, "----%p Received unintended mouse event", inst());
 
             if (kDown_ANPMouseAction == evt->data.mouse.action) {
                 ANPRectF* rect = validTouch(evt->data.mouse.x, evt->data.mouse.y);
@@ -292,6 +311,35 @@
             }
             return 1;
         }
+        case kCustom_ANPEventType: {
+
+            switch (evt->data.other[0]) {
+                case kSurfaceCreated_CustomEvent:
+                    gLogI.log(kDebug_ANPLogType, " ---- customEvent: surfaceCreated");
+                    drawCleanPlugin();
+                    break;
+                case kSurfaceChanged_CustomEvent: {
+                    gLogI.log(kDebug_ANPLogType, " ---- customEvent: surfaceChanged");
+
+                    int width = evt->data.other[1];
+                    int height = evt->data.other[2];
+
+                    PluginObject *obj = (PluginObject*) inst()->pdata;
+                    const int pW = obj->window->width;
+                    const int pH = obj->window->height;
+                    // compare to the plugin's surface dimensions
+                    if (pW != width || pH != height)
+                        gLogI.log(kError_ANPLogType,
+                                  "----%p Invalid Surface Dimensions (%d,%d):(%d,%d)",
+                                  inst(), pW, pH, width, height);
+                    break;
+                }
+                case kSurfaceDestroyed_CustomEvent:
+                    gLogI.log(kDebug_ANPLogType, " ---- customEvent: surfaceDestroyed");
+                    break;
+            }
+            break; // end KCustom_ANPEventType
+        }
         default:
             break;
     }
diff --git a/samples/BrowserPlugin/jni/paint/PaintPlugin.h b/samples/BrowserPlugin/jni/paint/PaintPlugin.h
index 8ff561c..4867a70 100644
--- a/samples/BrowserPlugin/jni/paint/PaintPlugin.h
+++ b/samples/BrowserPlugin/jni/paint/PaintPlugin.h
@@ -33,18 +33,15 @@
 public:
     PaintPlugin(NPP inst);
     virtual ~PaintPlugin();
-    virtual bool supportsDrawingModel(ANPDrawingModel);
     virtual int16 handleEvent(const ANPEvent* evt);
-    virtual void surfaceCreated(JNIEnv* env, jobject surface);
-    virtual void surfaceChanged(int format, int width, int height);
-    virtual void surfaceDestroyed();
-    virtual bool isFixedSurface();
+    virtual jobject getSurface();
 
 private:
     void        drawCleanPlugin(ANPCanvas* canvas = NULL);
     ANPCanvas*  getCanvas(ANPRectI* dirtyRect = NULL);
     ANPCanvas*  getCanvas(ANPRectF* dirtyRect);
     const char* getColorText();
+    void        destroySurface();
     void        paintMouse(int x, int y);
     void        paintTouch();
     void        releaseCanvas(ANPCanvas*);
@@ -55,7 +52,6 @@
     bool        m_isTouchActive;
     bool        m_isTouchCurrentInput;
 
-    JavaVM*     m_vm;
     jobject     m_surface;
     ANPPath*    m_touchPath;
 
diff --git a/samples/BrowserPlugin/jni/video/VideoPlugin.cpp b/samples/BrowserPlugin/jni/video/VideoPlugin.cpp
new file mode 100644
index 0000000..f24295b
--- /dev/null
+++ b/samples/BrowserPlugin/jni/video/VideoPlugin.cpp
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "VideoPlugin.h"
+#include "android_npapi.h"
+
+#include <stdio.h>
+#include <sys/time.h>
+#include <time.h>
+#include <math.h>
+#include <string.h>
+
+extern NPNetscapeFuncs*        browser;
+extern ANPBitmapInterfaceV0    gBitmapI;
+extern ANPCanvasInterfaceV0    gCanvasI;
+extern ANPLogInterfaceV0       gLogI;
+extern ANPPaintInterfaceV0     gPaintI;
+extern ANPSurfaceInterfaceV0   gSurfaceI;
+extern ANPSystemInterfaceV0    gSystemI;
+extern ANPTypefaceInterfaceV0  gTypefaceI;
+extern ANPWindowInterfaceV0    gWindowI;
+
+///////////////////////////////////////////////////////////////////////////////
+
+VideoPlugin::VideoPlugin(NPP inst) : SurfaceSubPlugin(inst) {
+
+    // initialize the drawing surface
+    m_surface = NULL;
+
+    //register for touch events
+    ANPEventFlags flags = kTouch_ANPEventFlag;
+    NPError err = browser->setvalue(inst, kAcceptEvents_ANPSetValue, &flags);
+    if (err != NPERR_NO_ERROR) {
+        gLogI.log(kError_ANPLogType, "Error selecting input events.");
+    }
+}
+
+VideoPlugin::~VideoPlugin() {
+    setContext(NULL);
+    destroySurface();
+}
+
+jobject VideoPlugin::getSurface() {
+
+    if (m_surface) {
+        return m_surface;
+    }
+
+    // load the appropriate java class and instantiate it
+    JNIEnv* env = NULL;
+    if (gVM->GetEnv((void**) &env, JNI_VERSION_1_4) != JNI_OK) {
+        gLogI.log(kError_ANPLogType, " ---- getSurface: failed to get env");
+        return NULL;
+    }
+
+    const char* className = "com.android.sampleplugin.VideoSurface";
+    jclass videoClass = gSystemI.loadJavaClass(inst(), className);
+
+    if(!videoClass) {
+        gLogI.log(kError_ANPLogType, " ---- getSurface: failed to load class");
+        return NULL;
+    }
+
+    jmethodID constructor = env->GetMethodID(videoClass, "<init>", "(Landroid/content/Context;)V");
+    jobject videoSurface = env->NewObject(videoClass, constructor, m_context);
+
+    if(!videoSurface) {
+        gLogI.log(kError_ANPLogType, " ---- getSurface: failed to construct object");
+        return NULL;
+    }
+
+    m_surface = env->NewGlobalRef(videoSurface);
+    return m_surface;
+}
+
+void VideoPlugin::destroySurface() {
+    JNIEnv* env = NULL;
+    if (m_surface && gVM->GetEnv((void**) &env, JNI_VERSION_1_4) == JNI_OK) {
+        env->DeleteGlobalRef(m_surface);
+        m_surface = NULL;
+    }
+}
+
+int16 VideoPlugin::handleEvent(const ANPEvent* evt) {
+    switch (evt->eventType) {
+        case kLifecycle_ANPEventType: {
+            switch (evt->data.lifecycle.action) {
+                case kEnterFullScreen_ANPLifecycleAction:
+                    gLogI.log(kDebug_ANPLogType, " ---- %p entering fullscreen", inst());
+                    break;
+                case kExitFullScreen_ANPLifecycleAction:
+                    gLogI.log(kDebug_ANPLogType, " ---- %p exiting fullscreen", inst());
+                    break;
+            }
+            break; // end kLifecycle_ANPEventType
+        }
+        case kDraw_ANPEventType:
+            gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request draw events", inst());
+            break;
+        case kTouch_ANPEventType:
+            if (kDown_ANPTouchAction == evt->data.touch.action) {
+                gLogI.log(kDebug_ANPLogType, " ------ %p requesting fullscreen mode", inst());
+                gWindowI.requestFullScreen(inst());
+            }
+            return 1;
+        case kKey_ANPEventType:
+            gLogI.log(kError_ANPLogType, " ------ %p the plugin did not request key events", inst());
+            break;
+        default:
+            break;
+    }
+    return 0;   // unknown or unhandled event
+}
diff --git a/samples/BrowserPlugin/jni/video/VideoPlugin.h b/samples/BrowserPlugin/jni/video/VideoPlugin.h
new file mode 100644
index 0000000..701e2d0
--- /dev/null
+++ b/samples/BrowserPlugin/jni/video/VideoPlugin.h
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "PluginObject.h"
+
+#ifndef videoPlugin__DEFINED
+#define videoPlugin__DEFINED
+
+class VideoPlugin : public SurfaceSubPlugin {
+public:
+    VideoPlugin(NPP inst);
+    virtual ~VideoPlugin();
+    virtual int16 handleEvent(const ANPEvent* evt);
+    virtual jobject getSurface();
+
+private:
+    void destroySurface();
+
+    jobject     m_surface;
+};
+
+#endif // videoPlugin__DEFINED
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundSurface.java b/samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundSurface.java
new file mode 100644
index 0000000..5af8c8e
--- /dev/null
+++ b/samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundSurface.java
@@ -0,0 +1,19 @@
+package com.android.sampleplugin;
+
+import android.content.Context;
+import android.graphics.Color;
+import android.widget.TextView;
+
+public class BackgroundSurface extends TextView {
+
+    public BackgroundSurface(Context context) {
+        super(context);
+
+        this.setBackgroundColor(Color.BLACK);
+        this.setTextColor(Color.WHITE);
+        this.setText("This is a java background plugin");
+
+        // ensure that the view system is aware that we will be drawing
+        this.setWillNotDraw(false);
+    }
+}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundTest.java b/samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundTest.java
new file mode 100644
index 0000000..1f6b0d4
--- /dev/null
+++ b/samples/BrowserPlugin/src/com/android/sampleplugin/BackgroundTest.java
@@ -0,0 +1,11 @@
+package com.android.sampleplugin;
+
+public class BackgroundTest {
+
+    public BackgroundTest() {}
+    
+    public int addInt(int x, int y) {
+        return x + y;
+    }
+    
+}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/PaintSurface.java b/samples/BrowserPlugin/src/com/android/sampleplugin/PaintSurface.java
new file mode 100644
index 0000000..9582bcc
--- /dev/null
+++ b/samples/BrowserPlugin/src/com/android/sampleplugin/PaintSurface.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.android.sampleplugin;
+
+import android.content.Context;
+import android.graphics.PixelFormat;
+import android.view.SurfaceHolder;
+import android.view.SurfaceView;
+import android.view.SurfaceHolder.Callback;
+
+public class PaintSurface extends SurfaceView {
+
+    static {
+        //needed for jni calls
+        System.loadLibrary("sampleplugin");
+    }
+
+    private final int npp;
+
+    private boolean validNPP = true;
+    private Object nppLock = new Object();
+
+    public PaintSurface(Context context, int NPP, int width, int height) {
+        super(context);
+
+        this.npp = NPP;
+
+        this.getHolder().setFormat(PixelFormat.RGBA_8888);
+        this.getHolder().addCallback(new Callback() {
+
+            public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
+                synchronized (nppLock) {
+                    if (validNPP) {
+                        nativeSurfaceChanged(npp, format, width, height);
+                    }
+                }
+            }
+
+            public void surfaceCreated(SurfaceHolder holder) {
+                synchronized (nppLock) {
+                    if (validNPP) {
+                        nativeSurfaceCreated(npp);
+                    }
+                }
+            }
+
+            public void surfaceDestroyed(SurfaceHolder holder) {
+                synchronized (nppLock) {
+                    if (validNPP) {
+                        nativeSurfaceDestroyed(npp);
+                    }
+                }
+            }
+        });
+
+        // sets the plugin's surface to a fixed size
+        this.getHolder().setFixedSize(width, height);
+
+        // ensure that the view system is aware that we will be drawing
+        this.setWillNotDraw(false);
+    }
+
+    // called by JNI
+    private void invalidateNPP() {
+        synchronized (nppLock) {
+            validNPP = false;
+        }
+    }
+
+    private native void nativeSurfaceCreated(int npp);
+    private native void nativeSurfaceChanged(int npp, int format, int width, int height);
+    private native void nativeSurfaceDestroyed(int npp);
+}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePlugin.java b/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePlugin.java
index 9b8ce95..b5b728e 100644
--- a/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePlugin.java
+++ b/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePlugin.java
@@ -1,3 +1,27 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
 package com.android.sampleplugin;
 
 import android.app.Service;
@@ -11,5 +35,4 @@
         // TODO Auto-generated method stub
         return null;
     }
-
 }
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePluginStub.java b/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePluginStub.java
deleted file mode 100644
index 3c0a0c7..0000000
--- a/samples/BrowserPlugin/src/com/android/sampleplugin/SamplePluginStub.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright (C) 2009 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.android.sampleplugin;
-
-import android.content.Context;
-import android.graphics.PixelFormat;
-import android.opengl.GLSurfaceView;
-import android.view.SurfaceHolder;
-import android.view.SurfaceView;
-import android.view.View;
-import android.view.WindowManager;
-import android.view.SurfaceHolder.Callback;
-import android.view.ViewGroup.LayoutParams;
-import android.webkit.PluginStub;
-import android.widget.FrameLayout;
-import android.widget.MediaController;
-import android.widget.VideoView;
-import com.android.sampleplugin.graphics.CubeRenderer;
-
-public class SamplePluginStub implements PluginStub {
-
-    static {
-        //needed for jni calls
-        System.loadLibrary("sampleplugin");
-    }
-    
-    public View getEmbeddedView(final int npp, Context context) {
-        
-        final SurfaceView view = new SurfaceView(context);
-
-        /* You can do all sorts of interesting operations on the surface view
-         * here. We illustrate a few of the important operations below.
-         */
-        
-        //TODO get pixel format from the subplugin (via jni)
-        view.getHolder().setFormat(PixelFormat.RGBA_8888);
-        view.getHolder().addCallback(new Callback() {
-
-            public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
-                nativeSurfaceChanged(npp, format, width, height);
-            }
-
-            public void surfaceCreated(SurfaceHolder holder) {
-                nativeSurfaceCreated(npp, view);
-            }
-
-            public void surfaceDestroyed(SurfaceHolder holder) {
-                nativeSurfaceDestroyed(npp);
-            }
-            
-        });
-        
-        if (nativeIsFixedSurface(npp)) {
-            //TODO get the fixed dimensions from the plugin 
-            //view.getHolder().setFixedSize(width, height);
-        }
-        
-        return view;
-    }
-    
-    public View getFullScreenView(int npp, Context context) {
-        
-        /* TODO make this aware of the plugin instance and get the video file
-         * from the plugin.
-         */
-        
-        FrameLayout layout = new FrameLayout(context);
-        LayoutParams fp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
-        layout.setLayoutParams(fp);
-
-        VideoView video = new VideoView(context);
-        LayoutParams vp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
-        layout.setLayoutParams(vp);
-
-        GLSurfaceView gl = new GLSurfaceView(context);
-        LayoutParams gp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
-        layout.setLayoutParams(gp);
-        
-        layout.addView(video);
-        layout.addView(gl);
-        
-        // We want an 8888 pixel format because that's required for a translucent 
-        // window. And we want a depth buffer.
-        gl.setEGLConfigChooser(8, 8, 8, 8, 16, 0);
-        // Tell the cube renderer that we want to render a translucent version
-        // of the cube:
-        gl.setRenderer(new CubeRenderer(true));
-        // Use a surface format with an Alpha channel:
-        gl.getHolder().setFormat(PixelFormat.TRANSLUCENT);
-        gl.setWindowType(WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY);
-        
-        
-        video.setVideoPath("/sdcard/test_video.3gp");
-        video.setMediaController(new MediaController(context));
-        video.requestFocus();
-        
-        return layout;
-    }
-    
-    private native void nativeSurfaceCreated(int npp, View surfaceView);
-    private native void nativeSurfaceChanged(int npp, int format, int width, int height);
-    private native void nativeSurfaceDestroyed(int npp);
-    private native boolean nativeIsFixedSurface(int npp);
-}
diff --git a/samples/BrowserPlugin/src/com/android/sampleplugin/VideoSurface.java b/samples/BrowserPlugin/src/com/android/sampleplugin/VideoSurface.java
new file mode 100644
index 0000000..a3c80cf
--- /dev/null
+++ b/samples/BrowserPlugin/src/com/android/sampleplugin/VideoSurface.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright 2009, The Android Open Source Project
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package com.android.sampleplugin;
+
+import com.android.sampleplugin.graphics.CubeRenderer;
+
+import android.content.Context;
+import android.opengl.GLSurfaceView;
+import android.view.WindowManager;
+import android.widget.FrameLayout;
+import android.widget.MediaController;
+import android.widget.VideoView;
+
+public class VideoSurface extends FrameLayout {
+
+    public VideoSurface(Context context) {
+        super(context);
+
+        LayoutParams fp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
+        this.setLayoutParams(fp);
+
+//        VideoView video = new VideoView(context);
+//        LayoutParams vp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
+//        vp.setLayoutParams(vp);
+
+        GLSurfaceView gl = new GLSurfaceView(context);
+        LayoutParams gp = new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT);
+        gl.setLayoutParams(gp);
+
+        this.addView(gl);
+//        this.addView(video);
+
+        // Tell the cube renderer that we want to render a translucent version
+        // of the cube:
+        gl.setRenderer(new CubeRenderer(false));
+        gl.setWindowType(WindowManager.LayoutParams.TYPE_APPLICATION_MEDIA_OVERLAY);
+
+//        video.setVideoPath("/sdcard/test_video.3gp");
+//        video.setMediaController(new MediaController(context));
+//        video.requestFocus();
+
+        // ensure that the view system is aware that we will be drawing
+        this.setWillNotDraw(false);
+    }
+}
diff --git a/samples/BusinessCard/res/layout/business_card.xml b/samples/BusinessCard/res/layout/business_card.xml
index c7ce713..ffb18d4 100644
--- a/samples/BusinessCard/res/layout/business_card.xml
+++ b/samples/BusinessCard/res/layout/business_card.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     <Button
         android:id="@+id/pick_contact_button"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_alignParentTop="true"
         android:layout_margin="10dip"
diff --git a/samples/ContactManager/res/layout/account_entry.xml b/samples/ContactManager/res/layout/account_entry.xml
index 435e737..9a4e197 100644
--- a/samples/ContactManager/res/layout/account_entry.xml
+++ b/samples/ContactManager/res/layout/account_entry.xml
@@ -15,19 +15,19 @@
 -->
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="?android:attr/listPreferredItemHeight"
     android:padding="6dip">
     <ImageView
         android:id="@+id/accountIcon"
         android:layout_width="wrap_content"
-        android:layout_height="fill_parent"
+        android:layout_height="match_parent"
         android:layout_alignParentTop="true"
         android:layout_alignParentBottom="true"
         android:layout_marginRight="6dip" />
     <TextView
         android:id="@+id/secondAccountLine"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="26dip"
         android:layout_toRightOf="@id/accountIcon"
         android:layout_alignParentBottom="true"
@@ -37,7 +37,7 @@
         android:textColor="@android:color/secondary_text_light" />
     <TextView
         android:id="@+id/firstAccountLine"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_toRightOf="@id/accountIcon"
         android:layout_alignParentRight="true"
diff --git a/samples/ContactManager/res/layout/contact_adder.xml b/samples/ContactManager/res/layout/contact_adder.xml
index 92d06f3..8fb7277 100644
--- a/samples/ContactManager/res/layout/contact_adder.xml
+++ b/samples/ContactManager/res/layout/contact_adder.xml
@@ -15,10 +15,10 @@
 -->
 
 <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
-            android:layout_width="fill_parent"
-            android:layout_height="fill_parent">
-    <TableLayout android:layout_width="fill_parent"
-                 android:layout_height="fill_parent">
+            android:layout_width="match_parent"
+            android:layout_height="match_parent">
+    <TableLayout android:layout_width="match_parent"
+                 android:layout_height="match_parent">
         <TableRow>
             <TextView android:layout_width="wrap_content"
                       android:layout_height="wrap_content"
@@ -26,7 +26,7 @@
         </TableRow>
         <TableRow>
             <Spinner android:layout_height="wrap_content"
-                     android:layout_width="fill_parent"
+                     android:layout_width="match_parent"
                      android:layout_weight="1"
                      android:id="@+id/accountSpinner"/>
         </TableRow>
@@ -73,7 +73,7 @@
             <Button android:layout_height="wrap_content"
                     android:text="@string/save"
                     android:id="@+id/contactSaveButton"
-                    android:layout_width="fill_parent"
+                    android:layout_width="match_parent"
                     android:layout_weight="1"/>
         </TableRow>
     </TableLayout>
diff --git a/samples/ContactManager/res/layout/contact_entry.xml b/samples/ContactManager/res/layout/contact_entry.xml
index 9909025..6193db5 100644
--- a/samples/ContactManager/res/layout/contact_entry.xml
+++ b/samples/ContactManager/res/layout/contact_entry.xml
@@ -19,6 +19,6 @@
               android:layout_height="wrap_content">
     <TextView android:text="@+id/contactEntryText"
               android:id="@+id/contactEntryText"
-              android:layout_width="fill_parent"
+              android:layout_width="match_parent"
               android:layout_height="wrap_content"/>
 </LinearLayout>
diff --git a/samples/ContactManager/res/layout/contact_manager.xml b/samples/ContactManager/res/layout/contact_manager.xml
index 73f6f81..8fe18c5 100644
--- a/samples/ContactManager/res/layout/contact_manager.xml
+++ b/samples/ContactManager/res/layout/contact_manager.xml
@@ -16,9 +16,9 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
               android:orientation="vertical"
-              android:layout_width="fill_parent"
-              android:layout_height="fill_parent">
-    <ListView android:layout_width="fill_parent"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent">
+    <ListView android:layout_width="match_parent"
               android:id="@+id/contactList"
               android:layout_height="wrap_content"
               android:layout_weight="1"/>
@@ -26,7 +26,7 @@
               android:layout_height="wrap_content"
               android:id="@+id/showInvisible"
               android:text="@string/showInvisible"/>
-    <Button android:layout_width="fill_parent"
+    <Button android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:id="@+id/addContactButton"
             android:text="@string/addContactButtonLabel"/>
diff --git a/samples/FixedGridLayout/res/layout/main.xml b/samples/FixedGridLayout/res/layout/main.xml
index 93e2d5e..c6bc52a 100644
--- a/samples/FixedGridLayout/res/layout/main.xml
+++ b/samples/FixedGridLayout/res/layout/main.xml
@@ -3,8 +3,8 @@
         xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:app="http://schemas.android.com/apk/res/com.example.android.fixedgridlayout"
         android:id="@+id/grid"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         app:cellWidth="80dp"
         app:cellHeight="100dp"
         >
diff --git a/samples/GlobalTime/res/layout/global_time.xml b/samples/GlobalTime/res/layout/global_time.xml
index 237207f..6bb3c79 100644
--- a/samples/GlobalTime/res/layout/global_time.xml
+++ b/samples/GlobalTime/res/layout/global_time.xml
@@ -15,7 +15,7 @@
 -->
 
 <EditText xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
-    android:layout_width="fill_parent" android:layout_height="fill_parent"
+    android:layout_width="match_parent" android:layout_height="match_parent"
     android:textSize="18sp"
     android:text="@string/global_time_text_text" />
 
diff --git a/samples/HelloActivity/res/layout/hello_activity.xml b/samples/HelloActivity/res/layout/hello_activity.xml
index 2a4d2de..bab9c9c 100644
--- a/samples/HelloActivity/res/layout/hello_activity.xml
+++ b/samples/HelloActivity/res/layout/hello_activity.xml
@@ -15,8 +15,8 @@
 -->
 
 <EditText xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:textSize="18sp"
     android:autoText="true"
     android:capitalize="sentences"
diff --git a/samples/Home/res/layout-land/home.xml b/samples/Home/res/layout-land/home.xml
index d723c69..8eecbdb 100644
--- a/samples/Home/res/layout-land/home.xml
+++ b/samples/Home/res/layout-land/home.xml
@@ -17,8 +17,8 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:home="http://schemas.android.com/apk/res/com.example.android.home"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <!-- All applications on the top side of the screen -->
     <GridView android:id="@+id/all_apps"
@@ -33,7 +33,7 @@
         android:stretchMode="spacingWidth"
         android:layout_weight="1.0"
         android:layout_height="0dip"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:stackFromBottom="true"
         android:visibility="invisible" />
 
@@ -43,7 +43,7 @@
         home:marginLeft="1dip"
         home:marginRight="1dip"
         android:layout_marginTop="0dip"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="65dip"
         android:background="@drawable/application_background" />
 
diff --git a/samples/Home/res/layout-port/home.xml b/samples/Home/res/layout-port/home.xml
index d723c69..8eecbdb 100644
--- a/samples/Home/res/layout-port/home.xml
+++ b/samples/Home/res/layout-port/home.xml
@@ -17,8 +17,8 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:home="http://schemas.android.com/apk/res/com.example.android.home"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <!-- All applications on the top side of the screen -->
     <GridView android:id="@+id/all_apps"
@@ -33,7 +33,7 @@
         android:stretchMode="spacingWidth"
         android:layout_weight="1.0"
         android:layout_height="0dip"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:stackFromBottom="true"
         android:visibility="invisible" />
 
@@ -43,7 +43,7 @@
         home:marginLeft="1dip"
         home:marginRight="1dip"
         android:layout_marginTop="0dip"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="65dip"
         android:background="@drawable/application_background" />
 
diff --git a/samples/Home/res/layout/all_applications_button.xml b/samples/Home/res/layout/all_applications_button.xml
index 88430b3..bed98dd 100644
--- a/samples/Home/res/layout/all_applications_button.xml
+++ b/samples/Home/res/layout/all_applications_button.xml
@@ -28,7 +28,7 @@
         android:id="@+id/show_all_apps_check"
         android:focusable="false"
         android:clickable="false"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:background="@drawable/all_applications_background"
         android:button="@drawable/all_applications"
diff --git a/samples/Home/res/layout/wallpaper.xml b/samples/Home/res/layout/wallpaper.xml
index 92dc65e..76f5af7 100644
--- a/samples/Home/res/layout/wallpaper.xml
+++ b/samples/Home/res/layout/wallpaper.xml
@@ -19,8 +19,8 @@
 -->
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
-    android:layout_width="fill_parent" 
-    android:layout_height="fill_parent"> 
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent"> 
     
     <TextView
         android:layout_width="wrap_content"
@@ -34,7 +34,7 @@
     
     <Gallery android:id="@+id/gallery"
         android:background="#70000000"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="60dip"
         android:layout_alignParentBottom="true"
         android:layout_alignParentLeft="true"
diff --git a/samples/JetBoy/res/layout/main.xml b/samples/JetBoy/res/layout/main.xml
index ea2277f..b1154ad 100755
--- a/samples/JetBoy/res/layout/main.xml
+++ b/samples/JetBoy/res/layout/main.xml
@@ -1,11 +1,11 @@
 <?xml version="1.0" encoding="utf-8"?>
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-	android:layout_width="fill_parent"
-	android:layout_height="fill_parent">
+	android:layout_width="match_parent"
+	android:layout_height="match_parent">
 
 	<com.example.android.jetboy.JetBoyView android:id="@+id/JetBoyView"
-		android:layout_width="fill_parent"
-		android:layout_height="fill_parent" />
+		android:layout_width="match_parent"
+		android:layout_height="match_parent" />
 
 	<TextView android:id="@+id/text" android:text="@string/helpText"
 		style="@style/helpText" android:visibility="invisible" 
diff --git a/samples/LunarLander/AndroidManifest.xml b/samples/LunarLander/AndroidManifest.xml
index 7fdc572..301291a 100644
--- a/samples/LunarLander/AndroidManifest.xml
+++ b/samples/LunarLander/AndroidManifest.xml
@@ -22,11 +22,11 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.example.android.lunarlander">
     <application android:icon="@drawable/app_lunar_lander" android:label="@string/app_name">
-        <activity android:name="LunarLander">
+        <activity android:name="LunarLander" android:theme="@android:style/Theme.NoTitleBar">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
             </intent-filter>
-		</activity>
+        </activity>
     </application>
 </manifest>
diff --git a/samples/LunarLander/res/layout/lunar_layout.xml b/samples/LunarLander/res/layout/lunar_layout.xml
index 9ad0536..f1a8990 100644
--- a/samples/LunarLander/res/layout/lunar_layout.xml
+++ b/samples/LunarLander/res/layout/lunar_layout.xml
@@ -15,17 +15,17 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
     
     <com.example.android.lunarlander.LunarView
       android:id="@+id/lunar"
-      android:layout_width="fill_parent"
-      android:layout_height="fill_parent"/>
+      android:layout_width="match_parent"
+      android:layout_height="match_parent"/>
     
     <RelativeLayout
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent" >
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" >
         <TextView
           android:id="@+id/text"
 		  android:text="@string/lunar_layout_text_text"
diff --git a/samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java b/samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java
index 7f54ff6..a4ffef5 100644
--- a/samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java
+++ b/samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java
@@ -124,9 +124,6 @@
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        // turn off the window's title bar
-        requestWindowFeature(Window.FEATURE_NO_TITLE);
-
         // tell system to use the layout defined in our XML file
         setContentView(R.layout.lunar_layout);
 
diff --git a/samples/MultiResolution/res/layout-land/main.xml b/samples/MultiResolution/res/layout-land/main.xml
index f704425..515349f 100644
--- a/samples/MultiResolution/res/layout-land/main.xml
+++ b/samples/MultiResolution/res/layout-land/main.xml
@@ -16,28 +16,28 @@
 
 <LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
-  android:layout_width="fill_parent"
-  android:layout_height="fill_parent"
+  android:layout_width="match_parent"
+  android:layout_height="match_parent"
   android:orientation="horizontal"
   android:background="@drawable/background">
 
   <LinearLayout
     android:layout_weight="1"
     android:orientation="vertical"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <!-- Notice that widget sizes are expressed in dip, or device-independent
          pixels, while text sizes are expressed in sp, or scale-independent
          pixels, to factor in user-chosen font sizes. -->
     <FrameLayout
       android:background="@drawable/image_container"
-      android:layout_width="fill_parent"
-      android:layout_height="fill_parent"
+      android:layout_width="match_parent"
+      android:layout_height="match_parent"
       android:id="@+id/image_container">
       <ImageView
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:id="@+id/image_view"
         android:scaleType="fitCenter"/>
       <TextView
@@ -57,7 +57,7 @@
 
   <LinearLayout
     android:layout_width="wrap_content"
-    android:layout_height="fill_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical"
     android:layout_marginLeft="10dip"
     android:gravity="top">
diff --git a/samples/MultiResolution/res/layout/main.xml b/samples/MultiResolution/res/layout/main.xml
index 4c01e82..9910849 100644
--- a/samples/MultiResolution/res/layout/main.xml
+++ b/samples/MultiResolution/res/layout/main.xml
@@ -16,27 +16,27 @@
 
 <LinearLayout
   xmlns:android="http://schemas.android.com/apk/res/android"
-  android:layout_width="fill_parent"
-  android:layout_height="fill_parent"
+  android:layout_width="match_parent"
+  android:layout_height="match_parent"
   android:orientation="vertical"
   android:background="@drawable/background">
 
   <LinearLayout
     android:layout_weight="1"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent">
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
 
     <!-- Notice that widget sizes are expressed in dip, or device-independent
          pixels, while text sizes are expressed in sp, or scale-independent
          pixels, to factor in user-chosen font sizes. -->
     <FrameLayout
-      android:layout_width="fill_parent"
-      android:layout_height="fill_parent"
+      android:layout_width="match_parent"
+      android:layout_height="match_parent"
       android:id="@+id/image_container"
       android:background="@drawable/image_container">
       <ImageView
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
         android:id="@+id/image_view"
         android:scaleType="fitCenter"/>
       <TextView
@@ -55,7 +55,7 @@
   </LinearLayout>
 
   <LinearLayout
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:layout_marginTop="10dip"
     android:gravity="center">
diff --git a/samples/MySampleRss/res/layout/add_item.xml b/samples/MySampleRss/res/layout/add_item.xml
index 8191bf5..826082d 100644
--- a/samples/MySampleRss/res/layout/add_item.xml
+++ b/samples/MySampleRss/res/layout/add_item.xml
@@ -15,8 +15,8 @@
 -->
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-                android:layout_height="fill_parent"
-                android:layout_width="fill_parent">
+                android:layout_height="match_parent"
+                android:layout_width="match_parent">
                 
                 <TextView android:id="@+id/title_label"
                           android:layout_height="wrap_content"
@@ -26,11 +26,11 @@
                           android:text="@string/add_item_title"/>
                 <EditText android:id="@+id/title_textbox"
                           android:layout_height="wrap_content"
-                          android:layout_width="fill_parent"
+                          android:layout_width="match_parent"
                           android:layout_toRightOf="@id/title_label"/>
                 <EditText android:id="@+id/url_textbox"
                           android:layout_height="wrap_content"
-                          android:layout_width="fill_parent"
+                          android:layout_width="match_parent"
                           android:layout_below="@id/title_textbox"
                           android:layout_alignLeft="@id/title_textbox"/>
                           
diff --git a/samples/MySampleRss/res/layout/main_screen.xml b/samples/MySampleRss/res/layout/main_screen.xml
index 5292bb2..3cae487 100755
--- a/samples/MySampleRss/res/layout/main_screen.xml
+++ b/samples/MySampleRss/res/layout/main_screen.xml
@@ -15,21 +15,21 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:layout_height="fill_parent"
-              android:layout_width="fill_parent"
+              android:layout_height="match_parent"
+              android:layout_width="match_parent"
               android:orientation="vertical"
               android:scrollbars="vertical">
                   
         <ListView android:id="@+id/rssListView"
                   android:layout_height="0px"
-                  android:layout_width="fill_parent"
+                  android:layout_width="match_parent"
                   android:layout_weight="1"
                   android:background="#00CC00"/>
                   
 				<WebView android:id="@+id/rssWebView"
 			             android:background="#77CC0000"
 				         android:layout_height="0px"
-				         android:layout_width="fill_parent"
+				         android:layout_width="match_parent"
 				         android:layout_weight="1"/>
 
 </LinearLayout>
diff --git a/samples/MySampleRss/res/layout/main_screen2.xml b/samples/MySampleRss/res/layout/main_screen2.xml
index 36b0af4..826e5bc 100644
--- a/samples/MySampleRss/res/layout/main_screen2.xml
+++ b/samples/MySampleRss/res/layout/main_screen2.xml
@@ -15,19 +15,19 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-              android:layout_height="fill_parent" 
-              android:layout_width="fill_parent"
+              android:layout_height="match_parent" 
+              android:layout_width="match_parent"
               android:orientation="vertical"
               android:scrollbars="vertical">
 	                 
 	       <ListView android:id="@+id/rssListView" 
 	                 android:layout_height="0px"
-	                 android:layout_width="fill_parent"
+	                 android:layout_width="match_parent"
 	                 android:layout_weight="1"
 	                 android:background="#9900FF00"/>
                   
 				<WebView android:id="@+id/rssWebView"
 				         android:layout_height="0px"
-				         android:layout_width="fill_parent"
+				         android:layout_width="match_parent"
 				         android:layout_weight="2"/>
 </LinearLayout>
diff --git a/samples/NotePad/res/layout/note_editor.xml b/samples/NotePad/res/layout/note_editor.xml
index c54a963..d7da99e 100644
--- a/samples/NotePad/res/layout/note_editor.xml
+++ b/samples/NotePad/res/layout/note_editor.xml
@@ -17,8 +17,8 @@
 <view xmlns:android="http://schemas.android.com/apk/res/android"
     class="com.example.android.notepad.NoteEditor$LinedEditText"
     android:id="@+id/note"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:background="@android:color/transparent"
     android:padding="5dip"
     android:scrollbars="vertical"
diff --git a/samples/NotePad/res/layout/noteslist_item.xml b/samples/NotePad/res/layout/noteslist_item.xml
index b167734..e11c5ee 100644
--- a/samples/NotePad/res/layout/noteslist_item.xml
+++ b/samples/NotePad/res/layout/noteslist_item.xml
@@ -16,7 +16,7 @@
 
 <TextView xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@android:id/text1"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="?android:attr/listPreferredItemHeight"
     android:textAppearance="?android:attr/textAppearanceLarge"
     android:gravity="center_vertical"
diff --git a/samples/RSSReader/res/layout/rss_layout.xml b/samples/RSSReader/res/layout/rss_layout.xml
index 842f4f7..838656a 100644
--- a/samples/RSSReader/res/layout/rss_layout.xml
+++ b/samples/RSSReader/res/layout/rss_layout.xml
@@ -15,13 +15,13 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
-    android:layout_width="fill_parent" 
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent" 
+    android:layout_height="match_parent"
     android:padding="10dip"
     android:orientation="vertical">
 
 	<EditText android:id="@+id/urltext"
-	    android:layout_width="fill_parent"
+	    android:layout_width="match_parent"
 	    android:layout_height="wrap_content"
 	    android:textSize="12sp"
 	    android:autoText="false"
@@ -34,7 +34,7 @@
 		android:text="@string/rss_layout_download_text" />
 	
 	<TextView android:id="@+id/statustext"
-	    android:layout_width="fill_parent"
+	    android:layout_width="match_parent"
 	    android:layout_height="wrap_content"
 	    android:autoText="false"
 	    android:capitalize="none"
@@ -42,7 +42,7 @@
 	    android:text="@string/rss_layout_statustext_text" />
 	
 	<ListView android:id="@android:id/list"
-	    android:layout_width="fill_parent"
+	    android:layout_width="match_parent"
 	    android:layout_height="0dip"
 	    android:layout_weight="1"
 	    android:drawSelectorOnTop="false"/>
diff --git a/samples/SearchableDictionary/res/layout/main.xml b/samples/SearchableDictionary/res/layout/main.xml
index d0dd522..666416d 100644
--- a/samples/SearchableDictionary/res/layout/main.xml
+++ b/samples/SearchableDictionary/res/layout/main.xml
@@ -18,18 +18,18 @@
 -->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:orientation="vertical"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
     <TextView
             android:id="@+id/textField"
             android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/search_instructions"/>
 
     <ListView
             android:id="@+id/list"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="0dip"
             android:layout_weight="1"/>
 </LinearLayout>
diff --git a/samples/SearchableDictionary/res/layout/word.xml b/samples/SearchableDictionary/res/layout/word.xml
index ba1a3da..21a5ed4 100644
--- a/samples/SearchableDictionary/res/layout/word.xml
+++ b/samples/SearchableDictionary/res/layout/word.xml
@@ -18,8 +18,8 @@
 -->
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
         android:orientation="vertical"
-        android:layout_width="fill_parent"
-        android:layout_height="fill_parent">
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
     <TextView
             android:id="@+id/word"
             android:textAppearance="?android:attr/textAppearanceLarge"
@@ -32,7 +32,7 @@
     <TextView
             android:id="@+id/definition"
             android:textAppearance="?android:attr/textAppearanceMedium"
-            android:layout_width="fill_parent"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
             android:text="@string/search_instructions"
             android:layout_marginLeft="10dip" />
diff --git a/samples/SkeletonApp/res/layout/skeleton_activity.xml b/samples/SkeletonApp/res/layout/skeleton_activity.xml
index b8dcac7..1aa49dd 100644
--- a/samples/SkeletonApp/res/layout/skeleton_activity.xml
+++ b/samples/SkeletonApp/res/layout/skeleton_activity.xml
@@ -22,7 +22,7 @@
      a row, here set to be vertical (so the first is at the top) -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent" android:layout_height="fill_parent"
+    android:layout_width="match_parent" android:layout_height="match_parent"
     android:orientation="vertical">
 
     <!-- First view is a text editor.  We want it to use all available
@@ -30,7 +30,7 @@
          is available to it.  Note the use of the "id" attribute, which
          allows us to find this object from the Java code. -->
     <EditText android:id="@+id/editor"
-        android:layout_width="fill_parent" android:layout_height="0dip"
+        android:layout_width="match_parent" android:layout_height="0dip"
         android:autoText="true"
         android:capitalize="sentences"
         android:layout_weight="1"
diff --git a/samples/Snake/AndroidManifest.xml b/samples/Snake/AndroidManifest.xml
index 174e8b4..36a9939 100644
--- a/samples/Snake/AndroidManifest.xml
+++ b/samples/Snake/AndroidManifest.xml
@@ -23,6 +23,7 @@
     package="com.example.android.snake">
     <application android:label="Snake on a Phone">
       <activity android:name="Snake"
+        android:theme="@android:style/Theme.NoTitleBar"
         android:screenOrientation="portrait"
         android:configChanges="keyboardHidden|orientation">
             <intent-filter>
diff --git a/samples/Snake/res/layout/snake_layout.xml b/samples/Snake/res/layout/snake_layout.xml
index 583c0c4..ef8abe3 100644
--- a/samples/Snake/res/layout/snake_layout.xml
+++ b/samples/Snake/res/layout/snake_layout.xml
@@ -15,19 +15,19 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-	android:layout_width="fill_parent"
-	android:layout_height="fill_parent">
+	android:layout_width="match_parent"
+	android:layout_height="match_parent">
 	
 	<com.example.android.snake.SnakeView
 	 android:id="@+id/snake"
-		android:layout_width="fill_parent"
-                android:layout_height="fill_parent"
+		android:layout_width="match_parent"
+                android:layout_height="match_parent"
                 tileSize="24"
                 />
 	
 	<RelativeLayout
-		android:layout_width="fill_parent"
-		android:layout_height="fill_parent" >
+		android:layout_width="match_parent"
+		android:layout_height="match_parent" >
 		
 		<TextView
 		 android:id="@+id/text"
diff --git a/samples/Snake/src/com/example/android/snake/Snake.java b/samples/Snake/src/com/example/android/snake/Snake.java
index 5fdc024..6306693 100644
--- a/samples/Snake/src/com/example/android/snake/Snake.java
+++ b/samples/Snake/src/com/example/android/snake/Snake.java
@@ -45,9 +45,6 @@
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        // No Title bar
-        requestWindowFeature(Window.FEATURE_NO_TITLE);
-
         setContentView(R.layout.snake_layout);
 
         mSnakeView = (SnakeView) findViewById(R.id.snake);
diff --git a/samples/SoftKeyboard/res/layout/input.xml b/samples/SoftKeyboard/res/layout/input.xml
index 1b57468..d78a9f2 100755
--- a/samples/SoftKeyboard/res/layout/input.xml
+++ b/samples/SoftKeyboard/res/layout/input.xml
@@ -22,6 +22,6 @@
         xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@+id/keyboard"
         android:layout_alignParentBottom="true"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         />
diff --git a/samples/Wiktionary/res/layout/about.xml b/samples/Wiktionary/res/layout/about.xml
index 3b25b32..7b90fd9 100644
--- a/samples/Wiktionary/res/layout/about.xml
+++ b/samples/Wiktionary/res/layout/about.xml
@@ -15,13 +15,13 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical"
     android:padding="20dip">
 
     <TextView
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:textSize="16sp"
         android:text="@string/app_descrip"
@@ -29,7 +29,7 @@
 
     <TextView
         android:id="@+id/about_credits"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:paddingTop="20dip"
         android:textSize="16sp"
diff --git a/samples/Wiktionary/res/layout/lookup.xml b/samples/Wiktionary/res/layout/lookup.xml
index 43cffaa..6b7e3ea 100644
--- a/samples/Wiktionary/res/layout/lookup.xml
+++ b/samples/Wiktionary/res/layout/lookup.xml
@@ -15,13 +15,13 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="fill_parent"
-    android:layout_height="fill_parent"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
     android:orientation="vertical">
 
     <LinearLayout
         android:id="@+id/title_bar"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:orientation="horizontal"
         android:gravity="center_vertical">
@@ -49,7 +49,7 @@
 
     <WebView
         android:id="@+id/webview"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="0dip"
         android:layout_weight="1" />
 
diff --git a/samples/Wiktionary/res/layout/widget_message.xml b/samples/Wiktionary/res/layout/widget_message.xml
index ba94714..7a675b9 100644
--- a/samples/Wiktionary/res/layout/widget_message.xml
+++ b/samples/Wiktionary/res/layout/widget_message.xml
@@ -16,14 +16,14 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/widget"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
     style="@style/WidgetBackground">
 
     <TextView
         android:id="@+id/message"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="12dip"
         android:padding="10dip"
diff --git a/samples/Wiktionary/res/layout/widget_word.xml b/samples/Wiktionary/res/layout/widget_word.xml
index 0e76f0b..4a00384 100644
--- a/samples/Wiktionary/res/layout/widget_word.xml
+++ b/samples/Wiktionary/res/layout/widget_word.xml
@@ -16,7 +16,7 @@
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/widget"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:focusable="true"
     style="@style/WidgetBackground">
@@ -64,7 +64,7 @@
 
     <TextView
         android:id="@+id/definition"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_below="@id/word_title"
         android:layout_toRightOf="@id/bullet"
diff --git a/samples/WiktionarySimple/res/layout/widget_message.xml b/samples/WiktionarySimple/res/layout/widget_message.xml
index ba94714..7a675b9 100644
--- a/samples/WiktionarySimple/res/layout/widget_message.xml
+++ b/samples/WiktionarySimple/res/layout/widget_message.xml
@@ -16,14 +16,14 @@
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/widget"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
     style="@style/WidgetBackground">
 
     <TextView
         android:id="@+id/message"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="12dip"
         android:padding="10dip"
diff --git a/samples/WiktionarySimple/res/layout/widget_word.xml b/samples/WiktionarySimple/res/layout/widget_word.xml
index 0e76f0b..4a00384 100644
--- a/samples/WiktionarySimple/res/layout/widget_word.xml
+++ b/samples/WiktionarySimple/res/layout/widget_word.xml
@@ -16,7 +16,7 @@
 
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/widget"
-    android:layout_width="fill_parent"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:focusable="true"
     style="@style/WidgetBackground">
@@ -64,7 +64,7 @@
 
     <TextView
         android:id="@+id/definition"
-        android:layout_width="fill_parent"
+        android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_below="@id/word_title"
         android:layout_toRightOf="@id/bullet"
diff --git a/samples/source.properties b/samples/source.properties
index 73c0d76..64557a1 100644
--- a/samples/source.properties
+++ b/samples/source.properties
@@ -1,5 +1,5 @@
 Pkg.UserSrc=false
-Platform.Version=2.1
 Pkg.Revision=1
 AndroidVersion.ApiLevel=7
+AndroidVersion.CodeName=Froyo
 
diff --git a/sdk/doc_source.properties b/sdk/doc_source.properties
index 73c0d76..c3c7f81 100644
--- a/sdk/doc_source.properties
+++ b/sdk/doc_source.properties
@@ -1,5 +1,5 @@
 Pkg.UserSrc=false
-Platform.Version=2.1
 Pkg.Revision=1
+AndroidVersion.CodeName=Froyo
 AndroidVersion.ApiLevel=7
 
diff --git a/sdk/platform_source.properties b/sdk/platform_source.properties
index d4ff795..e872f9b 100644
--- a/sdk/platform_source.properties
+++ b/sdk/platform_source.properties
@@ -1,5 +1,6 @@
-Pkg.Desc=Android SDK Platform 2.1_r1
+Pkg.Desc=Android SDK Platform Froyo_r1
 Pkg.UserSrc=false
-Platform.Version=2.1
+Platform.Version=Froyo
 Pkg.Revision=1
 AndroidVersion.ApiLevel=7
+AndroidVersion.CodeName=Froyo
diff --git a/simulator/app/PropertyServer.cpp b/simulator/app/PropertyServer.cpp
index c94aa75..eb1bfc3 100644
--- a/simulator/app/PropertyServer.cpp
+++ b/simulator/app/PropertyServer.cpp
@@ -121,7 +121,6 @@
         { "init.svc.dbus", "running" },
         { "init.svc.pppd_gprs", "running" },
         { "adb.connected", "0" },
-        //{ "use-adb-networking", "1" },
         /*
         { "status.battery.state", "Slow" },
         { "status.battery.level", "5" },
@@ -148,6 +147,12 @@
         { "debug.sf.showbackground", "0" },
         { "debug.sf.showfps", "0" },
         { "default", "default" },
+
+        /* Stagefright options */
+        { "media.stagefright.enable-player", "true" },
+        { "media.stagefright.enable-meta", "true" },
+        { "media.stagefright.enable-scan", "true" },
+        { "media.stagefright.enable-http", "true" },
     };
 
     for (int i = 0; i < NELEM(propList); i++)
diff --git a/simulator/wrapsim/Android.mk b/simulator/wrapsim/Android.mk
index f9a2414..7c2cbf2 100644
--- a/simulator/wrapsim/Android.mk
+++ b/simulator/wrapsim/Android.mk
@@ -25,8 +25,6 @@
 	SysPower.c \
 	Util.c
 
-LOCAL_C_INCLUDES += prebuilt/common/esd
-
 LOCAL_MODULE := libwrapsim
 
 # Relying on other Android libraries is probably a bad idea, since any
@@ -36,7 +34,7 @@
 ifeq ($(BUILD_SIM_WITHOUT_AUDIO),true)
 LOCAL_CFLAGS += -DBUILD_SIM_WITHOUT_AUDIO=1
 else
-LOCAL_LDLIBS += -lesd
+LOCAL_LDLIBS += -lasound
 endif
 
 include $(BUILD_SHARED_LIBRARY)
diff --git a/simulator/wrapsim/DevAudio.c b/simulator/wrapsim/DevAudio.c
index 752ee65..a8f5c16 100644
--- a/simulator/wrapsim/DevAudio.c
+++ b/simulator/wrapsim/DevAudio.c
@@ -8,7 +8,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <esd.h>
+#include <alsa/asoundlib.h>
 
 #include <fcntl.h>
 #include <sys/ioctl.h>
@@ -19,10 +19,7 @@
  * Input event device state.
  */
 typedef struct AudioState {
-    int fd;
-    int sourceId;
-    int esdVol;
-    int streamType;
+    snd_pcm_t *handle;
 } AudioState;
 
 /*
@@ -33,45 +30,31 @@
 #if BUILD_SIM_WITHOUT_AUDIO
     return 0;
 #else
-    esd_player_info_t *pi; 
-    audioState->fd = -1;
-    audioState->sourceId = -1;
-    audioState->esdVol = -1;
-    audioState->streamType = 0;
+    audioState->handle = NULL;
 
-    int format = ESD_BITS16 | ESD_STEREO | ESD_STREAM | ESD_PLAY;
-    char namestring[] = "Android Audio XXXXXXXX";
-    sprintf(namestring,"Android Audio %08x", (unsigned int)audioState);
-    int esd_fd = esd_play_stream_fallback(format, 44100, NULL, namestring);
-    if (esd_fd > 0) {
-        // find the source_id for this stream
-        int mix = esd_open_sound(NULL);
-        if (mix > 0) {
-            esd_info_t *info = esd_get_all_info(mix);
+    snd_pcm_open(&audioState->handle, "default", SND_PCM_STREAM_PLAYBACK, 0);
 
-            if (info) {
-                for(pi = info->player_list; pi; pi = pi->next) {
-                    if(strcmp(pi->name, namestring) == 0) {
-                        audioState->sourceId = pi->source_id;
-                        break;
-                    }
-                }
-                esd_free_all_info(info);
-            }
-            esd_close(mix);
-        }
-        audioState->fd = esd_fd;
-        return 0;
+    if (audioState->handle) {
+        snd_pcm_hw_params_t *params;
+        snd_pcm_hw_params_malloc(&params);
+        snd_pcm_hw_params_any(audioState->handle, params);
+        snd_pcm_hw_params_set_access(audioState->handle, params, SND_PCM_ACCESS_RW_INTERLEAVED);
+        snd_pcm_hw_params_set_format(audioState->handle, params, SND_PCM_FORMAT_S16_LE);
+        unsigned int rate = 44100;
+        snd_pcm_hw_params_set_rate_near(audioState->handle, params, &rate, NULL);
+        snd_pcm_hw_params_set_channels(audioState->handle, params, 2);
+        snd_pcm_hw_params(audioState->handle, params);
+        snd_pcm_hw_params_free(params);
+    } else {
+        wsLog("Couldn't open audio hardware, faking it\n");
     }
-    printf("Couldn't open audio device. Faking it.\n");
+
     return 0;
 #endif
 }
 
 /*
- * Return the next available input event.
- *
- * We just pass this through to the real "write", since "fd" is real.
+ * Write audio data.
  */
 static ssize_t writeAudio(FakeDev* dev, int fd, const void* buf, size_t count)
 {
@@ -79,11 +62,13 @@
     return 0;
 #else
     AudioState *state = (AudioState*)dev->state;
-    if (state->fd >= 0)
-        return _ws_write(state->fd, buf, count);
+    if (state->handle != NULL) {
+        snd_pcm_writei(state->handle, buf, count / 4);
+        return count;
+    }
 
     // fake timing
-    usleep(count * 10000 / 441 * 4);
+    usleep(count * 10000 / (441 * 4));
     return count;
 #endif
 }
@@ -105,7 +90,7 @@
     return 0;
 #else
     AudioState *state = (AudioState*)dev->state;
-    close(state->fd);
+    snd_pcm_close(state->handle);
     free(state);
     dev->state = NULL;
     return 0;
diff --git a/simulator/wrapsim/README.txt b/simulator/wrapsim/README.txt
index 358c06c..364d96d 100644
--- a/simulator/wrapsim/README.txt
+++ b/simulator/wrapsim/README.txt
@@ -19,3 +19,6 @@
 For more verbose logging, you can enable the verbose forms of CALLTRACE
 and CALLTRACEV in Intercept.c.
 
+To build, you will need to have the 32-bit libaudio2 development package
+installed. On Ubuntu Hardy, do something like:
+% sudo apt-get install lib32asound2-dev
diff --git a/testrunner/coverage.py b/testrunner/coverage.py
index c94fc26..52e8a8c 100755
--- a/testrunner/coverage.py
+++ b/testrunner/coverage.py
@@ -86,7 +86,8 @@
 
   def ExtractReport(self, test_suite,
                     device_coverage_path,
-                    output_path=None):
+                    output_path=None,
+                    test_qualifier=None):
     """Extract runtime coverage data and generate code coverage report.
 
     Assumes test has just been executed.
@@ -94,25 +95,30 @@
       test_suite: TestSuite to generate coverage data for
       device_coverage_path: location of coverage file on device
       output_path: path to place output files in. If None will use
-        <android_root_path>/<_COVERAGE_REPORT_PATH>/<target>/<test>
+        <android_root_path>/<_COVERAGE_REPORT_PATH>/<target>/<test[-qualifier]>
+      test_qualifier: designates mode test was run with. e.g size=small.
+        If not None, this will be used to customize output_path as shown above.
 
     Returns:
       absolute file path string of generated html report file.
     """
     if output_path is None:
+      report_name = test_suite.GetName()
+      if test_qualifier:
+        report_name = report_name + "-" + test_qualifier
       output_path = os.path.join(self._root_path,
                                  self._COVERAGE_REPORT_PATH,
                                  test_suite.GetTargetName(),
-                                 test_suite.GetName())
+                                 report_name)
 
-    coverage_local_name = "%s.%s" % (test_suite.GetName(),
+    coverage_local_name = "%s.%s" % (report_name,
                                      self._TEST_COVERAGE_EXT)
     coverage_local_path = os.path.join(output_path,
                                        coverage_local_name)
     if self._adb.Pull(device_coverage_path, coverage_local_path):
 
       report_path = os.path.join(output_path,
-                                 test_suite.GetName())
+                                 report_name)
       target = self._targets_manifest.GetTarget(test_suite.GetTargetName())
       if target is None:
         msg = ["Error: test %s references undefined target %s."
diff --git a/testrunner/coverage_targets.xml b/testrunner/coverage_targets.xml
index 5fe1233..869c905 100644
--- a/testrunner/coverage_targets.xml
+++ b/testrunner/coverage_targets.xml
@@ -57,8 +57,6 @@
     </coverage_target>
    
    <!-- apps -->
-    <coverage_target name="AlarmClock" build_path="packages/apps/AlarmClock"
-        type="APPS" />
     <coverage_target name="ApiDemos" build_path="development/samples/ApiDemos"
         type="APPS" />
     <coverage_target name="Browser" build_path="packages/apps/Browser"
@@ -71,13 +69,17 @@
         type="APPS" />
     <coverage_target name="Contacts" build_path="packages/apps/Contacts"
         type="APPS" />
+    <coverage_target name="DeskClock" build_path="packages/apps/DeskClock"
+        type="APPS" />
     <coverage_target name="Email" build_path="packages/apps/Email"
         type="APPS" />
     <coverage_target name="Settings" build_path="packages/apps/Settings"
         type="APPS" />
     <coverage_target name="Phone" build_path="packages/apps/Phone"
         type="APPS" />
-    <coverage_target name="Launcher" build_path="packages/apps/Home"
+    <coverage_target name="QuickSearchBox" build_path="packages/apps/QuickSearchBox"
+        type="APPS" />
+    <coverage_target name="Launcher2" build_path="packages/apps/Launcher2"
         type="APPS" />
     <coverage_target name="Mms" build_path="packages/apps/Mms" type="APPS" />
     <coverage_target name="Music" build_path="packages/apps/Music"
@@ -90,14 +92,10 @@
         build_path="packages/providers/calendar" type="APPS" />
     <coverage_target name="ContactsProvider"
         build_path="packages/providers/ContactsProvider" type="APPS" />
-    <coverage_target name="GoogleContactsProvider"
-        build_path="packages/providers/GoogleContactsProvider" type="APPS" />
     <coverage_target name="DownloadProvider"
         build_path="packages/providers/DownloadProvider" type="APPS" />
     <coverage_target name="DrmProvider" build_path="packages/providers/drm"
         type="APPS" />
-    <coverage_target name="GmailProvider"
-        build_path="partner/google/providers/gmail" type="APPS" />
     <coverage_target name="MediaProvider"
         build_path="packages/providers/MediaProvider" type="APPS" />
     <coverage_target name="SettingsProvider"
diff --git a/testrunner/runtest.py b/testrunner/runtest.py
index a4d7231..a3135db 100755
--- a/testrunner/runtest.py
+++ b/testrunner/runtest.py
@@ -320,7 +320,10 @@
         self._DoBuild()
 
       for test_suite in self._GetTestsToRun():
-        test_suite.Run(self._options, self._adb)
+        try:
+          test_suite.Run(self._options, self._adb)
+        except errors.WaitForResponseTimedOutError:
+          logger.Log("Timed out waiting for response")
 
     except KeyboardInterrupt:
       logger.Log("Exiting...")
diff --git a/testrunner/test_defs.xml b/testrunner/test_defs.xml
index 68a62e4..2307cfa 100644
--- a/testrunner/test_defs.xml
+++ b/testrunner/test_defs.xml
@@ -33,21 +33,70 @@
 <test name="framework"
     build_path="frameworks/base/tests/FrameworkTest"
     package="com.android.frameworktest.tests"
-    class="com.android.frameworktest.AllTests"
     coverage_target="framework"
     continuous="true" />
 
 <test name="android"
     build_path="frameworks/base/tests/AndroidTests"
     package="com.android.unit_tests"
-    class="com.android.unit_tests.AndroidTests"
     coverage_target="framework"
     continuous="true" />
 
+<!-- frameworks tests -->
+<test name="frameworks-core"
+    build_path="frameworks/base/core/tests/coretests"
+    package="com.android.frameworks.coretests"
+    coverage_target="framework"
+    continuous="true" />
+
+<test name="frameworks-graphics"
+    build_path="frameworks/base/graphics/tests/graphicstests"
+    package="com.android.frameworks.graphicstests"
+    coverage_target="framework"
+    continuous="true" />
+
+<test name="frameworks-location"
+    build_path="frameworks/base/location/tests/locationtests"
+    package="com.android.frameworks.locationtests"
+    coverage_target="framework"
+    continuous="true" />
+
+<test name="frameworks-sax"
+    build_path="frameworks/base/sax/tests/saxtests"
+    package="com.android.frameworks.saxtests"
+    coverage_target="framework"
+    continuous="true" />
+
+<test name="frameworks-services"
+    build_path="frameworks/base/services/tests/servicestests"
+    package="com.android.frameworks.servicestests"
+    coverage_target="framework"
+    continuous="true" />
+
+<test name="frameworks-telephony"
+    build_path="frameworks/base/telephony/tests/telephonytests"
+    package="com.android.frameworks.telephonytests"
+    coverage_target="framework"
+    continuous="true" />
+
+<test name="frameworks-vpn"
+    build_path="frameworks/base/vpn/tests/vpntests"
+    package="com.android.frameworks.vpntests"
+    coverage_target="framework"
+    continuous="true" />
+
+<!--  end of framework tests -->
+
+<!-- subset of the android tests for just the database tests -->
+<!--test name="database"
+    build_path="frameworks/base/core/tests/coretests"
+    package="com.android.frameworks.coretests"
+    coverage_target="framework" /-->
+
 <test name="account"
-    build_path="frameworks/base/tests/AndroidTests"
-    package="com.android.unit_tests"
-    class="com.android.unit_tests.accounts.AccountManagerServiceTest"
+    build_path="frameworks/base/core/tests/coretests"
+    package="com.android.frameworks.coretests"
+    class="android.accounts.AccountManagerServiceTest"
     coverage_target="framework" />
 
 <test name="smoke"
@@ -59,16 +108,9 @@
 <test name="core"
     build_path="frameworks/base/tests/CoreTests"
     package="android.core"
-    class="android.core.CoreTests"
     coverage_target="framework"
     continuous="true" />
 
-<test name="libcore"
-    build_path="frameworks/base/tests/CoreTests"
-    package="android.core"
-    class="android.core.JavaTests"
-    coverage_target="framework" />
-
 <test name="apidemos"
     build_path="development/samples/ApiDemos"
     package="com.example.android.apis.tests"
@@ -87,11 +129,11 @@
     class="com.android.unit_tests.HeapTest"
     coverage_target="framework" />
 
-<test name="activity"
+<!--test name="activity"
     build_path="frameworks/base/tests/AndroidTests"
     package="com.android.unit_tests"
     class="com.android.unit_tests.activity.ActivityTests"
-    coverage_target="framework" />
+    coverage_target="framework" /-->
 
 <test name="keystore-unit"
     build_path="frameworks/base/keystore/tests"
@@ -100,13 +142,6 @@
     coverage_target="framework"
     continuous="true" />
 
-<test name="vpntests"
-    build_path="frameworks/base/tests/AndroidTests"
-    package="com.android.unit_tests"
-    class="com.android.unit_tests.VpnTest"
-    coverage_target="framework"
-    continuous="true" />
-
 <!--  obsolete?
 <test name="deadlock"
     build_path="frameworks/base/tests/Deadlock"
@@ -116,15 +151,15 @@
 
 
 <test name="contentprovideroperation"
-    build_path="frameworks/base/tests/FrameworkTest"
-    package="com.android.frameworktest.tests"
+    build_path="frameworks/base/core/tests/coretests"
+    package="com.android.frameworks.coretests"
     class="android.content.ContentProviderOperationTest"
     coverage_target="framework" />
 
 <test name="tablemerger"
     build_path="frameworks/base/tests/FrameworkTest"
     package="com.android.frameworktest.tests"
-    class="android.content.AbstractTableMergerTest"
+    class="com.google.android.gsf.AbstractTableMergerTest"
     coverage_target="framework" />
 
 <test name="imf"
@@ -140,6 +175,10 @@
     coverage_target="framework"
     continuous="true" />
 
+<test name="common"
+    build_path="frameworks/base/common/tests"
+    package="com.android.common.tests" />
+
 <!--  cts tests -->
 
 <test name="cts-permission"
@@ -354,7 +393,8 @@
 <test name="calprov"
     build_path="packages/providers/CalendarProvider/tests"
     package="com.android.providers.calendar.tests"
-    coverage_target="CalendarProvider" />
+    coverage_target="CalendarProvider"
+    continuous="true" />
 
 <test name="camerastress"
     build_path="packages/apps/Camera"
@@ -418,24 +458,6 @@
     class="com.android.email.SmallTests"
     coverage_target="Email" />
 
-<test name="globalsearch"
-    build_path="packages/apps/GlobalSearch"
-    package="com.android.globalsearch.tests"
-    coverage_target="GlobalSearch"
-    continuous="true" />
-
-<test name="globalsearch-permission"
-    build_path="packages/apps/GlobalSearch"
-    package="com.android.globalsearch.permission.tests"
-    coverage_target="GlobalSearch"
-    continuous="true" />
-
-<test name="improvider-permission"
-    build_path="packages/providers/ImProvider/tests/permission"
-    package="com.android.providers.im.permission.tests"
-    coverage_target="ImProvider"
-    continuous="true" />
-
 <test name="media"
     build_path="frameworks/base/media/tests/MediaFrameworkTest"
     package="com.android.mediaframeworktest"
@@ -500,11 +522,18 @@
     runner="com.android.mms.SmsLaunchPerformance"
     coverage_target="Mms" />
 
-<test name="telephony-unit"
-    build_path="frameworks/base/telephony/tests/TelephonyTest"
-    package="com.android.telephonytest"
-    runner=".TelephonyUnitTestRunner"
-    coverage_target="framework" />
+<!-- Unit tests for the phone application. -->
+<test name="phone-unit"
+    build_path="packages/apps/Phone"
+    package="com.android.phone.tests"
+    continuous="true"
+    coverage_target="Phone" />
+
+<test name="quicksearchbox"
+    build_path="packages/apps/QuickSearchBox"
+    package="com.android.quicksearchbox.tests"
+    coverage_target="QuickSearchBox"
+    continuous="true" />
 
 <!-- obsolete?
 <test name="ringtone"
diff --git a/testrunner/test_defs/instrumentation_test.py b/testrunner/test_defs/instrumentation_test.py
index 401a980..c932a0b 100644
--- a/testrunner/test_defs/instrumentation_test.py
+++ b/testrunner/test_defs/instrumentation_test.py
@@ -160,7 +160,8 @@
         logger.Log("Error: could not find coverage data on device")
         return
 
-      coverage_file = coverage_gen.ExtractReport(self, device_coverage_path)
+      coverage_file = coverage_gen.ExtractReport(
+          self, device_coverage_path, test_qualifier=options.test_size)
       if coverage_file is not None:
         logger.Log("Coverage report generated at %s" % coverage_file)
     else:
diff --git a/tools/etc1tool/etc1tool.cpp b/tools/etc1tool/etc1tool.cpp
index ecf96ec..4cc0202 100644
--- a/tools/etc1tool/etc1tool.cpp
+++ b/tools/etc1tool/etc1tool.cpp
@@ -142,9 +142,9 @@
     png_bytep* row_pointers = NULL; // Does not need to be deallocated.
     png_uint_32 width = 0;
     png_uint_32 height = 0;
+    png_uint_32 stride = 0;
     int result = -1;
     etc1_byte* pSourceImage = 0;
-    png_uint_32 stride = 0;
 
     if ((pIn = fopen(pInput, "rb")) == NULL) {
         fprintf(stderr, "Could not open input file %s for reading: %d\n",
diff --git a/tools/findunused/findunusedresources b/tools/findunused/findunusedresources
index 54b1596..073763e 100755
--- a/tools/findunused/findunusedresources
+++ b/tools/findunused/findunusedresources
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+LANG=C
+
 if [ "$1" == "-h" ]
 then
     cat <<- EOH
diff --git a/tools/hosttestlib/src/com/android/hosttest/DeviceConnector.java b/tools/hosttestlib/src/com/android/hosttest/DeviceConnector.java
new file mode 100644
index 0000000..8974d71
--- /dev/null
+++ b/tools/hosttestlib/src/com/android/hosttest/DeviceConnector.java
@@ -0,0 +1,110 @@
+/*
+ * 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.android.hosttest;
+
+import com.android.ddmlib.AndroidDebugBridge;
+import com.android.ddmlib.IDevice;
+import com.android.ddmlib.AndroidDebugBridge.IDeviceChangeListener;
+
+
+/**
+ * A helper class that can connect to a ddmlib {@link IDevice}
+ */
+public class DeviceConnector {
+
+    /**
+     * The maximum time to wait for a device to be connected.
+     */
+    private static final int MAX_WAIT_DEVICE_TIME = 5000;
+
+    /**
+     * Initializes DDMS library, and connects to specified Android device
+     *
+     * @param deviceSerial the device serial to connect to. If <code>null</code> connect to first
+     * discovered device.
+     *
+     * @return the {@link IDevice} found
+     * @throws IllegalArgumentException if no device cannot be found.
+     */
+    public IDevice connectToDevice(String deviceSerial) {
+        // initialize DDMS with no clientSupport aka debugger support
+        AndroidDebugBridge.init(false /* clientSupport */);
+        AndroidDebugBridge adbBridge = AndroidDebugBridge.createBridge();
+        for (IDevice device : adbBridge.getDevices()) {
+            if (deviceSerial == null) {
+                return device;
+            } else if (deviceSerial.equals(device.getSerialNumber())) {
+                return device;
+            }
+        }
+        // TODO: get some sort of logger interface as param instead
+        System.out.println("Waiting for device...");
+        NewDeviceListener listener = new NewDeviceListener(deviceSerial);
+        AndroidDebugBridge.addDeviceChangeListener(listener);
+        IDevice device = listener.waitForDevice(MAX_WAIT_DEVICE_TIME);
+        AndroidDebugBridge.removeDeviceChangeListener(listener);
+        if (device == null) {
+            throw new IllegalArgumentException("Could not connect to device");
+        } else {
+            System.out.println(String.format("Connected to %s", device.getSerialNumber()));
+        }
+        return device;
+    }
+
+    /**
+     * Listener for new Android devices
+     */
+    private static class NewDeviceListener implements IDeviceChangeListener {
+        private IDevice mDevice;
+        private String mSerial;
+
+        public NewDeviceListener(String serial) {
+            mSerial = serial;
+        }
+
+        public void deviceChanged(IDevice device, int changeMask) {
+        }
+
+        public void deviceConnected(IDevice device) {
+            if (mSerial == null) {
+                setDevice(device);
+            } else if (mSerial.equals(device.getSerialNumber())) {
+                setDevice(device);
+            }
+        }
+
+        private synchronized void setDevice(IDevice device) {
+            mDevice = device;
+            notify();
+        }
+
+        public void deviceDisconnected(IDevice device) {
+        }
+
+        public IDevice waitForDevice(long waitTime) {
+            synchronized(this) {
+                if (mDevice == null) {
+                    try {
+                        wait(waitTime);
+                    } catch (InterruptedException e) {
+                        System.out.println("Waiting for device interrupted");
+                    }
+                }
+            }
+            return mDevice;
+        }
+    }
+}
diff --git a/tools/hosttestlib/src/com/android/hosttest/DeviceTestRunner.java b/tools/hosttestlib/src/com/android/hosttest/DeviceTestRunner.java
index ab4ce5f..31ba31c 100644
--- a/tools/hosttestlib/src/com/android/hosttest/DeviceTestRunner.java
+++ b/tools/hosttestlib/src/com/android/hosttest/DeviceTestRunner.java
@@ -71,7 +71,8 @@
                 parentArgs.add(args[i]);
             }
         }
-        mDevice = connectToDevice(mDeviceSerial);
+        DeviceConnector connector = new DeviceConnector();
+        mDevice = connector.connectToDevice(mDeviceSerial);
         return super.start(parentArgs.toArray(new String[parentArgs.size()]));
     }
 
@@ -83,77 +84,6 @@
         return args[index];
     }
 
-    /**
-     * Initializes DDMS library, and connects to specified Android device
-     * @param deviceSerial
-     * @return {@link IDevice}
-     * @throws IllegalArgumentException if specified device cannot be found
-     */
-    private IDevice connectToDevice(String deviceSerial) {
-        // initialize DDMS with no clientSupport aka debugger support
-        AndroidDebugBridge.init(false /* clientSupport */);
-        AndroidDebugBridge adbBridge = AndroidDebugBridge.createBridge();
-        for (IDevice device : adbBridge.getDevices()) {
-            if (deviceSerial == null) {
-                return device;
-            } else if (deviceSerial.equals(device.getSerialNumber())) {
-                return device;
-            }
-        }
-        System.out.println("Waiting for device...");
-        NewDeviceListener listener = new NewDeviceListener(deviceSerial);
-        AndroidDebugBridge.addDeviceChangeListener(listener);
-        IDevice device = listener.waitForDevice(5000);
-        AndroidDebugBridge.removeDeviceChangeListener(listener);
-        if (device == null) {
-            throw new IllegalArgumentException("Could not connect to device");
-        }
-        return device;
-    }
-
-    /**
-     * Listener for new Android devices
-     */
-    private static class NewDeviceListener implements IDeviceChangeListener {
-        private IDevice mDevice;
-        private String mSerial;
-
-        public NewDeviceListener(String serial) {
-            mSerial = serial;
-        }
-
-        public void deviceChanged(IDevice device, int changeMask) {
-        }
-
-        public void deviceConnected(IDevice device) {
-            if (mSerial == null) {
-                setDevice(device);
-            } else if (mSerial.equals(device.getSerialNumber())) {
-                setDevice(device);
-            }
-        }
-
-        private synchronized void setDevice(IDevice device) {
-            mDevice = device;
-            notify();
-        }
-
-        public void deviceDisconnected(IDevice device) {
-        }
-
-        public IDevice waitForDevice(long waitTime) {
-            synchronized(this) {
-                if (mDevice == null) {
-                    try {
-                        wait(waitTime);
-                    } catch (InterruptedException e) {
-                        System.out.println("Waiting for device interrupted");
-                    }
-                }
-            }
-            return mDevice;
-        }
-    }
 
     /**
      * Main entry point.
@@ -202,6 +132,7 @@
     /**
      * Override parent to create DeviceTestSuite wrapper, instead of TestSuite
      */
+    @SuppressWarnings("unchecked")
     @Override
     protected TestResult runSingleMethod(String testCase, String method, boolean wait)
     throws Exception {
diff --git a/tools/make_key b/tools/make_key
new file mode 100755
index 0000000..ac02d17
--- /dev/null
+++ b/tools/make_key
@@ -0,0 +1,67 @@
+#!/bin/bash
+#
+# Copyright (C) 2009 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.
+
+# Generates a public/private key pair suitable for use in signing
+# android .apks and OTA update packages.
+
+if [ "$#" -ne 2 ]; then
+  cat <<EOF
+Usage: $0 <name> <subject>
+
+Creates <name>.pk8 key and <name>.x509.pem cert.  Cert contains the
+given <subject>.
+EOF
+  exit 2
+fi
+
+if [[ -e $1.pk8 || -e $1.x509.pem ]]; then
+  echo "$1.pk8 and/or $1.x509.pem already exist; please delete them first"
+  echo "if you want to replace them."
+  exit 1
+fi
+
+# Use named pipes to connect get the raw RSA private key to the cert-
+# and .pk8-creating programs, to avoid having the private key ever
+# touch the disk.
+
+tmpdir=$(mktemp -d)
+trap 'rm -rf ${tmpdir}; echo; exit 1' EXIT INT QUIT
+
+one=${tmpdir}/one
+two=${tmpdir}/two
+mknod ${one} p
+mknod ${two} p
+chmod 0600 ${one} ${two}
+
+read -p "Enter password for '$1' (blank for none; password will be visible): " \
+  password
+
+( openssl genrsa -3 2048 | tee ${one} > ${two} ) &
+
+openssl req -new -x509 -sha1 -key ${two} -out $1.x509.pem \
+  -days 10000 -subj "$2" &
+
+if [ "${password}" == "" ]; then
+  echo "creating ${1}.pk8 with no password"
+  openssl pkcs8 -in ${one} -topk8 -outform DER -out $1.pk8 -nocrypt
+else
+  echo "creating ${1}.pk8 with password [${password}]"
+  echo $password | openssl pkcs8 -in ${one} -topk8 -outform DER -out $1.pk8 \
+    -passout stdin
+fi
+
+wait
+wait
diff --git a/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRecorder.java b/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRecorder.java
index efc002b..f06eafd 100644
--- a/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRecorder.java
+++ b/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRecorder.java
@@ -52,12 +52,11 @@
  *    mr.close();
  *
  *  With MonkeyRunner this should output an xml file, <script_name>-yyyyMMdd-HH:mm:ss.xml, into the
- *  directory out/<script_name>-yyyyMMdd-HH:mm:ss with the contents:
+ *  directory out/<script_name>-yyyyMMdd-HH:mm:ss with the contents like:
  *
  *  <?xml version="1.0" encoding='UTF-8'?>
- *  <script_run>
- *    script_name="filename"
- *    monkeyRunnerVersion="0.2"
+ *  <!-- Monkey Script Results -->
+ *  <script_run script_name="filename" monkeyRunnerVersion="0.2">
  *    <!-- Device specific variables -->
  *    <device_var var_name="name" var_value="value" />
  *    <device_var name="build.display" value="opal-userdebug 1.6 DRC79 14207 test-keys"/>
@@ -95,14 +94,15 @@
   private static final String ROOT_DIR = "out";
   
   // for getting the date and time in now()
-  private static final SimpleDateFormat SIMPLE_DATE_TIME_FORMAT = new SimpleDateFormat("yyyyMMdd-HH:mm:ss");
+  private static final SimpleDateFormat SIMPLE_DATE_TIME_FORMAT =
+      new SimpleDateFormat("yyyyMMdd-HH:mm:ss");
   
   /**
    * Create a new MonkeyRecorder that records commands and zips up screenshots for submittal
    * 
    * @param scriptName filepath of the monkey script we are running
    */
-  public MonkeyRecorder(String scriptName) throws IOException {
+  public MonkeyRecorder(String scriptName, String version) throws IOException {
     // Create directory structure to store xml file, images and zips
     File scriptFile = new File(scriptName);
     scriptName = scriptFile.getName();  // Get rid of path
@@ -111,7 +111,7 @@
     
     // Initialize xml file
     mXmlFilename = stampFilename(stripType(scriptName) + ".xml");
-    initXmlFile(scriptName);
+    initXmlFile(scriptName, version);
   }
 
   // Get the current date and time in a simple string format (used for timestamping filenames)
@@ -123,14 +123,16 @@
    * Initialize the xml file writer
    * 
    * @param scriptName filename (not path) of the monkey script, stored as attribute in the xml file
+   * @param version of the monkey runner test system
    */
-  private static void initXmlFile(String scriptName) throws IOException {
+  private static void initXmlFile(String scriptName, String version) throws IOException {
+    String[] names = new String[] { "script_name", "monkeyRunnerVersion" };
+    String[] values = new String[] { scriptName, version };
     mXmlFile = new FileWriter(mDirname + "/" + mXmlFilename);
     mXmlWriter = new XMLWriter(mXmlFile);
     mXmlWriter.begin();
     mXmlWriter.comment("Monkey Script Results");
-    mXmlWriter.start("script_run");
-    mXmlWriter.addAttribute("script_name", scriptName);
+    mXmlWriter.start("script_run", names, values, names.length);
   }
   
   /**
@@ -146,8 +148,7 @@
    * Begin writing a command xml element
    */
   public static void startCommand() throws IOException {
-    mXmlWriter.start("command");
-    mXmlWriter.addAttribute("dateTime", now());
+    mXmlWriter.start("command", "dateTime", now());
   }
   
   /**
@@ -187,7 +188,7 @@
   }
   
   /**
-   * Add an attribut to an xml element. name="escaped_value"
+   * Add an attribut to an open xml element. name="escaped_value"
    * 
    * @param name name of the attribute
    * @param value value of the attribute
@@ -253,20 +254,6 @@
       return filename;
     return filename.substring(0, typeIndex);
   }
-  
-   /**
-   * Add a signature element
-   *
-   * @param filename path of file to be signatured
-   */
-   private static void addMD5Signature(String filename) throws IOException {
-      String signature = "";
-      // find signature... MD5 sig = new MD5(filename); signature = sig.toString();
-      String[] names = new String[] { "type", "filename", "signature" };
-      String[] values = new String[] { "md5", filename, signature };
-      mXmlWriter.tag("Signature", names, values, values.length);
-   }
- 
 
   /**
    * Close the monkeyRecorder by closing the xml file and zipping it up with the screenshots.
diff --git a/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRunner.java b/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRunner.java
index 07a4739..4734ba1 100644
--- a/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRunner.java
+++ b/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRunner.java
@@ -69,7 +69,7 @@
   final static int KEY_INPUT_DELAY = 1000;
   
   // version of monkey runner
-  final static String monkeyRunnerVersion = "0.31";
+  final static String monkeyRunnerVersion = "0.4";
 
   // TODO: interface cmd; class xml tags; fix logger; test class/script
 
@@ -222,10 +222,9 @@
     press("home", false);
     
     // Start recording the script output, might want md5 signature of file for completeness
-    monkeyRecorder = new MonkeyRecorder(scriptName);
+    monkeyRecorder = new MonkeyRecorder(scriptName, monkeyRunnerVersion);
 
-    // Record what device and version of software we are running on
-    monkeyRecorder.addAttribute("monkeyRunnerVersion", monkeyRunnerVersion);
+    // Record what device we are running on
     addDeviceVars();
     monkeyRecorder.addComment("Script commands");
   }
diff --git a/tutorials/NotepadCodeLab/Notepadv1/Android.mk b/tutorials/NotepadCodeLab/Notepadv1/Android.mk
new file mode 100644
index 0000000..60beb2c
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1/Android.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2009 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
+LOCAL_MODULE_TAGS := optional
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := Notepadv1
+
+# Make the app build against the current SDK
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tutorials/NotepadCodeLab/Notepadv1/AndroidManifest.xml b/tutorials/NotepadCodeLab/Notepadv1/AndroidManifest.xml
new file mode 100755
index 0000000..99023fe
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1/AndroidManifest.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.demo.notepad1">
+    <application android:icon="@drawable/icon">
+        <activity android:name=".Notepadv1" android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest> 
\ No newline at end of file
diff --git a/tutorials/NotepadCodeLab/Notepadv1/res/drawable/icon.png b/tutorials/NotepadCodeLab/Notepadv1/res/drawable/icon.png
new file mode 100755
index 0000000..64e3601
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1/res/drawable/icon.png
Binary files differ
diff --git a/tutorials/NotepadCodeLab/Notepadv1/res/layout/notepad_list.xml b/tutorials/NotepadCodeLab/Notepadv1/res/layout/notepad_list.xml
new file mode 100755
index 0000000..154888d
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1/res/layout/notepad_list.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+      android:layout_width="wrap_content"
+    android:layout_height="wrap_content">
+
+</LinearLayout>
\ No newline at end of file
diff --git a/tutorials/NotepadCodeLab/Notepadv1/res/values/strings.xml b/tutorials/NotepadCodeLab/Notepadv1/res/values/strings.xml
new file mode 100755
index 0000000..5698961
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1/res/values/strings.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">Notepad v1</string>
+    <string name="no_notes">No Notes Yet</string>
+</resources>
diff --git a/tutorials/NotepadCodeLab/Notepadv1/src/com/android/demo/notepad1/Notepadv1.java b/tutorials/NotepadCodeLab/Notepadv1/src/com/android/demo/notepad1/Notepadv1.java
new file mode 100755
index 0000000..df73f42
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1/src/com/android/demo/notepad1/Notepadv1.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * 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.android.demo.notepad1;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+
+public class Notepadv1 extends Activity {
+    private int mNoteNumber = 1;
+
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        // TODO Auto-generated method stub
+        return super.onCreateOptionsMenu(menu);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        // TODO Auto-generated method stub
+        return super.onOptionsItemSelected(item);
+    }
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv1/src/com/android/demo/notepad1/NotesDbAdapter.java b/tutorials/NotepadCodeLab/Notepadv1/src/com/android/demo/notepad1/NotesDbAdapter.java
new file mode 100755
index 0000000..a3295d6
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1/src/com/android/demo/notepad1/NotesDbAdapter.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ * 
+ * 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.android.demo.notepad1;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.SQLException;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.util.Log;
+
+/**
+ * Simple notes database access helper class. Defines the basic CRUD operations
+ * for the notepad example, and gives the ability to list all notes as well as
+ * retrieve or modify a specific note.
+ * 
+ * This has been improved from the first version of this tutorial through the
+ * addition of better error handling and also using returning a Cursor instead
+ * of using a collection of inner classes (which is less scalable and not
+ * recommended).
+ */
+public class NotesDbAdapter {
+
+    public static final String KEY_TITLE = "title";
+    public static final String KEY_BODY = "body";
+    public static final String KEY_ROWID = "_id";
+
+    private static final String TAG = "NotesDbAdapter";
+    private DatabaseHelper mDbHelper;
+    private SQLiteDatabase mDb;
+
+    /**
+     * Database creation sql statement
+     */
+    private static final String DATABASE_CREATE =
+        "create table notes (_id integer primary key autoincrement, "
+        + "title text not null, body text not null);";
+
+    private static final String DATABASE_NAME = "data";
+    private static final String DATABASE_TABLE = "notes";
+    private static final int DATABASE_VERSION = 2;
+
+    private final Context mCtx;
+
+    private static class DatabaseHelper extends SQLiteOpenHelper {
+
+        DatabaseHelper(Context context) {
+            super(context, DATABASE_NAME, null, DATABASE_VERSION);
+        }
+
+        @Override
+        public void onCreate(SQLiteDatabase db) {
+
+            db.execSQL(DATABASE_CREATE);
+        }
+
+        @Override
+        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+            Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
+                    + newVersion + ", which will destroy all old data");
+            db.execSQL("DROP TABLE IF EXISTS notes");
+            onCreate(db);
+        }
+    }
+
+    /**
+     * Constructor - takes the context to allow the database to be
+     * opened/created
+     * 
+     * @param ctx the Context within which to work
+     */
+    public NotesDbAdapter(Context ctx) {
+        this.mCtx = ctx;
+    }
+
+    /**
+     * Open the notes database. If it cannot be opened, try to create a new
+     * instance of the database. If it cannot be created, throw an exception to
+     * signal the failure
+     * 
+     * @return this (self reference, allowing this to be chained in an
+     *         initialization call)
+     * @throws SQLException if the database could be neither opened or created
+     */
+    public NotesDbAdapter open() throws SQLException {
+        mDbHelper = new DatabaseHelper(mCtx);
+        mDb = mDbHelper.getWritableDatabase();
+        return this;
+    }
+
+    public void close() {
+        mDbHelper.close();
+    }
+
+
+    /**
+     * Create a new note using the title and body provided. If the note is
+     * successfully created return the new rowId for that note, otherwise return
+     * a -1 to indicate failure.
+     * 
+     * @param title the title of the note
+     * @param body the body of the note
+     * @return rowId or -1 if failed
+     */
+    public long createNote(String title, String body) {
+        ContentValues initialValues = new ContentValues();
+        initialValues.put(KEY_TITLE, title);
+        initialValues.put(KEY_BODY, body);
+
+        return mDb.insert(DATABASE_TABLE, null, initialValues);
+    }
+
+    /**
+     * Delete the note with the given rowId
+     * 
+     * @param rowId id of note to delete
+     * @return true if deleted, false otherwise
+     */
+    public boolean deleteNote(long rowId) {
+
+        return mDb.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0;
+    }
+
+    /**
+     * Return a Cursor over the list of all notes in the database
+     * 
+     * @return Cursor over all notes
+     */
+    public Cursor fetchAllNotes() {
+
+        return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_TITLE,
+                KEY_BODY}, null, null, null, null, null);
+    }
+
+    /**
+     * Return a Cursor positioned at the note that matches the given rowId
+     * 
+     * @param rowId id of note to retrieve
+     * @return Cursor positioned to matching note, if found
+     * @throws SQLException if note could not be found/retrieved
+     */
+    public Cursor fetchNote(long rowId) throws SQLException {
+
+        Cursor mCursor =
+
+            mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
+                    KEY_TITLE, KEY_BODY}, KEY_ROWID + "=" + rowId, null,
+                    null, null, null, null);
+        if (mCursor != null) {
+            mCursor.moveToFirst();
+        }
+        return mCursor;
+
+    }
+
+    /**
+     * Update the note using the details provided. The note to be updated is
+     * specified using the rowId, and it is altered to use the title and body
+     * values passed in
+     * 
+     * @param rowId id of note to update
+     * @param title value to set note title to
+     * @param body value to set note body to
+     * @return true if the note was successfully updated, false otherwise
+     */
+    public boolean updateNote(long rowId, String title, String body) {
+        ContentValues args = new ContentValues();
+        args.put(KEY_TITLE, title);
+        args.put(KEY_BODY, body);
+
+        return mDb.update(DATABASE_TABLE, args, KEY_ROWID + "=" + rowId, null) > 0;
+    }
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv1Solution/Android.mk b/tutorials/NotepadCodeLab/Notepadv1Solution/Android.mk
new file mode 100644
index 0000000..35bc577
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1Solution/Android.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2009 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
+LOCAL_MODULE_TAGS := optional
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := Notepadv1Solution
+
+# Make the app build against the current SDK
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tutorials/NotepadCodeLab/Notepadv1Solution/AndroidManifest.xml b/tutorials/NotepadCodeLab/Notepadv1Solution/AndroidManifest.xml
new file mode 100755
index 0000000..99023fe
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1Solution/AndroidManifest.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.demo.notepad1">
+    <application android:icon="@drawable/icon">
+        <activity android:name=".Notepadv1" android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest> 
\ No newline at end of file
diff --git a/tutorials/NotepadCodeLab/Notepadv1Solution/res/drawable/icon.png b/tutorials/NotepadCodeLab/Notepadv1Solution/res/drawable/icon.png
new file mode 100755
index 0000000..64e3601
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1Solution/res/drawable/icon.png
Binary files differ
diff --git a/tutorials/NotepadCodeLab/Notepadv1Solution/res/layout/notepad_list.xml b/tutorials/NotepadCodeLab/Notepadv1Solution/res/layout/notepad_list.xml
new file mode 100755
index 0000000..0c8dbab
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1Solution/res/layout/notepad_list.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+      android:layout_width="wrap_content"
+    android:layout_height="wrap_content">
+
+	<ListView android:id="@id/android:list"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"/>
+  	<TextView android:id="@id/android:empty"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:text="@string/no_notes"/>
+        
+</LinearLayout>
\ No newline at end of file
diff --git a/tutorials/NotepadCodeLab/Notepadv1Solution/res/layout/notes_row.xml b/tutorials/NotepadCodeLab/Notepadv1Solution/res/layout/notes_row.xml
new file mode 100755
index 0000000..e405b52
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1Solution/res/layout/notes_row.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView android:id="@+id/text1"
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"/>
diff --git a/tutorials/NotepadCodeLab/Notepadv1Solution/res/values/strings.xml b/tutorials/NotepadCodeLab/Notepadv1Solution/res/values/strings.xml
new file mode 100755
index 0000000..265bc62
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1Solution/res/values/strings.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">Notepad v1</string>
+    <string name="no_notes">No Notes Yet</string>
+    <string name="menu_insert">Add Item</string>
+</resources>
diff --git a/tutorials/NotepadCodeLab/Notepadv1Solution/src/com/android/demo/notepad1/Notepadv1.java b/tutorials/NotepadCodeLab/Notepadv1Solution/src/com/android/demo/notepad1/Notepadv1.java
new file mode 100755
index 0000000..a1819ed
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1Solution/src/com/android/demo/notepad1/Notepadv1.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * 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.android.demo.notepad1;
+
+import android.app.ListActivity;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.widget.SimpleCursorAdapter;
+
+public class Notepadv1 extends ListActivity {
+	public static final int INSERT_ID = Menu.FIRST;
+	
+	private int mNoteNumber = 1;
+	private NotesDbAdapter mDbHelper;
+    
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.notepad_list);
+        mDbHelper = new NotesDbAdapter(this);
+        mDbHelper.open();
+        fillData();
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+    	boolean result = super.onCreateOptionsMenu(menu);
+        menu.add(0, INSERT_ID, 0, R.string.menu_insert);
+        return result;
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+    	switch (item.getItemId()) {
+        case INSERT_ID:
+            createNote();
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+    
+    private void createNote() {
+        String noteName = "Note " + mNoteNumber++;
+        mDbHelper.createNote(noteName, "");
+        fillData();
+    }
+    
+    private void fillData() {
+        // Get all of the notes from the database and create the item list
+        Cursor c = mDbHelper.fetchAllNotes();
+        startManagingCursor(c);
+
+        String[] from = new String[] { NotesDbAdapter.KEY_TITLE };
+        int[] to = new int[] { R.id.text1 };
+        
+        // Now create an array adapter and set it to display using our row
+        SimpleCursorAdapter notes =
+            new SimpleCursorAdapter(this, R.layout.notes_row, c, from, to);
+        setListAdapter(notes);
+    }
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv1Solution/src/com/android/demo/notepad1/NotesDbAdapter.java b/tutorials/NotepadCodeLab/Notepadv1Solution/src/com/android/demo/notepad1/NotesDbAdapter.java
new file mode 100755
index 0000000..a3295d6
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv1Solution/src/com/android/demo/notepad1/NotesDbAdapter.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ * 
+ * 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.android.demo.notepad1;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.SQLException;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.util.Log;
+
+/**
+ * Simple notes database access helper class. Defines the basic CRUD operations
+ * for the notepad example, and gives the ability to list all notes as well as
+ * retrieve or modify a specific note.
+ * 
+ * This has been improved from the first version of this tutorial through the
+ * addition of better error handling and also using returning a Cursor instead
+ * of using a collection of inner classes (which is less scalable and not
+ * recommended).
+ */
+public class NotesDbAdapter {
+
+    public static final String KEY_TITLE = "title";
+    public static final String KEY_BODY = "body";
+    public static final String KEY_ROWID = "_id";
+
+    private static final String TAG = "NotesDbAdapter";
+    private DatabaseHelper mDbHelper;
+    private SQLiteDatabase mDb;
+
+    /**
+     * Database creation sql statement
+     */
+    private static final String DATABASE_CREATE =
+        "create table notes (_id integer primary key autoincrement, "
+        + "title text not null, body text not null);";
+
+    private static final String DATABASE_NAME = "data";
+    private static final String DATABASE_TABLE = "notes";
+    private static final int DATABASE_VERSION = 2;
+
+    private final Context mCtx;
+
+    private static class DatabaseHelper extends SQLiteOpenHelper {
+
+        DatabaseHelper(Context context) {
+            super(context, DATABASE_NAME, null, DATABASE_VERSION);
+        }
+
+        @Override
+        public void onCreate(SQLiteDatabase db) {
+
+            db.execSQL(DATABASE_CREATE);
+        }
+
+        @Override
+        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+            Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
+                    + newVersion + ", which will destroy all old data");
+            db.execSQL("DROP TABLE IF EXISTS notes");
+            onCreate(db);
+        }
+    }
+
+    /**
+     * Constructor - takes the context to allow the database to be
+     * opened/created
+     * 
+     * @param ctx the Context within which to work
+     */
+    public NotesDbAdapter(Context ctx) {
+        this.mCtx = ctx;
+    }
+
+    /**
+     * Open the notes database. If it cannot be opened, try to create a new
+     * instance of the database. If it cannot be created, throw an exception to
+     * signal the failure
+     * 
+     * @return this (self reference, allowing this to be chained in an
+     *         initialization call)
+     * @throws SQLException if the database could be neither opened or created
+     */
+    public NotesDbAdapter open() throws SQLException {
+        mDbHelper = new DatabaseHelper(mCtx);
+        mDb = mDbHelper.getWritableDatabase();
+        return this;
+    }
+
+    public void close() {
+        mDbHelper.close();
+    }
+
+
+    /**
+     * Create a new note using the title and body provided. If the note is
+     * successfully created return the new rowId for that note, otherwise return
+     * a -1 to indicate failure.
+     * 
+     * @param title the title of the note
+     * @param body the body of the note
+     * @return rowId or -1 if failed
+     */
+    public long createNote(String title, String body) {
+        ContentValues initialValues = new ContentValues();
+        initialValues.put(KEY_TITLE, title);
+        initialValues.put(KEY_BODY, body);
+
+        return mDb.insert(DATABASE_TABLE, null, initialValues);
+    }
+
+    /**
+     * Delete the note with the given rowId
+     * 
+     * @param rowId id of note to delete
+     * @return true if deleted, false otherwise
+     */
+    public boolean deleteNote(long rowId) {
+
+        return mDb.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0;
+    }
+
+    /**
+     * Return a Cursor over the list of all notes in the database
+     * 
+     * @return Cursor over all notes
+     */
+    public Cursor fetchAllNotes() {
+
+        return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_TITLE,
+                KEY_BODY}, null, null, null, null, null);
+    }
+
+    /**
+     * Return a Cursor positioned at the note that matches the given rowId
+     * 
+     * @param rowId id of note to retrieve
+     * @return Cursor positioned to matching note, if found
+     * @throws SQLException if note could not be found/retrieved
+     */
+    public Cursor fetchNote(long rowId) throws SQLException {
+
+        Cursor mCursor =
+
+            mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
+                    KEY_TITLE, KEY_BODY}, KEY_ROWID + "=" + rowId, null,
+                    null, null, null, null);
+        if (mCursor != null) {
+            mCursor.moveToFirst();
+        }
+        return mCursor;
+
+    }
+
+    /**
+     * Update the note using the details provided. The note to be updated is
+     * specified using the rowId, and it is altered to use the title and body
+     * values passed in
+     * 
+     * @param rowId id of note to update
+     * @param title value to set note title to
+     * @param body value to set note body to
+     * @return true if the note was successfully updated, false otherwise
+     */
+    public boolean updateNote(long rowId, String title, String body) {
+        ContentValues args = new ContentValues();
+        args.put(KEY_TITLE, title);
+        args.put(KEY_BODY, body);
+
+        return mDb.update(DATABASE_TABLE, args, KEY_ROWID + "=" + rowId, null) > 0;
+    }
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv2/Android.mk b/tutorials/NotepadCodeLab/Notepadv2/Android.mk
new file mode 100644
index 0000000..77a2b47
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2/Android.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2009 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
+LOCAL_MODULE_TAGS := optional
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := Notepadv2
+
+# Make the app build against the current SDK
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tutorials/NotepadCodeLab/Notepadv2/AndroidManifest.xml b/tutorials/NotepadCodeLab/Notepadv2/AndroidManifest.xml
new file mode 100755
index 0000000..738fb2a
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2/AndroidManifest.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.demo.notepad2">
+    <application android:icon="@drawable/icon">
+        <activity android:name=".Notepadv2" android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest> 
\ No newline at end of file
diff --git a/tutorials/NotepadCodeLab/Notepadv2/res/drawable/icon.png b/tutorials/NotepadCodeLab/Notepadv2/res/drawable/icon.png
new file mode 100755
index 0000000..64e3601
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2/res/drawable/icon.png
Binary files differ
diff --git a/tutorials/NotepadCodeLab/Notepadv2/res/layout/note_edit.xml b/tutorials/NotepadCodeLab/Notepadv2/res/layout/note_edit.xml
new file mode 100755
index 0000000..4af9754
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2/res/layout/note_edit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:orientation="vertical" android:layout_width="match_parent"
+	android:layout_height="match_parent">
+	
+	<LinearLayout android:orientation="horizontal"
+		android:layout_width="match_parent"
+		android:layout_height="wrap_content">
+
+		<TextView android:layout_width="wrap_content"
+			android:layout_height="wrap_content" 
+			android:text="@string/title" />
+		<EditText android:id="@+id/title" 
+		  android:layout_width="wrap_content"
+			android:layout_height="wrap_content" 
+			android:layout_weight="1"/>
+	</LinearLayout>
+
+	<TextView android:layout_width="wrap_content"
+		android:layout_height="wrap_content" 
+		android:text="@string/body" />
+	<EditText android:id="@+id/body" android:layout_width="match_parent"
+		android:layout_height="wrap_content"
+		android:layout_weight="1"
+		android:scrollbars="vertical" />
+	
+	<Button android:id="@+id/confirm" 
+	  android:text="@string/confirm"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/tutorials/NotepadCodeLab/Notepadv2/res/layout/notes_list.xml b/tutorials/NotepadCodeLab/Notepadv2/res/layout/notes_list.xml
new file mode 100755
index 0000000..6ae0472
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2/res/layout/notes_list.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+      android:layout_width="wrap_content"
+    	android:layout_height="wrap_content">
+    
+    <ListView android:id="@+id/android:list"
+          android:layout_width="wrap_content"
+        	android:layout_height="wrap_content"/>
+  	<TextView android:id="@+id/android:empty"
+          android:layout_width="wrap_content"
+        	android:layout_height="wrap_content"
+        	android:text="@string/no_notes"/>
+</LinearLayout>
diff --git a/tutorials/NotepadCodeLab/Notepadv2/res/layout/notes_row.xml b/tutorials/NotepadCodeLab/Notepadv2/res/layout/notes_row.xml
new file mode 100755
index 0000000..f28a41b
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2/res/layout/notes_row.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView android:id="@+id/text1" xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"/>
diff --git a/tutorials/NotepadCodeLab/Notepadv2/res/values/strings.xml b/tutorials/NotepadCodeLab/Notepadv2/res/values/strings.xml
new file mode 100755
index 0000000..b70c3f8
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2/res/values/strings.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">Notepad v2</string>
+    <string name="no_notes">No Notes Yet</string>
+    <string name="menu_insert">Add Note</string>
+    <string name="menu_delete">Delete Note</string>
+    <string name="title">Title</string>
+    <string name="body">Body</string>
+    <string name="confirm">Confirm</string>
+    <string name="edit_note">Edit Note</string>
+</resources>
diff --git a/tutorials/NotepadCodeLab/Notepadv2/src/com/android/demo/notepad2/Notepadv2.java b/tutorials/NotepadCodeLab/Notepadv2/src/com/android/demo/notepad2/Notepadv2.java
new file mode 100755
index 0000000..c038180
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2/src/com/android/demo/notepad2/Notepadv2.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * 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.android.demo.notepad2;
+
+import android.app.ListActivity;
+import android.content.Intent;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.view.ContextMenu;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ContextMenu.ContextMenuInfo;
+import android.widget.ListView;
+import android.widget.SimpleCursorAdapter;
+
+public class Notepadv2 extends ListActivity {
+    private static final int ACTIVITY_CREATE=0;
+    private static final int ACTIVITY_EDIT=1;
+    
+    private static final int INSERT_ID = Menu.FIRST;
+    private static final int DELETE_ID = Menu.FIRST + 1;
+
+    private NotesDbAdapter mDbHelper;
+    private Cursor mNotesCursor;
+    
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.notes_list);
+        mDbHelper = new NotesDbAdapter(this);
+        mDbHelper.open();
+        fillData();
+    }
+    
+    private void fillData() {
+        // Get all of the rows from the database and create the item list
+        mNotesCursor = mDbHelper.fetchAllNotes();
+        startManagingCursor(mNotesCursor);
+        
+        // Create an array to specify the fields we want to display in the list (only TITLE)
+        String[] from = new String[]{NotesDbAdapter.KEY_TITLE};
+        
+        // and an array of the fields we want to bind those fields to (in this case just text1)
+        int[] to = new int[]{R.id.text1};
+        
+        // Now create a simple cursor adapter and set it to display
+        SimpleCursorAdapter notes = 
+        	    new SimpleCursorAdapter(this, R.layout.notes_row, mNotesCursor, from, to);
+        setListAdapter(notes);
+    }
+    
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+        menu.add(0, INSERT_ID,0, R.string.menu_insert);
+        return true;
+    }
+
+    @Override
+    public boolean onMenuItemSelected(int featureId, MenuItem item) {
+        switch(item.getItemId()) {
+        case INSERT_ID:
+            createNote();
+            return true;
+        }
+        
+        return super.onMenuItemSelected(featureId, item);
+    }
+
+    @Override
+	public void onCreateContextMenu(ContextMenu menu, View v,
+			ContextMenuInfo menuInfo) {
+		super.onCreateContextMenu(menu, v, menuInfo);
+		
+        // TODO: fill in rest of method
+	}
+
+    @Override
+	public boolean onContextItemSelected(MenuItem item) {
+		return super.onContextItemSelected(item);
+		
+        // TODO: fill in rest of method
+	}
+
+    private void createNote() {
+        // TODO: fill in implementation
+
+    }
+    
+    @Override
+    protected void onListItemClick(ListView l, View v, int position, long id) {
+        super.onListItemClick(l, v, position, id);
+
+        // TODO: fill in rest of method
+        
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
+        super.onActivityResult(requestCode, resultCode, intent);
+        
+        // TODO: fill in rest of method
+        
+    }
+
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv2/src/com/android/demo/notepad2/NotesDbAdapter.java b/tutorials/NotepadCodeLab/Notepadv2/src/com/android/demo/notepad2/NotesDbAdapter.java
new file mode 100755
index 0000000..50994ae
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2/src/com/android/demo/notepad2/NotesDbAdapter.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ * 
+ * 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.android.demo.notepad2;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.SQLException;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.util.Log;
+
+/**
+ * Simple notes database access helper class. Defines the basic CRUD operations
+ * for the notepad example, and gives the ability to list all notes as well as
+ * retrieve or modify a specific note.
+ * 
+ * This has been improved from the first version of this tutorial through the
+ * addition of better error handling and also using returning a Cursor instead
+ * of using a collection of inner classes (which is less scalable and not
+ * recommended).
+ */
+public class NotesDbAdapter {
+
+    public static final String KEY_TITLE = "title";
+    public static final String KEY_BODY = "body";
+    public static final String KEY_ROWID = "_id";
+
+    private static final String TAG = "NotesDbAdapter";
+    private DatabaseHelper mDbHelper;
+    private SQLiteDatabase mDb;
+
+    /**
+     * Database creation sql statement
+     */
+    private static final String DATABASE_CREATE =
+        "create table notes (_id integer primary key autoincrement, "
+        + "title text not null, body text not null);";
+
+    private static final String DATABASE_NAME = "data";
+    private static final String DATABASE_TABLE = "notes";
+    private static final int DATABASE_VERSION = 2;
+
+    private final Context mCtx;
+
+    private static class DatabaseHelper extends SQLiteOpenHelper {
+
+        DatabaseHelper(Context context) {
+            super(context, DATABASE_NAME, null, DATABASE_VERSION);
+        }
+
+        @Override
+        public void onCreate(SQLiteDatabase db) {
+
+            db.execSQL(DATABASE_CREATE);
+        }
+
+        @Override
+        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+            Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
+                    + newVersion + ", which will destroy all old data");
+            db.execSQL("DROP TABLE IF EXISTS notes");
+            onCreate(db);
+        }
+    }
+
+    /**
+     * Constructor - takes the context to allow the database to be
+     * opened/created
+     * 
+     * @param ctx the Context within which to work
+     */
+    public NotesDbAdapter(Context ctx) {
+        this.mCtx = ctx;
+    }
+
+    /**
+     * Open the notes database. If it cannot be opened, try to create a new
+     * instance of the database. If it cannot be created, throw an exception to
+     * signal the failure
+     * 
+     * @return this (self reference, allowing this to be chained in an
+     *         initialization call)
+     * @throws SQLException if the database could be neither opened or created
+     */
+    public NotesDbAdapter open() throws SQLException {
+        mDbHelper = new DatabaseHelper(mCtx);
+        mDb = mDbHelper.getWritableDatabase();
+        return this;
+    }
+
+    public void close() {
+        mDbHelper.close();
+    }
+
+
+    /**
+     * Create a new note using the title and body provided. If the note is
+     * successfully created return the new rowId for that note, otherwise return
+     * a -1 to indicate failure.
+     * 
+     * @param title the title of the note
+     * @param body the body of the note
+     * @return rowId or -1 if failed
+     */
+    public long createNote(String title, String body) {
+        ContentValues initialValues = new ContentValues();
+        initialValues.put(KEY_TITLE, title);
+        initialValues.put(KEY_BODY, body);
+
+        return mDb.insert(DATABASE_TABLE, null, initialValues);
+    }
+
+    /**
+     * Delete the note with the given rowId
+     * 
+     * @param rowId id of note to delete
+     * @return true if deleted, false otherwise
+     */
+    public boolean deleteNote(long rowId) {
+
+        return mDb.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0;
+    }
+
+    /**
+     * Return a Cursor over the list of all notes in the database
+     * 
+     * @return Cursor over all notes
+     */
+    public Cursor fetchAllNotes() {
+
+        return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_TITLE,
+                KEY_BODY}, null, null, null, null, null);
+    }
+
+    /**
+     * Return a Cursor positioned at the note that matches the given rowId
+     * 
+     * @param rowId id of note to retrieve
+     * @return Cursor positioned to matching note, if found
+     * @throws SQLException if note could not be found/retrieved
+     */
+    public Cursor fetchNote(long rowId) throws SQLException {
+
+        Cursor mCursor =
+
+            mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
+                    KEY_TITLE, KEY_BODY}, KEY_ROWID + "=" + rowId, null,
+                    null, null, null, null);
+        if (mCursor != null) {
+            mCursor.moveToFirst();
+        }
+        return mCursor;
+
+    }
+
+    /**
+     * Update the note using the details provided. The note to be updated is
+     * specified using the rowId, and it is altered to use the title and body
+     * values passed in
+     * 
+     * @param rowId id of note to update
+     * @param title value to set note title to
+     * @param body value to set note body to
+     * @return true if the note was successfully updated, false otherwise
+     */
+    public boolean updateNote(long rowId, String title, String body) {
+        ContentValues args = new ContentValues();
+        args.put(KEY_TITLE, title);
+        args.put(KEY_BODY, body);
+
+        return mDb.update(DATABASE_TABLE, args, KEY_ROWID + "=" + rowId, null) > 0;
+    }
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv2Solution/Android.mk b/tutorials/NotepadCodeLab/Notepadv2Solution/Android.mk
new file mode 100644
index 0000000..63961a3
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2Solution/Android.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2009 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
+LOCAL_MODULE_TAGS := optional
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := Notepadv2Solution
+
+# Make the app build against the current SDK
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tutorials/NotepadCodeLab/Notepadv2Solution/AndroidManifest.xml b/tutorials/NotepadCodeLab/Notepadv2Solution/AndroidManifest.xml
new file mode 100755
index 0000000..b86a741
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2Solution/AndroidManifest.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.demo.notepad2">
+    <application android:icon="@drawable/icon">
+        <activity android:name=".Notepadv2" android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity android:name=".NoteEdit" />
+    </application>
+</manifest> 
\ No newline at end of file
diff --git a/tutorials/NotepadCodeLab/Notepadv2Solution/res/drawable/icon.png b/tutorials/NotepadCodeLab/Notepadv2Solution/res/drawable/icon.png
new file mode 100755
index 0000000..64e3601
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2Solution/res/drawable/icon.png
Binary files differ
diff --git a/tutorials/NotepadCodeLab/Notepadv2Solution/res/layout/note_edit.xml b/tutorials/NotepadCodeLab/Notepadv2Solution/res/layout/note_edit.xml
new file mode 100755
index 0000000..4af9754
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2Solution/res/layout/note_edit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:orientation="vertical" android:layout_width="match_parent"
+	android:layout_height="match_parent">
+	
+	<LinearLayout android:orientation="horizontal"
+		android:layout_width="match_parent"
+		android:layout_height="wrap_content">
+
+		<TextView android:layout_width="wrap_content"
+			android:layout_height="wrap_content" 
+			android:text="@string/title" />
+		<EditText android:id="@+id/title" 
+		  android:layout_width="wrap_content"
+			android:layout_height="wrap_content" 
+			android:layout_weight="1"/>
+	</LinearLayout>
+
+	<TextView android:layout_width="wrap_content"
+		android:layout_height="wrap_content" 
+		android:text="@string/body" />
+	<EditText android:id="@+id/body" android:layout_width="match_parent"
+		android:layout_height="wrap_content"
+		android:layout_weight="1"
+		android:scrollbars="vertical" />
+	
+	<Button android:id="@+id/confirm" 
+	  android:text="@string/confirm"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/tutorials/NotepadCodeLab/Notepadv2Solution/res/layout/notes_list.xml b/tutorials/NotepadCodeLab/Notepadv2Solution/res/layout/notes_list.xml
new file mode 100755
index 0000000..6ae0472
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2Solution/res/layout/notes_list.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+      android:layout_width="wrap_content"
+    	android:layout_height="wrap_content">
+    
+    <ListView android:id="@+id/android:list"
+          android:layout_width="wrap_content"
+        	android:layout_height="wrap_content"/>
+  	<TextView android:id="@+id/android:empty"
+          android:layout_width="wrap_content"
+        	android:layout_height="wrap_content"
+        	android:text="@string/no_notes"/>
+</LinearLayout>
diff --git a/tutorials/NotepadCodeLab/Notepadv2Solution/res/layout/notes_row.xml b/tutorials/NotepadCodeLab/Notepadv2Solution/res/layout/notes_row.xml
new file mode 100755
index 0000000..f28a41b
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2Solution/res/layout/notes_row.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView android:id="@+id/text1" xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"/>
diff --git a/tutorials/NotepadCodeLab/Notepadv2Solution/res/values/strings.xml b/tutorials/NotepadCodeLab/Notepadv2Solution/res/values/strings.xml
new file mode 100755
index 0000000..b70c3f8
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2Solution/res/values/strings.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">Notepad v2</string>
+    <string name="no_notes">No Notes Yet</string>
+    <string name="menu_insert">Add Note</string>
+    <string name="menu_delete">Delete Note</string>
+    <string name="title">Title</string>
+    <string name="body">Body</string>
+    <string name="confirm">Confirm</string>
+    <string name="edit_note">Edit Note</string>
+</resources>
diff --git a/tutorials/NotepadCodeLab/Notepadv2Solution/src/com/android/demo/notepad2/NoteEdit.java b/tutorials/NotepadCodeLab/Notepadv2Solution/src/com/android/demo/notepad2/NoteEdit.java
new file mode 100755
index 0000000..8c9dccc
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2Solution/src/com/android/demo/notepad2/NoteEdit.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * 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.android.demo.notepad2;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+public class NoteEdit extends Activity {
+
+    private EditText mTitleText;
+    private EditText mBodyText;
+    private Long mRowId;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.note_edit);
+
+        mTitleText = (EditText) findViewById(R.id.title);
+        mBodyText = (EditText) findViewById(R.id.body);
+
+        Button confirmButton = (Button) findViewById(R.id.confirm);
+
+        mRowId = null;
+        Bundle extras = getIntent().getExtras();
+        if (extras != null) {
+            String title = extras.getString(NotesDbAdapter.KEY_TITLE);
+            String body = extras.getString(NotesDbAdapter.KEY_BODY);
+            mRowId = extras.getLong(NotesDbAdapter.KEY_ROWID);
+
+            if (title != null) {
+                mTitleText.setText(title);
+            }
+            if (body != null) {
+                mBodyText.setText(body);
+            }
+        }
+
+        confirmButton.setOnClickListener(new View.OnClickListener() {
+
+            public void onClick(View view) {
+                Bundle bundle = new Bundle();
+
+                bundle.putString(NotesDbAdapter.KEY_TITLE, mTitleText.getText().toString());
+                bundle.putString(NotesDbAdapter.KEY_BODY, mBodyText.getText().toString());
+                if (mRowId != null) {
+                    bundle.putLong(NotesDbAdapter.KEY_ROWID, mRowId);
+                }
+
+                Intent mIntent = new Intent();
+                mIntent.putExtras(bundle);
+                setResult(RESULT_OK, mIntent);
+                finish();
+            }
+
+        });
+    }
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv2Solution/src/com/android/demo/notepad2/Notepadv2.java b/tutorials/NotepadCodeLab/Notepadv2Solution/src/com/android/demo/notepad2/Notepadv2.java
new file mode 100755
index 0000000..c65806b
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2Solution/src/com/android/demo/notepad2/Notepadv2.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * 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.android.demo.notepad2;
+
+import android.app.ListActivity;
+import android.content.Intent;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.view.ContextMenu;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ContextMenu.ContextMenuInfo;
+import android.widget.ListView;
+import android.widget.SimpleCursorAdapter;
+import android.widget.AdapterView.AdapterContextMenuInfo;
+
+public class Notepadv2 extends ListActivity {
+    private static final int ACTIVITY_CREATE=0;
+    private static final int ACTIVITY_EDIT=1;
+
+    private static final int INSERT_ID = Menu.FIRST;
+    private static final int DELETE_ID = Menu.FIRST + 1;
+
+    private NotesDbAdapter mDbHelper;
+    private Cursor mNotesCursor;
+
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.notes_list);
+        mDbHelper = new NotesDbAdapter(this);
+        mDbHelper.open();
+        fillData();
+        registerForContextMenu(getListView());
+    }
+
+    private void fillData() {
+        // Get all of the rows from the database and create the item list
+        mNotesCursor = mDbHelper.fetchAllNotes();
+        startManagingCursor(mNotesCursor);
+
+        // Create an array to specify the fields we want to display in the list (only TITLE)
+        String[] from = new String[]{NotesDbAdapter.KEY_TITLE};
+
+        // and an array of the fields we want to bind those fields to (in this case just text1)
+        int[] to = new int[]{R.id.text1};
+
+        // Now create a simple cursor adapter and set it to display
+        SimpleCursorAdapter notes = 
+            new SimpleCursorAdapter(this, R.layout.notes_row, mNotesCursor, from, to);
+        setListAdapter(notes);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+        menu.add(0, INSERT_ID, 0, R.string.menu_insert);
+        return true;
+    }
+
+    @Override
+    public boolean onMenuItemSelected(int featureId, MenuItem item) {
+        switch(item.getItemId()) {
+            case INSERT_ID:
+                createNote();
+                return true;
+        }
+
+        return super.onMenuItemSelected(featureId, item);
+    }
+
+    @Override
+    public void onCreateContextMenu(ContextMenu menu, View v,
+            ContextMenuInfo menuInfo) {
+        super.onCreateContextMenu(menu, v, menuInfo);
+        menu.add(0, DELETE_ID, 0, R.string.menu_delete);
+    }
+
+    @Override
+    public boolean onContextItemSelected(MenuItem item) {
+        switch(item.getItemId()) {
+            case DELETE_ID:
+                AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
+                mDbHelper.deleteNote(info.id);
+                fillData();
+                return true;
+        }
+        return super.onContextItemSelected(item);
+    }
+
+    private void createNote() {
+        Intent i = new Intent(this, NoteEdit.class);
+        startActivityForResult(i, ACTIVITY_CREATE);
+    }
+
+    @Override
+    protected void onListItemClick(ListView l, View v, int position, long id) {
+        super.onListItemClick(l, v, position, id);
+        Cursor c = mNotesCursor;
+        c.moveToPosition(position);
+        Intent i = new Intent(this, NoteEdit.class);
+        i.putExtra(NotesDbAdapter.KEY_ROWID, id);
+        i.putExtra(NotesDbAdapter.KEY_TITLE, c.getString(
+                c.getColumnIndexOrThrow(NotesDbAdapter.KEY_TITLE)));
+        i.putExtra(NotesDbAdapter.KEY_BODY, c.getString(
+                c.getColumnIndexOrThrow(NotesDbAdapter.KEY_BODY)));
+        startActivityForResult(i, ACTIVITY_EDIT);
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
+        super.onActivityResult(requestCode, resultCode, intent);
+        Bundle extras = intent.getExtras();
+        switch(requestCode) {
+            case ACTIVITY_CREATE:
+                String title = extras.getString(NotesDbAdapter.KEY_TITLE);
+                String body = extras.getString(NotesDbAdapter.KEY_BODY);
+                mDbHelper.createNote(title, body);
+                fillData();
+                break;
+            case ACTIVITY_EDIT:
+                Long rowId = extras.getLong(NotesDbAdapter.KEY_ROWID);
+                if (rowId != null) {
+                    String editTitle = extras.getString(NotesDbAdapter.KEY_TITLE);
+                    String editBody = extras.getString(NotesDbAdapter.KEY_BODY);
+                    mDbHelper.updateNote(rowId, editTitle, editBody);
+                }
+                fillData();
+                break;
+        }
+    }
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv2Solution/src/com/android/demo/notepad2/NotesDbAdapter.java b/tutorials/NotepadCodeLab/Notepadv2Solution/src/com/android/demo/notepad2/NotesDbAdapter.java
new file mode 100755
index 0000000..50994ae
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv2Solution/src/com/android/demo/notepad2/NotesDbAdapter.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ * 
+ * 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.android.demo.notepad2;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.SQLException;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.util.Log;
+
+/**
+ * Simple notes database access helper class. Defines the basic CRUD operations
+ * for the notepad example, and gives the ability to list all notes as well as
+ * retrieve or modify a specific note.
+ * 
+ * This has been improved from the first version of this tutorial through the
+ * addition of better error handling and also using returning a Cursor instead
+ * of using a collection of inner classes (which is less scalable and not
+ * recommended).
+ */
+public class NotesDbAdapter {
+
+    public static final String KEY_TITLE = "title";
+    public static final String KEY_BODY = "body";
+    public static final String KEY_ROWID = "_id";
+
+    private static final String TAG = "NotesDbAdapter";
+    private DatabaseHelper mDbHelper;
+    private SQLiteDatabase mDb;
+
+    /**
+     * Database creation sql statement
+     */
+    private static final String DATABASE_CREATE =
+        "create table notes (_id integer primary key autoincrement, "
+        + "title text not null, body text not null);";
+
+    private static final String DATABASE_NAME = "data";
+    private static final String DATABASE_TABLE = "notes";
+    private static final int DATABASE_VERSION = 2;
+
+    private final Context mCtx;
+
+    private static class DatabaseHelper extends SQLiteOpenHelper {
+
+        DatabaseHelper(Context context) {
+            super(context, DATABASE_NAME, null, DATABASE_VERSION);
+        }
+
+        @Override
+        public void onCreate(SQLiteDatabase db) {
+
+            db.execSQL(DATABASE_CREATE);
+        }
+
+        @Override
+        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+            Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
+                    + newVersion + ", which will destroy all old data");
+            db.execSQL("DROP TABLE IF EXISTS notes");
+            onCreate(db);
+        }
+    }
+
+    /**
+     * Constructor - takes the context to allow the database to be
+     * opened/created
+     * 
+     * @param ctx the Context within which to work
+     */
+    public NotesDbAdapter(Context ctx) {
+        this.mCtx = ctx;
+    }
+
+    /**
+     * Open the notes database. If it cannot be opened, try to create a new
+     * instance of the database. If it cannot be created, throw an exception to
+     * signal the failure
+     * 
+     * @return this (self reference, allowing this to be chained in an
+     *         initialization call)
+     * @throws SQLException if the database could be neither opened or created
+     */
+    public NotesDbAdapter open() throws SQLException {
+        mDbHelper = new DatabaseHelper(mCtx);
+        mDb = mDbHelper.getWritableDatabase();
+        return this;
+    }
+
+    public void close() {
+        mDbHelper.close();
+    }
+
+
+    /**
+     * Create a new note using the title and body provided. If the note is
+     * successfully created return the new rowId for that note, otherwise return
+     * a -1 to indicate failure.
+     * 
+     * @param title the title of the note
+     * @param body the body of the note
+     * @return rowId or -1 if failed
+     */
+    public long createNote(String title, String body) {
+        ContentValues initialValues = new ContentValues();
+        initialValues.put(KEY_TITLE, title);
+        initialValues.put(KEY_BODY, body);
+
+        return mDb.insert(DATABASE_TABLE, null, initialValues);
+    }
+
+    /**
+     * Delete the note with the given rowId
+     * 
+     * @param rowId id of note to delete
+     * @return true if deleted, false otherwise
+     */
+    public boolean deleteNote(long rowId) {
+
+        return mDb.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0;
+    }
+
+    /**
+     * Return a Cursor over the list of all notes in the database
+     * 
+     * @return Cursor over all notes
+     */
+    public Cursor fetchAllNotes() {
+
+        return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_TITLE,
+                KEY_BODY}, null, null, null, null, null);
+    }
+
+    /**
+     * Return a Cursor positioned at the note that matches the given rowId
+     * 
+     * @param rowId id of note to retrieve
+     * @return Cursor positioned to matching note, if found
+     * @throws SQLException if note could not be found/retrieved
+     */
+    public Cursor fetchNote(long rowId) throws SQLException {
+
+        Cursor mCursor =
+
+            mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
+                    KEY_TITLE, KEY_BODY}, KEY_ROWID + "=" + rowId, null,
+                    null, null, null, null);
+        if (mCursor != null) {
+            mCursor.moveToFirst();
+        }
+        return mCursor;
+
+    }
+
+    /**
+     * Update the note using the details provided. The note to be updated is
+     * specified using the rowId, and it is altered to use the title and body
+     * values passed in
+     * 
+     * @param rowId id of note to update
+     * @param title value to set note title to
+     * @param body value to set note body to
+     * @return true if the note was successfully updated, false otherwise
+     */
+    public boolean updateNote(long rowId, String title, String body) {
+        ContentValues args = new ContentValues();
+        args.put(KEY_TITLE, title);
+        args.put(KEY_BODY, body);
+
+        return mDb.update(DATABASE_TABLE, args, KEY_ROWID + "=" + rowId, null) > 0;
+    }
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv3/Android.mk b/tutorials/NotepadCodeLab/Notepadv3/Android.mk
new file mode 100644
index 0000000..c9f319e
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3/Android.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2009 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
+LOCAL_MODULE_TAGS := optional
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := Notepadv3
+
+# Make the app build against the current SDK
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tutorials/NotepadCodeLab/Notepadv3/AndroidManifest.xml b/tutorials/NotepadCodeLab/Notepadv3/AndroidManifest.xml
new file mode 100755
index 0000000..06e1645
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3/AndroidManifest.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.demo.notepad3">
+    <application android:icon="@drawable/icon">
+        <activity android:name=".Notepadv3" android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity android:name=".NoteEdit" />
+    </application>
+</manifest> 
\ No newline at end of file
diff --git a/tutorials/NotepadCodeLab/Notepadv3/res/drawable/icon.png b/tutorials/NotepadCodeLab/Notepadv3/res/drawable/icon.png
new file mode 100755
index 0000000..64e3601
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3/res/drawable/icon.png
Binary files differ
diff --git a/tutorials/NotepadCodeLab/Notepadv3/res/layout/note_edit.xml b/tutorials/NotepadCodeLab/Notepadv3/res/layout/note_edit.xml
new file mode 100755
index 0000000..4af9754
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3/res/layout/note_edit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:orientation="vertical" android:layout_width="match_parent"
+	android:layout_height="match_parent">
+	
+	<LinearLayout android:orientation="horizontal"
+		android:layout_width="match_parent"
+		android:layout_height="wrap_content">
+
+		<TextView android:layout_width="wrap_content"
+			android:layout_height="wrap_content" 
+			android:text="@string/title" />
+		<EditText android:id="@+id/title" 
+		  android:layout_width="wrap_content"
+			android:layout_height="wrap_content" 
+			android:layout_weight="1"/>
+	</LinearLayout>
+
+	<TextView android:layout_width="wrap_content"
+		android:layout_height="wrap_content" 
+		android:text="@string/body" />
+	<EditText android:id="@+id/body" android:layout_width="match_parent"
+		android:layout_height="wrap_content"
+		android:layout_weight="1"
+		android:scrollbars="vertical" />
+	
+	<Button android:id="@+id/confirm" 
+	  android:text="@string/confirm"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/tutorials/NotepadCodeLab/Notepadv3/res/layout/notes_list.xml b/tutorials/NotepadCodeLab/Notepadv3/res/layout/notes_list.xml
new file mode 100755
index 0000000..6ae0472
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3/res/layout/notes_list.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+      android:layout_width="wrap_content"
+    	android:layout_height="wrap_content">
+    
+    <ListView android:id="@+id/android:list"
+          android:layout_width="wrap_content"
+        	android:layout_height="wrap_content"/>
+  	<TextView android:id="@+id/android:empty"
+          android:layout_width="wrap_content"
+        	android:layout_height="wrap_content"
+        	android:text="@string/no_notes"/>
+</LinearLayout>
diff --git a/tutorials/NotepadCodeLab/Notepadv3/res/layout/notes_row.xml b/tutorials/NotepadCodeLab/Notepadv3/res/layout/notes_row.xml
new file mode 100755
index 0000000..f28a41b
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3/res/layout/notes_row.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView android:id="@+id/text1" xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"/>
diff --git a/tutorials/NotepadCodeLab/Notepadv3/res/values/strings.xml b/tutorials/NotepadCodeLab/Notepadv3/res/values/strings.xml
new file mode 100755
index 0000000..ae63b83
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3/res/values/strings.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">Notepad v3</string>
+    <string name="no_notes">No Notes Yet</string>
+    <string name="menu_insert">Add Note</string>
+    <string name="menu_delete">Delete Note</string>
+    <string name="title">Title</string>
+    <string name="body">Body</string>
+    <string name="confirm">Confirm</string>
+    <string name="edit_note">Edit Note</string>
+</resources>
diff --git a/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NoteEdit.java b/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NoteEdit.java
new file mode 100755
index 0000000..dee7ff4
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NoteEdit.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * 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.android.demo.notepad3;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+public class NoteEdit extends Activity {
+
+    private EditText mTitleText;
+    private EditText mBodyText;
+    private Long mRowId;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.note_edit);
+
+        mTitleText = (EditText) findViewById(R.id.title);
+        mBodyText = (EditText) findViewById(R.id.body);
+
+        Button confirmButton = (Button) findViewById(R.id.confirm);
+
+        mRowId = null;
+        Bundle extras = getIntent().getExtras();
+        if (extras != null) {
+            String title = extras.getString(NotesDbAdapter.KEY_TITLE);
+            String body = extras.getString(NotesDbAdapter.KEY_BODY);
+            mRowId = extras.getLong(NotesDbAdapter.KEY_ROWID);
+
+            if (title != null) {
+                mTitleText.setText(title);
+            }
+            if (body != null) {
+                mBodyText.setText(body);
+            }
+        }
+
+        confirmButton.setOnClickListener(new View.OnClickListener() {
+
+            public void onClick(View view) {
+                Bundle bundle = new Bundle();
+
+                bundle.putString(NotesDbAdapter.KEY_TITLE, mTitleText.getText().toString());
+                bundle.putString(NotesDbAdapter.KEY_BODY, mBodyText.getText().toString());
+                if (mRowId != null) {
+                    bundle.putLong(NotesDbAdapter.KEY_ROWID, mRowId);
+                }
+
+                Intent mIntent = new Intent();
+                mIntent.putExtras(bundle);
+                setResult(RESULT_OK, mIntent);
+                finish();
+            }
+
+        });
+    }
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/Notepadv3.java b/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/Notepadv3.java
new file mode 100755
index 0000000..0ed8ed6
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/Notepadv3.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * 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.android.demo.notepad3;
+
+import android.app.ListActivity;
+import android.content.Intent;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.view.ContextMenu;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ContextMenu.ContextMenuInfo;
+import android.widget.ListView;
+import android.widget.SimpleCursorAdapter;
+import android.widget.AdapterView.AdapterContextMenuInfo;
+
+public class Notepadv3 extends ListActivity {
+    private static final int ACTIVITY_CREATE=0;
+    private static final int ACTIVITY_EDIT=1;
+
+    private static final int INSERT_ID = Menu.FIRST;
+    private static final int DELETE_ID = Menu.FIRST + 1;
+
+    private NotesDbAdapter mDbHelper;
+    private Cursor mNotesCursor;
+
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.notes_list);
+        mDbHelper = new NotesDbAdapter(this);
+        mDbHelper.open();
+        fillData();
+        registerForContextMenu(getListView());
+    }
+
+    private void fillData() {
+        // Get all of the rows from the database and create the item list
+        mNotesCursor = mDbHelper.fetchAllNotes();
+        startManagingCursor(mNotesCursor);
+
+        // Create an array to specify the fields we want to display in the list (only TITLE)
+        String[] from = new String[]{NotesDbAdapter.KEY_TITLE};
+
+        // and an array of the fields we want to bind those fields to (in this case just text1)
+        int[] to = new int[]{R.id.text1};
+
+        // Now create a simple cursor adapter and set it to display
+        SimpleCursorAdapter notes = 
+            new SimpleCursorAdapter(this, R.layout.notes_row, mNotesCursor, from, to);
+        setListAdapter(notes);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+        menu.add(0, INSERT_ID, 0, R.string.menu_insert);
+        return true;
+    }
+
+    @Override
+    public boolean onMenuItemSelected(int featureId, MenuItem item) {
+        switch(item.getItemId()) {
+            case INSERT_ID:
+                createNote();
+                return true;
+        }
+
+        return super.onMenuItemSelected(featureId, item);
+    }
+
+    @Override
+    public void onCreateContextMenu(ContextMenu menu, View v,
+            ContextMenuInfo menuInfo) {
+        super.onCreateContextMenu(menu, v, menuInfo);
+        menu.add(0, DELETE_ID, 0, R.string.menu_delete);
+    }
+
+    @Override
+    public boolean onContextItemSelected(MenuItem item) {
+        switch(item.getItemId()) {
+            case DELETE_ID:
+                AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
+                mDbHelper.deleteNote(info.id);
+                fillData();
+                return true;
+        }
+        return super.onContextItemSelected(item);
+    }
+
+    private void createNote() {
+        Intent i = new Intent(this, NoteEdit.class);
+        startActivityForResult(i, ACTIVITY_CREATE);
+    }
+
+    @Override
+    protected void onListItemClick(ListView l, View v, int position, long id) {
+        super.onListItemClick(l, v, position, id);
+        Cursor c = mNotesCursor;
+        c.moveToPosition(position);
+        Intent i = new Intent(this, NoteEdit.class);
+        i.putExtra(NotesDbAdapter.KEY_ROWID, id);
+        i.putExtra(NotesDbAdapter.KEY_TITLE, c.getString(
+                c.getColumnIndexOrThrow(NotesDbAdapter.KEY_TITLE)));
+        i.putExtra(NotesDbAdapter.KEY_BODY, c.getString(
+                c.getColumnIndexOrThrow(NotesDbAdapter.KEY_BODY)));
+        startActivityForResult(i, ACTIVITY_EDIT);
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
+        super.onActivityResult(requestCode, resultCode, intent);
+        Bundle extras = intent.getExtras();
+        switch(requestCode) {
+            case ACTIVITY_CREATE:
+                String title = extras.getString(NotesDbAdapter.KEY_TITLE);
+                String body = extras.getString(NotesDbAdapter.KEY_BODY);
+                mDbHelper.createNote(title, body);
+                fillData();
+                break;
+            case ACTIVITY_EDIT:
+                Long rowId = extras.getLong(NotesDbAdapter.KEY_ROWID);
+                if (rowId != null) {
+                    String editTitle = extras.getString(NotesDbAdapter.KEY_TITLE);
+                    String editBody = extras.getString(NotesDbAdapter.KEY_BODY);
+                    mDbHelper.updateNote(rowId, editTitle, editBody);
+                }
+                fillData();
+                break;
+        }
+    }
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NotesDbAdapter.java b/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NotesDbAdapter.java
new file mode 100755
index 0000000..38ee1c0
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3/src/com/android/demo/notepad3/NotesDbAdapter.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ * 
+ * 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.android.demo.notepad3;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.SQLException;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.util.Log;
+
+/**
+ * Simple notes database access helper class. Defines the basic CRUD operations
+ * for the notepad example, and gives the ability to list all notes as well as
+ * retrieve or modify a specific note.
+ * 
+ * This has been improved from the first version of this tutorial through the
+ * addition of better error handling and also using returning a Cursor instead
+ * of using a collection of inner classes (which is less scalable and not
+ * recommended).
+ */
+public class NotesDbAdapter {
+
+    public static final String KEY_TITLE = "title";
+    public static final String KEY_BODY = "body";
+    public static final String KEY_ROWID = "_id";
+
+    private static final String TAG = "NotesDbAdapter";
+    private DatabaseHelper mDbHelper;
+    private SQLiteDatabase mDb;
+
+    /**
+     * Database creation sql statement
+     */
+    private static final String DATABASE_CREATE =
+        "create table notes (_id integer primary key autoincrement, "
+        + "title text not null, body text not null);";
+
+    private static final String DATABASE_NAME = "data";
+    private static final String DATABASE_TABLE = "notes";
+    private static final int DATABASE_VERSION = 2;
+
+    private final Context mCtx;
+
+    private static class DatabaseHelper extends SQLiteOpenHelper {
+
+        DatabaseHelper(Context context) {
+            super(context, DATABASE_NAME, null, DATABASE_VERSION);
+        }
+
+        @Override
+        public void onCreate(SQLiteDatabase db) {
+
+            db.execSQL(DATABASE_CREATE);
+        }
+
+        @Override
+        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+            Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
+                    + newVersion + ", which will destroy all old data");
+            db.execSQL("DROP TABLE IF EXISTS notes");
+            onCreate(db);
+        }
+    }
+
+    /**
+     * Constructor - takes the context to allow the database to be
+     * opened/created
+     * 
+     * @param ctx the Context within which to work
+     */
+    public NotesDbAdapter(Context ctx) {
+        this.mCtx = ctx;
+    }
+
+    /**
+     * Open the notes database. If it cannot be opened, try to create a new
+     * instance of the database. If it cannot be created, throw an exception to
+     * signal the failure
+     * 
+     * @return this (self reference, allowing this to be chained in an
+     *         initialization call)
+     * @throws SQLException if the database could be neither opened or created
+     */
+    public NotesDbAdapter open() throws SQLException {
+        mDbHelper = new DatabaseHelper(mCtx);
+        mDb = mDbHelper.getWritableDatabase();
+        return this;
+    }
+
+    public void close() {
+        mDbHelper.close();
+    }
+
+
+    /**
+     * Create a new note using the title and body provided. If the note is
+     * successfully created return the new rowId for that note, otherwise return
+     * a -1 to indicate failure.
+     * 
+     * @param title the title of the note
+     * @param body the body of the note
+     * @return rowId or -1 if failed
+     */
+    public long createNote(String title, String body) {
+        ContentValues initialValues = new ContentValues();
+        initialValues.put(KEY_TITLE, title);
+        initialValues.put(KEY_BODY, body);
+
+        return mDb.insert(DATABASE_TABLE, null, initialValues);
+    }
+
+    /**
+     * Delete the note with the given rowId
+     * 
+     * @param rowId id of note to delete
+     * @return true if deleted, false otherwise
+     */
+    public boolean deleteNote(long rowId) {
+
+        return mDb.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0;
+    }
+
+    /**
+     * Return a Cursor over the list of all notes in the database
+     * 
+     * @return Cursor over all notes
+     */
+    public Cursor fetchAllNotes() {
+
+        return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_TITLE,
+                KEY_BODY}, null, null, null, null, null);
+    }
+
+    /**
+     * Return a Cursor positioned at the note that matches the given rowId
+     * 
+     * @param rowId id of note to retrieve
+     * @return Cursor positioned to matching note, if found
+     * @throws SQLException if note could not be found/retrieved
+     */
+    public Cursor fetchNote(long rowId) throws SQLException {
+
+        Cursor mCursor =
+
+            mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
+                    KEY_TITLE, KEY_BODY}, KEY_ROWID + "=" + rowId, null,
+                    null, null, null, null);
+        if (mCursor != null) {
+            mCursor.moveToFirst();
+        }
+        return mCursor;
+
+    }
+
+    /**
+     * Update the note using the details provided. The note to be updated is
+     * specified using the rowId, and it is altered to use the title and body
+     * values passed in
+     * 
+     * @param rowId id of note to update
+     * @param title value to set note title to
+     * @param body value to set note body to
+     * @return true if the note was successfully updated, false otherwise
+     */
+    public boolean updateNote(long rowId, String title, String body) {
+        ContentValues args = new ContentValues();
+        args.put(KEY_TITLE, title);
+        args.put(KEY_BODY, body);
+
+        return mDb.update(DATABASE_TABLE, args, KEY_ROWID + "=" + rowId, null) > 0;
+    }
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv3Solution/Android.mk b/tutorials/NotepadCodeLab/Notepadv3Solution/Android.mk
new file mode 100644
index 0000000..d8a6ea5
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3Solution/Android.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2009 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+# Only build apk if this package is added to CUSTOM_MODLUES in buildspec.mk
+LOCAL_MODULE_TAGS := optional
+
+# Only compile source java files in this apk.
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := Notepadv3Solution
+
+# Make the app build against the current SDK
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/tutorials/NotepadCodeLab/Notepadv3Solution/AndroidManifest.xml b/tutorials/NotepadCodeLab/Notepadv3Solution/AndroidManifest.xml
new file mode 100755
index 0000000..06e1645
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3Solution/AndroidManifest.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="utf-8"?>
+<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.demo.notepad3">
+    <application android:icon="@drawable/icon">
+        <activity android:name=".Notepadv3" android:label="@string/app_name">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+        <activity android:name=".NoteEdit" />
+    </application>
+</manifest> 
\ No newline at end of file
diff --git a/tutorials/NotepadCodeLab/Notepadv3Solution/res/drawable/icon.png b/tutorials/NotepadCodeLab/Notepadv3Solution/res/drawable/icon.png
new file mode 100755
index 0000000..64e3601
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3Solution/res/drawable/icon.png
Binary files differ
diff --git a/tutorials/NotepadCodeLab/Notepadv3Solution/res/layout/note_edit.xml b/tutorials/NotepadCodeLab/Notepadv3Solution/res/layout/note_edit.xml
new file mode 100755
index 0000000..4af9754
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3Solution/res/layout/note_edit.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+	android:orientation="vertical" android:layout_width="match_parent"
+	android:layout_height="match_parent">
+	
+	<LinearLayout android:orientation="horizontal"
+		android:layout_width="match_parent"
+		android:layout_height="wrap_content">
+
+		<TextView android:layout_width="wrap_content"
+			android:layout_height="wrap_content" 
+			android:text="@string/title" />
+		<EditText android:id="@+id/title" 
+		  android:layout_width="wrap_content"
+			android:layout_height="wrap_content" 
+			android:layout_weight="1"/>
+	</LinearLayout>
+
+	<TextView android:layout_width="wrap_content"
+		android:layout_height="wrap_content" 
+		android:text="@string/body" />
+	<EditText android:id="@+id/body" android:layout_width="match_parent"
+		android:layout_height="wrap_content"
+		android:layout_weight="1"
+		android:scrollbars="vertical" />
+	
+	<Button android:id="@+id/confirm" 
+	  android:text="@string/confirm"
+		android:layout_width="wrap_content"
+		android:layout_height="wrap_content" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/tutorials/NotepadCodeLab/Notepadv3Solution/res/layout/notes_list.xml b/tutorials/NotepadCodeLab/Notepadv3Solution/res/layout/notes_list.xml
new file mode 100755
index 0000000..6ae0472
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3Solution/res/layout/notes_list.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+      android:layout_width="wrap_content"
+    	android:layout_height="wrap_content">
+    
+    <ListView android:id="@+id/android:list"
+          android:layout_width="wrap_content"
+        	android:layout_height="wrap_content"/>
+  	<TextView android:id="@+id/android:empty"
+          android:layout_width="wrap_content"
+        	android:layout_height="wrap_content"
+        	android:text="@string/no_notes"/>
+</LinearLayout>
diff --git a/tutorials/NotepadCodeLab/Notepadv3Solution/res/layout/notes_row.xml b/tutorials/NotepadCodeLab/Notepadv3Solution/res/layout/notes_row.xml
new file mode 100755
index 0000000..f28a41b
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3Solution/res/layout/notes_row.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<TextView android:id="@+id/text1" xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"/>
diff --git a/tutorials/NotepadCodeLab/Notepadv3Solution/res/values/strings.xml b/tutorials/NotepadCodeLab/Notepadv3Solution/res/values/strings.xml
new file mode 100755
index 0000000..ae63b83
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3Solution/res/values/strings.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+    <string name="app_name">Notepad v3</string>
+    <string name="no_notes">No Notes Yet</string>
+    <string name="menu_insert">Add Note</string>
+    <string name="menu_delete">Delete Note</string>
+    <string name="title">Title</string>
+    <string name="body">Body</string>
+    <string name="confirm">Confirm</string>
+    <string name="edit_note">Edit Note</string>
+</resources>
diff --git a/tutorials/NotepadCodeLab/Notepadv3Solution/src/com/android/demo/notepad3/NoteEdit.java b/tutorials/NotepadCodeLab/Notepadv3Solution/src/com/android/demo/notepad3/NoteEdit.java
new file mode 100755
index 0000000..b864784
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3Solution/src/com/android/demo/notepad3/NoteEdit.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * 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.android.demo.notepad3;
+
+import android.app.Activity;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.Button;
+import android.widget.EditText;
+
+public class NoteEdit extends Activity {
+
+    private EditText mTitleText;
+    private EditText mBodyText;
+    private Long mRowId;
+    private NotesDbAdapter mDbHelper;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mDbHelper = new NotesDbAdapter(this);
+        mDbHelper.open();
+
+        setContentView(R.layout.note_edit);
+
+        mTitleText = (EditText) findViewById(R.id.title);
+        mBodyText = (EditText) findViewById(R.id.body);
+
+        Button confirmButton = (Button) findViewById(R.id.confirm);
+
+        mRowId = (savedInstanceState == null) ? null :
+            (Long) savedInstanceState.getSerializable(NotesDbAdapter.KEY_ROWID);
+		if (mRowId == null) {
+			Bundle extras = getIntent().getExtras();
+			mRowId = extras != null ? extras.getLong(NotesDbAdapter.KEY_ROWID)
+									: null;
+		}
+
+		populateFields();
+
+        confirmButton.setOnClickListener(new View.OnClickListener() {
+
+            public void onClick(View view) {
+                setResult(RESULT_OK);
+                finish();
+            }
+
+        });
+    }
+
+    private void populateFields() {
+        if (mRowId != null) {
+            Cursor note = mDbHelper.fetchNote(mRowId);
+            startManagingCursor(note);
+            mTitleText.setText(note.getString(
+                    note.getColumnIndexOrThrow(NotesDbAdapter.KEY_TITLE)));
+            mBodyText.setText(note.getString(
+                    note.getColumnIndexOrThrow(NotesDbAdapter.KEY_BODY)));
+        }
+    }
+
+    @Override
+    protected void onSaveInstanceState(Bundle outState) {
+        super.onSaveInstanceState(outState);
+        saveState();
+        outState.putSerializable(NotesDbAdapter.KEY_ROWID, mRowId);
+    }
+
+    @Override
+    protected void onPause() {
+        super.onPause();
+        saveState();
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        populateFields();
+    }
+
+    private void saveState() {
+        String title = mTitleText.getText().toString();
+        String body = mBodyText.getText().toString();
+
+        if (mRowId == null) {
+            long id = mDbHelper.createNote(title, body);
+            if (id > 0) {
+                mRowId = id;
+            }
+        } else {
+            mDbHelper.updateNote(mRowId, title, body);
+        }
+    }
+
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv3Solution/src/com/android/demo/notepad3/Notepadv3.java b/tutorials/NotepadCodeLab/Notepadv3Solution/src/com/android/demo/notepad3/Notepadv3.java
new file mode 100755
index 0000000..1e15694
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3Solution/src/com/android/demo/notepad3/Notepadv3.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ *
+ * 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.android.demo.notepad3;
+
+import android.app.ListActivity;
+import android.content.Intent;
+import android.database.Cursor;
+import android.os.Bundle;
+import android.view.ContextMenu;
+import android.view.Menu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ContextMenu.ContextMenuInfo;
+import android.widget.ListView;
+import android.widget.SimpleCursorAdapter;
+import android.widget.AdapterView.AdapterContextMenuInfo;
+
+public class Notepadv3 extends ListActivity {
+    private static final int ACTIVITY_CREATE=0;
+    private static final int ACTIVITY_EDIT=1;
+
+    private static final int INSERT_ID = Menu.FIRST;
+    private static final int DELETE_ID = Menu.FIRST + 1;
+
+    private NotesDbAdapter mDbHelper;
+
+    /** Called when the activity is first created. */
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.notes_list);
+        mDbHelper = new NotesDbAdapter(this);
+        mDbHelper.open();
+        fillData();
+        registerForContextMenu(getListView());
+    }
+
+    private void fillData() {
+        Cursor notesCursor = mDbHelper.fetchAllNotes();
+        startManagingCursor(notesCursor);
+
+        // Create an array to specify the fields we want to display in the list (only TITLE)
+        String[] from = new String[]{NotesDbAdapter.KEY_TITLE};
+
+        // and an array of the fields we want to bind those fields to (in this case just text1)
+        int[] to = new int[]{R.id.text1};
+
+        // Now create a simple cursor adapter and set it to display
+        SimpleCursorAdapter notes = 
+            new SimpleCursorAdapter(this, R.layout.notes_row, notesCursor, from, to);
+        setListAdapter(notes);
+    }
+
+    @Override
+    public boolean onCreateOptionsMenu(Menu menu) {
+        super.onCreateOptionsMenu(menu);
+        menu.add(0, INSERT_ID, 0, R.string.menu_insert);
+        return true;
+    }
+
+    @Override
+    public boolean onMenuItemSelected(int featureId, MenuItem item) {
+        switch(item.getItemId()) {
+            case INSERT_ID:
+                createNote();
+                return true;
+        }
+
+        return super.onMenuItemSelected(featureId, item);
+    }
+
+    @Override
+    public void onCreateContextMenu(ContextMenu menu, View v,
+            ContextMenuInfo menuInfo) {
+        super.onCreateContextMenu(menu, v, menuInfo);
+        menu.add(0, DELETE_ID, 0, R.string.menu_delete);
+    }
+
+    @Override
+    public boolean onContextItemSelected(MenuItem item) {
+        switch(item.getItemId()) {
+            case DELETE_ID:
+                AdapterContextMenuInfo info = (AdapterContextMenuInfo) item.getMenuInfo();
+                mDbHelper.deleteNote(info.id);
+                fillData();
+                return true;
+        }
+        return super.onContextItemSelected(item);
+    }
+
+    private void createNote() {
+        Intent i = new Intent(this, NoteEdit.class);
+        startActivityForResult(i, ACTIVITY_CREATE);
+    }
+
+    @Override
+    protected void onListItemClick(ListView l, View v, int position, long id) {
+        super.onListItemClick(l, v, position, id);
+        Intent i = new Intent(this, NoteEdit.class);
+        i.putExtra(NotesDbAdapter.KEY_ROWID, id);
+        startActivityForResult(i, ACTIVITY_EDIT);
+    }
+
+    @Override
+    protected void onActivityResult(int requestCode, int resultCode, Intent intent) {
+        super.onActivityResult(requestCode, resultCode, intent);
+        fillData();
+    }
+}
diff --git a/tutorials/NotepadCodeLab/Notepadv3Solution/src/com/android/demo/notepad3/NotesDbAdapter.java b/tutorials/NotepadCodeLab/Notepadv3Solution/src/com/android/demo/notepad3/NotesDbAdapter.java
new file mode 100755
index 0000000..38ee1c0
--- /dev/null
+++ b/tutorials/NotepadCodeLab/Notepadv3Solution/src/com/android/demo/notepad3/NotesDbAdapter.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) 2008 Google Inc.
+ * 
+ * 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.android.demo.notepad3;
+
+import android.content.ContentValues;
+import android.content.Context;
+import android.database.Cursor;
+import android.database.SQLException;
+import android.database.sqlite.SQLiteDatabase;
+import android.database.sqlite.SQLiteOpenHelper;
+import android.util.Log;
+
+/**
+ * Simple notes database access helper class. Defines the basic CRUD operations
+ * for the notepad example, and gives the ability to list all notes as well as
+ * retrieve or modify a specific note.
+ * 
+ * This has been improved from the first version of this tutorial through the
+ * addition of better error handling and also using returning a Cursor instead
+ * of using a collection of inner classes (which is less scalable and not
+ * recommended).
+ */
+public class NotesDbAdapter {
+
+    public static final String KEY_TITLE = "title";
+    public static final String KEY_BODY = "body";
+    public static final String KEY_ROWID = "_id";
+
+    private static final String TAG = "NotesDbAdapter";
+    private DatabaseHelper mDbHelper;
+    private SQLiteDatabase mDb;
+
+    /**
+     * Database creation sql statement
+     */
+    private static final String DATABASE_CREATE =
+        "create table notes (_id integer primary key autoincrement, "
+        + "title text not null, body text not null);";
+
+    private static final String DATABASE_NAME = "data";
+    private static final String DATABASE_TABLE = "notes";
+    private static final int DATABASE_VERSION = 2;
+
+    private final Context mCtx;
+
+    private static class DatabaseHelper extends SQLiteOpenHelper {
+
+        DatabaseHelper(Context context) {
+            super(context, DATABASE_NAME, null, DATABASE_VERSION);
+        }
+
+        @Override
+        public void onCreate(SQLiteDatabase db) {
+
+            db.execSQL(DATABASE_CREATE);
+        }
+
+        @Override
+        public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
+            Log.w(TAG, "Upgrading database from version " + oldVersion + " to "
+                    + newVersion + ", which will destroy all old data");
+            db.execSQL("DROP TABLE IF EXISTS notes");
+            onCreate(db);
+        }
+    }
+
+    /**
+     * Constructor - takes the context to allow the database to be
+     * opened/created
+     * 
+     * @param ctx the Context within which to work
+     */
+    public NotesDbAdapter(Context ctx) {
+        this.mCtx = ctx;
+    }
+
+    /**
+     * Open the notes database. If it cannot be opened, try to create a new
+     * instance of the database. If it cannot be created, throw an exception to
+     * signal the failure
+     * 
+     * @return this (self reference, allowing this to be chained in an
+     *         initialization call)
+     * @throws SQLException if the database could be neither opened or created
+     */
+    public NotesDbAdapter open() throws SQLException {
+        mDbHelper = new DatabaseHelper(mCtx);
+        mDb = mDbHelper.getWritableDatabase();
+        return this;
+    }
+
+    public void close() {
+        mDbHelper.close();
+    }
+
+
+    /**
+     * Create a new note using the title and body provided. If the note is
+     * successfully created return the new rowId for that note, otherwise return
+     * a -1 to indicate failure.
+     * 
+     * @param title the title of the note
+     * @param body the body of the note
+     * @return rowId or -1 if failed
+     */
+    public long createNote(String title, String body) {
+        ContentValues initialValues = new ContentValues();
+        initialValues.put(KEY_TITLE, title);
+        initialValues.put(KEY_BODY, body);
+
+        return mDb.insert(DATABASE_TABLE, null, initialValues);
+    }
+
+    /**
+     * Delete the note with the given rowId
+     * 
+     * @param rowId id of note to delete
+     * @return true if deleted, false otherwise
+     */
+    public boolean deleteNote(long rowId) {
+
+        return mDb.delete(DATABASE_TABLE, KEY_ROWID + "=" + rowId, null) > 0;
+    }
+
+    /**
+     * Return a Cursor over the list of all notes in the database
+     * 
+     * @return Cursor over all notes
+     */
+    public Cursor fetchAllNotes() {
+
+        return mDb.query(DATABASE_TABLE, new String[] {KEY_ROWID, KEY_TITLE,
+                KEY_BODY}, null, null, null, null, null);
+    }
+
+    /**
+     * Return a Cursor positioned at the note that matches the given rowId
+     * 
+     * @param rowId id of note to retrieve
+     * @return Cursor positioned to matching note, if found
+     * @throws SQLException if note could not be found/retrieved
+     */
+    public Cursor fetchNote(long rowId) throws SQLException {
+
+        Cursor mCursor =
+
+            mDb.query(true, DATABASE_TABLE, new String[] {KEY_ROWID,
+                    KEY_TITLE, KEY_BODY}, KEY_ROWID + "=" + rowId, null,
+                    null, null, null, null);
+        if (mCursor != null) {
+            mCursor.moveToFirst();
+        }
+        return mCursor;
+
+    }
+
+    /**
+     * Update the note using the details provided. The note to be updated is
+     * specified using the rowId, and it is altered to use the title and body
+     * values passed in
+     * 
+     * @param rowId id of note to update
+     * @param title value to set note title to
+     * @param body value to set note body to
+     * @return true if the note was successfully updated, false otherwise
+     */
+    public boolean updateNote(long rowId, String title, String body) {
+        ContentValues args = new ContentValues();
+        args.put(KEY_TITLE, title);
+        args.put(KEY_BODY, body);
+
+        return mDb.update(DATABASE_TABLE, args, KEY_ROWID + "=" + rowId, null) > 0;
+    }
+}