am b19cc7ba: Merge "Update permission name for Tag app." into gingerbread

Merge commit 'b19cc7baa931fe7af87ab1c6a372bec723a44d75' into gingerbread-plus-aosp

* commit 'b19cc7baa931fe7af87ab1c6a372bec723a44d75':
  Update permission name for Tag app.
diff --git a/apps/Development/src/com/android/development/PackageSummary.java b/apps/Development/src/com/android/development/PackageSummary.java
index 58ab0f7..d621d4e 100644
--- a/apps/Development/src/com/android/development/PackageSummary.java
+++ b/apps/Development/src/com/android/development/PackageSummary.java
@@ -251,7 +251,7 @@
     private final static void setItemText(Button item, PackageInfo pi,
                                           String className)
     {
-        item.setText(className.substring(pi.packageName.length()+1));
+        item.setText(className.substring(className.lastIndexOf('.')+1));
     }
 
     private final class ActivityOnClick implements View.OnClickListener
diff --git a/build/tools/make_windows_sdk.sh b/build/tools/make_windows_sdk.sh
index 1154452..396034a 100755
--- a/build/tools/make_windows_sdk.sh
+++ b/build/tools/make_windows_sdk.sh
@@ -98,7 +98,7 @@
     # you will generally need to edit build/core/main.mk and add directories
     # where Android.mk makefiles are to be found to the SDK_ONLY==true section.
 
-    echo 
+    echo
     echo "Building..."
     [ -n "$MAKE_OPT" ] && echo "Make options: $MAKE_OPT"
 
@@ -140,7 +140,7 @@
     [ -e "$UNZIPPED" ] && rm -rfv "$UNZIPPED"  # cleanup unzip dir (if exists)
     unzip "$SDK_ZIP" -d "$TEMP_DIR"
     mv -v "$UNZIPPED" "$TEMP_SDK_DIR"
-    
+
     # Assert that the package contains only one platform
     PLATFORMS="$TEMP_SDK_DIR/platforms"
     THE_PLATFORM=`echo $PLATFORMS/*`
@@ -160,7 +160,7 @@
     TOOLS="$TEMP_SDK_DIR/tools"
     LIB="$TEMP_SDK_DIR/tools/lib"
     rm -v "$TOOLS"/{adb,android,apkbuilder,ddms,dmtracedump,draw9patch,emulator,etc1tool}
-    rm -v "$TOOLS"/{hierarchyviewer,hprof-conv,layoutopt,mksdcard,sqlite3,traceview,zipalign}
+    rm -v "$TOOLS"/{hierarchyviewer,hprof-conv,layoutopt,mksdcard,sqlite3,traceview,zipalign,monkeyrunner}
     rm -v "$LIB"/*/swt.jar
     rm -v "$PLATFORM_TOOLS"/{aapt,aidl,dx,dexdump}
 
@@ -193,6 +193,7 @@
     cp -v sdk/layoutopt/app/etc/layoutopt.bat              "$TOOLS"/
     cp -v sdk/draw9patch/etc/draw9patch.bat                "$TOOLS"/
     cp -v sdk/sdkmanager/app/etc/android.bat               "$TOOLS"/
+    cp -v sdk/monkeyrunner/etc/monkeyrunner.bat            "$TOOLS"/
 
     # Put the JetCreator tools, content and docs (not available in the linux SDK)
     JET="$TOOLS/Jet"
@@ -214,7 +215,7 @@
     cp -rv external/sonivox/jet_tools/logic_templates    "$JETLOGICTEMPLATES"/
     chmod -vR u+w "$JETCREATOR"  # fixes an issue where Cygwin might copy the above as u+rx only
     cp -v prebuilt/windows/jetcreator/EASDLL.dll         "$JETCREATOR"/
-    
+
     cp -v  external/sonivox/docs/JET_Authoring_Guidelines.html  "$JETDOC"/
     cp -rv external/sonivox/docs/JET_Authoring_Guidelines_files "$JETDOC"/
     cp  -v external/sonivox/docs/JET_Creator_User_Manual.html   "$JETDOC"/
diff --git a/build/tools/patch_windows_sdk.sh b/build/tools/patch_windows_sdk.sh
index 6875261..ec5cfd3 100755
--- a/build/tools/patch_windows_sdk.sh
+++ b/build/tools/patch_windows_sdk.sh
@@ -26,7 +26,7 @@
 PLATFORM_TOOLS=$TEMP_SDK_DIR/platform-tools
 LIB=$TEMP_SDK_DIR/tools/lib
 rm $V $TOOLS/{android,apkbuilder,ddms,dmtracedump,draw9patch,emulator,etc1tool}
-rm $V $TOOLS/{hierarchyviewer,hprof-conv,layoutopt,mksdcard,sqlite3,traceview,zipalign}
+rm $V $TOOLS/{hierarchyviewer,hprof-conv,layoutopt,mksdcard,sqlite3,traceview,zipalign,monkeyrunner}
 rm $V $LIB/*/swt.jar
 rm $V $PLATFORM_TOOLS/{adb,aapt,aidl,dx,dexdump}
 
@@ -64,6 +64,7 @@
 cp $V ${TOPDIR}sdk/layoutopt/app/etc/layoutopt.bat              $TOOLS/
 cp $V ${TOPDIR}sdk/draw9patch/etc/draw9patch.bat                $TOOLS/
 cp $V ${TOPDIR}sdk/sdkmanager/app/etc/android.bat               $TOOLS/
+cp $V ${TOPDIR}sdk/monkeyrunner/etc/monkeyrunner.bat            $TOOLS/
 
 # Put the JetCreator tools, content and docs (not available in the linux SDK)
 JET=$TOOLS/Jet
diff --git a/cmds/monkey/src/com/android/commands/monkey/Monkey.java b/cmds/monkey/src/com/android/commands/monkey/Monkey.java
index 47c9cd8..241baf7 100644
--- a/cmds/monkey/src/com/android/commands/monkey/Monkey.java
+++ b/cmds/monkey/src/com/android/commands/monkey/Monkey.java
@@ -919,6 +919,9 @@
         int eventCounter = 0;
         int cycleCounter = 0;
 
+        boolean shouldReportAnrTraces = false;
+        boolean shouldReportDumpsysMemInfo = false;
+        boolean shouldAbort = false;
         boolean systemCrashed = false;
 
         // TO DO : The count should apply to each of the script file.
@@ -929,12 +932,12 @@
                     mRequestProcRank = false;
                 }
                 if (mRequestAnrTraces) {
-                    reportAnrTraces();
                     mRequestAnrTraces = false;
+                    shouldReportAnrTraces = true;
                 }
                 if (mRequestDumpsysMemInfo) {
-                    reportDumpsysMemInfo();
                     mRequestDumpsysMemInfo = false;
+                    shouldReportDumpsysMemInfo = true;
                 }
                 if (mMonitorNativeCrashes) {
                     // first time through, when eventCounter == 0, just set up
@@ -945,12 +948,29 @@
                     }
                 }
                 if (mAbort) {
-                    System.out.println("** Monkey aborted due to error.");
-                    System.out.println("Events injected: " + eventCounter);
-                    return eventCounter;
+                    shouldAbort = true;
                 }
             }
 
+            // Report ANR, dumpsys after releasing lock on this.
+            // This ensures the availability of the lock to Activity controller's appNotResponding
+            if (shouldReportAnrTraces) {
+               shouldReportAnrTraces = false;
+               reportAnrTraces();
+            }
+
+            if (shouldReportDumpsysMemInfo) {
+               shouldReportDumpsysMemInfo = false;
+               reportDumpsysMemInfo();
+            }
+
+            if (shouldAbort) {
+               shouldAbort = false;
+               System.out.println("** Monkey aborted due to error.");
+               System.out.println("Events injected: " + eventCounter);
+               return eventCounter;
+            }
+
             // In this debugging mode, we never send any events. This is
             // primarily here so you can manually test the package or category
             // limits, while manually exercising the system.
diff --git a/docs/howto_SDK_git_cygwin.txt b/docs/howto_SDK_git_cygwin.txt
deleted file mode 100644
index 622c592..0000000
--- a/docs/howto_SDK_git_cygwin.txt
+++ /dev/null
@@ -1,189 +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.
-
-
-Subject: How to get the android source code using Cygwin and Git
-Date:    2009/04/27
-Updated: 2009/05/21
-Updated: 2010/03/30
-
-
-Table of content:
-  1- Goals and Requirements
-  2- Getting the code, the simple way
-  3- SSH issues
-  4- Advanced Tricks
-
-
--------------------------
-1- Goals and Requirements
--------------------------
-
-This document explains how to checkout the Android source from the git
-repositories under Windows.
-
-As stated in development/docs/howto_build_SDK.txt, one can't build the whole
-Android source code under Windows. You can only build the SDK tools for
-Windows.
-
-There are a number of caveats in checking out the code from Git under Windows. 
-This document tries to explain them.
-
-First you will need to meet the following requirements:
-- You must have Cygwin installed. But wait! You CANNOT use the latest Cygwin 1.7.
-  Instead you MUST use the "legacy Cygwin 1.5" that you can find at this page:
-
-    http://cygwin.org/win-9x.html
-
-  Don't mind the page title, just grab setup-legacy.exe and it will works just fine
-  under XP or Vista.
-
-- You must install Cyginw using the "Unix / Binary" mode.
-  If you don't do that, git will fail to properly compute some SHA1 keys.
-
-- You need the "git" and "curl" packages to checkout the code.
-  If you plan to contribute, you might want to get "gitk" also.
-
-  Note: if you want to build the SDK, check the howto_build_SDK.txt file
-  for a list of extra required packages.
-  The short summary is that you need at least these:
-    autoconf, bison, curl, flex, gcc, g++, git, gnupg, make, mingw-zlib, python, unzip, zip
-  and you must avoid the "readline" package.
-
-
------------------------------------
-2- Getting the code, the simple way
------------------------------------
-
-Out of the box, "repo" and "git" will work just fine under Cygwin:
-
-  $ repo init -u git://android.git.kernel.org/platform/manifest.git
-  $ repo sync
-
-And you're done. You can build as explained in howto_build_SDK.txt and ignore
-the rest of this document.
-
-
--------------
-3- SSH issues
--------------
-
-If you maintain your own private repository using an SSH server, you might get
-some "mux/ssh" errors. In this case try this:
-
-  $ repo init -u ssh://my.private.ssh.repo/platform/manifest.git
-  $ export GIT_SSH=ssh
-  $ repo sync
-
-
-------------------
-4- Advanced Tricks
-------------------
-
-There is one remaining issue with the default repo/git options:
-
-If you plan on contributing, you will notice that even after a fresh "repo
-sync" some projects are marked as having modified files. This happens on the
-"bionic" and the "external/iptables" project. The issue is that they have files
-which have the same name yet differ only by their case-sensitivity. Since the
-Windows filesystem is not case-sensitive, this confuses Git.
-
-Solution: we can simply ignore these projects as they are not needed to build
-the Windows SDK.
-
-To do this you just need to create a file .repo/local_manifest.xml that
-provides a list of projects to ignore:
-
-<?xml version="1.0" encoding="UTF-8"?>
-<manifest>
-  <remove-project name="platform/external/iptables" />
-</manifest>
-
-The other thing we can do is tell git not to track the files that cause
-problems:
-
-  cd bionic
-  git update-index --assume-unchanged \
-    libc/kernel/common/linux/netfilter/xt_CONNMARK.h \
-    libc/kernel/common/linux/netfilter/xt_MARK.h \
-    libc/kernel/common/linux/netfilter_ipv6/ip6t_HL.h
-
-  cd external/tcpdump;
-  git update-index --assume-unchanged \
-    tests/print-X.new \
-    tests/print-XX.new
-
-
-Here's a script that takes care of all these details. It performs the repo
-init, creates the appropriate local_manifest.xml, does a repo sync as
-needed and tell git to ignore the offending files:
-
-------------
-#!/bin/bash
-
-set -e  # fail on errors
-
-URL=ssh://android-git.corp.google.com:29418/platform/manifest.git
-BRANCH=donut
-if [ "$1" == "-b" ]; then shift; BRANCH=$1; shift; fi
-
-# repo init if there's no .repo directory
-if [[ ! -d .repo ]]; then
-    repo init -u $URL -b $BRANCH
-fi
-
-# create a local_manifest to exclude projects that cause problems under Windows
-# due to the case-insenstivines of the file system.
-L=.repo/local_manifest.xml
-if [[ ! -f $L ]]; then
-
-    cat > $L <<EOF
-<?xml version="1.0" encoding="UTF-8"?>
-<manifest>
-<remove-project name="platform/external/iptables" />
-</manifest>
-EOF
-fi
-
-# sync using the native ssh client if necessary
-[[ $URL != ${URL/ssh/} ]] && export GIT_SSH=ssh
-repo sync $@
-
-
-# These files cause trouble too, we need to ignore them
-(cd bionic;
-git update-index --assume-unchanged \
-    libc/kernel/common/linux/netfilter/xt_CONNMARK.h \
-    libc/kernel/common/linux/netfilter/xt_MARK.h \
-    libc/kernel/common/linux/netfilter_ipv6/ip6t_HL.h
-)
-(cd external/tcpdump;
-git update-index --assume-unchanged \
-    tests/print-X.new \
-    tests/print-XX.new
-)
-------------
-
-Simply extract this to a "my_sync.sh" file and try the following:
-  $ mkdir android_src
-  $ cd android_src
-  $ chmod +x mysync.sh
-  $ ./mysync.sh
-
-
--end-
-
-
-
-
diff --git a/docs/howto_build_SDK.txt b/docs/howto_build_SDK.txt
deleted file mode 100644
index e09440b..0000000
--- a/docs/howto_build_SDK.txt
+++ /dev/null
@@ -1,305 +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.
-
-
-Subject: How to build an Android SDK & ADT Eclipse plugin.
-Date:    2009/03/27
-Updated: 2010/03/30
-
-
-Table of content:
-  0- License
-  1- Foreword
-  2- Building an SDK for MacOS and Linux
-  3- Building an SDK for Windows
-  4- Building an ADT plugin for Eclipse
-  5- Conclusion
-
-
-
-----------
-0- License
-----------
-
- 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.
-
-
-
------------
-1- Foreword
------------
-
-This document explains how to build the Android SDK and the ADT Eclipse plugin.
-
-It is designed for advanced users which are proficient with command-line
-operations and know how to setup the pre-required software.
-
-Basically it's not trivial yet when done right it's not that complicated.
-
-
-
---------------------------------------
-2- Building an SDK for MacOS and Linux
---------------------------------------
-
-First, setup your development environment and get the Android source code from
-git as explained here:
-
-  http://source.android.com/download
-
-For example for the cupcake branch:
-
-  $ mkdir ~/my-android-git
-  $ cd ~/my-android-git
-  $ repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake
-  $ repo sync
-
-Then once you have all the source, simply build the SDK using:
-
-  $ cd ~/my-android-git
-  $ . build/envsetup.sh
-  $ lunch sdk-eng
-  $ make sdk
-
-This will take a while, maybe between 20 minutes and several hours depending on
-your machine. After a while you'll see this in the output:
-
-  Package SDK: out/host/darwin-x86/sdk/android-sdk_eng.<build-id>_mac-x86.zip
-
-Some options:
-
-- Depending on your machine you can tell 'make' to build more things in
-  parallel, e.g. if you have a dual core, use "make -j4 sdk" to build faster.
-
-- You can define "BUILD_NUMBER" to control the build identifier that gets
-  incorporated in the resulting archive. The default is to use your username.
-  One suggestion is to include the date, e.g.:
-
-  $ export BUILD_NUMBER=${USER}-`date +%Y%m%d-%H%M%S`
-
-  There are certain characters you should avoid in the build number, typically
-  everything that might confuse 'make' or your shell. So for example avoid
-  punctuation and characters like $ & : / \ < > , and .
-
-
-
-------------------------------
-3- Building an SDK for Windows
-------------------------------
-
-A- SDK pre-requisite
---------------------
-
-First you need to build an SDK for MacOS and Linux. The Windows build works by
-updating an existing MacOS or Linux SDK zip file and replacing the unix
-binaries by Windows binaries.
-
-
-
-B- Cygwin pre-requisite & code checkout
----------------------------------------
-
-You must have Cygwin installed. But wait! You CANNOT use the latest Cygwin 1.7.
-Instead you MUST use the "legacy Cygwin 1.5" that you can find at this page:
-
-  http://cygwin.org/win-9x.html
-
-Don't mind the page title, just grab setup-legacy.exe and it will works just fine
-under XP or Vista.
-
-  
-Now configure it:
-- When installing Cygwin, set Default Text File Type to Unix/binary, not DOS/text.
-  This is really important, otherwise you will get errors when trying to
-  checkout code using git.
-- Packages that you must install or not:
-  - Required packages: autoconf, bison, curl, flex, gcc, g++, git, gnupg, make,
-                       mingw-zlib, python, zip, unzip.
-  - Suggested extra packages: diffutils, emacs, openssh, rsync, vim, wget.
-  - Packages that must not be installed: readline.
-
-Once you installed Cygwin properly, checkout the code from git as you did
-for MacOS or Linux. Make sure to get the same branch, and if possible keep
-it as close to the other one as possible:
-
-  $ mkdir ~/my-android-git
-  $ cd ~/my-android-git
-  $ repo init -u git://android.git.kernel.org/platform/manifest.git -b cupcake
-  $ repo sync
-
-
-
-C- Building the Windows SDK
----------------------------
-
-Now it's time to build that Windows SDK. You need:
-- The path to the MacOS or Linux SDK zip.
-- A directory where to place the final SDK. It will also hold some temporary
-  files.
-- The build number will be extracted from the SDK zip filename, but this will
-  only work if that build number has no underscores in it. It is suggested you
-  just define SDK_NUMBER (and not BUILD_NUMBER!) on the command line before
-  invoking the script.
-
-  Note that the "SDK number" is really a free identifier of your choice. It
-  doesn't need to be strictly a number. As always it is suggested you avoid
-  too much punctuation and special shell/make characters. Underscores cannot
-  be used.
-
-
-To summarize, the steps on the command line would be something like this:
-
-  $ mkdir ~/mysdk
-  $ export SDK_NUMBER=${USER}-`date +%Y%m%d-%H%M%S`
-  $ cd ~/my-android-git
-  $ development/build/tools/make_windows_sdk.sh /path/to/macos/or/linux/sdk.zip ~/mysdk
-
-This will take a while to build some Windows-specific binaries, including the
-emulator, unzip the previous zip, rename & replace things and rezip the final
-Windows SDK zip file. A typical build time should be around 5-10 minutes.
-
-
-
--------------------------------------
-4- Building an ADT plugin for Eclipse
--------------------------------------
-
-Requirements:
-- You can currently only build an ADT plugin for Eclipse under Linux.
-- You must have a working version of Eclipse 3.4 "ganymede" RCP installed.
-- You need X11 to run Eclipse at least once.
-- You need a lot of patience. The trick is to do the initial setup correctly
-  once, after it's a piece of cake.
-
-
-
-A- Pre-requisites
------------------
-
-Note for Ubuntu or Debian users: your apt repository probably only has Eclipse
-3.2 available and it's probably not suitable to build plugins in the first
-place. Forget that and install a working 3.4 manually as described below.
-
-- Visit http://www.eclipse.org/downloads/ to grab the
-  "Eclipse for RCP/Plug-in Developers (176 MB)" download for Linux.
-  32-bit and 64-bit versions are available, depending on your Linux installation.
-
-  Note: we've always used a 32-bit one, so use the 64-bit one at your own risk.
-
-  Note: Eclipse comes in various editions. Do yourself a favor and just stick
-  to the RCP for building this plugin. For example the J2EE contains too many
-  useless features that will get in the way, and the "Java" version lacks some
-  plugins you need to build other plugins. Please just use the RCP one.
-
-- Unpack "eclipse-rcp-ganymede-SR2-linux-gtk.tar.gz" in the directory of
-  your choice, e.g.:
-
-  $ mkdir ~/eclipse-3.4
-  $ cd ~/eclipse-3.4
-  $ tar xvzf eclipse-rcp-ganymede-SR2-linux-gtk.tar.gz
-
-  This will create an "eclipse" directory in the current directory.
-
-- Set ECLIPSE_HOME to that "eclipse" directory:
-
-  $ export ECLIPSE_HOME=~/eclipse-3.4/eclipse
-
-  Note: it is important you set ECLIPSE_HOME before starting the build.
-  Otherwise the build process will try to download and install its own Eclipse
-  installation in /buildroot, which is probably limited to root.
-
-- Now, before you can build anything, it is important that you start Eclipse
-  *manually* once using the same user that you will use to build later. That's
-  because your Eclipse installation is not finished: Eclipse must be run at
-  least once to create some files in ~/.eclipse/. So run Eclipse now:
-
-  $ ~/eclipse-3.4/eclipse/eclipse &
-
-  Wait for it load, create a workspace when requested and then simply quit
-  using the File > Quit menu. That's it. You won't need to run it manually
-  again.
-
-
-
-B- Building ADT
----------------
-
-Finally, you have Eclipse, it's installed and it created its own config files,
-so now you can build your ADT plugin. To do that you'll change directories to
-your git repository and invoke the build script by giving it a destination
-directory and an optional build number:
-
-  $ mkdir ~/mysdk
-  $ cd ~/my-android-git   # <-- this is where you did your "repo sync"
-  $ development/tools/eclipse/scripts/build_server.sh ~/mysdk $USER
-
-The first argument is the destination directory. It must be absolute. Do not
-give a relative destination directory such as "../mysdk". This will make the
-Eclipse build fail with a cryptic message:
-
-  BUILD SUCCESSFUL
-  Total time: 1 minute 5 seconds
-  **** Package in ../mysdk
-  Error: Build failed to produce ../mysdk/android-eclipse
-  Aborting
-
-The second argument is the build "number". The example used "$USER" but it
-really is a free identifier of your choice. It cannot contain spaces nor
-periods (dashes are ok.) If the build number is missing, a build timestamp will
-be used instead in the filename.
-
-The build should take something like 5-10 minutes.
-
-
-When the build succeeds, you'll see something like this at the end of the
-output:
-
-  ZIP of Update site available at ~/mysdk/android-eclipse-v200903272328.zip
-or
-  ZIP of Update site available at ~/mysdk/android-eclipse-<buildnumber>.zip
-
-When you load the plugin in Eclipse, its feature and plugin name will look like
-"com.android.ide.eclipse.adt_0.9.0.v200903272328-<buildnumber>.jar". The
-internal plugin ID is always composed of the package, the build timestamp and
-then your own build identifier (a.k.a. the "build number"), if provided. This
-means successive builds with the same build identifier are incremental and
-Eclipse will know how to update to more recent ones.
-
-
-
--------------
-5- Conclusion
--------------
-
-This completes the howto guide on building your own SDK and ADT plugin.
-Feedback is welcome on the public Android Open Source forums:
-  http://source.android.com/discuss
-
-If you are upgrading from a pre-cupcake to a cupcake or later SDK please read
-the accompanying document "howto_use_cupcake_sdk.txt".
-
--end-
-
diff --git a/docs/howto_use_cupcake_sdk.txt b/docs/howto_use_cupcake_sdk.txt
deleted file mode 100644
index b131230..0000000
--- a/docs/howto_use_cupcake_sdk.txt
+++ /dev/null
@@ -1,371 +0,0 @@
-Subject: How to build use a Cupcake Android SDK & ADT Eclipse plugin.
-Date:    2009/03/27
-
-
-Table of content:
-  0- License
-  1- Foreword
-  2- Installation steps
-  3- For Eclipse users
-  4- For Ant users
-  5- Targets, AVDs, Emulator changes
-  6- Conclusion
-
-
-
-----------
-0- License
-----------
-
- 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.
-
-
-
------------
-1- Foreword
------------
-
-This explains how to use the "new" SDK provided starting with cupcake.
-The new SDK has as a different structure than the pre-cupcake ones.
-
-This means:
-- The new SDK does not work with older Eclipse plugins (ADT 0.8)
-- The old SDKs (1.0 and 1.1) do NOT work with this Eclipse plugin (ADT 0.9)
-
-
-
-----------------------
-2- Installation steps
-----------------------
-
-First you will need to grab the zip of the SDK for your platform or build it
-yourself. Please refer to the accompanying document "howto_build_SDK.txt" if
-needed.
-
-Unzip the SDK somewhere. We'll call that directory "SDK" in command-line
-examples.
-
-Grab the new ADT Eclipse plugin zip file or build it yourself. Keep it
-somewhere (no need to unzip).
-
-
-
---------------------
-3- For Eclipse users
---------------------
-
-
-Below we'll explain how you can upgrade your Eclipse install to the new plugin.
-If you already have a working Eclipse installation with a pre-0.9 ADT,
-another suggestion is to simply install a new copy of Eclipse and create a
-new empty workspace. This is just a precaution. The update process should
-be otherwise harmless.
-
-
-
-A- Setting up Eclipse
----------------------
-
-- You must have Eclipse 3.3 or 3.4. Eclipse 3.2 is not longer supported.
-
-  There are many flavors, or "editions", of Eclipse. To develop, we'd recommend
-  the "Java" edition. The "RCP" one is totally suitable too. The J2EE one is
-  probably overkill.
-
-
-- If updating an existing Eclipse, use Help > Software Update and please
-  uninstall the two features of the previous ADT: the "editors" feature and the
-  ADT feature itself.
-
-  => If you don't you will get a conflict on editors when installing
-     the new one.
-
-- Using Help > Software Update, add a new "archived site", point it to the new
-  adt.zip (e.g. android-eclipse-<some-id>.zip), select the "Install" button at
-  the top right and restart eclipse as needed.
-
-- After it restarts, please use Window > Preferences > Android and select
-  the new SDK folder that you unzipped in paragraph 2.
-
-
-
-B- Updating older projects
---------------------------
-
-If you have pre-0.9 projects in your Eclipse workspace, or if you import them
-from your code repository, these projects will fail to build at first.
-
-First right-click on the project and select "Properties":
-
-- In the properties, open the Android panel and select the platform to use.
-  The SDK comes with a 1.5 platform. Select it and close the properties panel.
-- Do a clean build.
-
-
-The new plugin creates a "gen" folder in your project where it puts the R.java
-and all automatically generated AIDL java files. If you get an error such as:
-
-  "The type R is already defined"
-
-that means you must check to see if your old R.java or your old auto-generated
-AIDL Java files are still present in the "src" folder. If yes, remove them.
-
-Note: this does not apply to your own hand-crafted parcelable AIDL java files.
-
-Note: if you want to reuse the project with an older Eclipse ADT install,
-      simply remove the "gen" folder from the build path of the project.
-
-
-C- New Wizards
---------------
-
-The "New Android Project" wizard has been expanded to use the multi-platform
-capabilities of the new SDK.
-
-There is now a "New XML File" wizard that lets you create skeleton XML resource
-files for your Android projects. This makes it easier to create a new layout, a
-new strings file, etc.
-
-Both wizard are available via File > New... as well as new icons in the main
-icon bar. If you do not see the new icons, you may need to use Window > Reset
-Perspective on your Java perspective.
-
-
-Please see step 5 "Emulator changes" below for important details on how to run
-the emulator.
-
-
-
-----------------
-4- For Ant users
-----------------
-
-
-A- build.xml has changed
-------------------------
-
-You must re-create your build.xml file.
-
-First if you had customized your build.xml, make a copy of it:
-
-  $ cd my-project
-  $ cp build.xml build.xml.old
-
-
-Then use the new "android" tool to create a new build.xml:
-
-  $ SDK/tools/android update project --path /path/to/my-project
-
-or
-
-  $ cd my-project
-  $ SDK/tools/android update project --path .
-
-
-A "gen" folder will be created the first time you build and your R.java and
-your AIDL Java files will be generated in this "gen" folder. You MUST remove
-the old R.java and old auto-generated AIDL java files manually. (Note: this
-does not apply to your own hand-crafted parcelabe AIDL java files.)
-
-
-B- Where is activitycreator?
-----------------------------
-
-Note that the "activitycreator" tool has been replaced by the new "android"
-tool too. Example of how to create a new Ant project:
-
-  $ SDK/tools/android create project --path /path/to/my/project --name ProjectName
-      --package com.mycompany.myapp --activity MyActivityClass
-      --target 1 --mode activity
-
-
-Please see paragraph 5 below for important details on how to run the emulator
-and the meaning of that "--target 1" parameter.
-
-
-
-----------------------------------
-5- Targets, AVDs, Emulator changes
-----------------------------------
-
-This applies to BOTH Eclipse and Ant users.
-
-One major change with the emulator is that now you must pre-create an "Android
-Virtual Device" (a.k.a "AVD") before you run the emulator.
-
-
-
-A- What is an AVD and why do I need one?
-----------------------------------------
-
-What is an "AVD"? If you forget, just run:
-
-  $ SDK/tools/emulator -help-virtual-device
-
-  An Android Virtual Device (AVD) models a single virtual device running the
-  Android platform that has, at least, its own kernel, system image and data
-  partition.
-
-There is a lot more explanation given by the emulator. Please run the help
-command given above to read the rest.
-
-The bottom line is that you can create many emulator configurations, or "AVDs",
-each with their own system image and most important each with their own user
-data and SD card data. Then you tell Eclipse or the emulator which one to use
-to debug or run your applications.
-
-
-Note for Eclipse users: eventually there will be a user interface to do all of
-these operations. For right now, please use the command line interface.
-
-
-B- Listing targets and AVDs
----------------------------
-
-There is a new tool called "android" in the SDK that lets you know which
-"target" and AVDs you can use.
-
-A target is a specific version of Android that you can use. By default the SDK
-comes with an "Android 1.5" target, codenamed "cupcake". In the future there
-will be more versions of Android to use, e.g. "Android 2.0" or specific add-ons
-provided by hardware manufacturers. When you want to run an emulator, you need
-to specify a given flavor of Android: this is the "target".
-
-
-To learn about available targets in your SDK, use this command:
-
-  $ SDK/tools/android list targets
-
-This will give you an output such as:
-
-  Available Android targets:
-  [1] Android 1.5
-       API level: 3
-       Skins: HVGA (default), HVGA-L, HVGA-P, QVGA-L, QVGA-P
-
-Note the "[1]". Later you will need to reference this as "--target 1" on the
-command line.
-
-
-Similarly you can list the available AVDs:
-
-  $ SDK/tools/android list avds
-
-Which might output something as:
-
-  Available Android Virtual Devices:
-      Name: my_avd
-      Path: C:\Users\<username>\.android\avd\my_avd.avd
-    Target: Android 1.5 (API level 3)
-      Skin: 320x480
-    Sdcard: 16M
-
-
-
-C- Creating an AVD
-------------------
-
-To create a configuration:
-
-  $ SDK/tools/android create avd --name my_avd_name --target 1
-
-
-where "target 1" is the index of a target listed by "android list targets".
-
-The AVD name is purely an identifier used to refer to the AVD later.
-Since it is used as directory name, please avoid using shell or path specific
-characters.
-
-To learn the various options available when creating an AVD, simply type:
-
-  $ SDK/tools/android create avd
-
-The android tool will automatically print an explanation of required arguments.
-
-
-
-D- Invoking an AVD from the command-line
-----------------------------------------
-
-To use this AVD in the emulator from the command-line, type:
-
-  $ SDK/tools/emulator @my_avd_name
-
-
-For more options, please consult the emulator help:
-
-  $ SDK/tools/emulator -help-virtual-device
-
-
-
-E- Invoking an AVD from Eclipse
--------------------------------
-
-By default Android projects in Eclipse have an "automatic target" mode.
-In this mode, when a project is deployed in debug or run, it checks:
-- If there's one running device or emulator, this is used for deployment.
-- If there's more than one running device or emulator, a "device chooser" is
-  shown to let the user select which one to use.
-- If there are no running devices or emulators, ADT looks at available AVDs.
-  If one matches the project configuration (e.g. same API level), it is
-  automatically used.
-
-Alternatively you can edit the "launch configuration" on your Android project
-in Eclipse by selecting the menu Run > Run Configurations. In the "target" tab
-of the configuration, you can choose:
-
-- Manual or automatic targetting mode.
-
-  - Manual means to always present the device chooser.
-  - Automatic is the behavior explained above.
-
-- In automatic mode, which AVD is preferred. If none is selected, the first
-  suitable is used.
-
-
-F- AVD concurrency
-------------------
-
-You can no longer run several emulators at the same time on the same
-configuration.
-
-Before this used to put the second or more emulators in a transient read-only
-mode that would not save user data.
-
-Now you just need to create as many AVDs as you want to run emulators.
-
-For example if you are working on a client/server application for Android, you
-could create a "client" AVD and a "server" AVD then run them both at once. The
-emulator window will show you the AVD name so that you know which one is which.
-
-Example:
-
-  $ SDK/tools/android create avd --name client --target 1 --sdcard 16M --skin HVGA
-  $ SDK/tools/android create avd --name server --target 1 --sdcard 32M --skin HVGA-P
-  $ SDK/tools/emulator @server &
-  $ SDK/tools/emulator @client &
-
-
-
--------------
-6- Conclusion
--------------
-
-This completes the howto guide on how to use the new Cupcake SDK.
-Feedback is welcome on the public Android Open Source forums:
-  http://source.android.com/discuss
-
--end-
-
diff --git a/ide/eclipse/.classpath b/ide/eclipse/.classpath
index d535128..1994220 100644
--- a/ide/eclipse/.classpath
+++ b/ide/eclipse/.classpath
@@ -10,12 +10,14 @@
 	<classpathentry kind="src" path="packages/apps/Contacts/src"/>
 	<classpathentry kind="src" path="packages/apps/DeskClock/src"/>
 	<classpathentry kind="src" path="packages/apps/Email/src"/>
+	<classpathentry kind="src" path="packages/apps/Gallery3D/src"/>
 	<classpathentry kind="src" path="packages/apps/HTMLViewer/src"/>
 	<classpathentry kind="src" path="packages/apps/Launcher2/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/Provision/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"/>
@@ -31,7 +33,6 @@
 	<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"/>
@@ -49,6 +50,7 @@
 	<classpathentry kind="src" path="frameworks/base/voip/java"/>
 	<classpathentry kind="src" path="frameworks/base/vpn/java"/>
 	<classpathentry kind="src" path="frameworks/base/wifi/java"/>
+	<classpathentry kind="src" path="frameworks/ex/common/java"/>
 	<classpathentry kind="src" path="development/samples/ApiDemos/src"/>
 	<classpathentry kind="src" path="development/samples/ApiDemos/tests/src"/>
 	<classpathentry kind="src" path="development/samples/Compass/src"/>
@@ -92,8 +94,6 @@
 	<classpathentry kind="src" path="external/apache-http/src"/>
 	<classpathentry kind="src" path="external/bouncycastle/src/main/java"/>
 	<classpathentry kind="src" path="external/nist-sip/java"/>
-	<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/gsf-client_intermediates/javalib.jar"/>
 	<classpathentry kind="lib" path="out/target/common/obj/JAVA_LIBRARIES/guava_intermediates/javalib.jar"/>
 	<classpathentry kind="lib" path="packages/apps/Calculator/arity-2.1.2.jar"/>
 	<classpathentry kind="output" path="out/target/common/obj/JAVA_LIBRARIES/android_stubs_current_intermediates/classes"/>
diff --git a/pdk/README b/pdk/README
index d9f8996..0acb1eb 100644
--- a/pdk/README
+++ b/pdk/README
@@ -11,7 +11,7 @@
 
 If that doesn't work, go through the instructions on
 
-  http://source.android.com/download again.
+  http://source.android.com/source/download.html again.
 
 
 2) from the root
diff --git a/pdk/docs/source/git-repo.jd b/pdk/docs/source/git-repo.jd
index c5a75e2..8905780 100644
--- a/pdk/docs/source/git-repo.jd
+++ b/pdk/docs/source/git-repo.jd
@@ -288,14 +288,13 @@
  
 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> 
+  <li><a href="http://source.android.com/source/download.html">Get source</a></li> 
+  <li><a href="http://source.android.com/source/code-style.html">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><a href="http://source.android.com/source/git-repo.html">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> 
@@ -304,7 +303,7 @@
  
 Documentation on specific tasks:
 <ul>
-  <li><a href="http://source.android.com/documentation/building-for-dream">Building for an Android Developer Phone</a></li> 
+  <li><a href="http://source.android.com/source/building-dream.html">Building for an Android Developer Phone</a></li> 
 </ul> 
 -->
 
diff --git a/samples/ApiDemos/res/values/strings.xml b/samples/ApiDemos/res/values/strings.xml
index 4e61b8f..db432c1 100644
--- a/samples/ApiDemos/res/values/strings.xml
+++ b/samples/ApiDemos/res/values/strings.xml
@@ -522,7 +522,6 @@
     <string name="linear_layout_8_right">Right</string>
     <string name="linear_layout_10_from">From:</string>
     <string name="linear_layout_10_to">To:</string>
-    <string name="list_7_nothing">Nothing\u2026</string>
     <string name="radio_group_snack">Snack</string>
     <string name="radio_group_selection">"You have selected: "</string>
     <string name="radio_group_none">(none)</string>
@@ -946,8 +945,8 @@
     <!-- ============================ -->
 
     <string name="sms_warning">
-      WARNING: this demo can send actual text messages (one at a time), so be sure to
-      test with the Android emulator or have a text messaging plan with your carrier.
+        WARNING: this demo can send actual text messages (one at a time), so be sure to
+        test with the Android emulator or have a text messaging plan with your carrier.
     </string>
     <string name="sms_enable_receiver">Enable SMS broadcast receiver</string>
     <string name="sms_recipient_label">Recipient #</string>
@@ -957,4 +956,3 @@
     <string name="reply">Reply</string>
     <string name="dismiss">Dismiss</string>
 </resources>
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/ApiDemos.java b/samples/ApiDemos/src/com/example/android/apis/ApiDemos.java
index 78b1fd7..39f24b6 100644
--- a/samples/ApiDemos/src/com/example/android/apis/ApiDemos.java
+++ b/samples/ApiDemos/src/com/example/android/apis/ApiDemos.java
@@ -52,8 +52,8 @@
         getListView().setTextFilterEnabled(true);
     }
 
-    protected List getData(String prefix) {
-        List<Map> myData = new ArrayList<Map>();
+    protected List<Map<String, Object>> getData(String prefix) {
+        List<Map<String, Object>> myData = new ArrayList<Map<String, Object>>();
 
         Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
         mainIntent.addCategory(Intent.CATEGORY_SAMPLE_CODE);
@@ -107,10 +107,11 @@
         return myData;
     }
 
-    private final static Comparator<Map> sDisplayNameComparator = new Comparator<Map>() {
+    private final static Comparator<Map<String, Object>> sDisplayNameComparator =
+        new Comparator<Map<String, Object>>() {
         private final Collator   collator = Collator.getInstance();
 
-        public int compare(Map map1, Map map2) {
+        public int compare(Map<String, Object> map1, Map<String, Object> map2) {
             return collator.compare(map1.get("title"), map2.get("title"));
         }
     };
@@ -128,7 +129,7 @@
         return result;
     }
 
-    protected void addItem(List<Map> data, String name, Intent intent) {
+    protected void addItem(List<Map<String, Object>> data, String name, Intent intent) {
         Map<String, Object> temp = new HashMap<String, Object>();
         temp.put("title", name);
         temp.put("intent", intent);
@@ -136,11 +137,11 @@
     }
 
     @Override
+    @SuppressWarnings("unchecked")
     protected void onListItemClick(ListView l, View v, int position, long id) {
-        Map map = (Map) l.getItemAtPosition(position);
+        Map<String, Object> map = (Map<String, Object>)l.getItemAtPosition(position);
 
         Intent intent = (Intent) map.get("intent");
         startActivity(intent);
     }
-
 }
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/Animation.java b/samples/ApiDemos/src/com/example/android/apis/app/Animation.java
index 90831f5..5ba41c4 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/Animation.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/Animation.java
@@ -22,7 +22,6 @@
 import com.example.android.apis.view.Controls1;
 
 import android.app.Activity;
-import android.content.ComponentName;
 import android.content.Intent;
 import android.os.Bundle;
 import android.view.View;
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ContactsFilter.java b/samples/ApiDemos/src/com/example/android/apis/app/ContactsFilter.java
index bb843e5..d5b3deb 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ContactsFilter.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ContactsFilter.java
@@ -20,8 +20,6 @@
 // class is in a sub-package.
 import android.app.Activity;
 import android.content.ComponentName;
-import android.content.Context;
-import android.os.RemoteException;
 import android.os.Bundle;
 import android.view.View;
 import android.view.View.OnClickListener;
@@ -29,7 +27,6 @@
 
 import com.example.android.apis.R;
 
-
 /**
  * Front-end for launching {@link ContactsFilterInstrumentation} example
  * instrumentation class.
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ContactsFilterInstrumentation.java b/samples/ApiDemos/src/com/example/android/apis/app/ContactsFilterInstrumentation.java
index 04bb671..6895363 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ContactsFilterInstrumentation.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ContactsFilterInstrumentation.java
@@ -23,8 +23,6 @@
 import android.os.Bundle;
 import android.util.Log;
 
-import java.util.Map;
-
 /**
  * This is an example implementation of the {@link android.app.Instrumentation}
  * class, allowing you to run tests against application code.  The
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/DefaultValues.java b/samples/ApiDemos/src/com/example/android/apis/app/DefaultValues.java
index 35bdf13..494a2ea 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/DefaultValues.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/DefaultValues.java
@@ -19,7 +19,6 @@
 import com.example.android.apis.ApiDemosApplication;
 import com.example.android.apis.R;
 
-import android.app.Application;
 import android.content.SharedPreferences;
 import android.os.Bundle;
 import android.preference.PreferenceActivity;
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 c7a2dfb..7e061ed 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ForegroundService.java
@@ -49,9 +49,9 @@
     static final String ACTION_BACKGROUND = "com.example.android.apis.BACKGROUND";
     
  // BEGIN_INCLUDE(foreground_compatibility)
-    private static final Class[] mStartForegroundSignature = new Class[] {
+    private static final Class<?>[] mStartForegroundSignature = new Class[] {
         int.class, Notification.class};
-    private static final Class[] mStopForegroundSignature = new Class[] {
+    private static final Class<?>[] mStopForegroundSignature = new Class[] {
         boolean.class};
     
     private NotificationManager mNM;
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/LocalSample.java b/samples/ApiDemos/src/com/example/android/apis/app/LocalSample.java
index 1bb26e9..0e4b66e 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/LocalSample.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/LocalSample.java
@@ -20,8 +20,6 @@
 // class is in a sub-package.
 import android.app.Activity;
 import android.content.ComponentName;
-import android.content.Context;
-import android.os.RemoteException;
 import android.os.Bundle;
 import android.view.View;
 import android.view.View.OnClickListener;
@@ -29,7 +27,6 @@
 
 import com.example.android.apis.R;
 
-
 /**
  * Front-end for launching {@link LocalSampleInstrumentation} example
  * instrumentation class.
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/LocalSampleInstrumentation.java b/samples/ApiDemos/src/com/example/android/apis/app/LocalSampleInstrumentation.java
index e0f6163..aabfec3 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/LocalSampleInstrumentation.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/LocalSampleInstrumentation.java
@@ -23,8 +23,6 @@
 import android.os.Bundle;
 import android.util.Log;
 
-import java.util.Map;
-
 /**
  * This is an example implementation of the {@link android.app.Instrumentation}
  * class demonstrating instrumentation against one of this application's sample
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 859969c..0c7c108 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/LocalService.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/LocalService.java
@@ -45,6 +45,10 @@
 public class LocalService extends Service {
     private NotificationManager mNM;
 
+    // Unique Identification Number for the Notification.
+    // We use it on Notification start, and to cancel it.
+    private int NOTIFICATION = R.string.local_service_started;
+
     /**
      * Class for clients to access.  Because we know this service always
      * runs in the same process as its clients, we don't need to deal with
@@ -75,7 +79,7 @@
     @Override
     public void onDestroy() {
         // Cancel the persistent notification.
-        mNM.cancel(R.string.local_service_started);
+        mNM.cancel(NOTIFICATION);
 
         // Tell the user we stopped.
         Toast.makeText(this, R.string.local_service_stopped, Toast.LENGTH_SHORT).show();
@@ -110,8 +114,7 @@
                        text, contentIntent);
 
         // Send the notification.
-        // 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);
+        mNM.notify(NOTIFICATION, notification);
     }
 }
 //END_INCLUDE(service)
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/NotificationDisplay.java b/samples/ApiDemos/src/com/example/android/apis/app/NotificationDisplay.java
index a6c20ea..25b5d56 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/NotificationDisplay.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/NotificationDisplay.java
@@ -24,14 +24,11 @@
 import android.app.NotificationManager;
 import android.content.Intent;
 import android.os.Bundle;
-import android.view.Gravity;
 import android.view.View;
 import android.view.WindowManager;
 import android.widget.ImageButton;
-import android.widget.LinearLayout;
 import android.widget.RelativeLayout;
 
-
 /**
  * Activity used by StatusBarNotification to show the notification to the user.
  */
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/NotifyingController.java b/samples/ApiDemos/src/com/example/android/apis/app/NotifyingController.java
index a0de699..b8b4e3f 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/NotifyingController.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/NotifyingController.java
@@ -21,14 +21,12 @@
 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;
 
-
 /**
  * Controller to start and stop a service. The serivce will update a status bar
  * notification every 5 seconds for a minute.
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/NotifyingService.java b/samples/ApiDemos/src/com/example/android/apis/app/NotifyingService.java
index e580978..3b8139f 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/NotifyingService.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/NotifyingService.java
@@ -30,7 +30,6 @@
 import android.os.IBinder;
 import android.os.Parcel;
 import android.os.RemoteException;
-import android.widget.RemoteViews;
 
 /**
  * This is an example of service that will update its status bar balloon 
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/PreferencesFromXml.java b/samples/ApiDemos/src/com/example/android/apis/app/PreferencesFromXml.java
index 23461c6..63bbac2 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/PreferencesFromXml.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/PreferencesFromXml.java
@@ -18,9 +18,7 @@
 
 import com.example.android.apis.R;
 
-import android.content.SharedPreferences;
 import android.os.Bundle;
-import android.preference.Preference;
 import android.preference.PreferenceActivity;
 
 public class PreferencesFromXml extends PreferenceActivity {
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/QuickContactsDemo.java b/samples/ApiDemos/src/com/example/android/apis/app/QuickContactsDemo.java
index 1ee5742..004e568 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/QuickContactsDemo.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/QuickContactsDemo.java
@@ -75,8 +75,6 @@
         @Override
         public void bindView(View view, Context context, Cursor cursor) {
             final ContactListItemCache cache = (ContactListItemCache) view.getTag();
-            TextView nameView = cache.nameView;
-            QuickContactBadge photoView = cache.photoView;
             // Set the name
             cursor.copyStringToBuffer(SUMMARY_NAME_COLUMN_INDEX, cache.nameBuffer);
             int size = cache.nameBuffer.sizeCopied;
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/ReceiveResult.java b/samples/ApiDemos/src/com/example/android/apis/app/ReceiveResult.java
index 4e248b9..22ae7f4 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/ReceiveResult.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/ReceiveResult.java
@@ -18,8 +18,6 @@
 
 // Need the following import to get access to the app resources, since this
 // class is in a sub-package.
-import java.util.Map;
-
 import com.example.android.apis.R;
 
 import android.app.Activity;
@@ -31,8 +29,6 @@
 import android.widget.Button;
 import android.widget.TextView;
 
-import java.util.Map;
-
 /**
  * Shows how an activity can send data to its launching activity when done.y.
  * <p>This can be used, for example, to implement a dialog alowing the user to
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/RedirectGetter.java b/samples/ApiDemos/src/com/example/android/apis/app/RedirectGetter.java
index 982317c..c96e1bb 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/RedirectGetter.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/RedirectGetter.java
@@ -32,8 +32,11 @@
  */
 public class RedirectGetter extends Activity
 {
+    private String mTextPref;
+    private TextView mText;
+
     @Override
-	protected void onCreate(Bundle savedInstanceState)
+    protected void onCreate(Bundle savedInstanceState)
     {
         super.onCreate(savedInstanceState);
 
@@ -45,9 +48,12 @@
 
         // The text being set.
         mText = (TextView)findViewById(R.id.text);
+
+        // Display the stored values, or if not stored initialize with an empty String
+        loadPrefs();
     }
 
-    private final boolean loadPrefs()
+    private final void loadPrefs()
     {
         // Retrieve the current redirect values.
         // NOTE: because this preference is shared between multiple
@@ -58,10 +64,9 @@
         mTextPref = preferences.getString("text", null);
         if (mTextPref != null) {
             mText.setText(mTextPref);
-            return true;
+        } else {
+            mText.setText("");
         }
-
-        return false;
     }
 
     private OnClickListener mApplyListener = new OnClickListener()
@@ -79,8 +84,4 @@
             finish();
         }
     };
-
-    private String mTextPref;
-    TextView mText;
 }
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/SetWallpaperActivity.java b/samples/ApiDemos/src/com/example/android/apis/app/SetWallpaperActivity.java
index 8630b1c..f3d4ffb 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/SetWallpaperActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/SetWallpaperActivity.java
@@ -29,7 +29,6 @@
 import android.graphics.drawable.Drawable;
 import android.os.Bundle;
 import android.view.View;
-import android.view.WindowManager;
 import android.view.View.OnClickListener;
 import android.widget.Button;
 import android.widget.ImageView;
diff --git a/samples/ApiDemos/src/com/example/android/apis/app/WallpaperActivity.java b/samples/ApiDemos/src/com/example/android/apis/app/WallpaperActivity.java
index 8d7f5a1..7b5eea2 100644
--- a/samples/ApiDemos/src/com/example/android/apis/app/WallpaperActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/app/WallpaperActivity.java
@@ -22,7 +22,6 @@
 
 import android.app.Activity;
 import android.os.Bundle;
-import android.view.WindowManager;
 
 /**
  * <h3>Wallpaper Activity</h3>
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/AlphaBitmap.java b/samples/ApiDemos/src/com/example/android/apis/graphics/AlphaBitmap.java
index 8fff231..90d3450 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/AlphaBitmap.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/AlphaBitmap.java
@@ -18,15 +18,12 @@
 
 import com.example.android.apis.R;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.*;
 
 import java.io.InputStream;
-import java.io.ByteArrayOutputStream;
 
 public class AlphaBitmap extends GraphicsActivity {
 
@@ -35,23 +32,23 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Bitmap mBitmap;
         private Bitmap mBitmap2;
         private Bitmap mBitmap3;
         private Shader mShader;
-        
+
         private static void drawIntoBitmap(Bitmap bm) {
             float x = bm.getWidth();
             float y = bm.getHeight();
             Canvas c = new Canvas(bm);
             Paint p = new Paint();
             p.setAntiAlias(true);
-            
+
             p.setAlpha(0x80);
             c.drawCircle(x/2, y/2, x/2, p);
-            
+
             p.setAlpha(0x30);
             p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.SRC));
             p.setTextSize(60);
@@ -59,28 +56,28 @@
             Paint.FontMetrics fm = p.getFontMetrics();
             c.drawText("Alpha", x/2, (y-fm.ascent)/2, p);
         }
-        
+
         public SampleView(Context context) {
             super(context);
             setFocusable(true);
-            
+
             InputStream is = context.getResources().openRawResource(R.drawable.app_sample_code);
             mBitmap = BitmapFactory.decodeStream(is);
             mBitmap2 = mBitmap.extractAlpha();
             mBitmap3 = Bitmap.createBitmap(200, 200, Bitmap.Config.ALPHA_8);
             drawIntoBitmap(mBitmap3);
-            
+
             mShader = new LinearGradient(0, 0, 100, 70, new int[] {
                                          Color.RED, Color.GREEN, Color.BLUE },
                                          null, Shader.TileMode.MIRROR);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             canvas.drawColor(Color.WHITE);
 
             Paint p = new Paint();
             float y = 10;
-            
+
             p.setColor(Color.RED);
             canvas.drawBitmap(mBitmap, 10, y, p);
             y += mBitmap.getHeight() + 10;
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/AnimateDrawable.java b/samples/ApiDemos/src/com/example/android/apis/graphics/AnimateDrawable.java
index 279b588..330924e 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/AnimateDrawable.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/AnimateDrawable.java
@@ -23,23 +23,23 @@
 import android.view.animation.Transformation;
 
 public class AnimateDrawable extends ProxyDrawable {
-    
+
     private Animation mAnimation;
     private Transformation mTransformation = new Transformation();
 
     public AnimateDrawable(Drawable target) {
         super(target);
     }
-    
+
     public AnimateDrawable(Drawable target, Animation animation) {
         super(target);
         mAnimation = animation;
     }
-    
+
     public Animation getAnimation() {
         return mAnimation;
     }
-    
+
     public void setAnimation(Animation anim) {
         mAnimation = anim;
     }
@@ -47,11 +47,11 @@
     public boolean hasStarted() {
         return mAnimation != null && mAnimation.hasStarted();
     }
-    
+
     public boolean hasEnded() {
         return mAnimation == null || mAnimation.hasEnded();
     }
-    
+
     @Override
     public void draw(Canvas canvas) {
         Drawable dr = getProxy();
@@ -69,4 +69,4 @@
         }
     }
 }
-    
+
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/AnimateDrawables.java b/samples/ApiDemos/src/com/example/android/apis/graphics/AnimateDrawables.java
index 7c9473d..0398fbf 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/AnimateDrawables.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/AnimateDrawables.java
@@ -18,14 +18,14 @@
 
 import com.example.android.apis.R;
 
-import android.app.Activity;
 import android.content.Context;
-import android.graphics.*;
-import android.graphics.drawable.*;
-import android.view.animation.*;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.drawable.Drawable;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.View;
+import android.view.animation.Animation;
+import android.view.animation.TranslateAnimation;
 
 public class AnimateDrawables extends GraphicsActivity {
 
@@ -34,7 +34,7 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private AnimateDrawable mDrawable;
 
@@ -45,17 +45,18 @@
 
             Drawable dr = context.getResources().getDrawable(R.drawable.beach);
             dr.setBounds(0, 0, dr.getIntrinsicWidth(), dr.getIntrinsicHeight());
-            
+
             Animation an = new TranslateAnimation(0, 100, 0, 200);
             an.setDuration(2000);
             an.setRepeatCount(-1);
             an.initialize(10, 10, 10, 10);
-            
+
             mDrawable = new AnimateDrawable(dr, an);
             an.startNow();
         }
-        
-        @Override protected void onDraw(Canvas canvas) {
+
+        @Override
+        protected void onDraw(Canvas canvas) {
             canvas.drawColor(Color.WHITE);
 
             mDrawable.draw(canvas);
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Arcs.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Arcs.java
index ff8b38b..1bd07f9 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Arcs.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Arcs.java
@@ -20,7 +20,6 @@
 // class is in a sub-package.
 //import com.example.android.apis.R;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
@@ -33,7 +32,7 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Paint[] mPaints;
         private Paint mFramePaint;
@@ -43,27 +42,27 @@
         private float mStart;
         private float mSweep;
         private int mBigIndex;
-        
+
         private static final float SWEEP_INC = 2;
         private static final float START_INC = 15;
-        
+
         public SampleView(Context context) {
             super(context);
-            
+
             mPaints = new Paint[4];
             mUseCenters = new boolean[4];
             mOvals = new RectF[4];
-    
+
             mPaints[0] = new Paint();
             mPaints[0].setAntiAlias(true);
             mPaints[0].setStyle(Paint.Style.FILL);
             mPaints[0].setColor(0x88FF0000);
             mUseCenters[0] = false;
-            
+
             mPaints[1] = new Paint(mPaints[0]);
             mPaints[1].setColor(0x8800FF00);
             mUseCenters[1] = true;
-            
+
             mPaints[2] = new Paint(mPaints[0]);
             mPaints[2].setStyle(Paint.Style.STROKE);
             mPaints[2].setStrokeWidth(4);
@@ -73,36 +72,36 @@
             mPaints[3] = new Paint(mPaints[2]);
             mPaints[3].setColor(0x88888888);
             mUseCenters[3] = true;
-            
+
             mBigOval = new RectF(40, 10, 280, 250);
-            
+
             mOvals[0] = new RectF( 10, 270,  70, 330);
             mOvals[1] = new RectF( 90, 270, 150, 330);
             mOvals[2] = new RectF(170, 270, 230, 330);
             mOvals[3] = new RectF(250, 270, 310, 330);
-            
+
             mFramePaint = new Paint();
             mFramePaint.setAntiAlias(true);
             mFramePaint.setStyle(Paint.Style.STROKE);
             mFramePaint.setStrokeWidth(0);
         }
-        
+
         private void drawArcs(Canvas canvas, RectF oval, boolean useCenter,
                               Paint paint) {
             canvas.drawRect(oval, mFramePaint);
             canvas.drawArc(oval, mStart, mSweep, useCenter, paint);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             canvas.drawColor(Color.WHITE);
-            
+
             drawArcs(canvas, mBigOval, mUseCenters[mBigIndex],
                      mPaints[mBigIndex]);
-            
+
             for (int i = 0; i < 4; i++) {
                 drawArcs(canvas, mOvals[i], mUseCenters[i], mPaints[i]);
             }
-            
+
             mSweep += SWEEP_INC;
             if (mSweep > 360) {
                 mSweep -= 360;
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapDecode.java b/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapDecode.java
index 88f0c1d..6a8b542 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapDecode.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapDecode.java
@@ -18,36 +18,36 @@
 
 import com.example.android.apis.R;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.graphics.drawable.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.*;
 
-import java.io.IOException;
 import java.io.InputStream;
 import java.io.ByteArrayOutputStream;
 
 public class BitmapDecode extends GraphicsActivity {
-    
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Bitmap mBitmap;
         private Bitmap mBitmap2;
         private Bitmap mBitmap3;
         private Bitmap mBitmap4;
         private Drawable mDrawable;
-        
+
         private Movie mMovie;
         private long mMovieStart;
-        
+
+        //Set to false to use decodeByteArray
+        private static final boolean DECODE_STREAM = true;
+
         private static byte[] streamToBytes(InputStream is) {
             ByteArrayOutputStream os = new ByteArrayOutputStream(1024);
             byte[] buffer = new byte[1024];
@@ -60,33 +60,33 @@
             }
             return os.toByteArray();
         }
-        
+
         public SampleView(Context context) {
             super(context);
             setFocusable(true);
-            
+
             java.io.InputStream is;
             is = context.getResources().openRawResource(R.drawable.beach);
-            
+
             BitmapFactory.Options opts = new BitmapFactory.Options();
             Bitmap bm;
-            
+
             opts.inJustDecodeBounds = true;
             bm = BitmapFactory.decodeStream(is, null, opts);
-            
+
             // now opts.outWidth and opts.outHeight are the dimension of the
             // bitmap, even though bm is null
-            
+
             opts.inJustDecodeBounds = false;    // this will request the bm
             opts.inSampleSize = 4;             // scaled down by 4
             bm = BitmapFactory.decodeStream(is, null, opts);
-            
+
             mBitmap = bm;
-            
+
             // decode an image with transparency
             is = context.getResources().openRawResource(R.drawable.frog);
             mBitmap2 = BitmapFactory.decodeStream(is);
-            
+
             // create a deep copy of it using getPixels() into different configs
             int w = mBitmap2.getWidth();
             int h = mBitmap2.getHeight();
@@ -96,32 +96,34 @@
                                            Bitmap.Config.ARGB_8888);
             mBitmap4 = Bitmap.createBitmap(pixels, 0, w, w, h,
                                            Bitmap.Config.ARGB_4444);
-            
+
             mDrawable = context.getResources().getDrawable(R.drawable.button);
             mDrawable.setBounds(150, 20, 300, 100);
-            
+
             is = context.getResources().openRawResource(R.drawable.animated_gif);
-            if (true) {
+
+            if (DECODE_STREAM) {
                 mMovie = Movie.decodeStream(is);
             } else {
                 byte[] array = streamToBytes(is);
                 mMovie = Movie.decodeByteArray(array, 0, array.length);
             }
         }
-        
-        @Override protected void onDraw(Canvas canvas) {
-            canvas.drawColor(0xFFCCCCCC);            
-            
+
+        @Override
+        protected void onDraw(Canvas canvas) {
+            canvas.drawColor(0xFFCCCCCC);
+
             Paint p = new Paint();
             p.setAntiAlias(true);
-            
+
             canvas.drawBitmap(mBitmap, 10, 10, null);
             canvas.drawBitmap(mBitmap2, 10, 170, null);
             canvas.drawBitmap(mBitmap3, 110, 170, null);
             canvas.drawBitmap(mBitmap4, 210, 170, null);
-            
+
             mDrawable.draw(canvas);
-            
+
             long now = android.os.SystemClock.uptimeMillis();
             if (mMovieStart == 0) {   // first time
                 mMovieStart = now;
@@ -140,4 +142,3 @@
         }
     }
 }
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.java b/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.java
index 4d48a1e..12c79ca 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapMesh.java
@@ -31,16 +31,16 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private static final int WIDTH = 20;
         private static final int HEIGHT = 20;
         private static final int COUNT = (WIDTH + 1) * (HEIGHT + 1);
-        
+
         private final Bitmap mBitmap;
         private final float[] mVerts = new float[COUNT*2];
         private final float[] mOrig = new float[COUNT*2];
-        
+
         private final Matrix mMatrix = new Matrix();
         private final Matrix mInverse = new Matrix();
 
@@ -55,7 +55,7 @@
 
             mBitmap = BitmapFactory.decodeResource(getResources(),
                                                      R.drawable.beach);
-            
+
             float w = mBitmap.getWidth();
             float h = mBitmap.getHeight();
             // construct our mesh
@@ -63,17 +63,17 @@
             for (int y = 0; y <= HEIGHT; y++) {
                 float fy = h * y / HEIGHT;
                 for (int x = 0; x <= WIDTH; x++) {
-                    float fx = w * x / WIDTH;                    
+                    float fx = w * x / WIDTH;
                     setXY(mVerts, index, fx, fy);
                     setXY(mOrig, index, fx, fy);
                     index += 1;
                 }
             }
-            
+
             mMatrix.setTranslate(10, 10);
             mMatrix.invert(mInverse);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             canvas.drawColor(0xFFCCCCCC);
 
@@ -81,7 +81,7 @@
             canvas.drawBitmapMesh(mBitmap, WIDTH, HEIGHT, mVerts, 0,
                                   null, 0, null);
         }
-        
+
         private void warp(float cx, float cy) {
             final float K = 10000;
             float[] src = mOrig;
@@ -94,7 +94,7 @@
                 float dd = dx*dx + dy*dy;
                 float d = FloatMath.sqrt(dd);
                 float pull = K / (dd + 0.000001f);
-                
+
                 pull /= (d + 0.000001f);
              //   android.util.Log.d("skia", "index " + i + " dist=" + d + " pull=" + pull);
 
@@ -114,7 +114,7 @@
         @Override public boolean onTouchEvent(MotionEvent event) {
             float[] pt = { event.getX(), event.getY() };
             mInverse.mapPoints(pt);
-            
+
             int x = (int)pt[0];
             int y = (int)pt[1];
             if (mLastWarpX != x || mLastWarpY != y) {
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapPixels.java b/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapPixels.java
index 88717bc..e9b2167 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapPixels.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/BitmapPixels.java
@@ -16,32 +16,26 @@
 
 package com.example.android.apis.graphics;
 
-import com.example.android.apis.R;
-
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
-import android.graphics.drawable.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.*;
 
 import java.nio.IntBuffer;
 import java.nio.ShortBuffer;
 
 public class BitmapPixels extends GraphicsActivity {
-    
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Bitmap mBitmap1;
         private Bitmap mBitmap2;
         private Bitmap mBitmap3;
-        private Bitmap mBitmap4;
 
         // access the red component from a premultiplied color
         private static int getR32(int c) { return (c >>  0) & 0xFF; }
@@ -67,7 +61,7 @@
         private static short pack4444(int r, int g, int b, int a) {
             return (short)((a << 0) | ( b << 4) | (g << 8) | (r << 12));
         }
-        
+
         private static int mul255(int c, int a) {
             int prod = c * a + 128;
             return (prod + (prod >> 8)) >> 8;
@@ -88,7 +82,7 @@
             // now pack it in the correct order
             return pack8888(r, g, b, a);
         }
-        
+
         private static void makeRamp(int from, int to, int n,
                                      int[] ramp8888, short[] ramp565,
                                      short[] ramp4444) {
@@ -113,7 +107,7 @@
                 a += da;
             }
         }
-        
+
         private static IntBuffer makeBuffer(int[] src, int n) {
             IntBuffer dst = IntBuffer.allocate(n*n);
             for (int i = 0; i < n; i++) {
@@ -122,7 +116,7 @@
             dst.rewind();
             return dst;
         }
-        
+
         private static ShortBuffer makeBuffer(short[] src, int n) {
             ShortBuffer dst = ShortBuffer.allocate(n*n);
             for (int i = 0; i < n; i++) {
@@ -131,31 +125,31 @@
             dst.rewind();
             return dst;
         }
-        
+
         public SampleView(Context context) {
             super(context);
             setFocusable(true);
-            
+
             final int N = 100;
             int[] data8888 = new int[N];
             short[] data565 = new short[N];
             short[] data4444 = new short[N];
-            
+
             makeRamp(premultiplyColor(Color.RED), premultiplyColor(Color.GREEN),
                      N, data8888, data565, data4444);
-            
+
             mBitmap1 = Bitmap.createBitmap(N, N, Bitmap.Config.ARGB_8888);
             mBitmap2 = Bitmap.createBitmap(N, N, Bitmap.Config.RGB_565);
             mBitmap3 = Bitmap.createBitmap(N, N, Bitmap.Config.ARGB_4444);
-            
+
             mBitmap1.copyPixelsFromBuffer(makeBuffer(data8888, N));
             mBitmap2.copyPixelsFromBuffer(makeBuffer(data565, N));
             mBitmap3.copyPixelsFromBuffer(makeBuffer(data4444, N));
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
-            canvas.drawColor(0xFFCCCCCC);            
-            
+            canvas.drawColor(0xFFCCCCCC);
+
             int y = 10;
             canvas.drawBitmap(mBitmap1, 10, y, null);
             y += mBitmap1.getHeight() + 10;
@@ -165,4 +159,3 @@
         }
     }
 }
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Clipping.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Clipping.java
index cf83597..42f8be3 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Clipping.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Clipping.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
@@ -29,7 +28,7 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Paint mPaint;
         private Path mPath;
@@ -37,46 +36,46 @@
         public SampleView(Context context) {
             super(context);
             setFocusable(true);
-            
+
             mPaint = new Paint();
             mPaint.setAntiAlias(true);
             mPaint.setStrokeWidth(6);
             mPaint.setTextSize(16);
             mPaint.setTextAlign(Paint.Align.RIGHT);
-            
+
             mPath = new Path();
         }
-        
+
         private void drawScene(Canvas canvas) {
             canvas.clipRect(0, 0, 100, 100);
-            
+
             canvas.drawColor(Color.WHITE);
-            
+
             mPaint.setColor(Color.RED);
             canvas.drawLine(0, 0, 100, 100, mPaint);
-            
+
             mPaint.setColor(Color.GREEN);
             canvas.drawCircle(30, 70, 30, mPaint);
-            
+
             mPaint.setColor(Color.BLUE);
             canvas.drawText("Clipping", 100, 30, mPaint);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
-            canvas.drawColor(Color.GRAY);            
+            canvas.drawColor(Color.GRAY);
 
             canvas.save();
             canvas.translate(10, 10);
             drawScene(canvas);
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(160, 10);
             canvas.clipRect(10, 10, 90, 90);
             canvas.clipRect(30, 30, 70, 70, Region.Op.DIFFERENCE);
             drawScene(canvas);
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(10, 160);
             mPath.reset();
@@ -85,21 +84,21 @@
             canvas.clipPath(mPath, Region.Op.REPLACE);
             drawScene(canvas);
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(160, 160);
             canvas.clipRect(0, 0, 60, 60);
             canvas.clipRect(40, 40, 100, 100, Region.Op.UNION);
             drawScene(canvas);
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(10, 310);
             canvas.clipRect(0, 0, 60, 60);
             canvas.clipRect(40, 40, 100, 100, Region.Op.XOR);
             drawScene(canvas);
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(160, 310);
             canvas.clipRect(0, 0, 60, 60);
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/ColorFilters.java b/samples/ApiDemos/src/com/example/android/apis/graphics/ColorFilters.java
index 92d18ba..8eb60b5 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/ColorFilters.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/ColorFilters.java
@@ -23,18 +23,17 @@
 import android.graphics.*;
 import android.graphics.drawable.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.*;
 
 public class ColorFilters extends GraphicsActivity {
-    
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
-        
+
     }
-    
+
     private static class SampleView extends View {
         private Activity mActivity;
         private Drawable mDrawable;
@@ -52,7 +51,7 @@
             int center = (r.top + r.bottom) >> 1;
             int h = curr.getIntrinsicHeight();
             int y = center - (h >> 1);
-            
+
             curr.setBounds(x, y, x + curr.getIntrinsicWidth(), y + h);
         }
 
@@ -61,7 +60,7 @@
             mActivity = activity;
             Context context = activity;
             setFocusable(true);
-            
+
             mDrawable = context.getResources().getDrawable(R.drawable.btn_default_normal);
             mDrawable.setBounds(0, 0, 150, 48);
             mDrawable.setDither(true);
@@ -84,13 +83,13 @@
             mPaint.setAntiAlias(true);
             mPaint.setTextSize(16);
             mPaint.setTextAlign(Paint.Align.CENTER);
-            
+
             mPaint2 = new Paint(mPaint);
             mPaint2.setAlpha(64);
-            
+
             Paint.FontMetrics fm = mPaint.getFontMetrics();
             mPaintTextOffset = (fm.descent + fm.ascent) * 0.5f;
-            
+
             mColors = new int[] {
                 0,
                 0xCC0000FF,
@@ -106,10 +105,10 @@
                 PorterDuff.Mode.MULTIPLY,
             };
             mModeIndex = 0;
-            
+
             updateTitle();
         }
-        
+
         private void swapPaintColors() {
             if (mPaint.getColor() == 0xFF000000) {
                 mPaint.setColor(0xFFFFFFFF);
@@ -120,11 +119,11 @@
             }
             mPaint2.setAlpha(64);
         }
-        
+
         private void updateTitle() {
             mActivity.setTitle(mModes[mModeIndex].toString());
         }
-        
+
         private void drawSample(Canvas canvas, ColorFilter filter) {
             Rect r = mDrawable.getBounds();
             float x = (r.left + r.right) * 0.5f;
@@ -134,15 +133,15 @@
             mDrawable.draw(canvas);
             canvas.drawText("Label", x+1, y+1, mPaint2);
             canvas.drawText("Label", x, y, mPaint);
-            
+
             for (Drawable dr : mDrawables) {
                 dr.setColorFilter(filter);
                 dr.draw(canvas);
             }
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
-            canvas.drawColor(0xFFCCCCCC);            
+            canvas.drawColor(0xFFCCCCCC);
 
             canvas.translate(8, 12);
             for (int color : mColors) {
@@ -160,8 +159,6 @@
 
         @Override
         public boolean onTouchEvent(MotionEvent event) {
-            float x = event.getX();
-            float y = event.getY();
             switch (event.getAction()) {
                 case MotionEvent.ACTION_DOWN:
                     break;
@@ -181,4 +178,3 @@
         }
     }
 }
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/ColorMatrixSample.java b/samples/ApiDemos/src/com/example/android/apis/graphics/ColorMatrixSample.java
index 19a0f7f..f438e73 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/ColorMatrixSample.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/ColorMatrixSample.java
@@ -18,35 +18,31 @@
 
 import com.example.android.apis.R;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.View;
 
 public class ColorMatrixSample extends GraphicsActivity {
-    
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
-        private ColorMatrix mCM = new ColorMatrix();
         private Bitmap mBitmap;
-        private float mSaturation;
         private float mAngle;
-        
+
         public SampleView(Context context) {
             super(context);
-            
+
             mBitmap = BitmapFactory.decodeResource(context.getResources(),
                                                    R.drawable.balloons);
         }
-        
+
         private static void setTranslate(ColorMatrix cm, float dr, float dg,
                                          float db, float da) {
             cm.set(new float[] {
@@ -55,7 +51,7 @@
                    0, 0, 2, 0, db,
                    0, 0, 0, 1, da });
         }
-        
+
         private static void setContrast(ColorMatrix cm, float contrast) {
             float scale = contrast + 1.f;
                float translate = (-.5f * scale + .5f) * 255.f;
@@ -65,7 +61,7 @@
                    0, 0, scale, 0, translate,
                    0, 0, 0, 1, 0 });
         }
-        
+
         private static void setContrastTranslateOnly(ColorMatrix cm, float contrast) {
             float scale = contrast + 1.f;
                float translate = (-.5f * scale + .5f) * 255.f;
@@ -75,7 +71,7 @@
                    0, 0, 1, 0, translate,
                    0, 0, 0, 1, 0 });
         }
-        
+
         private static void setContrastScaleOnly(ColorMatrix cm, float contrast) {
             float scale = contrast + 1.f;
                float translate = (-.5f * scale + .5f) * 255.f;
@@ -85,40 +81,40 @@
                    0, 0, scale, 0, 0,
                    0, 0, 0, 1, 0 });
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             Paint paint = mPaint;
             float x = 20;
             float y = 20;
-            
+
             canvas.drawColor(Color.WHITE);
-            
+
             paint.setColorFilter(null);
             canvas.drawBitmap(mBitmap, x, y, paint);
-            
+
             ColorMatrix cm = new ColorMatrix();
-            
+
             mAngle += 2;
             if (mAngle > 180) {
                 mAngle = 0;
             }
-            
+
             //convert our animated angle [-180...180] to a contrast value of [-1..1]
             float contrast = mAngle / 180.f;
-            
+
             setContrast(cm, contrast);
             paint.setColorFilter(new ColorMatrixColorFilter(cm));
             canvas.drawBitmap(mBitmap, x + mBitmap.getWidth() + 10, y, paint);
-            
+
             setContrastScaleOnly(cm, contrast);
             paint.setColorFilter(new ColorMatrixColorFilter(cm));
             canvas.drawBitmap(mBitmap, x, y + mBitmap.getHeight() + 10, paint);
-            
+
             setContrastTranslateOnly(cm, contrast);
             paint.setColorFilter(new ColorMatrixColorFilter(cm));
             canvas.drawBitmap(mBitmap, x, y + 2*(mBitmap.getHeight() + 10),
                               paint);
-            
+
             invalidate();
         }
     }
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/ColorPickerDialog.java b/samples/ApiDemos/src/com/example/android/apis/graphics/ColorPickerDialog.java
index 7588180..1c7125f 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/ColorPickerDialog.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/ColorPickerDialog.java
@@ -37,7 +37,7 @@
         private Paint mCenterPaint;
         private final int[] mColors;
         private OnColorChangedListener mListener;
-        
+
         ColorPickerView(Context c, OnColorChangedListener l, int color) {
             super(c);
             mListener = l;
@@ -46,33 +46,33 @@
                 0xFFFFFF00, 0xFFFF0000
             };
             Shader s = new SweepGradient(0, 0, mColors, null);
-            
+
             mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
             mPaint.setShader(s);
             mPaint.setStyle(Paint.Style.STROKE);
             mPaint.setStrokeWidth(32);
-            
+
             mCenterPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
             mCenterPaint.setColor(color);
             mCenterPaint.setStrokeWidth(5);
         }
-        
+
         private boolean mTrackingCenter;
         private boolean mHighlightCenter;
 
-        @Override 
+        @Override
         protected void onDraw(Canvas canvas) {
             float r = CENTER_X - mPaint.getStrokeWidth()*0.5f;
-            
+
             canvas.translate(CENTER_X, CENTER_X);
-            
-            canvas.drawOval(new RectF(-r, -r, r, r), mPaint);            
+
+            canvas.drawOval(new RectF(-r, -r, r, r), mPaint);
             canvas.drawCircle(0, 0, CENTER_RADIUS, mCenterPaint);
-            
+
             if (mTrackingCenter) {
                 int c = mCenterPaint.getColor();
                 mCenterPaint.setStyle(Paint.Style.STROKE);
-                
+
                 if (mHighlightCenter) {
                     mCenterPaint.setAlpha(0xFF);
                 } else {
@@ -81,17 +81,17 @@
                 canvas.drawCircle(0, 0,
                                   CENTER_RADIUS + mCenterPaint.getStrokeWidth(),
                                   mCenterPaint);
-                
+
                 mCenterPaint.setStyle(Paint.Style.FILL);
                 mCenterPaint.setColor(c);
             }
         }
-        
+
         @Override
         protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
             setMeasuredDimension(CENTER_X*2, CENTER_Y*2);
         }
-        
+
         private static final int CENTER_X = 100;
         private static final int CENTER_Y = 100;
         private static final int CENTER_RADIUS = 32;
@@ -108,11 +108,11 @@
             }
             return n;
         }
-        
+
         private int ave(int s, int d, float p) {
             return s + java.lang.Math.round(p * (d - s));
         }
-        
+
         private int interpColor(int colors[], float unit) {
             if (unit <= 0) {
                 return colors[0];
@@ -120,7 +120,7 @@
             if (unit >= 1) {
                 return colors[colors.length - 1];
             }
-            
+
             float p = unit * (colors.length - 1);
             int i = (int)p;
             p -= i;
@@ -132,16 +132,16 @@
             int r = ave(Color.red(c0), Color.red(c1), p);
             int g = ave(Color.green(c0), Color.green(c1), p);
             int b = ave(Color.blue(c0), Color.blue(c1), p);
-            
+
             return Color.argb(a, r, g, b);
         }
-        
+
         private int rotateColor(int color, float rad) {
             float deg = rad * 180 / 3.1415927f;
             int r = Color.red(color);
             int g = Color.green(color);
             int b = Color.blue(color);
-            
+
             ColorMatrix cm = new ColorMatrix();
             ColorMatrix tmp = new ColorMatrix();
 
@@ -150,17 +150,17 @@
             cm.postConcat(tmp);
             tmp.setYUV2RGB();
             cm.postConcat(tmp);
-            
+
             final float[] a = cm.getArray();
 
             int ir = floatToByte(a[0] * r +  a[1] * g +  a[2] * b);
             int ig = floatToByte(a[5] * r +  a[6] * g +  a[7] * b);
             int ib = floatToByte(a[10] * r + a[11] * g + a[12] * b);
-            
+
             return Color.argb(Color.alpha(color), pinToByte(ir),
                               pinToByte(ig), pinToByte(ib));
         }
-        
+
         private static final float PI = 3.1415926f;
 
         @Override
@@ -168,7 +168,7 @@
             float x = event.getX() - CENTER_X;
             float y = event.getY() - CENTER_Y;
             boolean inCenter = java.lang.Math.sqrt(x*x + y*y) <= CENTER_RADIUS;
-            
+
             switch (event.getAction()) {
                 case MotionEvent.ACTION_DOWN:
                     mTrackingCenter = inCenter;
@@ -212,7 +212,7 @@
                              OnColorChangedListener listener,
                              int initialColor) {
         super(context);
-        
+
         mListener = listener;
         mInitialColor = initialColor;
     }
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Compass.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Compass.java
index d3b0981..85471d9 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Compass.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Compass.java
@@ -35,10 +35,10 @@
     private Sensor mSensor;
     private SampleView mView;
     private float[] mValues;
-    
+
     private final SensorEventListener mListener = new SensorEventListener() {
         public void onSensorChanged(SensorEvent event) {
-            if (Config.LOGD) Log.d(TAG,
+            if (Config.DEBUG) Log.d(TAG,
                     "sensorChanged (" + event.values[0] + ", " + event.values[1] + ", " + event.values[2] + ")");
             mValues = event.values;
             if (mView != null) {
@@ -62,17 +62,17 @@
     @Override
     protected void onResume()
     {
-        if (Config.LOGD) Log.d(TAG, "onResume");
+        if (Config.DEBUG) Log.d(TAG, "onResume");
         super.onResume();
 
         mSensorManager.registerListener(mListener, mSensor,
                 SensorManager.SENSOR_DELAY_GAME);
     }
-    
+
     @Override
     protected void onStop()
     {
-        if (Config.LOGD) Log.d(TAG, "onStop");
+        if (Config.DEBUG) Log.d(TAG, "onStop");
         mSensorManager.unregisterListener(mListener);
         super.onStop();
     }
@@ -81,7 +81,6 @@
         private Paint   mPaint = new Paint();
         private Path    mPath = new Path();
         private boolean mAnimate;
-        private long    mNextTime;
 
         public SampleView(Context context) {
             super(context);
@@ -93,12 +92,12 @@
             mPath.lineTo(20, 60);
             mPath.close();
         }
-    
+
         @Override protected void onDraw(Canvas canvas) {
             Paint paint = mPaint;
 
             canvas.drawColor(Color.WHITE);
-            
+
             paint.setAntiAlias(true);
             paint.setColor(Color.BLACK);
             paint.setStyle(Paint.Style.FILL);
@@ -109,23 +108,24 @@
             int cy = h / 2;
 
             canvas.translate(cx, cy);
-            if (mValues != null) {            
+            if (mValues != null) {
                 canvas.rotate(-mValues[0]);
             }
             canvas.drawPath(mPath, mPaint);
         }
-    
+
         @Override
         protected void onAttachedToWindow() {
             mAnimate = true;
+            if (Config.DEBUG) Log.d(TAG, "onAttachedToWindow. mAnimate=" + mAnimate);
             super.onAttachedToWindow();
         }
-        
+
         @Override
         protected void onDetachedFromWindow() {
             mAnimate = false;
+            if (Config.DEBUG) Log.d(TAG, "onDetachedFromWindow. mAnimate=" + mAnimate);
             super.onDetachedFromWindow();
         }
     }
 }
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/CreateBitmap.java b/samples/ApiDemos/src/com/example/android/apis/graphics/CreateBitmap.java
index e3e5d9a..61fe9d5 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/CreateBitmap.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/CreateBitmap.java
@@ -16,13 +16,9 @@
 
 package com.example.android.apis.graphics;
 
-import com.example.android.apis.R;
-
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.*;
 
 import java.io.ByteArrayOutputStream;
@@ -34,11 +30,11 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static final int WIDTH = 50;
     private static final int HEIGHT = 50;
     private static final int STRIDE = 64;   // must be >= WIDTH
-    
+
     private static int[] createColors() {
         int[] colors = new int[STRIDE * HEIGHT];
         for (int y = 0; y < HEIGHT; y++) {
@@ -52,18 +48,18 @@
         }
         return colors;
     }
-        
+
     private static class SampleView extends View {
         private Bitmap[] mBitmaps;
         private Bitmap[] mJPEG;
         private Bitmap[] mPNG;
         private int[]    mColors;
         private Paint    mPaint;
-        
+
         private static Bitmap codec(Bitmap src, Bitmap.CompressFormat format,
                                     int quality) {
             ByteArrayOutputStream os = new ByteArrayOutputStream();
-            src.compress(format, quality, os);            
+            src.compress(format, quality, os);
 
             byte[] array = os.toByteArray();
             return BitmapFactory.decodeByteArray(array, 0, array.length);
@@ -72,7 +68,7 @@
         public SampleView(Context context) {
             super(context);
             setFocusable(true);
-            
+
             mColors = createColors();
             int[] colors = mColors;
 
@@ -84,7 +80,7 @@
                                               Bitmap.Config.RGB_565);
             mBitmaps[2] = Bitmap.createBitmap(colors, 0, STRIDE, WIDTH, HEIGHT,
                                               Bitmap.Config.ARGB_4444);
-            
+
             // these three will have their colors set later
             mBitmaps[3] = Bitmap.createBitmap(WIDTH, HEIGHT,
                                               Bitmap.Config.ARGB_8888);
@@ -95,10 +91,10 @@
             for (int i = 3; i <= 5; i++) {
                 mBitmaps[i].setPixels(colors, 0, STRIDE, 0, 0, WIDTH, HEIGHT);
             }
-            
+
             mPaint = new Paint();
             mPaint.setDither(true);
-            
+
             // now encode/decode using JPEG and PNG
             mJPEG = new Bitmap[mBitmaps.length];
             mPNG = new Bitmap[mBitmaps.length];
@@ -107,7 +103,7 @@
                 mPNG[i] = codec(mBitmaps[i], Bitmap.CompressFormat.PNG, 0);
             }
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             canvas.drawColor(Color.WHITE);
 
@@ -117,7 +113,7 @@
                 canvas.drawBitmap(mPNG[i], 160, 0, null);
                 canvas.translate(0, mBitmaps[i].getHeight());
             }
-            
+
             // draw the color array directly, w/o craeting a bitmap object
             canvas.drawBitmap(mColors, 0, STRIDE, 0, 0, WIDTH, HEIGHT,
                               true, null);
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Cube.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Cube.java
index bb154eb..715e175 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Cube.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Cube.java
@@ -88,10 +88,10 @@
 
     public void draw(GL10 gl)
     {
-        gl.glFrontFace(gl.GL_CW);
-        gl.glVertexPointer(3, gl.GL_FIXED, 0, mVertexBuffer);
-        gl.glColorPointer(4, gl.GL_FIXED, 0, mColorBuffer);
-        gl.glDrawElements(gl.GL_TRIANGLES, 36, gl.GL_UNSIGNED_BYTE, mIndexBuffer);
+        gl.glFrontFace(GL10.GL_CW);
+        gl.glVertexPointer(3, GL10.GL_FIXED, 0, mVertexBuffer);
+        gl.glColorPointer(4, GL10.GL_FIXED, 0, mColorBuffer);
+        gl.glDrawElements(GL10.GL_TRIANGLES, 36, GL10.GL_UNSIGNED_BYTE, mIndexBuffer);
     }
 
     private IntBuffer   mVertexBuffer;
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/CubeRenderer.java b/samples/ApiDemos/src/com/example/android/apis/graphics/CubeRenderer.java
index 0f15f91..ac0ae27 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/CubeRenderer.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/CubeRenderer.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import javax.microedition.khronos.egl.EGL10;
 import javax.microedition.khronos.egl.EGLConfig;
 import javax.microedition.khronos.opengles.GL10;
 
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 8c5c93a..0288ad1 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/DensityActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/DensityActivity.java
@@ -47,7 +47,7 @@
 
         final LayoutInflater li = (LayoutInflater)getSystemService(
                 LAYOUT_INFLATER_SERVICE);
-        
+
         this.setTitle(R.string.density_title);
         LinearLayout root = new LinearLayout(this);
         root.setOrientation(LinearLayout.VERTICAL);
@@ -76,11 +76,11 @@
         layout = (LinearLayout)li.inflate(R.layout.density_image_views, null);
         addLabelToRoot(root, "Inflated layout");
         addChildToRoot(root, layout);
-        
+
         layout = (LinearLayout)li.inflate(R.layout.density_styled_image_views, null);
         addLabelToRoot(root, "Inflated styled layout");
         addChildToRoot(root, layout);
-        
+
         layout = new LinearLayout(this);
         addCanvasBitmap(layout, R.drawable.logo120dpi, true);
         addCanvasBitmap(layout, R.drawable.logo160dpi, true);
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/DrawPoints.java b/samples/ApiDemos/src/com/example/android/apis/graphics/DrawPoints.java
index cbe6373..21eba0d 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/DrawPoints.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/DrawPoints.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
@@ -29,7 +28,7 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Paint   mPaint = new Paint();
         private float[] mPts;
@@ -38,11 +37,11 @@
         private static final int SEGS = 32;
         private static final int X = 0;
         private static final int Y = 1;
-        
+
         private void buildPoints() {
             final int ptCount = (SEGS + 1) * 2;
             mPts = new float[ptCount * 2];
-            
+
             float value = 0;
             final float delta = SIZE / SEGS;
             for (int i = 0; i <= SEGS; i++) {
@@ -53,16 +52,16 @@
                 value += delta;
             }
         }
-    
+
         public SampleView(Context context) {
             super(context);
-            
+
             buildPoints();
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             Paint paint = mPaint;
-            
+
             canvas.translate(10, 10);
 
             canvas.drawColor(Color.WHITE);
@@ -70,7 +69,7 @@
             paint.setColor(Color.RED);
             paint.setStrokeWidth(0);
             canvas.drawLines(mPts, paint);
-            
+
             paint.setColor(Color.BLUE);
             paint.setStrokeWidth(3);
             canvas.drawPoints(mPts, paint);
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.java b/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.java
index 867da4c..fcfd28f 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/FingerPaint.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
@@ -26,7 +25,7 @@
 import android.view.View;
 
 public class FingerPaint extends GraphicsActivity
-        implements ColorPickerDialog.OnColorChangedListener {    
+        implements ColorPickerDialog.OnColorChangedListener {
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -41,34 +40,34 @@
         mPaint.setStrokeJoin(Paint.Join.ROUND);
         mPaint.setStrokeCap(Paint.Cap.ROUND);
         mPaint.setStrokeWidth(12);
-        
+
         mEmboss = new EmbossMaskFilter(new float[] { 1, 1, 1 },
                                        0.4f, 6, 3.5f);
 
         mBlur = new BlurMaskFilter(8, BlurMaskFilter.Blur.NORMAL);
     }
-    
+
     private Paint       mPaint;
     private MaskFilter  mEmboss;
     private MaskFilter  mBlur;
-    
+
     public void colorChanged(int color) {
         mPaint.setColor(color);
     }
 
     public class MyView extends View {
-        
+
         private static final float MINP = 0.25f;
         private static final float MAXP = 0.75f;
-        
+
         private Bitmap  mBitmap;
         private Canvas  mCanvas;
         private Path    mPath;
         private Paint   mBitmapPaint;
-        
+
         public MyView(Context c) {
             super(c);
-            
+
             mBitmap = Bitmap.createBitmap(320, 480, Bitmap.Config.ARGB_8888);
             mCanvas = new Canvas(mBitmap);
             mPath = new Path();
@@ -79,19 +78,19 @@
         protected void onSizeChanged(int w, int h, int oldw, int oldh) {
             super.onSizeChanged(w, h, oldw, oldh);
         }
-        
+
         @Override
         protected void onDraw(Canvas canvas) {
             canvas.drawColor(0xFFAAAAAA);
-            
+
             canvas.drawBitmap(mBitmap, 0, 0, mBitmapPaint);
-            
+
             canvas.drawPath(mPath, mPaint);
         }
-        
+
         private float mX, mY;
         private static final float TOUCH_TOLERANCE = 4;
-        
+
         private void touch_start(float x, float y) {
             mPath.reset();
             mPath.moveTo(x, y);
@@ -114,12 +113,12 @@
             // kill this so we don't double draw
             mPath.reset();
         }
-        
+
         @Override
         public boolean onTouchEvent(MotionEvent event) {
             float x = event.getX();
             float y = event.getY();
-            
+
             switch (event.getAction()) {
                 case MotionEvent.ACTION_DOWN:
                     touch_start(x, y);
@@ -137,7 +136,7 @@
             return true;
         }
     }
-    
+
     private static final int COLOR_MENU_ID = Menu.FIRST;
     private static final int EMBOSS_MENU_ID = Menu.FIRST + 1;
     private static final int BLUR_MENU_ID = Menu.FIRST + 2;
@@ -147,7 +146,7 @@
     @Override
     public boolean onCreateOptionsMenu(Menu menu) {
         super.onCreateOptionsMenu(menu);
-        
+
         menu.add(0, COLOR_MENU_ID, 0, "Color").setShortcut('3', 'c');
         menu.add(0, EMBOSS_MENU_ID, 0, "Emboss").setShortcut('4', 's');
         menu.add(0, BLUR_MENU_ID, 0, "Blur").setShortcut('5', 'z');
@@ -164,13 +163,13 @@
         *****/
         return true;
     }
-    
+
     @Override
     public boolean onPrepareOptionsMenu(Menu menu) {
         super.onPrepareOptionsMenu(menu);
         return true;
     }
-    
+
     @Override
     public boolean onOptionsItemSelected(MenuItem item) {
         mPaint.setXfermode(null);
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/GradientDrawable1.java b/samples/ApiDemos/src/com/example/android/apis/graphics/GradientDrawable1.java
index eb6d47d..fa7a6b7 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/GradientDrawable1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/GradientDrawable1.java
@@ -20,7 +20,6 @@
 // class is in a sub-package.
 import com.example.android.apis.R;
 
-import android.app.Activity;
 import android.os.Bundle;
 
 public class GradientDrawable1 extends GraphicsActivity {
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/GraphicsActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/GraphicsActivity.java
index 023c0d7..69682d4 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/GraphicsActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/GraphicsActivity.java
@@ -20,9 +20,11 @@
 import android.os.Bundle;
 import android.view.View;
 import android.view.ViewGroup;
-import android.view.Window;
 
 class GraphicsActivity extends Activity {
+    // set to true to test Picture
+    private static final boolean TEST_PICTURE = false;
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -30,13 +32,12 @@
 
     @Override
     public void setContentView(View view) {
-        if (false) { // set to true to test Picture
+        if (TEST_PICTURE) {
             ViewGroup vg = new PictureLayout(this);
             vg.addView(view);
             view = vg;
         }
-        
+
         super.setContentView(view);
     }
-}
-
+}
\ No newline at end of file
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Layers.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Layers.java
index d9f5db0..7e2a694 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Layers.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Layers.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
@@ -29,7 +28,7 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private static final int LAYER_FLAGS = Canvas.MATRIX_SAVE_FLAG |
                                             Canvas.CLIP_SAVE_FLAG |
@@ -42,23 +41,23 @@
         public SampleView(Context context) {
             super(context);
             setFocusable(true);
-            
+
             mPaint = new Paint();
             mPaint.setAntiAlias(true);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
-            canvas.drawColor(Color.WHITE);            
-            
+            canvas.drawColor(Color.WHITE);
+
             canvas.translate(10, 10);
-            
+
             canvas.saveLayerAlpha(0, 0, 200, 200, 0x88, LAYER_FLAGS);
-            
+
             mPaint.setColor(Color.RED);
             canvas.drawCircle(75, 75, 75, mPaint);
             mPaint.setColor(Color.BLUE);
             canvas.drawCircle(125, 125, 75, mPaint);
-            
+
             canvas.restore();
         }
     }
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/MeasureText.java b/samples/ApiDemos/src/com/example/android/apis/graphics/MeasureText.java
index e159efe..c2d433e 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/MeasureText.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/MeasureText.java
@@ -16,13 +16,9 @@
 
 package com.example.android.apis.graphics;
 
-import com.example.android.apis.R;
-
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.*;
 
 public class MeasureText extends GraphicsActivity {
@@ -32,11 +28,11 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static final int WIDTH = 50;
     private static final int HEIGHT = 50;
     private static final int STRIDE = 64;   // must be >= WIDTH
-    
+
     private static int[] createColors() {
         int[] colors = new int[STRIDE * HEIGHT];
         for (int y = 0; y < HEIGHT; y++) {
@@ -50,16 +46,16 @@
         }
         return colors;
     }
-    
+
     private static class SampleView extends View {
         private Paint   mPaint;
         private float   mOriginX = 10;
         private float   mOriginY = 80;
-        
+
         public SampleView(Context context) {
             super(context);
             setFocusable(true);
-            
+
             mPaint = new Paint();
             mPaint.setAntiAlias(true);
             mPaint.setStrokeWidth(5);
@@ -68,22 +64,22 @@
             mPaint.setTypeface(Typeface.create(Typeface.SERIF,
                                                Typeface.ITALIC));
         }
-        
+
         private void showText(Canvas canvas, String text, Paint.Align align) {
          //   mPaint.setTextAlign(align);
-            
+
             Rect    bounds = new Rect();
             float[] widths = new float[text.length()];
 
             int count = mPaint.getTextWidths(text, 0, text.length(), widths);
             float w = mPaint.measureText(text, 0, text.length());
             mPaint.getTextBounds(text, 0, text.length(), bounds);
-            
+
             mPaint.setColor(0xFF88FF88);
             canvas.drawRect(bounds, mPaint);
             mPaint.setColor(Color.BLACK);
             canvas.drawText(text, 0, 0, mPaint);
-            
+
             float[] pts = new float[2 + count*2];
             float x = 0;
             float y = 0;
@@ -100,12 +96,12 @@
             mPaint.setStrokeWidth(5);
             canvas.drawPoints(pts, 0, (count + 1) << 1, mPaint);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             canvas.drawColor(Color.WHITE);
-            
+
             canvas.translate(mOriginX, mOriginY);
-            
+
             showText(canvas, "Measure", Paint.Align.LEFT);
             canvas.translate(0, 80);
             showText(canvas, "wiggy!", Paint.Align.CENTER);
@@ -114,4 +110,3 @@
         }
     }
 }
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/PathEffects.java b/samples/ApiDemos/src/com/example/android/apis/graphics/PathEffects.java
index 80ddf38..2894fa9 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/PathEffects.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/PathEffects.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
@@ -30,7 +29,7 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Paint mPaint;
         private Path mPath;
@@ -41,7 +40,7 @@
         private static PathEffect makeDash(float phase) {
             return new DashPathEffect(new float[] { 15, 5, 8, 5 }, phase);
         }
-        
+
         private static void makeEffects(PathEffect[] e, float phase) {
             e[0] = null;     // no effect
             e[1] = new CornerPathEffect(10);
@@ -51,7 +50,7 @@
             e[4] = new ComposePathEffect(e[2], e[1]);
             e[5] = new ComposePathEffect(e[3], e[1]);
         }
-        
+
         public SampleView(Context context) {
             super(context);
             setFocusable(true);
@@ -60,23 +59,23 @@
             mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
             mPaint.setStyle(Paint.Style.STROKE);
             mPaint.setStrokeWidth(6);
-            
+
             mPath = makeFollowPath();
-            
+
             mEffects = new PathEffect[6];
-            
+
             mColors = new int[] { Color.BLACK, Color.RED, Color.BLUE,
                                   Color.GREEN, Color.MAGENTA, Color.BLACK
                                 };
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             canvas.drawColor(Color.WHITE);
-            
+
             RectF bounds = new RectF();
             mPath.computeBounds(bounds, false);
             canvas.translate(10 - bounds.left, 10 - bounds.top);
-            
+
             makeEffects(mEffects, mPhase);
             mPhase += 1;
             invalidate();
@@ -88,7 +87,7 @@
                 canvas.translate(0, 28);
             }
         }
-        
+
         @Override public boolean onKeyDown(int keyCode, KeyEvent event) {
             switch (keyCode) {
                 case KeyEvent.KEYCODE_DPAD_CENTER:
@@ -106,7 +105,7 @@
             }
             return p;
         }
-        
+
         private static Path makePathDash() {
             Path p = new Path();
             p.moveTo(4, 0);
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/PathFillTypes.java b/samples/ApiDemos/src/com/example/android/apis/graphics/PathFillTypes.java
index 78dba26..10cfc49 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/PathFillTypes.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/PathFillTypes.java
@@ -20,11 +20,9 @@
 // class is in a sub-package.
 //import com.example.android.apis.R;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.View;
 
 public class PathFillTypes extends GraphicsActivity {
@@ -34,7 +32,7 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
         private Path mPath;
@@ -48,7 +46,7 @@
             mPath.addCircle(40, 40, 45, Path.Direction.CCW);
             mPath.addCircle(80, 80, 45, Path.Direction.CCW);
         }
-        
+
         private void showPath(Canvas canvas, int x, int y, Path.FillType ft,
                               Paint paint) {
             canvas.save();
@@ -59,14 +57,14 @@
             canvas.drawPath(mPath, paint);
             canvas.restore();
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             Paint paint = mPaint;
 
             canvas.drawColor(0xFFCCCCCC);
-            
+
             canvas.translate(20, 20);
-            
+
             paint.setAntiAlias(true);
 
             showPath(canvas, 0, 0, Path.FillType.WINDING, paint);
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Patterns.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Patterns.java
index d2a51ff..6b6d8e1 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Patterns.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Patterns.java
@@ -16,11 +16,9 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.MotionEvent;
 import android.view.*;
 
@@ -31,7 +29,7 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static Bitmap makeBitmap1() {
         Bitmap bm = Bitmap.createBitmap(40, 40, Bitmap.Config.RGB_565);
         Canvas c = new Canvas(bm);
@@ -41,7 +39,7 @@
         c.drawRect(5, 5, 35, 35, p);
         return bm;
     }
-    
+
     private static Bitmap makeBitmap2() {
         Bitmap bm = Bitmap.createBitmap(64, 64, Bitmap.Config.ARGB_8888);
         Canvas c = new Canvas(bm);
@@ -51,13 +49,13 @@
         c.drawCircle(32, 32, 27, p);
         return bm;
     }
-    
+
     private static class SampleView extends View {
         private final Shader mShader1;
         private final Shader mShader2;
         private final Paint mPaint;
         private final DrawFilter mFastDF;
-        
+
         private float mTouchStartX;
         private float mTouchStartY;
         private float mTouchCurrX;
@@ -72,25 +70,25 @@
             mFastDF = new PaintFlagsDrawFilter(Paint.FILTER_BITMAP_FLAG |
                                                Paint.DITHER_FLAG,
                                                0);
-    
+
             mShader1 = new BitmapShader(makeBitmap1(), Shader.TileMode.REPEAT,
                                         Shader.TileMode.REPEAT);
             mShader2 = new BitmapShader(makeBitmap2(), Shader.TileMode.REPEAT,
                                         Shader.TileMode.REPEAT);
-            
+
             Matrix m = new Matrix();
             m.setRotate(30);
             mShader2.setLocalMatrix(m);
-            
+
             mPaint = new Paint(Paint.FILTER_BITMAP_FLAG);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             canvas.setDrawFilter(mDF);
 
             mPaint.setShader(mShader1);
             canvas.drawPaint(mPaint);
-            
+
             canvas.translate(mTouchCurrX - mTouchStartX,
                              mTouchCurrY - mTouchStartY);
 
@@ -102,7 +100,7 @@
         public boolean onTouchEvent(MotionEvent event) {
             float x = event.getX();
             float y = event.getY();
-            
+
             switch (event.getAction()) {
                 case MotionEvent.ACTION_DOWN:
                     mTouchStartX = mTouchCurrX = x;
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 cfa3c29..c1d22a8 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/PictureLayout.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/PictureLayout.java
@@ -26,7 +26,6 @@
 import android.view.ViewGroup;
 import android.view.ViewParent;
 
-
 public class PictureLayout extends ViewGroup {
     private final Picture mPicture = new Picture();
 
@@ -36,7 +35,7 @@
 
     public PictureLayout(Context context, AttributeSet attrs) {
         super(context, attrs);
-    }    
+    }
 
     @Override
     public void addView(View child) {
@@ -105,7 +104,7 @@
         setMeasuredDimension(resolveSize(maxWidth, widthMeasureSpec),
                 resolveSize(maxHeight, heightMeasureSpec));
     }
-    
+
     private void drawPict(Canvas canvas, int x, int y, int w, int h,
                           float sx, float sy) {
         canvas.save();
@@ -121,10 +120,10 @@
     protected void dispatchDraw(Canvas canvas) {
         super.dispatchDraw(mPicture.beginRecording(getWidth(), getHeight()));
         mPicture.endRecording();
-        
+
         int x = getWidth()/2;
         int y = getHeight()/2;
-        
+
         if (false) {
             canvas.drawPicture(mPicture);
         } else {
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Pictures.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Pictures.java
index 1bd0a8c..61842dd 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Pictures.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Pictures.java
@@ -16,13 +16,11 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.PictureDrawable;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.View;
 
 import java.io.*;
@@ -34,17 +32,17 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Picture mPicture;
         private Drawable mDrawable;
 
         static void drawSomething(Canvas canvas) {
             Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
-            
+
             p.setColor(0x88FF0000);
             canvas.drawCircle(50, 50, 40, p);
-            
+
             p.setColor(Color.GREEN);
             p.setTextSize(30);
             canvas.drawText("Pictures", 60, 60, p);
@@ -58,20 +56,20 @@
             mPicture = new Picture();
             drawSomething(mPicture.beginRecording(200, 100));
             mPicture.endRecording();
-            
+
             mDrawable = new PictureDrawable(mPicture);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             canvas.drawColor(Color.WHITE);
 
             canvas.drawPicture(mPicture);
-            
+
             canvas.drawPicture(mPicture, new RectF(0, 100, getWidth(), 200));
-            
+
             mDrawable.setBounds(0, 200, getWidth(), 300);
             mDrawable.draw(canvas);
-            
+
             ByteArrayOutputStream os = new ByteArrayOutputStream();
             mPicture.writeToStream(os);
             InputStream is = new ByteArrayInputStream(os.toByteArray());
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/PolyToPoly.java b/samples/ApiDemos/src/com/example/android/apis/graphics/PolyToPoly.java
index 15d92de..a1f1ed4 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/PolyToPoly.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/PolyToPoly.java
@@ -20,7 +20,6 @@
 // class is in a sub-package.
 //import com.example.android.apis.R;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
@@ -33,7 +32,7 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Paint   mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
         private Matrix  mMatrix = new Matrix();
@@ -43,13 +42,13 @@
             canvas.save();
             mMatrix.setPolyToPoly(src, 0, dst, 0, src.length >> 1);
             canvas.concat(mMatrix);
-            
+
             mPaint.setColor(Color.GRAY);
             mPaint.setStyle(Paint.Style.STROKE);
             canvas.drawRect(0, 0, 64, 64, mPaint);
             canvas.drawLine(0, 0, 64, 64, mPaint);
             canvas.drawLine(0, 64, 64, 0, mPaint);
-            
+
             mPaint.setColor(Color.RED);
             mPaint.setStyle(Paint.Style.FILL);
             // how to draw the text center on our square
@@ -58,7 +57,7 @@
             // centering in Y, we need to measure ascent/descent first
             float y = 64/2 - (mFontMetrics.ascent + mFontMetrics.descent)/2;
             canvas.drawText(src.length/2 + "", x, y, mPaint);
-            
+
             canvas.restore();
         }
 
@@ -72,10 +71,9 @@
             mPaint.setTextAlign(Paint.Align.CENTER);
             mFontMetrics = mPaint.getFontMetrics();
         }
-        
-        @Override protected void onDraw(Canvas canvas) {
-            Paint paint = mPaint;
 
+        @Override
+        protected void onDraw(Canvas canvas) {
             canvas.drawColor(Color.WHITE);
 
             canvas.save();
@@ -83,7 +81,7 @@
             // translate (1 point)
             doDraw(canvas, new float[] { 0, 0 }, new float[] { 5, 5 });
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(160, 10);
             // rotate/uniform-scale (2 points)
@@ -107,4 +105,3 @@
         }
     }
 }
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/ProxyDrawable.java b/samples/ApiDemos/src/com/example/android/apis/graphics/ProxyDrawable.java
index d264134..635132e 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/ProxyDrawable.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/ProxyDrawable.java
@@ -22,18 +22,18 @@
 import android.graphics.drawable.Drawable;
 
 public class ProxyDrawable extends Drawable {
-    
+
     private Drawable mProxy;
     private boolean mMutated;
 
     public ProxyDrawable(Drawable target) {
         mProxy = target;
     }
-    
+
     public Drawable getProxy() {
         return mProxy;
     }
-    
+
     public void setProxy(Drawable proxy) {
         if (proxy != this) {
             mProxy = proxy;
@@ -46,43 +46,43 @@
             mProxy.draw(canvas);
         }
     }
-    
+
     @Override
     public int getIntrinsicWidth() {
         return mProxy != null ? mProxy.getIntrinsicWidth() : -1;
     }
-    
+
     @Override
     public int getIntrinsicHeight() {
         return mProxy != null ? mProxy.getIntrinsicHeight() : -1;
     }
-    
+
     @Override
     public int getOpacity() {
         return mProxy != null ? mProxy.getOpacity() : PixelFormat.TRANSPARENT;
     }
-    
+
     @Override
     public void setFilterBitmap(boolean filter) {
         if (mProxy != null) {
             mProxy.setFilterBitmap(filter);
         }
     }
-    
+
     @Override
     public void setDither(boolean dither) {
         if (mProxy != null) {
             mProxy.setDither(dither);
         }
     }
-    
+
     @Override
     public void setColorFilter(ColorFilter colorFilter) {
         if (mProxy != null) {
             mProxy.setColorFilter(colorFilter);
         }
     }
-    
+
     @Override
     public void setAlpha(int alpha) {
         if (mProxy != null) {
@@ -99,4 +99,4 @@
         return this;
     }
 }
-    
+
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Regions.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Regions.java
index 833274b..fc0aa08 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Regions.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Regions.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
@@ -29,7 +28,7 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private final Paint mPaint = new Paint();
         private final Rect  mRect1 = new Rect();
@@ -38,11 +37,11 @@
         public SampleView(Context context) {
             super(context);
             setFocusable(true);
-            
+
             mPaint.setAntiAlias(true);
             mPaint.setTextSize(16);
             mPaint.setTextAlign(Paint.Align.CENTER);
-            
+
             mRect1.set(10, 10, 100, 80);
             mRect2.set(50, 50, 130, 110);
         }
@@ -55,25 +54,25 @@
             mPaint.setColor(Color.BLUE);
             mPaint.setAlpha(alpha);
             drawCentered(canvas, mRect2, mPaint);
-            
+
             // restore style
             mPaint.setStyle(Paint.Style.FILL);
         }
-        
+
         private void drawRgn(Canvas canvas, int color, String str, Region.Op op) {
             if (str != null) {
                 mPaint.setColor(Color.BLACK);
                 canvas.drawText(str, 80, 24, mPaint);
             }
-            
+
             Region rgn = new Region();
             rgn.set(mRect1);
             rgn.op(mRect2, op);
-            
+
             mPaint.setColor(color);
             RegionIterator iter = new RegionIterator(rgn);
             Rect r = new Rect();
-            
+
             canvas.translate(0, 30);
             mPaint.setColor(color);
             while (iter.next(r)) {
@@ -81,7 +80,7 @@
             }
             drawOriginalRects(canvas, 0x80);
         }
-        
+
         private static void drawCentered(Canvas c, Rect r, Paint p) {
             float inset = p.getStrokeWidth() * 0.5f;
             if (inset == 0) {   // catch hairlines
@@ -90,32 +89,33 @@
             c.drawRect(r.left + inset, r.top + inset,
                        r.right - inset, r.bottom - inset, p);
         }
-        
-        @Override protected void onDraw(Canvas canvas) {
-            canvas.drawColor(Color.GRAY);            
+
+        @Override
+        protected void onDraw(Canvas canvas) {
+            canvas.drawColor(Color.GRAY);
 
             canvas.save();
             canvas.translate(80, 5);
             drawOriginalRects(canvas, 0xFF);
             canvas.restore();
-            
+
             mPaint.setStyle(Paint.Style.FILL);
-            
+
             canvas.save();
             canvas.translate(0, 140);
             drawRgn(canvas, Color.RED, "Union", Region.Op.UNION);
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(0, 280);
             drawRgn(canvas, Color.BLUE, "Xor", Region.Op.XOR);
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(160, 140);
             drawRgn(canvas, Color.GREEN, "Difference", Region.Op.DIFFERENCE);
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(160, 280);
             drawRgn(canvas, Color.WHITE, "Intersect", Region.Op.INTERSECT);
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/RoundRects.java b/samples/ApiDemos/src/com/example/android/apis/graphics/RoundRects.java
index b0ff035..74c2406 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/RoundRects.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/RoundRects.java
@@ -16,14 +16,10 @@
 
 package com.example.android.apis.graphics;
 
-import com.example.android.apis.R;
-
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.graphics.drawable.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.*;
 
 public class RoundRects extends GraphicsActivity {
@@ -33,7 +29,7 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Path    mPath;
         private Paint   mPaint;
@@ -47,73 +43,71 @@
             mPath = new Path();
             mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
             mRect = new Rect(0, 0, 120, 120);
-            
+
             mDrawable = new GradientDrawable(GradientDrawable.Orientation.TL_BR,
                                              new int[] { 0xFFFF0000, 0xFF00FF00,
                                                  0xFF0000FF });
             mDrawable.setShape(GradientDrawable.RECTANGLE);
             mDrawable.setGradientRadius((float)(Math.sqrt(2) * 60));
         }
-        
+
         static void setCornerRadii(GradientDrawable drawable, float r0,
                                    float r1, float r2, float r3) {
             drawable.setCornerRadii(new float[] { r0, r0, r1, r1,
                                                   r2, r2, r3, r3 });
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
-            
+
             mDrawable.setBounds(mRect);
 
             float r = 16;
-            
+
             canvas.save();
             canvas.translate(10, 10);
             mDrawable.setGradientType(GradientDrawable.LINEAR_GRADIENT);
             setCornerRadii(mDrawable, r, r, 0, 0);
             mDrawable.draw(canvas);
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(10 + mRect.width() + 10, 10);
             mDrawable.setGradientType(GradientDrawable.RADIAL_GRADIENT);
             setCornerRadii(mDrawable, 0, 0, r, r);
             mDrawable.draw(canvas);
             canvas.restore();
-            
+
             canvas.translate(0, mRect.height() + 10);
-    
+
             canvas.save();
             canvas.translate(10, 10);
             mDrawable.setGradientType(GradientDrawable.SWEEP_GRADIENT);
             setCornerRadii(mDrawable, 0, r, r, 0);
             mDrawable.draw(canvas);
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(10 + mRect.width() + 10, 10);
             mDrawable.setGradientType(GradientDrawable.LINEAR_GRADIENT);
             setCornerRadii(mDrawable, r, 0, 0, r);
             mDrawable.draw(canvas);
             canvas.restore();
-            
+
             canvas.translate(0, mRect.height() + 10);
-            
+
             canvas.save();
             canvas.translate(10, 10);
             mDrawable.setGradientType(GradientDrawable.RADIAL_GRADIENT);
             setCornerRadii(mDrawable, r, 0, r, 0);
             mDrawable.draw(canvas);
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(10 + mRect.width() + 10, 10);
             mDrawable.setGradientType(GradientDrawable.SWEEP_GRADIENT);
             setCornerRadii(mDrawable, 0, r, 0, r);
             mDrawable.draw(canvas);
             canvas.restore();
-            
         }
     }
 }
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/ScaleToFit.java b/samples/ApiDemos/src/com/example/android/apis/graphics/ScaleToFit.java
index f55e55b..6ffdb5b 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/ScaleToFit.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/ScaleToFit.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
@@ -29,14 +28,14 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private final Paint   mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
         private final Paint   mHairPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
         private final Paint   mLabelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
         private final Matrix  mMatrix = new Matrix();
         private final RectF   mSrcR = new RectF();
-        
+
         private static final Matrix.ScaleToFit[] sFits =
                 new Matrix.ScaleToFit[] {
             Matrix.ScaleToFit.FILL,
@@ -44,11 +43,11 @@
             Matrix.ScaleToFit.CENTER,
             Matrix.ScaleToFit.END
         };
-        
+
         private static final String[] sFitLabels = new String[] {
             "FILL", "START", "CENTER", "END"
         };
-        
+
         private static final int[] sSrcData = new int[] {
             80, 40, Color.RED,
             40, 80, Color.GREEN,
@@ -56,7 +55,7 @@
             80, 80, Color.BLACK
         };
         private static final int N = 4;
-        
+
         private static final int WIDTH = 52;
         private static final int HEIGHT = 52;
         private final RectF mDstR = new RectF(0, 0, WIDTH, HEIGHT);
@@ -67,34 +66,33 @@
             mHairPaint.setStyle(Paint.Style.STROKE);
             mLabelPaint.setTextSize(16);
         }
-        
+
         private void setSrcR(int index) {
             int w = sSrcData[index*3 + 0];
             int h = sSrcData[index*3 + 1];
             mSrcR.set(0, 0, w, h);
         }
-        
+
         private void drawSrcR(Canvas canvas, int index) {
             mPaint.setColor(sSrcData[index*3 + 2]);
             canvas.drawOval(mSrcR, mPaint);
         }
-        
+
         private void drawFit(Canvas canvas, int index, Matrix.ScaleToFit stf) {
             canvas.save();
-            
+
             setSrcR(index);
             mMatrix.setRectToRect(mSrcR, mDstR, stf);
             canvas.concat(mMatrix);
             drawSrcR(canvas, index);
-            
+
             canvas.restore();
-            
+
             canvas.drawRect(mDstR, mHairPaint);
         }
 
-        @Override protected void onDraw(Canvas canvas) {
-            Paint paint = mPaint;
-
+        @Override
+        protected void onDraw(Canvas canvas) {
             canvas.drawColor(Color.WHITE);
 
             canvas.translate(10, 10);
@@ -106,7 +104,7 @@
                 canvas.translate(mSrcR.width() + 15, 0);
             }
             canvas.restore();
-            
+
             canvas.translate(0, 100);
             for (int j = 0; j < sFits.length; j++) {
                 canvas.save();
@@ -121,4 +119,3 @@
         }
     }
 }
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/SensorTest.java b/samples/ApiDemos/src/com/example/android/apis/graphics/SensorTest.java
index 87e0461..dc07a27 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/SensorTest.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/SensorTest.java
@@ -24,6 +24,7 @@
 import android.hardware.SensorManager;
 import android.os.Bundle;
 import android.util.Config;
+import android.util.Log;
 import android.view.View;
 
 public class SensorTest extends GraphicsActivity {
@@ -33,7 +34,7 @@
     private Sensor mSensor;
     private SampleView mView;
     private float[] mValues;
-    
+
     private static class RunAve {
         private final float[] mWeights;
         private final float mWeightScale;
@@ -43,7 +44,7 @@
 
         public RunAve(float[] weights) {
             mWeights = weights;
-            
+
             float sum = 0;
             for (int i = 0; i < weights.length; i++) {
                 sum += weights[i];
@@ -54,12 +55,12 @@
             mSamples = new float[mDepth];
             mCurr = 0;
         }
-        
+
         public void addSample(float value) {
             mSamples[mCurr] = value;
             mCurr = (mCurr + 1) % mDepth;
         }
-        
+
         public float computeAve() {
             final int depth = mDepth;
             int index = mCurr;
@@ -92,20 +93,20 @@
                 }
                 mPrev[i] = event.values[i];
             }
-            
+
             if (show) {
                 // only shows if we think the delta is big enough, in an attempt
                 // to detect "serious" moves left/right or up/down
-                android.util.Log.e(TAG, "sensorChanged " + event.sensor.getName() +
+                Log.e(TAG, "sensorChanged " + event.sensor.getName() +
                         " (" + event.values[0] + ", " + event.values[1] + ", " +
                         event.values[2] + ")" + " diff(" + diff[0] +
                         " " + diff[1] + " " + diff[2] + ")");
             }
-            
+
             long now = android.os.SystemClock.uptimeMillis();
             if (now - mLastGestureTime > 1000) {
                 mLastGestureTime = 0;
-                
+
                 float x = diff[0];
                 float y = diff[1];
                 boolean gestX = Math.abs(x) > 3;
@@ -114,15 +115,15 @@
                 if ((gestX || gestY) && !(gestX && gestY)) {
                     if (gestX) {
                         if (x < 0) {
-                            android.util.Log.e("test", "<<<<<<<< LEFT <<<<<<<<<<<<");
+                            Log.e("test", "<<<<<<<< LEFT <<<<<<<<<<<<");
                         } else {
-                            android.util.Log.e("test", ">>>>>>>>> RITE >>>>>>>>>>>");
+                            Log.e("test", ">>>>>>>>> RITE >>>>>>>>>>>");
                         }
                     } else {
                         if (y < -2) {
-                            android.util.Log.e("test", "<<<<<<<< UP <<<<<<<<<<<<");
+                            Log.e("test", "<<<<<<<< UP <<<<<<<<<<<<");
                         } else {
-                            android.util.Log.e("test", ">>>>>>>>> DOWN >>>>>>>>>>>");
+                            Log.e("test", ">>>>>>>>> DOWN >>>>>>>>>>>");
                         }
                     }
                     mLastGestureTime = now;
@@ -141,28 +142,27 @@
         mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
         mView = new SampleView(this);
         setContentView(mView);
-        if (Config.LOGD) android.util.Log.d(TAG, "create " + mSensorManager);
+        if (Config.DEBUG) Log.d(TAG, "create " + mSensorManager);
     }
 
     @Override
     protected void onResume() {
         super.onResume();
         mSensorManager.registerListener(mListener, mSensor, SensorManager.SENSOR_DELAY_FASTEST);
-        if (Config.LOGD) android.util.Log.d(TAG, "resume " + mSensorManager);
+        if (Config.DEBUG) Log.d(TAG, "resume " + mSensorManager);
     }
-    
+
     @Override
     protected void onStop() {
         mSensorManager.unregisterListener(mListener);
         super.onStop();
-        if (Config.LOGD) android.util.Log.d(TAG, "stop " + mSensorManager);
+        if (Config.DEBUG) Log.d(TAG, "stop " + mSensorManager);
     }
 
     private class SampleView extends View {
         private Paint   mPaint = new Paint();
         private Path    mPath = new Path();
         private boolean mAnimate;
-        private long    mNextTime;
 
         public SampleView(Context context) {
             super(context);
@@ -174,13 +174,13 @@
             mPath.lineTo(20, 60);
             mPath.close();
         }
-    
+
         @Override
         protected void onDraw(Canvas canvas) {
             Paint paint = mPaint;
 
             canvas.drawColor(Color.WHITE);
-            
+
             paint.setAntiAlias(true);
             paint.setColor(Color.BLACK);
             paint.setStyle(Paint.Style.FILL);
@@ -191,21 +191,23 @@
             int cy = h / 2;
 
             canvas.translate(cx, cy);
-            if (mValues != null) {            
+            if (mValues != null) {
                 canvas.rotate(-mValues[0]);
             }
             canvas.drawPath(mPath, mPaint);
         }
-    
+
         @Override
         protected void onAttachedToWindow() {
             mAnimate = true;
+            if (Config.DEBUG) Log.d(TAG, "onAttachedToWindow. mAnimate="+mAnimate);
             super.onAttachedToWindow();
         }
-        
+
         @Override
         protected void onDetachedFromWindow() {
             mAnimate = false;
+            if (Config.DEBUG) Log.d(TAG, "onAttachedToWindow. mAnimate="+mAnimate);
             super.onDetachedFromWindow();
         }
     }
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/ShapeDrawable1.java b/samples/ApiDemos/src/com/example/android/apis/graphics/ShapeDrawable1.java
index 6d450bb..236f4fc 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/ShapeDrawable1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/ShapeDrawable1.java
@@ -16,16 +16,12 @@
 
 package com.example.android.apis.graphics;
 
-import com.example.android.apis.R;
-
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.graphics.drawable.Drawable;
 import android.graphics.drawable.ShapeDrawable;
 import android.graphics.drawable.shapes.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.*;
 
 public class ShapeDrawable1 extends GraphicsActivity {
@@ -35,49 +31,49 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private ShapeDrawable[] mDrawables;
-        
+
         private static Shader makeSweep() {
             return new SweepGradient(150, 25,
                 new int[] { 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0xFFFF0000 },
                 null);
         }
-        
+
         private static Shader makeLinear() {
             return new LinearGradient(0, 0, 50, 50,
                               new int[] { 0xFFFF0000, 0xFF00FF00, 0xFF0000FF },
                               null, Shader.TileMode.MIRROR);
         }
-        
+
         private static Shader makeTiling() {
             int[] pixels = new int[] { 0xFFFF0000, 0xFF00FF00, 0xFF0000FF, 0};
             Bitmap bm = Bitmap.createBitmap(pixels, 2, 2,
                                             Bitmap.Config.ARGB_8888);
-            
+
             return new BitmapShader(bm, Shader.TileMode.REPEAT,
                                         Shader.TileMode.REPEAT);
         }
-        
+
         private static class MyShapeDrawable extends ShapeDrawable {
             private Paint mStrokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
-            
+
             public MyShapeDrawable(Shape s) {
                 super(s);
                 mStrokePaint.setStyle(Paint.Style.STROKE);
             }
-            
+
             public Paint getStrokePaint() {
                 return mStrokePaint;
             }
-            
+
             @Override protected void onDraw(Shape s, Canvas c, Paint p) {
                 s.draw(c, p);
                 s.draw(c, mStrokePaint);
             }
         }
-        
+
         public SampleView(Context context) {
             super(context);
             setFocusable(true);
@@ -85,14 +81,14 @@
             float[] outerR = new float[] { 12, 12, 12, 12, 0, 0, 0, 0 };
             RectF   inset = new RectF(6, 6, 6, 6);
             float[] innerR = new float[] { 12, 12, 0, 0, 12, 12, 0, 0 };
-            
+
             Path path = new Path();
             path.moveTo(50, 0);
             path.lineTo(0, 50);
             path.lineTo(50, 100);
             path.lineTo(100, 50);
             path.close();
-            
+
             mDrawables = new ShapeDrawable[7];
             mDrawables[0] = new ShapeDrawable(new RectShape());
             mDrawables[1] = new ShapeDrawable(new OvalShape());
@@ -104,7 +100,7 @@
                                                                  innerR));
             mDrawables[5] = new ShapeDrawable(new PathShape(path, 100, 100));
             mDrawables[6] = new MyShapeDrawable(new ArcShape(45, -270));
-            
+
             mDrawables[0].getPaint().setColor(0xFFFF0000);
             mDrawables[1].getPaint().setColor(0xFF00FF00);
             mDrawables[2].getPaint().setColor(0xFF0000FF);
@@ -112,26 +108,26 @@
             mDrawables[4].getPaint().setShader(makeLinear());
             mDrawables[5].getPaint().setShader(makeTiling());
             mDrawables[6].getPaint().setColor(0x88FF8844);
-            
+
             PathEffect pe = new DiscretePathEffect(10, 4);
             PathEffect pe2 = new CornerPathEffect(4);
             mDrawables[3].getPaint().setPathEffect(
                                                 new ComposePathEffect(pe2, pe));
-        
+
             MyShapeDrawable msd = (MyShapeDrawable)mDrawables[6];
             msd.getStrokePaint().setStrokeWidth(4);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
-            
+
             int x = 10;
             int y = 10;
             int width = 300;
             int height = 50;
-            
+
             for (Drawable dr : mDrawables) {
                 dr.setBounds(x, y, x + width, y + height);
-                dr.draw(canvas);                
+                dr.draw(canvas);
                 y += height + 5;
             }
         }
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Sweep.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Sweep.java
index dc127fd..5da10cf 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Sweep.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Sweep.java
@@ -16,11 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-// 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.Context;
 import android.graphics.*;
 import android.os.Bundle;
@@ -34,7 +29,7 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Paint mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
         private float mRotate;
@@ -55,7 +50,7 @@
                                                   Color.GREEN }, null);
             mPaint.setShader(mShader);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             Paint paint = mPaint;
             float x = 160;
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/TextAlign.java b/samples/ApiDemos/src/com/example/android/apis/graphics/TextAlign.java
index 0576a7c..0ecba16 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/TextAlign.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/TextAlign.java
@@ -16,13 +16,9 @@
 
 package com.example.android.apis.graphics;
 
-import com.example.android.apis.R;
-
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.*;
 
 public class TextAlign extends GraphicsActivity {
@@ -32,27 +28,27 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Paint   mPaint;
         private float   mX;
         private float[] mPos;
-        
+
         private Path    mPath;
         private Paint   mPathPaint;
-        
+
         private static final int DY = 30;
         private static final String TEXT_L = "Left";
         private static final String TEXT_C = "Center";
         private static final String TEXT_R = "Right";
         private static final String POSTEXT = "Positioned";
         private static final String TEXTONPATH = "Along a path";
-        
+
         private static void makePath(Path p) {
             p.moveTo(10, 0);
             p.cubicTo(100, -50, 200, 50, 300, 0);
         }
-        
+
         private float[] buildTextPositions(String text, float y, Paint paint) {
             float[] widths = new float[text.length()];
             // initially get the widths for each char
@@ -67,18 +63,18 @@
             }
             return pos;
         }
-        
+
         public SampleView(Context context) {
             super(context);
             setFocusable(true);
-            
+
             mPaint = new Paint();
             mPaint.setAntiAlias(true);
             mPaint.setTextSize(30);
             mPaint.setTypeface(Typeface.SERIF);
-            
+
             mPos = buildTextPositions(POSTEXT, 0, mPaint);
-            
+
             mPath = new Path();
             makePath(mPath);
 
@@ -87,7 +83,7 @@
             mPathPaint.setColor(0x800000FF);
             mPathPaint.setStyle(Paint.Style.STROKE);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             canvas.drawColor(Color.WHITE);
 
@@ -95,13 +91,13 @@
             float x = mX;
             float y = 0;
             float[] pos = mPos;
-            
+
             // draw the normal strings
 
             p.setColor(0x80FF0000);
             canvas.drawLine(x, y, x, y+DY*3, p);
             p.setColor(Color.BLACK);
-            
+
             canvas.translate(0, DY);
             p.setTextAlign(Paint.Align.LEFT);
             canvas.drawText(TEXT_L, x, y, p);
@@ -113,11 +109,11 @@
             canvas.translate(0, DY);
             p.setTextAlign(Paint.Align.RIGHT);
             canvas.drawText(TEXT_R, x, y, p);
-            
+
             canvas.translate(100, DY*2);
 
             // now draw the positioned strings
-    
+
             p.setColor(0xBB00FF00);
             for (int i = 0; i < pos.length/2; i++) {
                 canvas.drawLine(pos[i*2+0], pos[i*2+1]-DY,
@@ -127,17 +123,17 @@
 
             p.setTextAlign(Paint.Align.LEFT);
             canvas.drawPosText(POSTEXT, pos, p);
-            
+
             canvas.translate(0, DY);
             p.setTextAlign(Paint.Align.CENTER);
             canvas.drawPosText(POSTEXT, pos, p);
-            
+
             canvas.translate(0, DY);
             p.setTextAlign(Paint.Align.RIGHT);
             canvas.drawPosText(POSTEXT, pos, p);
-            
+
             // now draw the text on path
-            
+
             canvas.translate(-100, DY*2);
 
             canvas.drawPath(mPath, mPathPaint);
@@ -148,7 +144,7 @@
             canvas.drawPath(mPath, mPathPaint);
             p.setTextAlign(Paint.Align.CENTER);
             canvas.drawTextOnPath(TEXTONPATH, mPath, 0, 0, p);
-            
+
             canvas.translate(0, DY*1.5f);
             canvas.drawPath(mPath, mPathPaint);
             p.setTextAlign(Paint.Align.RIGHT);
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.java b/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.java
index 14e6c4f..9a3eb65 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.Canvas;
@@ -41,34 +40,34 @@
 public class TouchPaint extends GraphicsActivity {
     /** Used as a pulse to gradually fade the contents of the window. */
     private static final int FADE_MSG = 1;
-    
+
     /** Menu ID for the command to clear the window. */
     private static final int CLEAR_ID = Menu.FIRST;
     /** Menu ID for the command to toggle fading. */
     private static final int FADE_ID = Menu.FIRST+1;
-    
+
     /** How often to fade the contents of the window (in ms). */
     private static final int FADE_DELAY = 100;
-    
+
     /** The view responsible for drawing the window. */
     MyView mView;
     /** Is fading mode enabled? */
     boolean mFading;
-    
+
     @Override protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        
+
         // Create and attach the view that is responsible for painting.
         mView = new MyView(this);
         setContentView(mView);
         mView.requestFocus();
-        
+
         // Restore the fading option if we are being thawed from a
         // previously saved state.  Note that we are not currently remembering
         // the contents of the bitmap.
         mFading = savedInstanceState != null ? savedInstanceState.getBoolean("fading", true) : true;
     }
-    
+
     @Override public boolean onCreateOptionsMenu(Menu menu) {
         menu.add(0, CLEAR_ID, 0, "Clear");
         menu.add(0, FADE_ID, 0, "Fade").setCheckable(true);
@@ -130,14 +129,14 @@
         mHandler.sendMessageDelayed(
                 mHandler.obtainMessage(FADE_MSG), FADE_DELAY);
     }
-    
+
     /**
      * Stop the pulse to fade the screen.
      */
     void stopFading() {
         mHandler.removeMessages(FADE_MSG);
     }
-    
+
     private Handler mHandler = new Handler() {
         @Override public void handleMessage(Message msg) {
             switch (msg.what) {
@@ -155,7 +154,7 @@
             }
         }
     };
-    
+
     public class MyView extends View {
         private static final int FADE_ALPHA = 0x06;
         private static final int MAX_FADE_STEPS = 256/FADE_ALPHA + 4;
@@ -169,7 +168,7 @@
         private float mCurX;
         private float mCurY;
         private int mFadeSteps = MAX_FADE_STEPS;
-        
+
         public MyView(Context c) {
             super(c);
             setFocusable(true);
@@ -189,7 +188,7 @@
                 mFadeSteps = MAX_FADE_STEPS;
             }
         }
-        
+
         public void fade() {
             if (mCanvas != null && mFadeSteps < MAX_FADE_STEPS) {
                 mCanvas.drawPaint(mFadePaint);
@@ -197,7 +196,7 @@
                 mFadeSteps++;
             }
         }
-        
+
         @Override protected void onSizeChanged(int w, int h, int oldw,
                 int oldh) {
             int curW = mBitmap != null ? mBitmap.getWidth() : 0;
@@ -205,10 +204,10 @@
             if (curW >= w && curH >= h) {
                 return;
             }
-            
+
             if (curW < w) curW = w;
             if (curH < h) curH = h;
-            
+
             Bitmap newBitmap = Bitmap.createBitmap(curW, curH,
                                                    Bitmap.Config.RGB_565);
             Canvas newCanvas = new Canvas();
@@ -220,7 +219,7 @@
             mCanvas = newCanvas;
             mFadeSteps = MAX_FADE_STEPS;
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             if (mBitmap != null) {
                 canvas.drawBitmap(mBitmap, 0, 0, null);
@@ -246,7 +245,7 @@
             drawPoint(mCurX, mCurY, 1.0f, 16.0f);
             return true;
         }
-        
+
         @Override public boolean onTouchEvent(MotionEvent event) {
             int action = event.getActionMasked();
             if (action != MotionEvent.ACTION_UP && action != MotionEvent.ACTION_CANCEL) {
@@ -269,7 +268,7 @@
             }
             return true;
         }
-        
+
         private void drawPoint(float x, float y, float pressure, float width) {
             //Log.i("TouchPaint", "Drawing: " + x + "x" + y + " p="
             //        + pressure + " width=" + width);
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/TouchRotateActivity.java b/samples/ApiDemos/src/com/example/android/apis/graphics/TouchRotateActivity.java
index c0f32a7..4133c04 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/TouchRotateActivity.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/TouchRotateActivity.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import javax.microedition.khronos.egl.EGL10;
 import javax.microedition.khronos.egl.EGLConfig;
 import javax.microedition.khronos.opengles.GL10;
 
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 ede6ef5..c41d173 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleRenderer.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/TriangleRenderer.java
@@ -23,7 +23,6 @@
 import java.nio.FloatBuffer;
 import java.nio.ShortBuffer;
 
-import javax.microedition.khronos.egl.EGL10;
 import javax.microedition.khronos.egl.EGLConfig;
 import javax.microedition.khronos.opengles.GL10;
 
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Typefaces.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Typefaces.java
index aefc311..08facaa 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Typefaces.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Typefaces.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
@@ -29,20 +28,20 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Paint    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
         private Typeface mFace;
-        
+
         public SampleView(Context context) {
             super(context);
 
             mFace = Typeface.createFromAsset(getContext().getAssets(),
                                              "fonts/samplefont.ttf");
-            
+
             mPaint.setTextSize(64);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             canvas.drawColor(Color.WHITE);
 
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/UnicodeChart.java b/samples/ApiDemos/src/com/example/android/apis/graphics/UnicodeChart.java
index 7ee99d0..0a2f630 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/UnicodeChart.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/UnicodeChart.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
 import android.os.Bundle;
@@ -29,20 +28,20 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        
+
         requestWindowFeature(Window.FEATURE_NO_TITLE);
-        
+
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private Paint mBigCharPaint;
         private Paint mLabelPaint;
         private final char[] mChars = new char[256];
         private final float[] mPos = new float[512];
-        
+
         private int mBase;
-        
+
         private static final int XMUL = 20;
         private static final int YMUL = 28;
         private static final int YBASE = 18;
@@ -51,49 +50,49 @@
             super(context);
             setFocusable(true);
             setFocusableInTouchMode(true);
-            
+
             mBigCharPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
             mBigCharPaint.setTextSize(15);
             mBigCharPaint.setTextAlign(Paint.Align.CENTER);
-            
+
             mLabelPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
             mLabelPaint.setTextSize(8);
             mLabelPaint.setTextAlign(Paint.Align.CENTER);
-            
+
             // the position array is the same for all charts
             float[] pos = mPos;
             int index = 0;
             for (int col = 0; col < 16; col++) {
-                final float x = col * 20 + 10;
+                final float x = col * XMUL + 10;
                 for (int row = 0; row < 16; row++) {
                     pos[index++] = x;
                     pos[index++] = row * YMUL + YBASE;
                 }
             }
         }
-        
+
         private float computeX(int index) {
-            return (index >> 4) * 20 + 10;
+            return (index >> 4) * XMUL + 10;
         }
 
         private float computeY(int index) {
             return (index & 0xF) * YMUL + YMUL;
         }
-        
+
         private void drawChart(Canvas canvas, int base) {
             char[] chars = mChars;
             for (int i = 0; i < 256; i++) {
                 int unichar = base + i;
                 chars[i] = (char)unichar;
-                
+
                 canvas.drawText(Integer.toHexString(unichar),
                                 computeX(i), computeY(i), mLabelPaint);
             }
             canvas.drawPosText(chars, 0, 256, mPos, mBigCharPaint);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
-            canvas.drawColor(Color.WHITE);            
+            canvas.drawColor(Color.WHITE);
 
             canvas.translate(0, 1);
             drawChart(canvas, mBase * 256);
@@ -118,4 +117,3 @@
         }
     }
 }
-
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Vertices.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Vertices.java
index 1e61906..ac1ab8a 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Vertices.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Vertices.java
@@ -18,17 +18,11 @@
 
 import com.example.android.apis.R;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.*;
-import android.graphics.drawable.*;
 import android.os.Bundle;
-import android.view.KeyEvent;
 import android.view.*;
 
-import java.io.IOException;
-import java.io.InputStream;
-
 public class Vertices extends GraphicsActivity {
 
     @Override
@@ -36,14 +30,13 @@
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private final Paint mPaint = new Paint();
         private final float[] mVerts = new float[10];
         private final float[] mTexs = new float[10];
-        private final int[] mColors = new int[10];
         private final short[] mIndices = { 0, 1, 2, 3, 4, 1 };
-        
+
         private final Matrix mMatrix = new Matrix();
         private final Matrix mInverse = new Matrix();
 
@@ -61,7 +54,7 @@
             Shader s = new BitmapShader(bm, Shader.TileMode.CLAMP,
                                         Shader.TileMode.CLAMP);
             mPaint.setShader(s);
-            
+
             float w = bm.getWidth();
             float h = bm.getHeight();
             // construct our mesh
@@ -70,18 +63,18 @@
             setXY(mTexs, 2, w, 0);
             setXY(mTexs, 3, w, h);
             setXY(mTexs, 4, 0, h);
-            
+
             setXY(mVerts, 0, w/2, h/2);
             setXY(mVerts, 1, 0, 0);
             setXY(mVerts, 2, w, 0);
             setXY(mVerts, 3, w, h);
             setXY(mVerts, 4, 0, h);
-            
+
             mMatrix.setScale(0.8f, 0.8f);
             mMatrix.preTranslate(20, 20);
             mMatrix.invert(mInverse);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             canvas.drawColor(0xFFCCCCCC);
             canvas.save();
@@ -104,7 +97,7 @@
             invalidate();
             return true;
         }
-        
+
     }
 }
 
diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/Xfermodes.java b/samples/ApiDemos/src/com/example/android/apis/graphics/Xfermodes.java
index b9f8424..54e15e3 100644
--- a/samples/ApiDemos/src/com/example/android/apis/graphics/Xfermodes.java
+++ b/samples/ApiDemos/src/com/example/android/apis/graphics/Xfermodes.java
@@ -16,7 +16,6 @@
 
 package com.example.android.apis.graphics;
 
-import android.app.Activity;
 import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.BitmapShader;
@@ -33,35 +32,35 @@
 import android.view.View;
 
 public class Xfermodes extends GraphicsActivity {
-    
+
     // create a bitmap with a circle, used for the "dst" image
     static Bitmap makeDst(int w, int h) {
         Bitmap bm = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
         Canvas c = new Canvas(bm);
         Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
-        
-        p.setColor(0xFFFFCC44);    
+
+        p.setColor(0xFFFFCC44);
         c.drawOval(new RectF(0, 0, w*3/4, h*3/4), p);
         return bm;
     }
-    
+
     // create a bitmap with a rect, used for the "src" image
     static Bitmap makeSrc(int w, int h) {
         Bitmap bm = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
         Canvas c = new Canvas(bm);
         Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
-        
+
         p.setColor(0xFF66AAFF);
         c.drawRect(w/3, h/3, w*19/20, h*19/20, p);
         return bm;
     }
-    
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
         setContentView(new SampleView(this));
     }
-    
+
     private static class SampleView extends View {
         private static final int W = 64;
         private static final int H = 64;
@@ -70,7 +69,7 @@
         private Bitmap mSrcB;
         private Bitmap mDstB;
         private Shader mBG;     // background checker-board pattern
-        
+
         private static final Xfermode[] sModes = {
             new PorterDuffXfermode(PorterDuff.Mode.CLEAR),
             new PorterDuffXfermode(PorterDuff.Mode.SRC),
@@ -89,20 +88,20 @@
             new PorterDuffXfermode(PorterDuff.Mode.MULTIPLY),
             new PorterDuffXfermode(PorterDuff.Mode.SCREEN)
         };
-        
+
         private static final String[] sLabels = {
             "Clear", "Src", "Dst", "SrcOver",
             "DstOver", "SrcIn", "DstIn", "SrcOut",
             "DstOut", "SrcATop", "DstATop", "Xor",
             "Darken", "Lighten", "Multiply", "Screen"
         };
-        
+
         public SampleView(Context context) {
             super(context);
-            
+
             mSrcB = makeSrc(W, H);
             mDstB = makeDst(W, H);
-            
+
             // make a ckeckerboard pattern
             Bitmap bm = Bitmap.createBitmap(new int[] { 0xFFFFFFFF, 0xFFCCCCCC,
                                             0xFFCCCCCC, 0xFFFFFFFF }, 2, 2,
@@ -114,18 +113,18 @@
             m.setScale(6, 6);
             mBG.setLocalMatrix(m);
         }
-        
+
         @Override protected void onDraw(Canvas canvas) {
             canvas.drawColor(Color.WHITE);
-            
+
             Paint labelP = new Paint(Paint.ANTI_ALIAS_FLAG);
             labelP.setTextAlign(Paint.Align.CENTER);
-            
+
             Paint paint = new Paint();
             paint.setFilterBitmap(false);
-            
+
             canvas.translate(15, 35);
-            
+
             int x = 0;
             int y = 0;
             for (int i = 0; i < sModes.length; i++) {
@@ -134,12 +133,12 @@
                 paint.setShader(null);
                 canvas.drawRect(x - 0.5f, y - 0.5f,
                                 x + W + 0.5f, y + H + 0.5f, paint);
-                
+
                 // draw the checker-board pattern
                 paint.setStyle(Paint.Style.FILL);
                 paint.setShader(mBG);
                 canvas.drawRect(x, y, x + W, y + H, paint);
-                
+
                 // draw the src/dst example into our offscreen bitmap
                 int sc = canvas.saveLayer(x, y, x + W, y + H, null,
                                           Canvas.MATRIX_SAVE_FLAG |
@@ -153,13 +152,13 @@
                 canvas.drawBitmap(mSrcB, 0, 0, paint);
                 paint.setXfermode(null);
                 canvas.restoreToCount(sc);
-                
+
                 // draw the label
                 canvas.drawText(sLabels[i],
                                 x + W/2, y - labelP.getTextSize()/2, labelP);
-                
+
                 x += W + 10;
-                
+
                 // wrap around when we've drawn enough for one row
                 if ((i % ROW_MAX) == ROW_MAX - 1) {
                     x = 0;
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/Animation2.java b/samples/ApiDemos/src/com/example/android/apis/view/Animation2.java
index b2236aa..041794e 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/Animation2.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/Animation2.java
@@ -49,7 +49,7 @@
         s.setOnItemSelectedListener(this);
     }
 
-    public void onItemSelected(AdapterView parent, View v, int position, long id) {
+    public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
         switch (position) {
 
         case 0:
@@ -79,7 +79,7 @@
         }
     }
 
-    public void onNothingSelected(AdapterView parent) {
+    public void onNothingSelected(AdapterView<?> parent) {
     }
 
     private String[] mStrings = {
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/Animation3.java b/samples/ApiDemos/src/com/example/android/apis/view/Animation3.java
index 11fc9ed..2cd7605 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/Animation3.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/Animation3.java
@@ -50,7 +50,7 @@
         s.setOnItemSelectedListener(this);
     }
 
-    public void onItemSelected(AdapterView parent, View v, int position, long id) {
+    public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
         final View target = findViewById(R.id.target);
         final View targetParent = (View) target.getParent();
 
@@ -96,6 +96,6 @@
         target.startAnimation(a);
     }
 
-    public void onNothingSelected(AdapterView parent) {
+    public void onNothingSelected(AdapterView<?> parent) {
     }
 }
\ No newline at end of file
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete1.java b/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete1.java
index f4274e5..bec4a5d 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete1.java
@@ -19,12 +19,9 @@
 import com.example.android.apis.R;
 
 import android.app.Activity;
-import android.widget.Spinner;
 import android.widget.ArrayAdapter;
 import android.widget.AutoCompleteTextView;
 import android.os.Bundle;
-import android.view.View;
-
 
 public class AutoComplete1 extends Activity {
 
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete4.java b/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete4.java
index c6fa08b..3d63a91 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete4.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete4.java
@@ -22,13 +22,15 @@
 import android.content.ContentResolver;
 import android.content.Context;
 import android.database.Cursor;
+import android.net.Uri;
 import android.os.Bundle;
-import android.provider.Contacts;
+import android.provider.ContactsContract.Contacts;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
 import android.widget.AutoCompleteTextView;
 import android.widget.CursorAdapter;
+import android.widget.FilterQueryProvider;
 import android.widget.Filterable;
 import android.widget.TextView;
 
@@ -39,8 +41,9 @@
         setContentView(R.layout.autocomplete_4);
 
         ContentResolver content = getContentResolver();
-        Cursor cursor = content.query(Contacts.People.CONTENT_URI,
-                PEOPLE_PROJECTION, null, null, Contacts.People.DEFAULT_SORT_ORDER);
+        Cursor cursor = content.query(Contacts.CONTENT_URI,
+                CONTACT_PROJECTION, null, null, null);
+
         ContactListAdapter adapter = new ContactListAdapter(this, cursor);
 
         AutoCompleteTextView textView = (AutoCompleteTextView)
@@ -61,50 +64,40 @@
             final LayoutInflater inflater = LayoutInflater.from(context);
             final TextView view = (TextView) inflater.inflate(
                     android.R.layout.simple_dropdown_item_1line, parent, false);
-            view.setText(cursor.getString(5));
+            view.setText(cursor.getString(COLUMN_DISPLAY_NAME));
             return view;
         }
 
         @Override
         public void bindView(View view, Context context, Cursor cursor) {
-            ((TextView) view).setText(cursor.getString(5));
+            ((TextView) view).setText(cursor.getString(COLUMN_DISPLAY_NAME));
         }
 
         @Override
         public String convertToString(Cursor cursor) {
-            return cursor.getString(5);
+            return cursor.getString(COLUMN_DISPLAY_NAME);
         }
 
         @Override
         public Cursor runQueryOnBackgroundThread(CharSequence constraint) {
-            if (getFilterQueryProvider() != null) {
-                return getFilterQueryProvider().runQuery(constraint);
+            FilterQueryProvider filter = getFilterQueryProvider();
+            if (filter != null) {
+                return filter.runQuery(constraint);
             }
 
-            StringBuilder buffer = null;
-            String[] args = null;
-            if (constraint != null) {
-                buffer = new StringBuilder();
-                buffer.append("UPPER(");
-                buffer.append(Contacts.ContactMethods.NAME);
-                buffer.append(") GLOB ?");
-                args = new String[] { constraint.toString().toUpperCase() + "*" };
-            }
-
-            return mContent.query(Contacts.People.CONTENT_URI, PEOPLE_PROJECTION,
-                    buffer == null ? null : buffer.toString(), args,
-                    Contacts.People.DEFAULT_SORT_ORDER);
+            Uri uri = Uri.withAppendedPath(
+                    Contacts.CONTENT_FILTER_URI,
+                    Uri.encode(constraint.toString()));
+            return mContent.query(uri, CONTACT_PROJECTION, null, null, null);
         }
 
-        private ContentResolver mContent;        
+        private ContentResolver mContent;
     }
 
-    private static final String[] PEOPLE_PROJECTION = new String[] {
-        Contacts.People._ID,
-        Contacts.People.PRIMARY_PHONE_ID,
-        Contacts.People.TYPE,
-        Contacts.People.NUMBER,
-        Contacts.People.LABEL,
-        Contacts.People.NAME,
+    public static final String[] CONTACT_PROJECTION = new String[] {
+        Contacts._ID,
+        Contacts.DISPLAY_NAME
     };
-}
+
+    private static final int COLUMN_DISPLAY_NAME = 1;
+}
\ No newline at end of file
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete5.java b/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete5.java
index 7406da4..2009d8a 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete5.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete5.java
@@ -22,7 +22,7 @@
 import android.content.ContentResolver;
 import android.database.Cursor;
 import android.os.Bundle;
-import android.provider.Contacts;
+import android.provider.ContactsContract.Contacts;
 import android.widget.AutoCompleteTextView;
 
 public class AutoComplete5 extends Activity {
@@ -32,8 +32,8 @@
         setContentView(R.layout.autocomplete_5);
 
         ContentResolver content = getContentResolver();
-        Cursor cursor = content.query(Contacts.People.CONTENT_URI,
-                PEOPLE_PROJECTION, null, null, Contacts.People.DEFAULT_SORT_ORDER);
+        Cursor cursor = content.query(Contacts.CONTENT_URI,
+                AutoComplete4.CONTACT_PROJECTION, null, null, null);
         AutoComplete4.ContactListAdapter adapter =
                 new AutoComplete4.ContactListAdapter(this, cursor);
 
@@ -41,13 +41,4 @@
                 findViewById(R.id.edit);
         textView.setAdapter(adapter);
     }
-
-    private static final String[] PEOPLE_PROJECTION = new String[] {
-        Contacts.People._ID,
-        Contacts.People.PRIMARY_PHONE_ID,
-        Contacts.People.TYPE,
-        Contacts.People.NUMBER,
-        Contacts.People.LABEL,
-        Contacts.People.NAME
-    };
-}
+}
\ No newline at end of file
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete6.java b/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete6.java
index 3573bfb..2c28d65 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete6.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/AutoComplete6.java
@@ -19,12 +19,9 @@
 import com.example.android.apis.R;
 
 import android.app.Activity;
-import android.widget.Spinner;
 import android.widget.ArrayAdapter;
 import android.widget.MultiAutoCompleteTextView;
 import android.os.Bundle;
-import android.view.View;
-
 
 public class AutoComplete6 extends Activity {
 
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/Buttons1.java b/samples/ApiDemos/src/com/example/android/apis/view/Buttons1.java
index e2f8cc8..a88ee30 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/Buttons1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/Buttons1.java
@@ -22,9 +22,6 @@
 
 import android.app.Activity;
 import android.os.Bundle;
-import android.widget.Spinner;
-import android.widget.ArrayAdapter;
-
 
 /**
  * A gallery of the different styles of buttons.
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList2.java b/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList2.java
index 5784122..b6cce29 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList2.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList2.java
@@ -17,49 +17,49 @@
 package com.example.android.apis.view;
 
 import android.app.ExpandableListActivity;
-import android.content.ContentUris;
 import android.content.Context;
 import android.database.Cursor;
-import android.net.Uri;
 import android.os.Bundle;
-import android.provider.Contacts.People;
+import android.provider.ContactsContract.Contacts;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
 import android.widget.ExpandableListAdapter;
 import android.widget.SimpleCursorTreeAdapter;
 
-
 /**
  * Demonstrates expandable lists backed by Cursors
  */
 public class ExpandableList2 extends ExpandableListActivity {
-    private int mGroupIdColumnIndex; 
-    
-    private String mPhoneNumberProjection[] = new String[] {
-            People.Phones._ID, People.Phones.NUMBER
+    private static final int COLUMN_CONTACT_ID = 0;
+
+    private static final String[] CONTACT_PROJECTION = new String[] {
+        Contacts._ID,
+        Contacts.DISPLAY_NAME
     };
 
-    
+    private static final String[] PHONE_PROJECTION = new String[] {
+        Phone._ID,
+        Phone.CONTACT_ID,
+        Phone.NUMBER
+    };
+
     private ExpandableListAdapter mAdapter;
-    
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         // Query for people
-        Cursor groupCursor = managedQuery(People.CONTENT_URI,
-                new String[] {People._ID, People.NAME}, null, null, null);
-
-        // Cache the ID column index
-        mGroupIdColumnIndex = groupCursor.getColumnIndexOrThrow(People._ID);
+        Cursor groupCursor = managedQuery(Contacts.CONTENT_URI,
+                CONTACT_PROJECTION, null, null, null);
 
         // Set up our adapter
         mAdapter = new MyExpandableListAdapter(groupCursor,
                 this,
                 android.R.layout.simple_expandable_list_item_1,
                 android.R.layout.simple_expandable_list_item_1,
-                new String[] {People.NAME}, // Name for group layouts
+                new String[] {Contacts.DISPLAY_NAME}, // Name for group layouts
                 new int[] {android.R.id.text1},
-                new String[] {People.NUMBER}, // Number for child layouts
+                new String[] {Phone.NUMBER}, // Number for child layouts
                 new int[] {android.R.id.text1});
         setListAdapter(mAdapter);
     }
@@ -75,18 +75,13 @@
 
         @Override
         protected Cursor getChildrenCursor(Cursor groupCursor) {
-            // Given the group, we return a cursor for all the children within that group 
-
-            // Return a cursor that points to this contact's phone numbers
-            Uri.Builder builder = People.CONTENT_URI.buildUpon();
-            ContentUris.appendId(builder, groupCursor.getLong(mGroupIdColumnIndex));
-            builder.appendEncodedPath(People.Phones.CONTENT_DIRECTORY);
-            Uri phoneNumbersUri = builder.build();
-
+            int contactId = groupCursor.getInt(COLUMN_CONTACT_ID);
             // The returned Cursor MUST be managed by us, so we use Activity's helper
             // functionality to manage it for us.
-            return managedQuery(phoneNumbersUri, mPhoneNumberProjection, null, null, null);
+            return managedQuery(Phone.CONTENT_URI,
+                    PHONE_PROJECTION,
+                    Phone.CONTACT_ID + " = " + contactId,
+                    null, null);
         }
-
     }
-}
+}
\ No newline at end of file
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/Focus1.java b/samples/ApiDemos/src/com/example/android/apis/view/Focus1.java
index 86f6ee7..c816b31 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/Focus1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/Focus1.java
@@ -20,12 +20,10 @@
 
 import android.app.Activity;
 import android.os.Bundle;
-import android.view.View;
 import android.webkit.WebView;
 import android.widget.ListView;
 import android.widget.ArrayAdapter;
 
-
 /**
  * Demonstrates the use of non-focusable views.
  */
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/Gallery1.java b/samples/ApiDemos/src/com/example/android/apis/view/Gallery1.java
index a539a5b..7aaaaef 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/Gallery1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/Gallery1.java
@@ -49,7 +49,7 @@
         
         // Set a item click listener, and just Toast the clicked position
         g.setOnItemClickListener(new OnItemClickListener() {
-            public void onItemClick(AdapterView parent, View v, int position, long id) {
+            public void onItemClick(AdapterView<?> parent, View v, int position, long id) {
                 Toast.makeText(Gallery1.this, "" + position, Toast.LENGTH_SHORT).show();
             }
         });
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/Gallery2.java b/samples/ApiDemos/src/com/example/android/apis/view/Gallery2.java
index 2eea1ff..ed33451 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/Gallery2.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/Gallery2.java
@@ -17,9 +17,8 @@
 package com.example.android.apis.view;
 
 import android.app.Activity;
-import android.content.Context;
 import android.database.Cursor;
-import android.provider.Contacts.People;
+import android.provider.ContactsContract.Contacts;
 import android.os.Bundle;
 import android.widget.Gallery;
 import android.widget.SimpleCursorAdapter;
@@ -37,16 +36,17 @@
         setContentView(R.layout.gallery_2);
 
         // Get a cursor with all people
-        Cursor c = getContentResolver().query(People.CONTENT_URI, null, null, null, null);
+        Cursor c = getContentResolver().query(Contacts.CONTENT_URI,
+                CONTACT_PROJECTION, null, null, null);
         startManagingCursor(c);
-        
+
         SpinnerAdapter adapter = new SimpleCursorAdapter(this,
         // Use a template that displays a text view
                 android.R.layout.simple_gallery_item,
                 // Give the cursor to the list adatper
                 c,
                 // Map the NAME column in the people database to...
-                new String[] {People.NAME},
+                new String[] {Contacts.DISPLAY_NAME},
                 // The "text1" view defined in the XML template
                 new int[] { android.R.id.text1 });
 
@@ -54,4 +54,8 @@
         g.setAdapter(adapter);
     }
 
-}
+    private static final String[] CONTACT_PROJECTION = new String[] {
+        Contacts._ID,
+        Contacts.DISPLAY_NAME
+    };
+}
\ No newline at end of file
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 66ef282..7f17c82 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/ImageSwitcher1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/ImageSwitcher1.java
@@ -56,11 +56,11 @@
         g.setOnItemSelectedListener(this);
     }
 
-    public void onItemSelected(AdapterView parent, View v, int position, long id) {
+    public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
         mSwitcher.setImageResource(mImageIds[position]);
     }
 
-    public void onNothingSelected(AdapterView parent) {
+    public void onNothingSelected(AdapterView<?> parent) {
     }
 
     public View makeView() {
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/List13.java b/samples/ApiDemos/src/com/example/android/apis/view/List13.java
index b3087be..68179ed 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/List13.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/List13.java
@@ -52,7 +52,6 @@
         private LayoutInflater mInflater;
         
         public SlowAdapter(Context context) {
-            mContext = context;
             mInflater = (LayoutInflater)context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
         }
 
@@ -114,11 +113,6 @@
 
             return text;
         }
-
-        /**
-         * Remember our context so we can use it when constructing views.
-         */
-        private Context mContext;
     }
     
     @Override
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/List2.java b/samples/ApiDemos/src/com/example/android/apis/view/List2.java
index 4f37dd8..4dca2a7 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/List2.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/List2.java
@@ -18,34 +18,40 @@
 
 import android.app.ListActivity;
 import android.database.Cursor;
-import android.provider.Contacts.People;
+import android.provider.ContactsContract.Contacts;
 import android.os.Bundle;
 import android.widget.ListAdapter;
 import android.widget.SimpleCursorAdapter;
 
 /**
- * A list view example where the 
+ * A list view example where the
  * data comes from a cursor.
  */
 public class List2 extends ListActivity {
-    
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         // Get a cursor with all people
-        Cursor c = getContentResolver().query(People.CONTENT_URI, null, null, null, null);
+        Cursor c = getContentResolver().query(Contacts.CONTENT_URI,
+                CONTACT_PROJECTION, null, null, null);
         startManagingCursor(c);
 
-        ListAdapter adapter = new SimpleCursorAdapter(this, 
+        ListAdapter adapter = new SimpleCursorAdapter(this,
                 // Use a template that displays a text view
-                android.R.layout.simple_list_item_1, 
+                android.R.layout.simple_list_item_1,
                 // Give the cursor to the list adatper
-                c, 
+                c,
                 // Map the NAME column in the people database to...
-                new String[] {People.NAME} ,
+                new String[] {Contacts.DISPLAY_NAME},
                 // The "text1" view defined in the XML template
-                new int[] {android.R.id.text1}); 
+                new int[] {android.R.id.text1});
         setListAdapter(adapter);
     }
-}
+
+    private static final String[] CONTACT_PROJECTION = new String[] {
+        Contacts._ID,
+        Contacts.DISPLAY_NAME
+    };
+}
\ No newline at end of file
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/List3.java b/samples/ApiDemos/src/com/example/android/apis/view/List3.java
index 17e59f1..9c3b4b4 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/List3.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/List3.java
@@ -16,36 +16,69 @@
 
 package com.example.android.apis.view;
 
-
 import android.app.ListActivity;
 import android.database.Cursor;
 import android.os.Bundle;
-import android.provider.Contacts.Phones;
-import android.widget.ListAdapter;
+import android.provider.ContactsContract.CommonDataKinds.Phone;
+import android.view.View;
 import android.widget.SimpleCursorAdapter;
+import android.widget.TextView;
 
  /**
- * A list view example where the 
+ * A list view example where the
  * data comes from a cursor, and a
  * SimpleCursorListAdapter is used to map each item to a two-line
  * display.
  */
 public class List3 extends ListActivity {
-    
+
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
         // Get a cursor with all phones
-        Cursor c = getContentResolver().query(Phones.CONTENT_URI, null, null, null, null);
+        Cursor c = getContentResolver().query(Phone.CONTENT_URI,
+                PHONE_PROJECTION, null, null, null);
         startManagingCursor(c);
-        
+
         // Map Cursor columns to views defined in simple_list_item_2.xml
-        ListAdapter adapter = new SimpleCursorAdapter(this,
-                android.R.layout.simple_list_item_2, c, 
-                        new String[] { Phones.NAME, Phones.NUMBER }, 
+        SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
+                android.R.layout.simple_list_item_2, c,
+                        new String[] {
+                            Phone.TYPE,
+                            Phone.NUMBER
+                        },
                         new int[] { android.R.id.text1, android.R.id.text2 });
+        //Used to display a readable string for the phone type
+        adapter.setViewBinder(new SimpleCursorAdapter.ViewBinder() {
+            public boolean setViewValue(View view, Cursor cursor, int columnIndex) {
+                //Let the adapter handle the binding if the column is not TYPE
+                if (columnIndex != COLUMN_TYPE) {
+                    return false;
+                }
+                int type = cursor.getInt(COLUMN_TYPE);
+                String label = null;
+                //Custom type? Then get the custom label
+                if (type == Phone.TYPE_CUSTOM) {
+                    label = cursor.getString(COLUMN_LABEL);
+                }
+                //Get the readable string
+                String text = (String) Phone.getTypeLabel(getResources(), type, label);
+                //Set text
+                ((TextView) view).setText(text);
+                return true;
+            }
+        });
         setListAdapter(adapter);
     }
-  
-}
+
+    private static final String[] PHONE_PROJECTION = new String[] {
+        Phone._ID,
+        Phone.TYPE,
+        Phone.LABEL,
+        Phone.NUMBER
+    };
+
+    private static final int COLUMN_TYPE = 1;;
+    private static final int COLUMN_LABEL = 2;
+}
\ No newline at end of file
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 e773db6..ff5406f 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/List7.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/List7.java
@@ -16,12 +16,15 @@
 
 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.ContactsContract.CommonDataKinds.Phone;
 import android.os.Bundle;
-import android.provider.ContactsContract;
 import android.view.View;
 import android.widget.AdapterView;
 import android.widget.AdapterView.OnItemSelectedListener;
@@ -33,69 +36,64 @@
  * A list view example where the data comes from a cursor.
  */
 public class List7 extends ListActivity implements OnItemSelectedListener {
-    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;
 
+    private static final String[] PHONE_PROJECTION = new String[] {
+        Phone._ID,
+        Phone.TYPE,
+        Phone.LABEL,
+        Phone.NUMBER,
+        Phone.DISPLAY_NAME
+    };
+
+    private static final int COLUMN_PHONE_TYPE = 1;
+    private static final int COLUMN_PHONE_LABEL = 2;
+    private static final int COLUMN_PHONE_NUMBER = 3;
+
     @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 = managedQuery(ContactsContract.Contacts.CONTENT_URI,
-                PROJECTION, null, null, null);
-        mIdColumnIndex = c.getColumnIndex(ContactsContract.Contacts._ID);
-        mHasPhoneColumnIndex = c.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER);
+        // Get a cursor with all numbers.
+        // This query will only return contacts with phone numbers
+        Cursor c = getContentResolver().query(Phone.CONTENT_URI,
+                PHONE_PROJECTION, Phone.NUMBER + " NOT NULL", null, null);
+        startManagingCursor(c);
 
         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 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
+                // Use a template that displays a text view
+                android.R.layout.simple_list_item_1,
+                // Give the cursor to the list adapter
+                c,
+                // Map the DISPLAY_NAME column to...
+                new String[] {Phone.DISPLAY_NAME},
+                // The "text1" view defined in the XML template
+                new int[] {android.R.id.text1});
         setListAdapter(adapter);
     }
 
-    public void onItemSelected(AdapterView parent, View v, int position, long id) {
+    public void onItemSelected(AdapterView<?> parent, View v, int position, long id) {
         if (position >= 0) {
-            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);                
+            //Get current cursor
+            Cursor c = (Cursor) parent.getItemAtPosition(position);
+            int type = c.getInt(COLUMN_PHONE_TYPE);
+            String phone = c.getString(COLUMN_PHONE_NUMBER);
+            String label = null;
+            //Custom type? Then get the custom label
+            if (type == Phone.TYPE_CUSTOM) {
+                label = c.getString(COLUMN_PHONE_LABEL);
             }
+            //Get the readable string
+            String numberType = (String) Phone.getTypeLabel(getResources(), type, label);
+            String text = numberType + ": " + phone;
+            mPhone.setText(text);
         }
     }
 
-    public void onNothingSelected(AdapterView parent) {
-        mPhone.setText(R.string.list_7_nothing);
+    public void onNothingSelected(AdapterView<?> parent) {
     }
 }
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/List9.java b/samples/ApiDemos/src/com/example/android/apis/view/List9.java
index 15b3cc1..b2aea05 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/List9.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/List9.java
@@ -111,8 +111,8 @@
     
    
     
-    public void onScroll(AbsListView view, int firstVisibleItem, int visibleItemCount, int totalItemCount) {
-        int lastItem = firstVisibleItem + visibleItemCount - 1;
+    public void onScroll(AbsListView view, int firstVisibleItem,
+            int visibleItemCount, int totalItemCount) {
         if (mReady) {
             char firstLetter = mStrings[firstVisibleItem].charAt(0);
             
@@ -120,8 +120,6 @@
 
                 mShowing = true;
                 mDialogText.setVisibility(View.VISIBLE);
-               
-
             }
             mDialogText.setText(((Character)firstLetter).toString());
             mHandler.removeCallbacks(mRemoveWindow);
@@ -316,5 +314,4 @@
             "Woodside Cabecou", "Xanadu", "Xynotyro", "Yarg Cornish",
             "Yarra Valley Pyramid", "Yorkshire Blue", "Zamorano",
             "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano"};
-
 }
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/RatingBar1.java b/samples/ApiDemos/src/com/example/android/apis/view/RatingBar1.java
index 97416d4..5fbf6dd 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/RatingBar1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/RatingBar1.java
@@ -19,7 +19,6 @@
 import android.app.Activity;
 import android.os.Bundle;
 import android.widget.RatingBar;
-import android.widget.SeekBar;
 import android.widget.TextView;
 
 import com.example.android.apis.R;
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 1af3c81..02fcd0e 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/ScrollView2.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/ScrollView2.java
@@ -24,7 +24,6 @@
 import android.widget.TextView;
 import android.widget.Button;
 
-
 /**
  * Demonstrates wrapping a layout in a ScrollView.
  *
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/TableLayout10.java b/samples/ApiDemos/src/com/example/android/apis/view/TableLayout10.java
index f1f8f24..f904f84 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/TableLayout10.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/TableLayout10.java
@@ -19,15 +19,9 @@
 import com.example.android.apis.R;
 
 import android.app.Activity;
-import android.widget.TableLayout;
-import android.widget.Button;
 import android.os.Bundle;
-import android.view.View;
-
 
 public class TableLayout10 extends Activity {
-    private boolean mShrink;
-
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/TableLayout11.java b/samples/ApiDemos/src/com/example/android/apis/view/TableLayout11.java
index 770238f..09b19a2 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/TableLayout11.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/TableLayout11.java
@@ -25,8 +25,6 @@
  * <p>This example shows how to use horizontal gravity in a table layout.</p>
  */
 public class TableLayout11 extends Activity {
-    private boolean mShrink;
-
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/TableLayout12.java b/samples/ApiDemos/src/com/example/android/apis/view/TableLayout12.java
index 14cbd0d..f3fe850 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/TableLayout12.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/TableLayout12.java
@@ -25,8 +25,6 @@
  * <p>This example shows how to use cell spanning in a table layout.</p>
  */
 public class TableLayout12 extends Activity {
-    private boolean mShrink;
-
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/Tabs1.java b/samples/ApiDemos/src/com/example/android/apis/view/Tabs1.java
index 455969e..39f7e9b 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/Tabs1.java
+++ b/samples/ApiDemos/src/com/example/android/apis/view/Tabs1.java
@@ -21,7 +21,6 @@
 import android.widget.TabHost;
 import android.widget.TabHost.TabSpec;
 import android.view.LayoutInflater;
-import android.view.View;
 
 import com.example.android.apis.R;
 
diff --git a/samples/GlobalTime/src/com/android/globaltime/GlobalTime.java b/samples/GlobalTime/src/com/android/globaltime/GlobalTime.java
index d96b644..e27ee56 100644
--- a/samples/GlobalTime/src/com/android/globaltime/GlobalTime.java
+++ b/samples/GlobalTime/src/com/android/globaltime/GlobalTime.java
@@ -898,7 +898,7 @@
 
         // The '2' key zooms out
         case KeyEvent.KEYCODE_2:
-            if (!mAlphaKeySet && !mDisplayWorldFlat) {
+            if (!mAlphaKeySet && !mDisplayWorldFlat && mInitialized) {
                 mGLView.zoom(-2);
                 handled = true;
             }
@@ -906,7 +906,7 @@
 
         // The '8' key zooms in
         case KeyEvent.KEYCODE_8:
-            if (!mAlphaKeySet && !mDisplayWorldFlat) {
+            if (!mAlphaKeySet && !mDisplayWorldFlat && mInitialized) {
                 mGLView.zoom(2);
                 handled = true;
             }
diff --git a/samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java b/samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java
index a4ffef5..15c5923 100644
--- a/samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java
+++ b/samples/LunarLander/src/com/example/android/lunarlander/LunarLander.java
@@ -21,7 +21,6 @@
 import android.util.Log;
 import android.view.Menu;
 import android.view.MenuItem;
-import android.view.Window;
 import android.widget.TextView;
 
 import com.example.android.lunarlander.LunarView.LunarThread;
@@ -58,7 +57,7 @@
 
     /**
      * Invoked during init to give the Activity a chance to set up its Menu.
-     * 
+     *
      * @param menu the Menu to which entries may be added
      * @return true
      */
@@ -79,7 +78,7 @@
 
     /**
      * Invoked when the user selects an item from the Menu.
-     * 
+     *
      * @param item the Menu entry which was selected
      * @return true if the Menu item was legit (and we consumed it), false
      *         otherwise
@@ -116,7 +115,7 @@
 
     /**
      * Invoked when the Activity is created.
-     * 
+     *
      * @param savedInstanceState a Bundle containing state saved from a previous
      *        execution, or null if this is a new execution
      */
@@ -157,7 +156,7 @@
     /**
      * Notification that something is about to happen, to give the Activity a
      * chance to save state.
-     * 
+     *
      * @param outState a Bundle into which this Activity should save its state
      */
     @Override
diff --git a/samples/LunarLander/src/com/example/android/lunarlander/LunarView.java b/samples/LunarLander/src/com/example/android/lunarlander/LunarView.java
index c52c7ab..2a46147 100644
--- a/samples/LunarLander/src/com/example/android/lunarlander/LunarView.java
+++ b/samples/LunarLander/src/com/example/android/lunarlander/LunarView.java
@@ -37,7 +37,7 @@
 
 /**
  * View that draws, takes keystrokes, etc. for a simple LunarLander game.
- * 
+ *
  * Has a mode which RUNNING, PAUSED, etc. Has a x, y, dx, dy, ... capturing the
  * current ship physics. All x/y etc. are measured with (0,0) at the lower left.
  * updatePhysics() advances the physics based on realtime. draw() renders the
@@ -112,14 +112,14 @@
 
         /**
          * Current height of the surface/canvas.
-         * 
+         *
          * @see #setSurfaceSize
          */
         private int mCanvasHeight = 1;
 
         /**
          * Current width of the surface/canvas.
-         * 
+         *
          * @see #setSurfaceSize
          */
         private int mCanvasWidth = 1;
@@ -321,7 +321,7 @@
          * Restores game state from the indicated Bundle. Typically called when
          * the Activity is being restored after having been previously
          * destroyed.
-         * 
+         *
          * @param savedState Bundle containing the game state
          */
         public synchronized void restoreState(Bundle savedState) {
@@ -372,7 +372,7 @@
         /**
          * Dump game state to the provided Bundle. Typically called when the
          * Activity is being suspended.
-         * 
+         *
          * @return Bundle with this view's state
          */
         public Bundle saveState(Bundle map) {
@@ -400,7 +400,7 @@
 
         /**
          * Sets the current difficulty.
-         * 
+         *
          * @param difficulty
          */
         public void setDifficulty(int difficulty) {
@@ -423,7 +423,7 @@
          * Passing true allows the thread to run; passing false will shut it
          * down if it's already running. Calling start() after this was most
          * recently called with false will result in an immediate shutdown.
-         * 
+         *
          * @param b true to run, false to shut down
          */
         public void setRunning(boolean b) {
@@ -433,7 +433,7 @@
         /**
          * Sets the game mode. That is, whether we are running, paused, in the
          * failure state, in the victory state, etc.
-         * 
+         *
          * @see #setState(int, CharSequence)
          * @param mode one of the STATE_* constants
          */
@@ -446,7 +446,7 @@
         /**
          * Sets the game mode. That is, whether we are running, paused, in the
          * failure state, in the victory state, etc.
-         * 
+         *
          * @param mode one of the STATE_* constants
          * @param message string to add to screen or null
          */
@@ -509,7 +509,7 @@
                 mCanvasHeight = height;
 
                 // don't forget to resize the background image
-                mBackgroundImage = mBackgroundImage.createScaledBitmap(
+                mBackgroundImage = Bitmap.createScaledBitmap(
                         mBackgroundImage, width, height, true);
             }
         }
@@ -527,7 +527,7 @@
 
         /**
          * Handles a key-down event.
-         * 
+         *
          * @param keyCode the key that was pressed
          * @param msg the original event object
          * @return true
@@ -539,8 +539,6 @@
                 if (keyCode == KeyEvent.KEYCODE_DPAD_DOWN) okStart = true;
                 if (keyCode == KeyEvent.KEYCODE_S) okStart = true;
 
-                boolean center = (keyCode == KeyEvent.KEYCODE_DPAD_UP);
-
                 if (okStart
                         && (mMode == STATE_READY || mMode == STATE_LOSE || mMode == STATE_WIN)) {
                     // ready-to-start -> start
@@ -579,7 +577,7 @@
 
         /**
          * Handles a key-up event.
-         * 
+         *
          * @param keyCode the key that was pressed
          * @param msg the original event object
          * @return true if the key was handled and consumed, or else false
@@ -807,7 +805,7 @@
 
     /**
      * Fetches the animation thread corresponding to this LunarView.
-     * 
+     *
      * @return the animation thread
      */
     public LunarThread getThread() {
diff --git a/testrunner/adb_interface.py b/testrunner/adb_interface.py
index 451d046..1928c73 100755
--- a/testrunner/adb_interface.py
+++ b/testrunner/adb_interface.py
@@ -315,19 +315,10 @@
     self.SendCommand("wait-for-device")
     # Now the device is there, but may not be running.
     # Query the package manager with a basic command
-    pm_found = False
-    attempts = 0
-    wait_period = 5
-    while not pm_found and (attempts*wait_period) < wait_time:
-      # assume the 'adb shell pm path android' command will always
-      # return 'package: something' in the success case
-      output = self.SendShellCommand("pm path android", retry_count=1)
-      if "package:" in output:
-        pm_found = True
-      else:
-        time.sleep(wait_period)
-        attempts += 1
-    if not pm_found:
+    try:
+      self._WaitForShellCommandContents("pm path android", "package:",
+                                        wait_time)
+    except errors.WaitForResponseTimedOutError:
       raise errors.WaitForResponseTimedOutError(
           "Package manager did not respond after %s seconds" % wait_time)
 
@@ -344,28 +335,88 @@
     instrumentation_path = "%s/%s" % (package_name, runner_name)
     logger.Log("Waiting for instrumentation to be present")
     # Query the package manager
-    inst_found = False
-    attempts = 0
-    wait_period = 5
-    while not inst_found and (attempts*wait_period) < wait_time:
-      # assume the 'adb shell pm list instrumentation'
-      # return 'instrumentation: something' in the success case
-      try:
-        output = self.SendShellCommand("pm list instrumentation | grep %s"
-                                       % instrumentation_path, retry_count=1)
-        if "instrumentation:" in output:
-          inst_found = True
-      except errors.AbortError, e:
-        # ignore
-        pass
-      if not inst_found:
-        time.sleep(wait_period)
-        attempts += 1
-    if not inst_found:
+    try:
+      command = "pm list instrumentation | grep %s" % instrumentation_path
+      self._WaitForShellCommandContents(command, "instrumentation:", wait_time,
+                                        raise_abort=False)
+    except errors.WaitForResponseTimedOutError :
       logger.Log(
           "Could not find instrumentation %s on device. Does the "
           "instrumentation in test's AndroidManifest.xml match definition"
           "in test_defs.xml?" % instrumentation_path)
+      raise
+
+  def WaitForProcess(self, name, wait_time=120):
+    """Wait until a process is running on the device.
+
+    Args:
+      name: the process name as it appears in `ps`
+      wait_time: time in seconds to wait
+
+    Raises:
+      WaitForResponseTimedOutError if wait_time elapses and the process is
+          still not running
+    """
+    logger.Log("Waiting for process %s" % name)
+    self.SendCommand("wait-for-device")
+    self._WaitForShellCommandContents("ps", name, wait_time)
+
+  def WaitForProcessEnd(self, name, wait_time=120):
+    """Wait until a process is no longer running on the device.
+
+    Args:
+      name: the process name as it appears in `ps`
+      wait_time: time in seconds to wait
+
+    Raises:
+      WaitForResponseTimedOutError if wait_time elapses and the process is
+          still running
+    """
+    logger.Log("Waiting for process %s to end" % name)
+    self._WaitForShellCommandContents("ps", name, wait_time, invert=True)
+
+  def _WaitForShellCommandContents(self, command, expected, wait_time,
+                                   raise_abort=True, invert=False):
+    """Wait until the response to a command contains a given output.
+
+    Assumes that a only successful execution of "adb shell <command>" contains
+    the substring expected. Assumes that a device is present.
+
+    Args:
+      command: adb shell command to execute
+      expected: the string that should appear to consider the
+          command successful.
+      wait_time: time in seconds to wait
+      raise_abort: if False, retry when executing the command raises an
+          AbortError, rather than failing.
+      invert: if True, wait until the command output no longer contains the
+          expected contents.
+
+    Raises:
+      WaitForResponseTimedOutError: If wait_time elapses and the command has not
+          returned an output containing expected yet.
+    """
+    # Query the device with the command
+    success = False
+    attempts = 0
+    wait_period = 5
+    while not success and (attempts*wait_period) < wait_time:
+      # assume the command will always contain expected in the success case
+      try:
+        output = self.SendShellCommand(command, retry_count=1)
+        if ((not invert and expected in output)
+            or (invert and expected not in output)):
+          success = True
+      except errors.AbortError, e:
+        if raise_abort:
+          raise
+        # ignore otherwise
+
+      if not success:
+        time.sleep(wait_period)
+        attempts += 1
+
+    if not success:
       raise errors.WaitForResponseTimedOutError()
 
   def WaitForBootComplete(self, wait_time=120):
diff --git a/testrunner/test_defs/test_walker.py b/testrunner/test_defs/test_walker.py
index 06c4e6d..4ef6923 100755
--- a/testrunner/test_defs/test_walker.py
+++ b/testrunner/test_defs/test_walker.py
@@ -116,7 +116,8 @@
     Args:
       path: absolute file system path to check
       tests: current list of found tests
-      build_path: the parent directory where Android.mk was found
+      build_path: the parent directory where Android.mk that builds sub-folders
+        was found
 
     Returns:
       updated list of tests
@@ -124,17 +125,31 @@
     if not os.path.isdir(path):
       return tests
     filenames = os.listdir(path)
-    # Try to build as much of original path as possible, so
-    # keep track of upper-most parent directory where Android.mk was found
-    # this is also necessary in case of overlapping tests
-    # ie if a test exists at 'foo' directory  and 'foo/sub', attempting to
-    # build both 'foo' and 'foo/sub' will fail.
-    if not build_path and filenames.count(android_mk.AndroidMK.FILENAME):
-      build_path = self._MakePathRelativeToBuild(path)
     if filenames.count(android_manifest.AndroidManifest.FILENAME):
       # found a manifest! now parse it to find the test definition(s)
       manifest = android_manifest.AndroidManifest(app_path=path)
-      tests.extend(self._CreateSuitesFromManifest(manifest, build_path))
+      if not build_path:
+        # haven't found a parent makefile which builds this dir. Use current
+        # dir as build path
+        tests.extend(self._CreateSuitesFromManifest(
+            manifest, self._MakePathRelativeToBuild(path)))
+      else:
+        tests.extend(self._CreateSuitesFromManifest(manifest, build_path))
+    # Try to build as much of original path as possible, so
+    # keep track of upper-most parent directory where Android.mk was found that
+    # has rule to build sub-directory makefiles
+    # this is also necessary in case of overlapping tests
+    # ie if a test exists at 'foo' directory  and 'foo/sub', attempting to
+    # build both 'foo' and 'foo/sub' will fail.
+    if filenames.count(android_mk.AndroidMK.FILENAME):
+      android_mk_parser = android_mk.AndroidMK(app_path=path)
+      if android_mk_parser.HasInclude('call all-makefiles-under,$(LOCAL_PATH)'):
+        # found rule to build sub-directories. The parent path can be used, 
+        # or if not set, use current path
+        if not build_path:
+          build_path = self._MakePathRelativeToBuild(path)
+      else:
+        build_path = None
     for filename in filenames:
       self._FindSubTests(os.path.join(path, filename), tests, build_path)
     return tests
diff --git a/tools/monkeyrunner/Android.mk b/tools/monkeyrunner/Android.mk
deleted file mode 100644
index d15c67e..0000000
--- a/tools/monkeyrunner/Android.mk
+++ /dev/null
@@ -1,18 +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.
-#
-MONKEYRUNNER_LOCAL_DIR := $(call my-dir)
-include $(MONKEYRUNNER_LOCAL_DIR)/etc/Android.mk
-include $(MONKEYRUNNER_LOCAL_DIR)/src/Android.mk
diff --git a/tools/monkeyrunner/MODULE_LICENSE_APACHE2 b/tools/monkeyrunner/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/tools/monkeyrunner/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/tools/monkeyrunner/NOTICE b/tools/monkeyrunner/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/tools/monkeyrunner/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
-   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/tools/monkeyrunner/etc/Android.mk b/tools/monkeyrunner/etc/Android.mk
deleted file mode 100644
index 2d757fd..0000000
--- a/tools/monkeyrunner/etc/Android.mk
+++ /dev/null
@@ -1,20 +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.
-#
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_PREBUILT_EXECUTABLES := monkeyrunner
-include $(BUILD_HOST_PREBUILT)
diff --git a/tools/monkeyrunner/etc/manifest.txt b/tools/monkeyrunner/etc/manifest.txt
deleted file mode 100644
index 288be5f..0000000
--- a/tools/monkeyrunner/etc/manifest.txt
+++ /dev/null
@@ -1 +0,0 @@
-Main-Class: com.android.monkeyrunner.MonkeyRunner
diff --git a/tools/monkeyrunner/etc/monkeyrunner b/tools/monkeyrunner/etc/monkeyrunner
deleted file mode 100755
index 364be2a..0000000
--- a/tools/monkeyrunner/etc/monkeyrunner
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/bin/sh
-# Copyright 2005-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.
-
-# Set up prog to be the path of this script, including following symlinks,
-# and set up progdir to be the fully-qualified pathname of its directory.
-prog="$0"
-while [ -h "${prog}" ]; do
-    newProg=`/bin/ls -ld "${prog}"`
-    newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
-    if expr "x${newProg}" : 'x/' >/dev/null; then
-        prog="${newProg}"
-    else
-        progdir=`dirname "${prog}"`
-        prog="${progdir}/${newProg}"
-    fi
-done
-oldwd=`pwd`
-progdir=`dirname "${prog}"`
-cd "${progdir}"
-progdir=`pwd`
-prog="${progdir}"/`basename "${prog}"`
-cd "${oldwd}"
-
-jarfile=monkeyrunner.jar
-frameworkdir="$progdir"
-libdir="$progdir"
-if [ ! -r "$frameworkdir/$jarfile" ]
-then
-    frameworkdir=`dirname "$progdir"`/tools/lib
-    libdir=`dirname "$progdir"`/tools/lib
-fi
-if [ ! -r "$frameworkdir/$jarfile" ]
-then
-    frameworkdir=`dirname "$progdir"`/framework
-    libdir=`dirname "$progdir"`/lib
-fi
-if [ ! -r "$frameworkdir/$jarfile" ]
-then
-    echo `basename "$prog"`": can't find $jarfile"
-    exit 1
-fi
-
-
-# Check args.
-if [ debug = "$1" ]; then
-    # add this in for debugging
-    java_debug=-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y
-    shift 1
-else
-    java_debug=
-fi
-
-if [ "$OSTYPE" = "cygwin" ] ; then
-    jarpath=`cygpath -w  "$frameworkdir/$jarfile"`
-    progdir=`cygpath -w  "$progdir"`
-else
-    jarpath="$frameworkdir/$jarfile"
-fi
-
-# need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
-# might need more memory, e.g. -Xmx128M
-exec java -Xmx128M $os_opts $java_debug -Djava.ext.dirs="$frameworkdir" -Djava.library.path="$libdir" -Dcom.android.monkeyrunner.bindir="$progdir" -jar "$jarpath" "$@"
diff --git a/tools/monkeyrunner/src/Android.mk b/tools/monkeyrunner/src/Android.mk
deleted file mode 100644
index fb6b9c1..0000000
--- a/tools/monkeyrunner/src/Android.mk
+++ /dev/null
@@ -1,51 +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.
-#
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_JAR_MANIFEST := ../etc/manifest.txt
-LOCAL_JAVA_LIBRARIES := \
-	ddmlib \
-	jython \
-	xmlwriter
-
-
-LOCAL_MODULE := monkeyrunner
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
-# Build ext.jar
-# ============================================================
-
-ext_dirs := 	../../../../external/xmlwriter/src
-
-ext_src_files := $(call all-java-files-under,$(ext_dirs))
-
-# ====  the library  =========================================
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(ext_src_files)
-
-LOCAL_NO_STANDARD_LIBRARIES := true
-#LOCAL_JAVA_LIBRARIES := core
-#LOCAL_STATIC_JAVA_LIBRARIES := libgoogleclient
-
-LOCAL_MODULE := xmlwriter
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
diff --git a/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRecorder.java b/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRecorder.java
deleted file mode 100644
index f06eafd..0000000
--- a/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRecorder.java
+++ /dev/null
@@ -1,299 +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.monkeyrunner;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.text.SimpleDateFormat;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.jheer.XMLWriter;
-
-/**
- *  MonkeyRecorder is a host side class that records the output of scripts that are run. 
- *  It creates a unique directory, puts in an xml file that records each cmd and result.
- *  It stores every screenshot in this directory.
- *  When finished, it zips this all up.
- *
- *  Calling Sequence:
- *    mr = new MonkeyRecorder(scriptName);
- *    mr.startCommand();
- *    [mr.addAttribute(name, value);]
- *    ...
- *    [mr.addInput(cmd);]
- *    [mr.addResults(result, filename);]   // filename = "" if no screenshot
- *    mr.endCommand();
- *    mr.addComment(comment);
- *    mr.startCommand();
- *    ...
- *    mr.endCommand();
- *    ...
- *    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 like:
- *
- *  <?xml version="1.0" encoding='UTF-8'?>
- *  <!-- 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"/>
- *    ...
- *    <!-- Script commands -->
- *    <command>
- *      dateTime="20090921-17:08:43"
- *      <input cmd="Pressing: menu"/>
- *      <response result="OK" dateTime="20090921-17:08:43"/>
- *    </command>
- *    ...
- *    <command>
- *      dateTime="20090921-17:09:44"
- *      <input cmd="grabscreen"/>
- *      <response result="OK" dateTime="20090921-17:09:45" screenshot="home_screen-20090921-17:09:45.png"/>
- *    </command>
- *    ...
- *  </script_run>
- *  
- *  And then zip it up with all the screenshots in the file: <script_name>-yyyyMMdd-HH:mm:ss.zip.
- */
- 
-public class MonkeyRecorder {
-
-  // xml file to store output results in
-  private static String mXmlFilename;
-  private static FileWriter mXmlFile;
-  private static XMLWriter mXmlWriter;
-  
-  // unique subdirectory to put results in (screenshots and xml file)
-  private static String mDirname;
-  private static List<String> mScreenShotNames = new ArrayList<String>();
-  
-  // where we store all the results for all the script runs
-  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");
-  
-  /**
-   * 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, 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
-    mDirname = ROOT_DIR + "/" + stripType(scriptName) + "-" + now();
-    new File(mDirname).mkdirs();
-    
-    // Initialize xml file
-    mXmlFilename = stampFilename(stripType(scriptName) + ".xml");
-    initXmlFile(scriptName, version);
-  }
-
-  // Get the current date and time in a simple string format (used for timestamping filenames)
-  private static String now() {
-    return SIMPLE_DATE_TIME_FORMAT.format(Calendar.getInstance().getTime());     
-  }
-  
-  /**
-   * 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, 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", names, values, names.length);
-  }
-  
-  /**
-   * Add a comment to the xml file.
-   * 
-   * @param comment comment to add to the xml file
-   */
-  public static void addComment(String comment) throws IOException {
-    mXmlWriter.comment(comment);
-  }
-    
-  /**
-   * Begin writing a command xml element
-   */
-  public static void startCommand() throws IOException {
-    mXmlWriter.start("command", "dateTime", now());
-  }
-  
-  /**
-   * Write a command name attribute in a command xml element.  
-   * It's add as a sinlge script command could be multiple monkey commands.
-   * 
-   * @param cmd command sent to the monkey
-   */
-  public static void addInput(String cmd)  throws IOException {
-    String name = "cmd";
-    String value = cmd;
-    mXmlWriter.tag("input", name, value);
-  }
-  
-  /**
-   * Write a response xml element in a command.  
-   * Attributes include the monkey result, datetime, and possibly screenshot filename
-   * 
-   * @param result response of the monkey to the command
-   * @param filename filename of the screen shot (or other file to be included)
-   */
-  public static void addResult(String result, String filename) throws IOException {
-    int num_args = 2;
-    String[] names = new String[3];
-    String[] values = new String[3];
-    names[0] = "result";
-    values[0] = result;
-    names[1] = "dateTime";
-    values[1] = now();
-    if (filename.length() != 0) {
-      names[2] = "screenshot";
-      values[2] = stampFilename(filename); 
-      addScreenShot(filename);
-      num_args = 3;
-    }
-    mXmlWriter.tag("response", names, values, num_args); 
-  }
-  
-  /**
-   * Add an attribut to an open xml element. name="escaped_value"
-   * 
-   * @param name name of the attribute
-   * @param value value of the attribute
-   */
-  public static void addAttribute(String name, String value) throws IOException {
-    mXmlWriter.addAttribute(name, value);
-  }
-
-   /**
-   * Add an xml device variable element. name="escaped_value"
-   * 
-   * @param name name of the variable
-   * @param value value of the variable
-   */
-  public static void addDeviceVar(String name, String value) throws IOException {
-    String[] names = {"name", "value"};
-    String[] values = {name, value};
-    mXmlWriter.tag("device_var", names, values, names.length);
-  }
- 
-  /**
-   * Move the screenshot to storage and remember you did it so it can be zipped up later.
-   * 
-   * @param filename file name of the screenshot to be stored (Not path name)
-   */
-  private static void addScreenShot(String filename) {
-    File file = new File(filename);
-    String screenShotName = stampFilename(filename);
-    file.renameTo(new File(mDirname, screenShotName));
-    mScreenShotNames.add(screenShotName);
-  }
-
-  /**
-   * Finish writing a command xml element
-   */
-  public static void endCommand() throws IOException {
-    mXmlWriter.end();
-  }
-  
-  /**
-   * Add datetime in front of filetype (the stuff after and including the last infamous '.')
-   *
-   * @param filename path of file to be stamped
-   */
-  private static String stampFilename(String filename) {
-    // 
-    int typeIndex = filename.lastIndexOf('.');
-    if (typeIndex == -1) {
-      return filename + "-" + now();
-    }  
-    return filename.substring(0, typeIndex) + "-" + now() + filename.substring(typeIndex);
-  }
-  
-  /**
-   * Strip out the file type (the stuff after and including the last infamous '.')
-   *
-   * @param filename path of file to be stripped of type information
-   */
-   private static String stripType(String filename) {
-    // 
-    int typeIndex = filename.lastIndexOf('.');
-    if (typeIndex == -1)
-      return filename;
-    return filename.substring(0, typeIndex);
-  }
-
-  /**
-   * Close the monkeyRecorder by closing the xml file and zipping it up with the screenshots.
-   *
-   * @param filename path of file to be stripped of type information
-   */ 
-  public static void close() throws IOException {
-    // zip up xml file and screenshots into ROOT_DIR.
-    byte[] buf = new byte[1024];
-    String zipFileName = mXmlFilename + ".zip";
-    endCommand();
-    mXmlFile.close();
-    FileOutputStream zipFile = new FileOutputStream(ROOT_DIR + "/" + zipFileName);
-    ZipOutputStream out = new ZipOutputStream(zipFile);
-
-    // add the xml file
-    addFileToZip(out, mDirname + "/" + mXmlFilename, buf);
-    
-    // Add the screenshots
-    for (String filename : mScreenShotNames) {
-      addFileToZip(out, mDirname + "/" + filename, buf);
-    }
-    out.close();
-  }
-  
-  /**
-   * Helper function to zip up a file into an open zip archive.
-   *
-   * @param zip the stream of the zip archive
-   * @param filepath the filepath of the file to be added to the zip archive
-   * @param buf storage place to stage reads of file before zipping
-   */ 
-  private static void addFileToZip(ZipOutputStream zip, String filepath, byte[] buf) throws IOException {
-    FileInputStream in = new FileInputStream(filepath);
-    zip.putNextEntry(new ZipEntry(filepath));
-    int len;
-    while ((len = in.read(buf)) > 0) {
-      zip.write(buf, 0, len);
-    }
-    zip.closeEntry();
-    in.close();
-  }
-}
diff --git a/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRunner.java b/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRunner.java
deleted file mode 100644
index 4734ba1..0000000
--- a/tools/monkeyrunner/src/com/android/monkeyrunner/MonkeyRunner.java
+++ /dev/null
@@ -1,656 +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.monkeyrunner;
-
-import com.android.ddmlib.AndroidDebugBridge;
-import com.android.ddmlib.IDevice;
-import com.android.ddmlib.Log;
-import com.android.ddmlib.NullOutputReceiver;
-import com.android.ddmlib.RawImage;
-import com.android.ddmlib.Log.ILogOutput;
-import com.android.ddmlib.Log.LogLevel;
-
-import java.awt.image.BufferedImage;
-
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.net.InetAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.imageio.ImageIO;
-
-/**
- *  MonkeyRunner is a host side application to control a monkey instance on a
- *  device. MonkeyRunner provides some useful helper functions to control the
- *  device as well as various other methods to help script tests. 
- */
-public class MonkeyRunner {
-
-  static String monkeyServer = "127.0.0.1";
-  static int monkeyPort = 1080;
-  static Socket monkeySocket = null;
-
-  static IDevice monkeyDevice;
-
-  static BufferedReader monkeyReader;
-  static BufferedWriter monkeyWriter;
-  static String monkeyResponse;
-
-  static MonkeyRecorder monkeyRecorder;
-
-  static String scriptName = null;
-  
-  // Obtain a suitable logger.
-  private static Logger logger = Logger.getLogger("com.android.monkeyrunner");
-
-  // delay between key events
-  final static int KEY_INPUT_DELAY = 1000;
-  
-  // version of monkey runner
-  final static String monkeyRunnerVersion = "0.4";
-
-  // TODO: interface cmd; class xml tags; fix logger; test class/script
-
-  public static void main(String[] args) throws IOException {
-
-    // haven't figure out how to get below INFO...bad parent.  Pass -v INFO to turn on logging 
-    logger.setLevel(Level.parse("WARNING"));  
-    processOptions(args);
-    
-    logger.info("initAdb");
-    initAdbConnection();
-    logger.info("openMonkeyConnection");
-    openMonkeyConnection();
-
-    logger.info("start_script");
-    start_script();
-    
-    logger.info("ScriptRunner.run");
-    ScriptRunner.run(scriptName);
-   
-    logger.info("end_script");
-    end_script();
-    logger.info("closeMonkeyConnection");
-    closeMonkeyConnection();  
-  }
-
-  /**
-   *  Initialize an adb session with a device connected to the host
-   * 
-   */
-  public static void initAdbConnection() {
-    String adbLocation = "adb";
-    boolean device = false;
-    boolean emulator = false;
-    String serial = null;
-
-    AndroidDebugBridge.init(false /* debugger support */);
-
-    try {
-      AndroidDebugBridge bridge = AndroidDebugBridge.createBridge(
-          adbLocation, true /* forceNewBridge */);
-
-      // we can't just ask for the device list right away, as the internal thread getting
-      // them from ADB may not be done getting the first list.
-      // Since we don't really want getDevices() to be blocking, we wait here manually.
-      int count = 0;
-      while (bridge.hasInitialDeviceList() == false) {
-        try {
-          Thread.sleep(100);
-          count++;
-        } catch (InterruptedException e) {
-          // pass
-        }
-
-        // let's not wait > 10 sec.
-        if (count > 100) {
-          System.err.println("Timeout getting device list!");
-          return;
-        }
-      }
-
-      // now get the devices
-      IDevice[] devices = bridge.getDevices();
-
-      if (devices.length == 0) {
-        printAndExit("No devices found!", true /* terminate */);
-      }
-
-      monkeyDevice = null;
-
-      if (emulator || device) {
-        for (IDevice d : devices) {
-          // this test works because emulator and device can't both be true at the same
-          // time.
-          if (d.isEmulator() == emulator) {
-            // if we already found a valid target, we print an error and return.
-            if (monkeyDevice != null) {
-              if (emulator) {
-                printAndExit("Error: more than one emulator launched!",
-                    true /* terminate */);
-              } else {
-                printAndExit("Error: more than one device connected!",true /* terminate */);
-              }
-            }
-            monkeyDevice = d;
-          }
-        }
-      } else if (serial != null) {
-        for (IDevice d : devices) {
-          if (serial.equals(d.getSerialNumber())) {
-            monkeyDevice = d;
-            break;
-          }
-        }
-      } else {
-        if (devices.length > 1) {
-          printAndExit("Error: more than one emulator or device available!",
-              true /* terminate */);
-        }
-        monkeyDevice = devices[0];
-      }
-
-      monkeyDevice.createForward(monkeyPort, monkeyPort);
-      String command = "monkey --port " + monkeyPort;
-      monkeyDevice.executeShellCommand(command, new NullOutputReceiver());
-
-    } catch(IOException e) {
-      e.printStackTrace();
-    }
-  }
-
-  /**
-   * Open a tcp session over adb with the device to communicate monkey commands
-   */
-  public static void openMonkeyConnection() {
-    try {
-      InetAddress addr = InetAddress.getByName(monkeyServer);
-      monkeySocket = new Socket(addr, monkeyPort);
-      monkeyWriter = new BufferedWriter(new OutputStreamWriter(monkeySocket.getOutputStream()));
-      monkeyReader = new BufferedReader(new InputStreamReader(monkeySocket.getInputStream()));
-    } catch (UnknownHostException e) {
-      e.printStackTrace();
-    } catch(IOException e) {
-      e.printStackTrace();
-    }
-  }
-  
-  /** 
-   * Close tcp session with the monkey on the device
-   * 
-   */
-  public static void closeMonkeyConnection() {
-    try {
-      monkeyReader.close();
-      monkeyWriter.close();
-      monkeySocket.close();
-      AndroidDebugBridge.terminate();
-    } catch(IOException e) {
-      e.printStackTrace();
-    }
-  }
-
-  /** 
-   * This is a house cleaning routine to run before starting a script. Puts
-   * the device in a known state and starts recording interesting info.
-   */
-  public static void start_script() throws IOException {
-    press("menu", false);
-    press("menu", false);
-    press("home", false);
-    
-    // Start recording the script output, might want md5 signature of file for completeness
-    monkeyRecorder = new MonkeyRecorder(scriptName, monkeyRunnerVersion);
-
-    // Record what device we are running on
-    addDeviceVars();
-    monkeyRecorder.addComment("Script commands");
-  }
-
-  /** 
-   * This is a house cleaning routine to run after finishing a script.
-   * Puts the monkey server in a known state and closes the recording.
-   */
-  public static void end_script() throws IOException {
-    String command = "done";
-    sendMonkeyEvent(command, false, false);
-    
-    // Stop the recording and zip up the results
-    monkeyRecorder.close();
-  }
-
-  /** This is a method for scripts to launch an activity on the device
-   * 
-   * @param name The name of the activity to launch 
-   */
-  public static void launch_activity(String name) throws IOException {
-    System.out.println("Launching: " + name);
-    recordCommand("Launching: " + name);
-    monkeyDevice.executeShellCommand("am start -a android.intent.action.MAIN -n " 
-        + name, new NullOutputReceiver());
-    // void return, so no response given, just close the command element in the xml file.
-    monkeyRecorder.endCommand();
-   }
-
-  /**
-   * Grabs the current state of the screen stores it as a png
-   * 
-   * @param tag filename or tag descriptor of the screenshot
-   */
-  public static void grabscreen(String tag) throws IOException {
-    tag += ".png";
-
-    try {
-      Thread.sleep(1000);
-      getDeviceImage(monkeyDevice, tag, false);
-    } catch (InterruptedException e) {
-    }
-  }
-
-  /**
-   * Sleeper method for script to call
-   * 
-   * @param msec msecs to sleep for
-   */
-  public static void sleep(int msec) throws IOException {
-    try {
-      recordCommand("sleep: " + msec);
-      Thread.sleep(msec);
-      recordResponse("OK");
-    } catch (InterruptedException e) {
-      e.printStackTrace();
-    }
-  }
-
-  /**
-   * Tap function for scripts to call at a particular x and y location
-   * 
-   * @param x x-coordinate
-   * @param y y-coordinate
-   */
-  public static boolean tap(int x, int y) throws IOException {
-    String command = "tap " + x + " " + y;
-    boolean result = sendMonkeyEvent(command);
-    return result;
-  }
-
-  /** 
-   * Press function for scripts to call on a particular button or key
-   * 
-   * @param key key to press
-   */
-  public static boolean press(String key) throws IOException {
-    return press(key, true);
-  }
-
-  /** 
-   * Press function for scripts to call on a particular button or key
-   * 
-   * @param key key to press
-   * @param print whether to send output to user
-   */
-  private static boolean press(String key, boolean print) throws IOException {
-    String command = "press " + key;
-    boolean result = sendMonkeyEvent(command, print, true);
-    return result;
-  }
-
-  /**
-   * dpad down function
-   */
-  public static boolean down() throws IOException {
-    return press("dpad_down");
-  }
-
-  /**
-   * dpad up function
-   */
-  public static boolean up() throws IOException {
-    return press("dpad_up");
-  }
-
-  /**
-   * Function to type text on the device
-   * 
-   * @param text text to type
-   */
-  public static boolean type(String text) throws IOException {
-    boolean result = false;
-    // text might have line ends, which signal new monkey command, so we have to eat and reissue
-    String[] lines = text.split("[\\r\\n]+");
-    for (String line: lines) {
-      result = sendMonkeyEvent("type " + line + "\n");
-    }
-    // return last result.  Should never fail..?
-    return result;
-  }
-  
-  /**
-   * Function to get a static variable from the device
-   * 
-   * @param name name of static variable to get
-   */
-  public static boolean getvar(String name) throws IOException {
-    return sendMonkeyEvent("getvar " + name + "\n");
-  }
-
-  /**
-   * Function to get the list of static variables from the device
-   */
-  public static boolean listvar() throws IOException {
-    return sendMonkeyEvent("listvar \n");
-  }
-
-  /**
-   * This function is the communication bridge between the host and the device.
-   * It sends monkey events and waits for responses over the adb tcp socket.
-   * This version if for all scripted events so that they get recorded and reported to user.
-   * 
-   * @param command the monkey command to send to the device
-   */
-  private static boolean sendMonkeyEvent(String command) throws IOException {
-    return sendMonkeyEvent(command, true, true);
-  }
-
-  /**
-   * This function allows the communication bridge between the host and the device
-   * to be invisible to the script for internal needs.
-   * It splits a command into monkey events and waits for responses for each over an adb tcp socket.
-   * Returns on an error, else continues and sets up last response.
-   * 
-   * @param command the monkey command to send to the device
-   * @param print whether to print out the responses to the user
-   * @param record whether to put the command in the xml file that stores test outputs
-   */
-  private static boolean sendMonkeyEvent(String command, Boolean print, Boolean record) throws IOException {
-    command = command.trim();
-    if (print)
-      System.out.println("MonkeyCommand: " + command);
-    if (record)
-      recordCommand(command);
-    logger.info("Monkey Command: " + command + ".");
-      
-    // send a single command and get the response
-    monkeyWriter.write(command + "\n");
-    monkeyWriter.flush();
-    monkeyResponse = monkeyReader.readLine();
-
-    if(monkeyResponse != null) {
-      // if a command returns with a response
-      if (print)
-        System.out.println("MonkeyServer: " + monkeyResponse);
-      if (record)
-        recordResponse(monkeyResponse);
-      logger.info("Monkey Response: " + monkeyResponse + ".");
-
-      // return on error
-      if (monkeyResponse.startsWith("ERROR"))
-        return false;
-
-      // return on ok
-      if(monkeyResponse.startsWith("OK"))
-        return true;
-
-      // return on something else?
-      return false;
-    }
-    // didn't get a response...
-    if (print)
-      System.out.println("MonkeyServer: ??no response");
-    if (record)
-      recordResponse("??no response");
-    logger.info("Monkey Response: ??no response.");
-
-    //return on no response
-    return false;
-  }
-
-  /**
-   * Record the command in the xml file
-   *
-   * @param command the command sent to the monkey server
-   */
-  private static void recordCommand(String command) throws IOException {
-    if (monkeyRecorder != null) {                       // don't record setup junk
-      monkeyRecorder.startCommand();
-      monkeyRecorder.addInput(command);
-    }
-  }
-  
-  /**
-   * Record the response in the xml file
-   *
-   * @param response the response sent by the monkey server
-   */
-  private static void recordResponse(String response) throws IOException {
-    recordResponse(response, "");
-  } 
-  
-  /**
-   * Record the response and the filename in the xml file, store the file (to be zipped up later)
-   *
-   * @param response the response sent by the monkey server
-   * @param filename the filename of a file to be time stamped, recorded in the xml file and stored
-   */
-  private static void recordResponse(String response, String filename) throws IOException {
-    if (monkeyRecorder != null) {                    // don't record setup junk
-      monkeyRecorder.addResult(response, filename);  // ignores file if filename empty
-      monkeyRecorder.endCommand();
-    }
-  }
-    
-  /**
-   * Add the device variables to the xml file in monkeyRecorder.
-   * The results get added as device_var tags in the script_run tag
-   */
-  private static void addDeviceVars() throws IOException {
-    monkeyRecorder.addComment("Device specific variables");
-    sendMonkeyEvent("listvar \n", false, false);
-    if (monkeyResponse.startsWith("OK:")) {
-      // peel off "OK:" string and get the individual var names  
-      String[] varNames = monkeyResponse.substring(3).split("\\s+");
-      // grab all the individual var values
-      for (String name: varNames) {
-        sendMonkeyEvent("getvar " + name, false, false);
-        if(monkeyResponse != null) {
-          if (monkeyResponse.startsWith("OK") ) {
-            if (monkeyResponse.length() > 2) {
-              monkeyRecorder.addDeviceVar(name, monkeyResponse.substring(3));
-            } else { 
-              // only got OK - good variable but no value
-              monkeyRecorder.addDeviceVar(name, "null");
-            }
-          } else { 
-            // error returned - couldn't get var value for name... include error return
-            monkeyRecorder.addDeviceVar(name, monkeyResponse);
-          }
-        } else { 
-          // no monkeyResponse - bad variable with no value
-          monkeyRecorder.addDeviceVar(name, "null");
-        }
-      }
-    } else {
-      // it's an error, can't find variable names...
-      monkeyRecorder.addAttribute("listvar", monkeyResponse);
-    }
-  }
-  
-  /**
-   * Process the command-line options
-   *
-   * @return Returns true if options were parsed with no apparent errors.
-   */
-  private static void processOptions(String[] args) {
-    // parse command line parameters.
-    int index = 0;
-
-    do {
-      String argument = args[index++];
-
-      if ("-s".equals(argument)) {
-        if(index == args.length) {
-          printUsageAndQuit("Missing Server after -s");
-        }
-
-        monkeyServer = args[index++];
-
-      } else if ("-p".equals(argument)) {
-        // quick check on the next argument.
-        if (index == args.length) {
-          printUsageAndQuit("Missing Server port after -p");
-        }
-
-        monkeyPort = Integer.parseInt(args[index++]);
-
-      } else if ("-v".equals(argument)) {
-        // quick check on the next argument.
-        if (index == args.length) {
-          printUsageAndQuit("Missing Log Level after -v");
-        }
-
-        Level level = Level.parse(args[index++]);
-        logger.setLevel(level);
-        level = logger.getLevel();
-        System.out.println("Log level set to: " + level + "(" + level.intValue() + ").");
-        System.out.println("Warning: Log levels below INFO(800) not working currently... parent issues");
-        
-      } else if (argument.startsWith("-")) {
-        // we have an unrecognized argument.
-        printUsageAndQuit("Unrecognized argument: " + argument + ".");
-
-        monkeyPort = Integer.parseInt(args[index++]);
-
-      } else {
-        // get the filepath of the script to run.  This will be the last undashed argument.
-        scriptName = argument;
-      }
-    } while (index < args.length);
-  }
-
-  /*
-   * Grab an image from an ADB-connected device.
-   */
-  private static void getDeviceImage(IDevice device, String filepath, boolean landscape)
-  throws IOException {
-    RawImage rawImage;
-    recordCommand("grabscreen");
-    System.out.println("Grabbing Screeshot: " + filepath + ".");
-
-    try {
-      rawImage = device.getScreenshot();
-    }
-    catch (IOException ioe) {
-      recordResponse("No frame buffer", "");
-      printAndExit("Unable to get frame buffer: " + ioe.getMessage(), true /* terminate */);
-      return;
-    }
-
-    // device/adb not available?
-    if (rawImage == null) {
-      recordResponse("No image", "");
-      return;
-    }
-    
-    assert rawImage.bpp == 16;
-
-    BufferedImage image;
-    
-    logger.info("Raw Image - height: " + rawImage.height + ", width: " + rawImage.width);
-
-    if (landscape) {
-      // convert raw data to an Image
-      image = new BufferedImage(rawImage.height, rawImage.width,
-          BufferedImage.TYPE_INT_ARGB);
-
-      byte[] buffer = rawImage.data;
-      int index = 0;
-      for (int y = 0 ; y < rawImage.height ; y++) {
-        for (int x = 0 ; x < rawImage.width ; x++) {
-
-          int value = buffer[index++] & 0x00FF;
-          value |= (buffer[index++] << 8) & 0x0FF00;
-
-          int r = ((value >> 11) & 0x01F) << 3;
-          int g = ((value >> 5) & 0x03F) << 2;
-          int b = ((value >> 0) & 0x01F) << 3;
-
-          value = 0xFF << 24 | r << 16 | g << 8 | b;
-
-          image.setRGB(y, rawImage.width - x - 1, value);
-        }
-      }
-    } else {
-      // convert raw data to an Image
-      image = new BufferedImage(rawImage.width, rawImage.height,
-          BufferedImage.TYPE_INT_ARGB);
-
-      byte[] buffer = rawImage.data;
-      int index = 0;
-      for (int y = 0 ; y < rawImage.height ; y++) {
-        for (int x = 0 ; x < rawImage.width ; x++) {
-
-          int value = buffer[index++] & 0x00FF;
-          value |= (buffer[index++] << 8) & 0x0FF00;
-
-          int r = ((value >> 11) & 0x01F) << 3;
-          int g = ((value >> 5) & 0x03F) << 2;
-          int b = ((value >> 0) & 0x01F) << 3;
-
-          value = 0xFF << 24 | r << 16 | g << 8 | b;
-
-          image.setRGB(x, y, value);
-        }
-      }
-    }
-
-    if (!ImageIO.write(image, "png", new File(filepath))) {
-      recordResponse("No png writer", "");
-      throw new IOException("Failed to find png writer");
-    }
-    recordResponse("OK", filepath);
-  }
-
-  private static void printUsageAndQuit(String message) {
-    // 80 cols marker:  01234567890123456789012345678901234567890123456789012345678901234567890123456789
-    System.out.println(message);
-    System.out.println("Usage: monkeyrunner [options] SCRIPT_FILE");
-    System.out.println("");
-    System.out.println("    -s      MonkeyServer IP Address.");
-    System.out.println("    -p      MonkeyServer TCP Port.");
-    System.out.println("    -v      MonkeyServer Logging level (ALL, FINEST, FINER, FINE, CONFIG, INFO, WARNING, SEVERE, OFF)");
-    System.out.println("");
-    System.out.println("");
-
-    System.exit(1);
-  }
-
-  private static void printAndExit(String message, boolean terminate) {
-    System.out.println(message);
-    if (terminate) {
-      AndroidDebugBridge.terminate();
-    }
-    System.exit(1);
-  }
-}
diff --git a/tools/monkeyrunner/src/com/android/monkeyrunner/ScriptRunner.java b/tools/monkeyrunner/src/com/android/monkeyrunner/ScriptRunner.java
deleted file mode 100644
index 6a4405b..0000000
--- a/tools/monkeyrunner/src/com/android/monkeyrunner/ScriptRunner.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package com.android.monkeyrunner;
-
-import org.python.core.Py;
-import org.python.core.PyObject;
-import org.python.util.PythonInterpreter;
-import org.python.util.InteractiveConsole;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.FileInputStream;
-import java.lang.RuntimeException;
-import java.util.Properties;
-
-
-/**
- * Runs Jython based scripts.
- */
-public class ScriptRunner {
-
-  /** The "this" scope object for scripts. */
-  private final Object scope;
-  private final String variable;
-  
-  /** Private constructor. */
-  private ScriptRunner(Object scope, String variable) {
-    this.scope = scope;
-    this.variable = variable;
-  }
-  
-  /** Creates a new instance for the given scope object. */
-  public static ScriptRunner newInstance(Object scope, String variable) {
-    return new ScriptRunner(scope, variable);
-  }
-
-  /**
-   * Runs the specified Jython script. First runs the initialization script to
-   * preload the appropriate client library version.
-   */
-  public static void run(String scriptfilename) {
-    try {
-      initPython();
-      PythonInterpreter python = new PythonInterpreter();
-      
-      python.execfile(scriptfilename);
-    } catch(Exception e) {
-      e.printStackTrace();
-    }
-  }
-  
-
-  /** Initialize the python interpreter. */
-  private static void initPython() {
-    Properties props = new Properties();
-    // Default is 'message' which displays sys-package-mgr bloat
-    // Choose one of error,warning,message,comment,debug
-    props.setProperty("python.verbose", "error");
-    props.setProperty("python.path", System.getProperty("java.class.path"));
-    PythonInterpreter.initialize(System.getProperties(), props, new String[] {""});
-  }
-
-  /**
-   * Create and run a console using a new python interpreter for the test
-   * associated with this instance.
-   */
-  public void console() throws IOException {
-    initPython();
-    InteractiveConsole python = new InteractiveConsole();
-    initInterpreter(python, scope, variable);
-    python.interact();
-  }
-
-  /**
-   * Start an interactive python interpreter using the specified set of local
-   * variables. Use this to interrupt a running test script with a prompt:
-   * 
-   * @param locals
-   */
-  public static void console(PyObject locals) {
-    initPython();
-    InteractiveConsole python = new InteractiveConsole(locals);
-    python.interact();
-  }
-
-  /**
-   * Initialize a python interpreter.
-   * 
-   * @param python
-   * @param scope
-   * @throws IOException
-   */
-  public static void initInterpreter(PythonInterpreter python, Object scope, String variable) 
-      throws IOException {
-    // Store the current test case as the this variable
-    python.set(variable, scope);
-  }
-}