Merge "Allocate bitmap backing buffers in the Java heap."
diff --git a/api/current.xml b/api/current.xml
index c9371d0..8ce9da4 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -1949,7 +1949,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843553"
+ value="16843552"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -1960,7 +1960,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843552"
+ value="16843551"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -1971,7 +1971,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843554"
+ value="16843553"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -2147,7 +2147,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843585"
+ value="16843584"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -2180,7 +2180,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843566"
+ value="16843565"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -2312,7 +2312,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843561"
+ value="16843560"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -2389,7 +2389,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843550"
+ value="16843549"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -2499,7 +2499,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843563"
+ value="16843562"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -2543,7 +2543,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843578"
+ value="16843577"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -2675,7 +2675,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843582"
+ value="16843581"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -2686,7 +2686,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843581"
+ value="16843580"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3588,7 +3588,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843579"
+ value="16843578"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3599,7 +3599,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843577"
+ value="16843576"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3610,7 +3610,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843545"
+ value="16843544"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3940,7 +3940,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843547"
+ value="16843546"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -3995,7 +3995,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843548"
+ value="16843547"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -4193,7 +4193,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843588"
+ value="16843587"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -4215,7 +4215,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843593"
+ value="16843592"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -4226,7 +4226,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843590"
+ value="16843589"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -4237,7 +4237,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843591"
+ value="16843590"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -4248,7 +4248,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843589"
+ value="16843588"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -4259,7 +4259,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843592"
+ value="16843591"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -4952,7 +4952,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843546"
+ value="16843545"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -4963,7 +4963,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843564"
+ value="16843563"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -5293,7 +5293,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843559"
+ value="16843558"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -5469,7 +5469,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843586"
+ value="16843585"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -5568,7 +5568,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843580"
+ value="16843579"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -6844,7 +6844,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843565"
+ value="16843564"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -7394,7 +7394,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843560"
+ value="16843559"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -7867,7 +7867,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843573"
+ value="16843572"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -7878,7 +7878,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843574"
+ value="16843573"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -7889,7 +7889,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843575"
+ value="16843574"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -7988,7 +7988,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843571"
+ value="16843570"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -7999,7 +7999,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843572"
+ value="16843571"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -8351,7 +8351,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843583"
+ value="16843582"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -8384,7 +8384,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843549"
+ value="16843548"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -8538,7 +8538,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843576"
+ value="16843575"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -8791,7 +8791,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843562"
+ value="16843561"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -8978,7 +8978,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843584"
+ value="16843583"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -9737,7 +9737,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843556"
+ value="16843555"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -9748,7 +9748,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843555"
+ value="16843554"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -9770,18 +9770,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843557"
- static="true"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="textLineHeight"
- type="int"
- transient="false"
- volatile="false"
- value="16843544"
+ value="16843556"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -10188,7 +10177,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843567"
+ value="16843566"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -10199,7 +10188,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843568"
+ value="16843567"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -10210,7 +10199,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843569"
+ value="16843568"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -10221,7 +10210,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843570"
+ value="16843569"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -10298,7 +10287,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843551"
+ value="16843550"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -10441,7 +10430,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843587"
+ value="16843586"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -10771,7 +10760,7 @@
  type="int"
  transient="false"
  volatile="false"
- value="16843558"
+ value="16843557"
  static="true"
  final="true"
  deprecated="not deprecated"
@@ -29871,6 +29860,36 @@
 <parameter name="a" type="android.app.Activity">
 </parameter>
 </method>
+<method name="setMaxVisible"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="visibleCrumbs" type="int">
+</parameter>
+</method>
+<method name="setParentTitle"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="title" type="java.lang.CharSequence">
+</parameter>
+<parameter name="shortTitle" type="java.lang.CharSequence">
+</parameter>
+<parameter name="listener" type="android.view.View.OnClickListener">
+</parameter>
+</method>
 <method name="setTitle"
  return="void"
  abstract="false"
@@ -48137,6 +48156,17 @@
  visibility="public"
 >
 </field>
+<field name="MODE_MULTI_PROCESS"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="4"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="MODE_PRIVATE"
  type="int"
  transient="false"
@@ -148256,6 +148286,23 @@
 <parameter name="view" type="android.view.View">
 </parameter>
 </method>
+<method name="setParentTitle"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="title" type="java.lang.CharSequence">
+</parameter>
+<parameter name="shortTitle" type="java.lang.CharSequence">
+</parameter>
+<parameter name="listener" type="android.view.View.OnClickListener">
+</parameter>
+</method>
 <method name="setPreferenceScreen"
  return="void"
  abstract="false"
@@ -241251,6 +241298,17 @@
  visibility="public"
 >
 </method>
+<method name="isSplitTouchEnabled"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="isTouchable"
  return="boolean"
  abstract="false"
@@ -241403,6 +241461,19 @@
 <parameter name="mode" type="int">
 </parameter>
 </method>
+<method name="setSplitTouchEnabled"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="enabled" type="boolean">
+</parameter>
+</method>
 <method name="setTouchInterceptor"
  return="void"
  abstract="false"
@@ -248864,19 +248935,6 @@
 <parameter name="input" type="android.text.method.KeyListener">
 </parameter>
 </method>
-<method name="setLineHeight"
- return="void"
- abstract="false"
- native="false"
- synchronized="false"
- static="false"
- final="false"
- deprecated="not deprecated"
- visibility="public"
->
-<parameter name="lineHeight" type="int">
-</parameter>
-</method>
 <method name="setLineSpacing"
  return="void"
  abstract="false"
@@ -251198,7 +251256,7 @@
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="arg0" type="T">
+<parameter name="t" type="T">
 </parameter>
 </method>
 </interface>
@@ -347485,7 +347543,7 @@
  native="false"
  synchronized="false"
  static="true"
- final="true"
+ final="false"
  deprecated="not deprecated"
  visibility="public"
 >
@@ -347496,7 +347554,7 @@
  native="false"
  synchronized="false"
  static="true"
- final="true"
+ final="false"
  deprecated="not deprecated"
  visibility="public"
 >
@@ -347522,7 +347580,7 @@
  native="false"
  synchronized="false"
  static="true"
- final="true"
+ final="false"
  deprecated="not deprecated"
  visibility="public"
 >
@@ -347537,7 +347595,7 @@
  native="false"
  synchronized="false"
  static="true"
- final="true"
+ final="false"
  deprecated="not deprecated"
  visibility="public"
 >
@@ -347571,7 +347629,7 @@
  native="false"
  synchronized="false"
  static="true"
- final="true"
+ final="false"
  deprecated="not deprecated"
  visibility="public"
 >
@@ -347586,7 +347644,7 @@
  native="false"
  synchronized="false"
  static="true"
- final="true"
+ final="false"
  deprecated="not deprecated"
  visibility="public"
 >
@@ -347773,7 +347831,7 @@
  native="false"
  synchronized="false"
  static="true"
- final="true"
+ final="false"
  deprecated="not deprecated"
  visibility="public"
 >
@@ -347814,7 +347872,7 @@
  native="false"
  synchronized="false"
  static="true"
- final="true"
+ final="false"
  deprecated="not deprecated"
  visibility="public"
 >
diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java
index 083612e..72f7286 100644
--- a/core/java/android/app/ContextImpl.java
+++ b/core/java/android/app/ContextImpl.java
@@ -554,10 +554,13 @@
                 return sp;
             }
         }
-        // If somebody else (some other process) changed the prefs
-        // file behind our back, we reload it.  This has been the
-        // historical (if undocumented) behavior.
-        sp.startReloadIfChangedUnexpectedly();
+        if ((mode & Context.MODE_MULTI_PROCESS) != 0 ||
+            getApplicationInfo().targetSdkVersion < android.os.Build.VERSION_CODES.HONEYCOMB) {
+            // If somebody else (some other process) changed the prefs
+            // file behind our back, we reload it.  This has been the
+            // historical (if undocumented) behavior.
+            sp.startReloadIfChangedUnexpectedly();
+        }
         return sp;
     }
 
diff --git a/core/java/android/app/FragmentBreadCrumbs.java b/core/java/android/app/FragmentBreadCrumbs.java
index 8d76ffe..fb89099 100644
--- a/core/java/android/app/FragmentBreadCrumbs.java
+++ b/core/java/android/app/FragmentBreadCrumbs.java
@@ -45,6 +45,10 @@
 
     // Hahah
     BackStackRecord mTopEntry;
+    BackStackRecord mParentEntry;
+
+    /** Listener to inform when a parent entry is clicked */
+    private OnClickListener mParentClickListener;
 
     public FragmentBreadCrumbs(Context context) {
         this(context, null);
@@ -75,27 +79,51 @@
     }
 
     /**
-     * The maximum number of crumbs to show.
-     * @hide
+     * The maximum number of breadcrumbs to show. Older fragment headers will be hidden from view.
+     * @param visibleCrumbs the number of visible breadcrumbs. This should be greater than zero.
      */
     public void setMaxVisible(int visibleCrumbs) {
+        if (visibleCrumbs < 1) {
+            throw new IllegalArgumentException("visibleCrumbs must be greater than zero");
+        }
         mMaxVisible = visibleCrumbs;
     }
 
     /**
+     * Inserts an optional parent entry at the first position in the breadcrumbs. Selecting this
+     * entry will result in a call to the specified listener's 
+     * {@link android.view.View.OnClickListener#onClick(View)}
+     * method.
+     *
+     * @param title the title for the parent entry
+     * @param shortTitle the short title for the parent entry
+     * @param listener the {@link android.view.View.OnClickListener} to be called when clicked.
+     * A null will result in no action being taken when the parent entry is clicked.
+     */
+    public void setParentTitle(CharSequence title, CharSequence shortTitle,
+            OnClickListener listener) {
+        mParentEntry = createBackStackEntry(title, shortTitle);
+        mParentClickListener = listener;
+        updateCrumbs();
+    }
+
+    private BackStackRecord createBackStackEntry(CharSequence title, CharSequence shortTitle) {
+        if (title == null) return null;
+
+        final BackStackRecord entry = new BackStackRecord(
+                (FragmentManagerImpl) mActivity.getFragmentManager());
+        entry.setBreadCrumbTitle(title);
+        entry.setBreadCrumbShortTitle(shortTitle);
+        return entry;
+    }
+
+    /**
      * Set a custom title for the bread crumbs.  This will be the first entry
      * shown at the left, representing the root of the bread crumbs.  If the
      * title is null, it will not be shown.
      */
     public void setTitle(CharSequence title, CharSequence shortTitle) {
-        if (title == null) {
-            mTopEntry = null;
-        } else {
-            mTopEntry = new BackStackRecord((FragmentManagerImpl)
-                    mActivity.getFragmentManager());
-            mTopEntry.setBreadCrumbTitle(title);
-            mTopEntry.setBreadCrumbShortTitle(shortTitle);
-        }
+        mTopEntry = createBackStackEntry(title, shortTitle);
         updateCrumbs();
     }
 
@@ -151,41 +179,66 @@
         updateCrumbs();
     }
 
+    /**
+     * Returns the number of entries before the backstack, including the title of the current
+     * fragment and any custom parent title that was set.
+     */
+    private int getPreEntryCount() {
+        return (mTopEntry != null ? 1 : 0) + (mParentEntry != null ? 1 : 0);
+    }
+
+    /**
+     * Returns the pre-entry corresponding to the index. If there is a parent and a top entry
+     * set, parent has an index of zero and top entry has an index of 1. Returns null if the
+     * specified index doesn't exist or is null.
+     * @param index should not be more than {@link #getPreEntryCount()} - 1
+     */
+    private BackStackEntry getPreEntry(int index) {
+        // If there's a parent entry, then return that for zero'th item, else top entry.
+        if (mParentEntry != null) {
+            return index == 0 ? mParentEntry : mTopEntry;
+        } else {
+            return mTopEntry;
+        }
+    }
+
     void updateCrumbs() {
         FragmentManager fm = mActivity.getFragmentManager();
         int numEntries = fm.countBackStackEntries();
+        int numPreEntries = getPreEntryCount();
         int numViews = mContainer.getChildCount();
-        for (int i = mTopEntry != null ? -1 : 0; i < numEntries; i++) {
-            BackStackEntry bse = i == -1 ? mTopEntry : fm.getBackStackEntry(i);
-            int viewI = mTopEntry != null ? i + 1 : i;
-            if (viewI < numViews) {
-                View v = mContainer.getChildAt(viewI);
+        for (int i = 0; i < numEntries + numPreEntries; i++) {
+            BackStackEntry bse = i < numPreEntries
+                    ? getPreEntry(i)
+                    : fm.getBackStackEntry(i - numPreEntries);
+            if (i < numViews) {
+                View v = mContainer.getChildAt(i);
                 Object tag = v.getTag();
                 if (tag != bse) {
-                    for (int j = viewI; j < numViews; j++) {
-                        mContainer.removeViewAt(viewI);
+                    for (int j = i; j < numViews; j++) {
+                        mContainer.removeViewAt(i);
                     }
-                    numViews = viewI;
+                    numViews = i;
                 }
             }
-            if (viewI >= numViews) {
+            if (i >= numViews) {
                 final View item = mInflater.inflate(
                         com.android.internal.R.layout.fragment_bread_crumb_item,
                         this, false);
                 final TextView text = (TextView) item.findViewById(com.android.internal.R.id.title);
                 text.setText(bse.getBreadCrumbTitle());
                 text.setTag(bse);
-                if (viewI == 0) {
+                if (i == 0) {
                     item.findViewById(com.android.internal.R.id.left_icon).setVisibility(View.GONE);
                 }
                 mContainer.addView(item);
                 text.setOnClickListener(mOnClickListener);
             }
         }
-        int viewI = mTopEntry != null ? numEntries + 1 : numEntries;
+        int viewI = numEntries + numPreEntries;
         numViews = mContainer.getChildCount();
         while (numViews > viewI) {
-            mContainer.removeViewAt(numViews-1);
+            mContainer.removeViewAt(numViews - 1);
             numViews--;
         }
         // Adjust the visibility and availability of the bread crumbs and divider
@@ -208,8 +261,14 @@
         public void onClick(View v) {
             if (v.getTag() instanceof BackStackEntry) {
                 BackStackEntry bse = (BackStackEntry) v.getTag();
-                mActivity.getFragmentManager().popBackStack(bse.getId(),
-                        bse == mTopEntry? FragmentManager.POP_BACK_STACK_INCLUSIVE : 0);
+                if (bse == mParentEntry) {
+                    if (mParentClickListener != null) {
+                        mParentClickListener.onClick(v);
+                    }
+                } else {
+                    mActivity.getFragmentManager().popBackStack(bse.getId(),
+                            bse == mTopEntry? FragmentManager.POP_BACK_STACK_INCLUSIVE : 0);
+                }
             }
         }
     };
diff --git a/core/java/android/content/Context.java b/core/java/android/content/Context.java
index 277dc2f..b128d31 100644
--- a/core/java/android/content/Context.java
+++ b/core/java/android/content/Context.java
@@ -80,6 +80,25 @@
     public static final int MODE_APPEND = 0x8000;
 
     /**
+     * SharedPreference loading flag: when set, the file on disk will
+     * be checked for modification even if the shared preferences
+     * instance is already loaded in this process.  This behavior is
+     * sometimes desired in cases where the application has multiple
+     * processes, all writing to the same SharedPreferences file.
+     * Generally there are better forms of communication between
+     * processes, though.
+     *
+     * <p>This was the legacy (but undocumented) behavior in and
+     * before Gingerbread (Android 2.3) and this flag is implied when
+     * targetting such releases.  For applications targetting SDK
+     * versions <em>greater than</em> Android 2.3, this flag must be
+     * explicitly set if desired.
+     *
+     * @see #getSharedPreferences
+     */
+    public static final int MODE_MULTI_PROCESS = 0x0004;
+
+    /**
      * Flag for {@link #bindService}: automatically create the service as long
      * as the binding exists.  Note that while this will create the service,
      * its {@link android.app.Service#onStartCommand}
@@ -318,7 +337,11 @@
      * editor (SharedPreferences.edit()) and then commit changes (Editor.commit()).
      * @param mode Operating mode.  Use 0 or {@link #MODE_PRIVATE} for the
      * default operation, {@link #MODE_WORLD_READABLE}
-     * and {@link #MODE_WORLD_WRITEABLE} to control permissions.
+     * and {@link #MODE_WORLD_WRITEABLE} to control permissions.  The bit
+     * {@link #MODE_MULTI_PROCESS} can also be used if multiple processes
+     * are mutating the same SharedPreferences file.  {@link #MODE_MULTI_PROCESS}
+     * is always on in apps targetting Gingerbread (Android 2.3) and below, and
+     * off by default in later versions.
      *
      * @return Returns the single SharedPreferences instance that can be used
      *         to retrieve and modify the preference values.
@@ -326,6 +349,7 @@
      * @see #MODE_PRIVATE
      * @see #MODE_WORLD_READABLE
      * @see #MODE_WORLD_WRITEABLE
+     * @see #MODE_MULTI_PROCESS
      */
     public abstract SharedPreferences getSharedPreferences(String name,
             int mode);
diff --git a/core/java/android/content/SyncManager.java b/core/java/android/content/SyncManager.java
index dde198e..e07dbb8 100644
--- a/core/java/android/content/SyncManager.java
+++ b/core/java/android/content/SyncManager.java
@@ -735,14 +735,24 @@
 
         final Pair<Long, Long> previousSettings =
                 mSyncStorageEngine.getBackoff(op.account, op.authority);
-        long newDelayInMs;
-        if (previousSettings == null || previousSettings.second <= 0) {
+        long newDelayInMs = -1;
+        if (previousSettings != null) {
+            // don't increase backoff before current backoff is expired. This will happen for op's
+            // with ignoreBackoff set.
+            if (now < previousSettings.first) {
+                if (Log.isLoggable(TAG, Log.VERBOSE)) {
+                    Log.v(TAG, "Still in backoff, do not increase it. "
+                        + "Remaining: " + ((previousSettings.first - now) / 1000) + " seconds.");
+                }
+                return;
+            }
+            // Subsequent delays are the double of the previous delay
+            newDelayInMs = previousSettings.second * 2;
+        }
+        if (newDelayInMs <= 0) {
             // The initial delay is the jitterized INITIAL_SYNC_RETRY_TIME_IN_MS
             newDelayInMs = jitterize(INITIAL_SYNC_RETRY_TIME_IN_MS,
                     (long)(INITIAL_SYNC_RETRY_TIME_IN_MS * 1.1));
-        } else {
-            // Subsequent delays are the double of the previous delay
-            newDelayInMs = previousSettings.second * 2;
         }
 
         // Cap the delay
diff --git a/core/java/android/net/InterfaceConfiguration.java b/core/java/android/net/InterfaceConfiguration.java
index 915c5d7..980048c 100644
--- a/core/java/android/net/InterfaceConfiguration.java
+++ b/core/java/android/net/InterfaceConfiguration.java
@@ -19,14 +19,17 @@
 import android.os.Parcelable;
 import android.os.Parcel;
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
 /**
  * A simple object for retrieving / setting an interfaces configuration
  * @hide
  */
 public class InterfaceConfiguration implements Parcelable {
     public String hwAddr;
-    public int ipAddr;
-    public int netmask;
+    public InetAddress addr;
+    public InetAddress mask;
     public String interfaceFlags;
 
     public InterfaceConfiguration() {
@@ -36,21 +39,14 @@
     public String toString() {
         StringBuffer str = new StringBuffer();
 
-        str.append("ipddress "); putAddress(str, ipAddr);
-        str.append(" netmask "); putAddress(str, netmask);
+        str.append("ipddress "); str.append(addr.toString());
+        str.append(" netmask "); str.append(mask.toString());
         str.append(" flags ").append(interfaceFlags);
         str.append(" hwaddr ").append(hwAddr);
 
         return str.toString();
     }
 
-    private static void putAddress(StringBuffer buf, int addr) {
-        buf.append((addr >> 24) & 0xff).append('.').
-            append((addr >> 16) & 0xff).append('.').
-            append((addr >> 8) & 0xff).append('.').
-            append(addr & 0xff);
-    }
-
     /** Implement the Parcelable interface {@hide} */
     public int describeContents() {
         return 0;
@@ -59,8 +55,18 @@
     /** Implement the Parcelable interface {@hide} */
     public void writeToParcel(Parcel dest, int flags) {
         dest.writeString(hwAddr);
-        dest.writeInt(ipAddr);
-        dest.writeInt(netmask);
+        if (addr != null) {
+            dest.writeByte((byte)1);
+            dest.writeByteArray(addr.getAddress());
+        } else {
+            dest.writeByte((byte)0);
+        }
+        if (mask != null) {
+            dest.writeByte((byte)1);
+            dest.writeByteArray(mask.getAddress());
+        } else {
+            dest.writeByte((byte)0);
+        }
         dest.writeString(interfaceFlags);
     }
 
@@ -70,8 +76,16 @@
             public InterfaceConfiguration createFromParcel(Parcel in) {
                 InterfaceConfiguration info = new InterfaceConfiguration();
                 info.hwAddr = in.readString();
-                info.ipAddr = in.readInt();
-                info.netmask = in.readInt();
+                if (in.readByte() == 1) {
+                    try {
+                        info.addr = InetAddress.getByAddress(in.createByteArray());
+                    } catch (UnknownHostException e) {}
+                }
+                if (in.readByte() == 1) {
+                    try {
+                        info.mask = InetAddress.getByAddress(in.createByteArray());
+                    } catch (UnknownHostException e) {}
+                }
                 info.interfaceFlags = in.readString();
                 return info;
             }
diff --git a/core/java/android/net/dhcp/DhcpAckPacket.java b/core/java/android/net/dhcp/DhcpAckPacket.java
new file mode 100644
index 0000000..900a0e6
--- /dev/null
+++ b/core/java/android/net/dhcp/DhcpAckPacket.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.dhcp;
+
+import java.net.InetAddress;
+import java.net.Inet4Address;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * This class implements the DHCP-ACK packet.
+ */
+class DhcpAckPacket extends DhcpPacket {
+
+    /**
+     * The address of the server which sent this packet.
+     */
+    private final InetAddress mSrcIp;
+
+    DhcpAckPacket(int transId, boolean broadcast, InetAddress serverAddress,
+                  InetAddress clientIp, byte[] clientMac) {
+        super(transId, Inet4Address.ANY, clientIp, Inet4Address.ANY,
+            Inet4Address.ANY, clientMac, broadcast);
+        mBroadcast = broadcast;
+        mSrcIp = serverAddress;
+    }
+
+    public String toString() {
+        String s = super.toString();
+        String dnsServers = " DNS servers: ";
+
+        for (InetAddress dnsServer: mDnsServers) {
+            dnsServers += dnsServer.toString() + " ";
+        }
+
+        return s + " ACK: your new IP " + mYourIp +
+                ", netmask " + mSubnetMask +
+                ", gateway " + mGateway + dnsServers +
+                ", lease time " + mLeaseTime;
+    }
+
+    /**
+     * Fills in a packet with the requested ACK parameters.
+     */
+    public ByteBuffer buildPacket(int encap, short destUdp, short srcUdp) {
+        ByteBuffer result = ByteBuffer.allocate(MAX_LENGTH);
+        InetAddress destIp = mBroadcast ? Inet4Address.ALL : mYourIp;
+        InetAddress srcIp = mBroadcast ? Inet4Address.ANY : mSrcIp;
+
+        fillInPacket(encap, destIp, srcIp, destUdp, srcUdp, result,
+            DHCP_BOOTREPLY, mBroadcast);
+        result.flip();
+        return result;
+    }
+
+    /**
+     * Adds the optional parameters to the client-generated ACK packet.
+     */
+    void finishPacket(ByteBuffer buffer) {
+        addTlv(buffer, DHCP_MESSAGE_TYPE, DHCP_MESSAGE_TYPE_ACK);
+        addTlv(buffer, DHCP_SERVER_IDENTIFIER, mServerIdentifier);
+        addTlv(buffer, DHCP_LEASE_TIME, mLeaseTime);
+
+        // the client should renew at 1/2 the lease-expiry interval
+        if (mLeaseTime != null) {
+            addTlv(buffer, DHCP_RENEWAL_TIME,
+                Integer.valueOf(mLeaseTime.intValue() / 2));
+        }
+
+        addTlv(buffer, DHCP_SUBNET_MASK, mSubnetMask);
+        addTlv(buffer, DHCP_ROUTER, mGateway);
+        addTlv(buffer, DHCP_DOMAIN_NAME, mDomainName);
+        addTlv(buffer, DHCP_BROADCAST_ADDRESS, mBroadcastAddress);
+        addTlv(buffer, DHCP_DNS_SERVER, mDnsServers);
+        addTlvEnd(buffer);
+    }
+
+    /**
+     * Un-boxes an Integer, returning 0 if a null reference is supplied.
+     */
+    private static final int getInt(Integer v) {
+        if (v == null) {
+            return 0;
+        } else {
+            return v.intValue();
+        }
+    }
+
+    /**
+     * Notifies the specified state machine of the ACK packet parameters.
+     */
+    public void doNextOp(DhcpStateMachine machine) {
+        machine.onAckReceived(mYourIp, mSubnetMask, mGateway, mDnsServers,
+            mServerIdentifier, getInt(mLeaseTime));
+    }
+}
diff --git a/core/java/android/net/dhcp/DhcpDeclinePacket.java b/core/java/android/net/dhcp/DhcpDeclinePacket.java
new file mode 100644
index 0000000..7646eb4
--- /dev/null
+++ b/core/java/android/net/dhcp/DhcpDeclinePacket.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.dhcp;
+
+import java.net.InetAddress;
+import java.nio.ByteBuffer;
+
+/**
+ * This class implements the DHCP-DECLINE packet.
+ */
+class DhcpDeclinePacket extends DhcpPacket {
+    /**
+     * Generates a DECLINE packet with the specified parameters.
+     */
+    DhcpDeclinePacket(int transId, InetAddress clientIp, InetAddress yourIp,
+                      InetAddress nextIp, InetAddress relayIp,
+                      byte[] clientMac) {
+        super(transId, clientIp, yourIp, nextIp, relayIp, clientMac, false);
+    }
+
+    public String toString() {
+        String s = super.toString();
+        return s + " DECLINE";
+    }
+
+    /**
+     * Fills in a packet with the requested DECLINE attributes.
+     */
+    public ByteBuffer buildPacket(int encap, short destUdp, short srcUdp) {
+        ByteBuffer result = ByteBuffer.allocate(MAX_LENGTH);
+
+        fillInPacket(encap, mClientIp, mYourIp, destUdp, srcUdp, result,
+            DHCP_BOOTREQUEST, false);
+        result.flip();
+        return result;
+    }
+
+    /**
+     * Adds optional parameters to the DECLINE packet.
+     */
+    void finishPacket(ByteBuffer buffer) {
+        // None needed
+    }
+
+    /**
+     * Informs the state machine of the arrival of a DECLINE packet.
+     */
+    public void doNextOp(DhcpStateMachine machine) {
+        machine.onDeclineReceived(mClientMac, mRequestedIp);
+    }
+}
diff --git a/core/java/android/net/dhcp/DhcpDiscoverPacket.java b/core/java/android/net/dhcp/DhcpDiscoverPacket.java
new file mode 100644
index 0000000..0e2d39b
--- /dev/null
+++ b/core/java/android/net/dhcp/DhcpDiscoverPacket.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.dhcp;
+
+import java.net.InetAddress;
+import java.net.Inet4Address;
+import java.nio.ByteBuffer;
+
+/**
+ * This class implements the DHCP-DISCOVER packet.
+ */
+class DhcpDiscoverPacket extends DhcpPacket {
+    /**
+     * Generates a DISCOVER packet with the specified parameters.
+     */
+    DhcpDiscoverPacket(int transId, byte[] clientMac, boolean broadcast) {
+        super(transId, Inet4Address.ANY, Inet4Address.ANY, Inet4Address.ANY,
+            Inet4Address.ANY, clientMac, broadcast);
+    }
+
+    public String toString() {
+        String s = super.toString();
+        return s + " DISCOVER " +
+                (mBroadcast ? "broadcast " : "unicast ");
+    }
+
+    /**
+     * Fills in a packet with the requested DISCOVER parameters.
+     */
+    public ByteBuffer buildPacket(int encap, short destUdp, short srcUdp) {
+        ByteBuffer result = ByteBuffer.allocate(MAX_LENGTH);
+        InetAddress destIp = Inet4Address.ALL;
+
+        fillInPacket(encap, Inet4Address.ALL, Inet4Address.ANY, destUdp, srcUdp,
+            result, DHCP_BOOTREQUEST, true);
+        result.flip();
+        return result;
+    }
+
+    /**
+     * Adds optional parameters to a DISCOVER packet.
+     */
+    void finishPacket(ByteBuffer buffer) {
+        addTlv(buffer, DHCP_MESSAGE_TYPE, DHCP_MESSAGE_TYPE_DISCOVER);
+        addTlv(buffer, DHCP_PARAMETER_LIST, mRequestedParams);
+        addTlvEnd(buffer);
+    }
+
+    /**
+     * Informs the state machine of the arrival of a DISCOVER packet.
+     */
+    public void doNextOp(DhcpStateMachine machine) {
+        // currently omitted: host name
+        machine.onDiscoverReceived(mBroadcast, mTransId, mClientMac,
+            mRequestedParams);
+    }
+}
diff --git a/core/java/android/net/dhcp/DhcpInformPacket.java b/core/java/android/net/dhcp/DhcpInformPacket.java
new file mode 100644
index 0000000..da73216
--- /dev/null
+++ b/core/java/android/net/dhcp/DhcpInformPacket.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.dhcp;
+
+import java.net.InetAddress;
+import java.nio.ByteBuffer;
+
+/**
+ * This class implements the (unused) DHCP-INFORM packet.
+ */
+class DhcpInformPacket extends DhcpPacket {
+    /**
+     * Generates an INFORM packet with the specified parameters.
+     */
+    DhcpInformPacket(int transId, InetAddress clientIp, InetAddress yourIp,
+                     InetAddress nextIp, InetAddress relayIp,
+                     byte[] clientMac) {
+        super(transId, clientIp, yourIp, nextIp, relayIp, clientMac, false);
+    }
+
+    public String toString() {
+        String s = super.toString();
+        return s + " INFORM";
+    }
+
+    /**
+     * Builds an INFORM packet.
+     */
+    public ByteBuffer buildPacket(int encap, short destUdp, short srcUdp) {
+        ByteBuffer result = ByteBuffer.allocate(MAX_LENGTH);
+
+        fillInPacket(encap, mClientIp, mYourIp, destUdp, srcUdp, result,
+            DHCP_BOOTREQUEST, false);
+        result.flip();
+        return result;
+    }
+
+    /**
+     * Adds additional parameters to the INFORM packet.
+     */
+    void finishPacket(ByteBuffer buffer) {
+        byte[] clientId = new byte[7];
+
+        clientId[0] = CLIENT_ID_ETHER;
+        System.arraycopy(mClientMac, 0, clientId, 1, 6);
+
+        addTlv(buffer, DHCP_MESSAGE_TYPE, DHCP_MESSAGE_TYPE_REQUEST);
+        addTlv(buffer, DHCP_PARAMETER_LIST, mRequestedParams);
+        addTlvEnd(buffer);
+    }
+
+    /**
+     * Informs the state machine of the arrival of an INFORM packet.  Not
+     * used currently.
+     */
+    public void doNextOp(DhcpStateMachine machine) {
+        InetAddress clientRequest =
+            mRequestedIp == null ? mClientIp : mRequestedIp;
+        machine.onInformReceived(mTransId, mClientMac, clientRequest,
+            mRequestedParams);
+    }
+}
diff --git a/core/java/android/net/dhcp/DhcpNakPacket.java b/core/java/android/net/dhcp/DhcpNakPacket.java
new file mode 100644
index 0000000..1f340ad
--- /dev/null
+++ b/core/java/android/net/dhcp/DhcpNakPacket.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.dhcp;
+
+import java.net.InetAddress;
+import java.net.Inet4Address;
+import java.nio.ByteBuffer;
+
+/**
+ * This class implements the DHCP-NAK packet.
+ */
+class DhcpNakPacket extends DhcpPacket {
+    /**
+     * Generates a NAK packet with the specified parameters.
+     */
+    DhcpNakPacket(int transId, InetAddress clientIp, InetAddress yourIp,
+                  InetAddress nextIp, InetAddress relayIp,
+                  byte[] clientMac) {
+        super(transId, Inet4Address.ANY, Inet4Address.ANY, nextIp, relayIp,
+            clientMac, false);
+    }
+
+    public String toString() {
+        String s = super.toString();
+        return s + " NAK, reason " + (mMessage == null ? "(none)" : mMessage);
+    }
+
+    /**
+     * Fills in a packet with the requested NAK attributes.
+     */
+    public ByteBuffer buildPacket(int encap, short destUdp, short srcUdp) {
+        ByteBuffer result = ByteBuffer.allocate(MAX_LENGTH);
+        InetAddress destIp = mClientIp;
+        InetAddress srcIp = mYourIp;
+
+        fillInPacket(encap, destIp, srcIp, destUdp, srcUdp, result,
+            DHCP_BOOTREPLY, mBroadcast);
+        result.flip();
+        return result;
+    }
+
+    /**
+     * Adds the optional parameters to the client-generated NAK packet.
+     */
+    void finishPacket(ByteBuffer buffer) {
+        addTlv(buffer, DHCP_MESSAGE_TYPE, DHCP_MESSAGE_TYPE_NAK);
+        addTlv(buffer, DHCP_SERVER_IDENTIFIER, mServerIdentifier);
+        addTlv(buffer, DHCP_MESSAGE, mMessage);
+        addTlvEnd(buffer);
+    }
+
+    /**
+     * Notifies the specified state machine of the newly-arrived NAK packet.
+     */
+    public void doNextOp(DhcpStateMachine machine) {
+        machine.onNakReceived();
+    }
+}
diff --git a/core/java/android/net/dhcp/DhcpOfferPacket.java b/core/java/android/net/dhcp/DhcpOfferPacket.java
new file mode 100644
index 0000000..3d79f4d
--- /dev/null
+++ b/core/java/android/net/dhcp/DhcpOfferPacket.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.dhcp;
+
+import java.net.InetAddress;
+import java.net.Inet4Address;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * This class implements the DHCP-OFFER packet.
+ */
+class DhcpOfferPacket extends DhcpPacket {
+    /**
+     * The IP address of the server which sent this packet.
+     */
+    private final InetAddress mSrcIp;
+
+    /**
+     * Generates a OFFER packet with the specified parameters.
+     */
+    DhcpOfferPacket(int transId, boolean broadcast, InetAddress serverAddress,
+                    InetAddress clientIp, byte[] clientMac) {
+        super(transId, Inet4Address.ANY, clientIp, Inet4Address.ANY,
+            Inet4Address.ANY, clientMac, broadcast);
+        mSrcIp = serverAddress;
+    }
+
+    public String toString() {
+        String s = super.toString();
+        String dnsServers = ", DNS servers: ";
+
+        if (mDnsServers != null) {
+            for (InetAddress dnsServer: mDnsServers) {
+                dnsServers += dnsServer + " ";
+            }
+        }
+
+        return s + " OFFER, ip " + mYourIp + ", mask " + mSubnetMask +
+                dnsServers + ", gateway " + mGateway +
+                " lease time " + mLeaseTime + ", domain " + mDomainName;
+    }
+
+    /**
+     * Fills in a packet with the specified OFFER attributes.
+     */
+    public ByteBuffer buildPacket(int encap, short destUdp, short srcUdp) {
+        ByteBuffer result = ByteBuffer.allocate(MAX_LENGTH);
+        InetAddress destIp = mBroadcast ? Inet4Address.ALL : mYourIp;
+        InetAddress srcIp = mBroadcast ? Inet4Address.ANY : mSrcIp;
+
+        fillInPacket(encap, destIp, srcIp, destUdp, srcUdp, result,
+            DHCP_BOOTREPLY, mBroadcast);
+        result.flip();
+        return result;
+    }
+
+    /**
+     * Adds the optional parameters to the server-generated OFFER packet.
+     */
+    void finishPacket(ByteBuffer buffer) {
+        addTlv(buffer, DHCP_MESSAGE_TYPE, DHCP_MESSAGE_TYPE_OFFER);
+        addTlv(buffer, DHCP_SERVER_IDENTIFIER, mServerIdentifier);
+        addTlv(buffer, DHCP_LEASE_TIME, mLeaseTime);
+
+        // the client should renew at 1/2 the lease-expiry interval
+        if (mLeaseTime != null) {
+            addTlv(buffer, DHCP_RENEWAL_TIME,
+                Integer.valueOf(mLeaseTime.intValue() / 2));
+        }
+
+        addTlv(buffer, DHCP_SUBNET_MASK, mSubnetMask);
+        addTlv(buffer, DHCP_ROUTER, mGateway);
+        addTlv(buffer, DHCP_DOMAIN_NAME, mDomainName);
+        addTlv(buffer, DHCP_BROADCAST_ADDRESS, mBroadcastAddress);
+        addTlv(buffer, DHCP_DNS_SERVER, mDnsServers);
+        addTlvEnd(buffer);
+    }
+
+    /**
+     * Notifies the state machine of the OFFER packet parameters.
+     */
+    public void doNextOp(DhcpStateMachine machine) {
+        machine.onOfferReceived(mBroadcast, mTransId, mClientMac, mYourIp,
+            mServerIdentifier);
+    }
+}
diff --git a/core/java/android/net/dhcp/DhcpPacket.java b/core/java/android/net/dhcp/DhcpPacket.java
new file mode 100644
index 0000000..e009f70
--- /dev/null
+++ b/core/java/android/net/dhcp/DhcpPacket.java
@@ -0,0 +1,899 @@
+package android.net.dhcp;
+
+import android.util.Log;
+
+import java.io.UnsupportedEncodingException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.charset.Charsets;
+import java.nio.ShortBuffer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Defines basic data and operations needed to build and use packets for the
+ * DHCP protocol.  Subclasses create the specific packets used at each
+ * stage of the negotiation.
+ */
+abstract class DhcpPacket {
+    protected static final String TAG = "DhcpPacket";
+
+    /**
+     * Packet encapsulations.
+     */
+    public static final int ENCAP_L2 = 0;    // EthernetII header included
+    public static final int ENCAP_L3 = 1;    // IP/UDP header included
+    public static final int ENCAP_BOOTP = 2; // BOOTP contents only
+
+    /**
+     * IP layer definitions.
+     */
+    private static final byte IP_TYPE_UDP = (byte) 0x11;
+
+    /**
+     * IP: Version 4, Header Length 20 bytes
+     */
+    private static final byte IP_VERSION_HEADER_LEN = (byte) 0x45;
+
+    /**
+     * IP: Flags 0, Fragment Offset 0, Don't Fragment
+     */
+    private static final short IP_FLAGS_OFFSET = (short) 0x4000;
+
+    /**
+     * IP: TOS
+     */
+    private static final byte IP_TOS_LOWDELAY = (byte) 0x10;
+
+    /**
+     * IP: TTL -- use default 64 from RFC1340
+     */
+    private static final byte IP_TTL = (byte) 0x40;
+
+    /**
+     * The client DHCP port.
+     */
+    static final short DHCP_CLIENT = (short) 68;
+
+    /**
+     * The server DHCP port.
+     */
+    static final short DHCP_SERVER = (short) 67;
+
+    /**
+     * The message op code indicating a request from a client.
+     */
+    protected static final byte DHCP_BOOTREQUEST = (byte) 1;
+
+    /**
+     * The message op code indicating a response from the server.
+     */
+    protected static final byte DHCP_BOOTREPLY = (byte) 2;
+
+    /**
+     * The code type used to identify an Ethernet MAC address in the
+     * Client-ID field.
+     */
+    protected static final byte CLIENT_ID_ETHER = (byte) 1;
+
+    /**
+     * The maximum length of a packet that can be constructed.
+     */
+    protected static final int MAX_LENGTH = 1500;
+
+    /**
+     * DHCP Optional Type: DHCP Subnet Mask
+     */
+    protected static final byte DHCP_SUBNET_MASK = 1;
+    protected InetAddress mSubnetMask;
+
+    /**
+     * DHCP Optional Type: DHCP Router
+     */
+    protected static final byte DHCP_ROUTER = 3;
+    protected InetAddress mGateway;
+
+    /**
+     * DHCP Optional Type: DHCP DNS Server
+     */
+    protected static final byte DHCP_DNS_SERVER = 6;
+    protected List<InetAddress> mDnsServers;
+
+    /**
+     * DHCP Optional Type: DHCP Host Name
+     */
+    protected static final byte DHCP_HOST_NAME = 12;
+    protected String mHostName;
+
+    /**
+     * DHCP Optional Type: DHCP DOMAIN NAME
+     */
+    protected static final byte DHCP_DOMAIN_NAME = 15;
+    protected String mDomainName;
+
+    /**
+     * DHCP Optional Type: DHCP BROADCAST ADDRESS
+     */
+    protected static final byte DHCP_BROADCAST_ADDRESS = 28;
+    protected InetAddress mBroadcastAddress;
+
+    /**
+     * DHCP Optional Type: DHCP Requested IP Address
+     */
+    protected static final byte DHCP_REQUESTED_IP = 50;
+    protected InetAddress mRequestedIp;
+
+    /**
+     * DHCP Optional Type: DHCP Lease Time
+     */
+    protected static final byte DHCP_LEASE_TIME = 51;
+    protected Integer mLeaseTime;
+
+    /**
+     * DHCP Optional Type: DHCP Message Type
+     */
+    protected static final byte DHCP_MESSAGE_TYPE = 53;
+    // the actual type values
+    protected static final byte DHCP_MESSAGE_TYPE_DISCOVER = 1;
+    protected static final byte DHCP_MESSAGE_TYPE_OFFER = 2;
+    protected static final byte DHCP_MESSAGE_TYPE_REQUEST = 3;
+    protected static final byte DHCP_MESSAGE_TYPE_DECLINE = 4;
+    protected static final byte DHCP_MESSAGE_TYPE_ACK = 5;
+    protected static final byte DHCP_MESSAGE_TYPE_NAK = 6;
+    protected static final byte DHCP_MESSAGE_TYPE_INFORM = 8;
+
+    /**
+     * DHCP Optional Type: DHCP Server Identifier
+     */
+    protected static final byte DHCP_SERVER_IDENTIFIER = 54;
+    protected InetAddress mServerIdentifier;
+
+    /**
+     * DHCP Optional Type: DHCP Parameter List
+     */
+    protected static final byte DHCP_PARAMETER_LIST = 55;
+    protected byte[] mRequestedParams;
+
+    /**
+     * DHCP Optional Type: DHCP MESSAGE
+     */
+    protected static final byte DHCP_MESSAGE = 56;
+    protected String mMessage;
+
+    /**
+     * DHCP Optional Type: DHCP Renewal Time Value
+     */
+    protected static final byte DHCP_RENEWAL_TIME = 58;
+
+    /**
+     * DHCP Optional Type: Vendor Class Identifier
+     */
+    protected static final byte DHCP_VENDOR_CLASS_ID = 60;
+
+    /**
+     * DHCP Optional Type: DHCP Client Identifier
+     */
+    protected static final byte DHCP_CLIENT_IDENTIFIER = 61;
+
+    /**
+     * The transaction identifier used in this particular DHCP negotiation
+     */
+    protected final int mTransId;
+
+    /**
+     * The IP address of the client host.  This address is typically
+     * proposed by the client (from an earlier DHCP negotiation) or
+     * supplied by the server.
+     */
+    protected final InetAddress mClientIp;
+    protected final InetAddress mYourIp;
+    private final InetAddress mNextIp;
+    private final InetAddress mRelayIp;
+
+    /**
+     * Does the client request a broadcast response?
+     */
+    protected boolean mBroadcast;
+
+    /**
+     * The six-octet MAC of the client.
+     */
+    protected final byte[] mClientMac;
+
+    /**
+     * Asks the packet object to signal the next operation in the DHCP
+     * protocol.  The available actions are methods defined in the
+     * DhcpStateMachine interface.
+     */
+    public abstract void doNextOp(DhcpStateMachine stateMachine);
+
+    /**
+     * Asks the packet object to create a ByteBuffer serialization of
+     * the packet for transmission.
+     */
+    public abstract ByteBuffer buildPacket(int encap, short destUdp,
+        short srcUdp);
+
+    /**
+     * Allows the concrete class to fill in packet-type-specific details,
+     * typically optional parameters at the end of the packet.
+     */
+    abstract void finishPacket(ByteBuffer buffer);
+
+    protected DhcpPacket(int transId, InetAddress clientIp, InetAddress yourIp,
+                         InetAddress nextIp, InetAddress relayIp,
+                         byte[] clientMac, boolean broadcast) {
+        mTransId = transId;
+        mClientIp = clientIp;
+        mYourIp = yourIp;
+        mNextIp = nextIp;
+        mRelayIp = relayIp;
+        mClientMac = clientMac;
+        mBroadcast = broadcast;
+    }
+
+    /**
+     * Returns the transaction ID.
+     */
+    public int getTransactionId() {
+        return mTransId;
+    }
+
+    /**
+     * Creates a new L3 packet (including IP header) containing the
+     * DHCP udp packet.  This method relies upon the delegated method
+     * finishPacket() to insert the per-packet contents.
+     */
+    protected void fillInPacket(int encap, InetAddress destIp,
+        InetAddress srcIp, short destUdp, short srcUdp, ByteBuffer buf,
+        byte requestCode, boolean broadcast) {
+        byte[] destIpArray = destIp.getAddress();
+        byte[] srcIpArray = srcIp.getAddress();
+        int ipLengthOffset = 0;
+        int ipChecksumOffset = 0;
+        int endIpHeader = 0;
+        int udpHeaderOffset = 0;
+        int udpLengthOffset = 0;
+        int udpChecksumOffset = 0;
+
+        buf.clear();
+        buf.order(ByteOrder.BIG_ENDIAN);
+
+        // if a full IP packet needs to be generated, put the IP & UDP
+        // headers in place, and pre-populate with artificial values
+        // needed to seed the IP checksum.
+        if (encap == ENCAP_L3) {
+            // fake IP header, used in the IP-header checksum
+            buf.put(IP_VERSION_HEADER_LEN);
+            buf.put(IP_TOS_LOWDELAY);    // tos: IPTOS_LOWDELAY
+            ipLengthOffset = buf.position();
+            buf.putShort((short)0);  // length
+            buf.putShort((short)0);  // id
+            buf.putShort(IP_FLAGS_OFFSET); // ip offset: don't fragment
+            buf.put(IP_TTL);    // TTL: use default 64 from RFC1340
+            buf.put(IP_TYPE_UDP);
+            ipChecksumOffset = buf.position();
+            buf.putShort((short) 0); // checksum
+
+            buf.put(srcIpArray);
+            buf.put(destIpArray);
+            endIpHeader = buf.position();
+
+            // UDP header
+            udpHeaderOffset = buf.position();
+            buf.putShort(srcUdp);
+            buf.putShort(destUdp);
+            udpLengthOffset = buf.position();
+            buf.putShort((short) 0); // length
+            udpChecksumOffset = buf.position();
+            buf.putShort((short) 0); // UDP checksum -- initially zero
+        }
+
+        // DHCP payload
+        buf.put(requestCode);
+        buf.put((byte) 1); // Hardware Type: Ethernet
+        buf.put((byte) mClientMac.length); // Hardware Address Length
+        buf.put((byte) 0); // Hop Count
+        buf.putInt(mTransId);  // Transaction ID
+        buf.putShort((short) 0); // Elapsed Seconds
+
+        if (broadcast) {
+            buf.putShort((short) 0x8000); // Flags
+        } else {
+            buf.putShort((short) 0x0000); // Flags
+        }
+
+        buf.put(mClientIp.getAddress());
+        buf.put(mYourIp.getAddress());
+        buf.put(mNextIp.getAddress());
+        buf.put(mRelayIp.getAddress());
+        buf.put(mClientMac);
+        buf.position(buf.position() +
+                     (16 - mClientMac.length) // pad addr to 16 bytes
+                     + 64     // empty server host name (64 bytes)
+                     + 128);  // empty boot file name (128 bytes)
+        buf.putInt(0x63825363); // magic number
+        finishPacket(buf);
+
+        // round up to an even number of octets
+        if ((buf.position() & 1) == 1) {
+            buf.put((byte) 0);
+        }
+
+        // If an IP packet is being built, the IP & UDP checksums must be
+        // computed.
+        if (encap == ENCAP_L3) {
+            // fix UDP header: insert length
+            short udpLen = (short)(buf.position() - udpHeaderOffset);
+            buf.putShort(udpLengthOffset, udpLen);
+            // fix UDP header: checksum
+            // checksum for UDP at udpChecksumOffset
+            int udpSeed = 0;
+
+            // apply IPv4 pseudo-header.  Read IP address src and destination
+            // values from the IP header and accumulate checksum.
+            udpSeed += intAbs(buf.getShort(ipChecksumOffset + 2));
+            udpSeed += intAbs(buf.getShort(ipChecksumOffset + 4));
+            udpSeed += intAbs(buf.getShort(ipChecksumOffset + 6));
+            udpSeed += intAbs(buf.getShort(ipChecksumOffset + 8));
+
+            // accumulate extra data for the pseudo-header
+            udpSeed += IP_TYPE_UDP;
+            udpSeed += udpLen;
+            // and compute UDP checksum
+            buf.putShort(udpChecksumOffset, (short) checksum(buf, udpSeed,
+                                                             udpHeaderOffset,
+                                                             buf.position()));
+            // fix IP header: insert length
+            buf.putShort(ipLengthOffset, (short)buf.position());
+            // fixup IP-header checksum
+            buf.putShort(ipChecksumOffset,
+                         (short) checksum(buf, 0, 0, endIpHeader));
+        }
+    }
+
+    /**
+     * Converts a signed short value to an unsigned int value.  Needed
+     * because Java does not have unsigned types.
+     */
+    private int intAbs(short v) {
+        if (v < 0) {
+            int r = v + 65536;
+            return r;
+        } else {
+            return(v);
+        }
+    }
+
+    /**
+     * Performs an IP checksum (used in IP header and across UDP
+     * payload) on the specified portion of a ByteBuffer.  The seed
+     * allows the checksum to commence with a specified value.
+     */
+    private int checksum(ByteBuffer buf, int seed, int start, int end) {
+        int sum = seed;
+        int bufPosition = buf.position();
+
+        // set position of original ByteBuffer, so that the ShortBuffer
+        // will be correctly initialized
+        buf.position(start);
+        ShortBuffer shortBuf = buf.asShortBuffer();
+
+        // re-set ByteBuffer position
+        buf.position(bufPosition);
+
+        short[] shortArray = new short[(end - start) / 2];
+        shortBuf.get(shortArray);
+
+        for (short s : shortArray) {
+            sum += intAbs(s);
+        }
+
+        start += shortArray.length * 2;
+
+        // see if a singleton byte remains
+        if (end != start) {
+            short b = buf.get(start);
+
+            // make it unsigned
+            if (b < 0) {
+                b += 256;
+            }
+
+            sum += b * 256;
+        }
+
+        sum = ((sum >> 16) & 0xFFFF) + (sum & 0xFFFF);
+        sum = ((sum + ((sum >> 16) & 0xFFFF)) & 0xFFFF);
+        int negated = ~sum;
+        return intAbs((short) negated);
+    }
+
+    /**
+     * Adds an optional parameter containing a single byte value.
+     */
+    protected void addTlv(ByteBuffer buf, byte type, byte value) {
+        buf.put(type);
+        buf.put((byte) 1);
+        buf.put(value);
+    }
+
+    /**
+     * Adds an optional parameter containing an array of bytes.
+     */
+    protected void addTlv(ByteBuffer buf, byte type, byte[] payload) {
+        if (payload != null) {
+            buf.put(type);
+            buf.put((byte) payload.length);
+            buf.put(payload);
+        }
+    }
+
+    /**
+     * Adds an optional parameter containing an IP address.
+     */
+    protected void addTlv(ByteBuffer buf, byte type, InetAddress addr) {
+        if (addr != null) {
+            addTlv(buf, type, addr.getAddress());
+        }
+    }
+
+    /**
+     * Adds an optional parameter containing a list of IP addresses.
+     */
+    protected void addTlv(ByteBuffer buf, byte type, List<InetAddress> addrs) {
+        if (addrs != null && addrs.size() > 0) {
+            buf.put(type);
+            buf.put((byte)(4 * addrs.size()));
+
+            for (InetAddress addr : addrs) {
+                buf.put(addr.getAddress());
+            }
+        }
+    }
+
+    /**
+     * Adds an optional parameter containing a simple integer
+     */
+    protected void addTlv(ByteBuffer buf, byte type, Integer value) {
+        if (value != null) {
+            buf.put(type);
+            buf.put((byte) 4);
+            buf.putInt(value.intValue());
+        }
+    }
+
+    /**
+     * Adds an optional parameter containing and ASCII string.
+     */
+    protected void addTlv(ByteBuffer buf, byte type, String str) {
+        if (str != null) {
+            buf.put(type);
+            buf.put((byte) str.length());
+
+            for (int i = 0; i < str.length(); i++) {
+                buf.put((byte) str.charAt(i));
+            }
+        }
+    }
+
+    /**
+     * Adds the special end-of-optional-parameters indicator.
+     */
+    protected void addTlvEnd(ByteBuffer buf) {
+        buf.put((byte) 0xFF);
+    }
+
+    /**
+     * Converts a MAC from an array of octets to an ASCII string.
+     */
+    public static String macToString(byte[] mac) {
+        String macAddr = "";
+
+        for (int i = 0; i < mac.length; i++) {
+            String hexString = "0" + Integer.toHexString(mac[i]);
+
+            // substring operation grabs the last 2 digits: this
+            // allows signed bytes to be converted correctly.
+            macAddr += hexString.substring(hexString.length() - 2);
+
+            if (i != (mac.length - 1)) {
+                macAddr += ":";
+            }
+        }
+
+        return macAddr;
+    }
+
+    public String toString() {
+        String macAddr = macToString(mClientMac);
+
+        return macAddr;
+    }
+
+    /**
+     * Reads a four-octet value from a ByteBuffer and construct
+     * an IPv4 address from that value.
+     */
+    private static InetAddress readIpAddress(ByteBuffer packet) {
+        InetAddress result = null;
+        byte[] ipAddr = new byte[4];
+        packet.get(ipAddr);
+
+        try {
+            result = InetAddress.getByAddress(ipAddr);
+        } catch (UnknownHostException ex) {
+            // ipAddr is numeric, so this should not be
+            // triggered.  However, if it is, just nullify
+            result = null;
+        }
+
+        return result;
+    }
+
+    /**
+     * Reads a string of specified length from the buffer.
+     */
+    private static String readAsciiString(ByteBuffer buf, int byteCount) {
+        byte[] bytes = new byte[byteCount];
+        buf.get(bytes);
+        return new String(bytes, 0, bytes.length, Charsets.US_ASCII);
+    }
+
+    /**
+     * Creates a concrete DhcpPacket from the supplied ByteBuffer.  The
+     * buffer may have an L2 encapsulation (which is the full EthernetII
+     * format starting with the source-address MAC) or an L3 encapsulation
+     * (which starts with the IP header).
+     * <br>
+     * A subset of the optional parameters are parsed and are stored
+     * in object fields.
+     */
+    public static DhcpPacket decodeFullPacket(ByteBuffer packet, int pktType)
+    {
+        // bootp parameters
+        int transactionId;
+        InetAddress clientIp;
+        InetAddress yourIp;
+        InetAddress nextIp;
+        InetAddress relayIp;
+        byte[] clientMac;
+        List<InetAddress> dnsServers = null;
+        InetAddress gateway = null; // aka router
+        Integer leaseTime = null;
+        InetAddress serverIdentifier = null;
+        InetAddress netMask = null;
+        String message = null;
+        String vendorId = null;
+        byte[] expectedParams = null;
+        String hostName = null;
+        String domainName = null;
+        InetAddress ipSrc = null;
+        InetAddress ipDst = null;
+        InetAddress bcAddr = null;
+        InetAddress requestedIp = null;
+
+        // dhcp options
+        byte dhcpType = (byte) 0xFF;
+
+        packet.order(ByteOrder.BIG_ENDIAN);
+
+        // check to see if we need to parse L2, IP, and UDP encaps
+        if (pktType == ENCAP_L2) {
+            // System.out.println("buffer len " + packet.limit());
+            byte[] l2dst = new byte[6];
+            byte[] l2src = new byte[6];
+
+            packet.get(l2dst);
+            packet.get(l2src);
+
+            short l2type = packet.getShort();
+
+            if (l2type != 0x0800)
+                return null;
+        }
+
+        if ((pktType == ENCAP_L2) || (pktType == ENCAP_L3)) {
+            // assume l2type is 0x0800, i.e. IP
+            byte ipType = packet.get();
+            // System.out.println("ipType is " + ipType);
+            byte ipDiffServicesField = packet.get();
+            short ipTotalLength = packet.getShort();
+            short ipIdentification = packet.getShort();
+            byte ipFlags = packet.get();
+            byte ipFragOffset = packet.get();
+            byte ipTTL = packet.get();
+            byte ipProto = packet.get();
+            short ipChksm = packet.getShort();
+
+            ipSrc = readIpAddress(packet);
+            ipDst = readIpAddress(packet);
+
+            if (ipProto != IP_TYPE_UDP) // UDP
+                return null;
+
+            // assume UDP
+            short udpSrcPort = packet.getShort();
+            short udpDstPort = packet.getShort();
+            short udpLen = packet.getShort();
+            short udpChkSum = packet.getShort();
+
+            if ((udpSrcPort != DHCP_SERVER) && (udpSrcPort != DHCP_CLIENT))
+                return null;
+        }
+
+        // assume bootp
+        byte type = packet.get();
+        byte hwType = packet.get();
+        byte addrLen = packet.get();
+        byte hops = packet.get();
+        transactionId = packet.getInt();
+        short elapsed = packet.getShort();
+        short bootpFlags = packet.getShort();
+        boolean broadcast = (bootpFlags & 0x8000) != 0;
+        byte[] ipv4addr = new byte[4];
+
+        try {
+            packet.get(ipv4addr);
+            clientIp = InetAddress.getByAddress(ipv4addr);
+            packet.get(ipv4addr);
+            yourIp = InetAddress.getByAddress(ipv4addr);
+            packet.get(ipv4addr);
+            nextIp = InetAddress.getByAddress(ipv4addr);
+            packet.get(ipv4addr);
+            relayIp = InetAddress.getByAddress(ipv4addr);
+        } catch (UnknownHostException ex) {
+            return null;
+        }
+
+        clientMac = new byte[addrLen];
+        packet.get(clientMac);
+
+        // skip over address padding (16 octets allocated)
+        packet.position(packet.position() + (16 - addrLen)
+                        + 64    // skip server host name (64 chars)
+                        + 128); // skip boot file name (128 chars)
+
+        int dhcpMagicCookie = packet.getInt();
+
+        if (dhcpMagicCookie !=  0x63825363)
+            return null;
+
+        // parse options
+        boolean notFinishedOptions = true;
+
+        while ((packet.position() < packet.limit()) && notFinishedOptions) {
+            byte optionType = packet.get();
+
+            if (optionType == (byte) 0xFF) {
+                notFinishedOptions = false;
+            } else {
+                byte optionLen = packet.get();
+                int expectedLen = 0;
+
+                switch(optionType) {
+                    case DHCP_SUBNET_MASK:
+                        netMask = readIpAddress(packet);
+                        expectedLen = 4;
+                        break;
+                    case DHCP_ROUTER:
+                        gateway = readIpAddress(packet);
+                        expectedLen = 4;
+                        break;
+                    case DHCP_DNS_SERVER:
+                        dnsServers = new ArrayList<InetAddress>();
+                        expectedLen = 0;
+
+                        for (expectedLen = 0; expectedLen < optionLen;
+                             expectedLen += 4) {
+                            dnsServers.add(readIpAddress(packet));
+                        }
+                        break;
+                    case DHCP_HOST_NAME:
+                        expectedLen = optionLen;
+                        hostName = readAsciiString(packet, optionLen);
+                        break;
+                    case DHCP_DOMAIN_NAME:
+                        expectedLen = optionLen;
+                        domainName = readAsciiString(packet, optionLen);
+                        break;
+                    case DHCP_BROADCAST_ADDRESS:
+                        bcAddr = readIpAddress(packet);
+                        expectedLen = 4;
+                        break;
+                    case DHCP_REQUESTED_IP:
+                        requestedIp = readIpAddress(packet);
+                        expectedLen = 4;
+                        break;
+                    case DHCP_LEASE_TIME:
+                        leaseTime = Integer.valueOf(packet.getInt());
+                        expectedLen = 4;
+                        break;
+                    case DHCP_MESSAGE_TYPE:
+                        dhcpType = packet.get();
+                        expectedLen = 1;
+                        break;
+                    case DHCP_SERVER_IDENTIFIER:
+                        serverIdentifier = readIpAddress(packet);
+                        expectedLen = 4;
+                        break;
+                    case DHCP_PARAMETER_LIST:
+                        expectedParams = new byte[optionLen];
+                        packet.get(expectedParams);
+                        expectedLen = optionLen;
+                        break;
+                    case DHCP_MESSAGE:
+                        expectedLen = optionLen;
+                        message = readAsciiString(packet, optionLen);
+                        break;
+                    case DHCP_VENDOR_CLASS_ID:
+                        expectedLen = optionLen;
+                        vendorId = readAsciiString(packet, optionLen);
+                        break;
+                    case DHCP_CLIENT_IDENTIFIER: { // Client identifier
+                        byte[] id = new byte[optionLen];
+                        packet.get(id);
+                        expectedLen = optionLen;
+                    } break;
+                    default:
+                        // ignore any other parameters
+                        for (int i = 0; i < optionLen; i++) {
+                            expectedLen++;
+                            byte throwaway = packet.get();
+                        }
+                }
+
+                if (expectedLen != optionLen) {
+                    return null;
+                }
+            }
+        }
+
+        DhcpPacket newPacket;
+
+        switch(dhcpType) {
+            case -1: return null;
+            case DHCP_MESSAGE_TYPE_DISCOVER:
+                newPacket = new DhcpDiscoverPacket(
+                    transactionId, clientMac, broadcast);
+                break;
+            case DHCP_MESSAGE_TYPE_OFFER:
+                newPacket = new DhcpOfferPacket(
+                    transactionId, broadcast, ipSrc, yourIp, clientMac);
+                break;
+            case DHCP_MESSAGE_TYPE_REQUEST:
+                newPacket = new DhcpRequestPacket(
+                    transactionId, clientIp, clientMac, broadcast);
+                break;
+            case DHCP_MESSAGE_TYPE_DECLINE:
+                newPacket = new DhcpDeclinePacket(
+                    transactionId, clientIp, yourIp, nextIp, relayIp,
+                    clientMac);
+                break;
+            case DHCP_MESSAGE_TYPE_ACK:
+                newPacket = new DhcpAckPacket(
+                    transactionId, broadcast, ipSrc, yourIp, clientMac);
+                break;
+            case DHCP_MESSAGE_TYPE_NAK:
+                newPacket = new DhcpNakPacket(
+                    transactionId, clientIp, yourIp, nextIp, relayIp,
+                    clientMac);
+                break;
+            case DHCP_MESSAGE_TYPE_INFORM:
+                newPacket = new DhcpInformPacket(
+                    transactionId, clientIp, yourIp, nextIp, relayIp,
+                    clientMac);
+                break;
+            default:
+                System.out.println("Unimplemented type: " + dhcpType);
+                return null;
+        }
+
+        newPacket.mBroadcastAddress = bcAddr;
+        newPacket.mDnsServers = dnsServers;
+        newPacket.mDomainName = domainName;
+        newPacket.mGateway = gateway;
+        newPacket.mHostName = hostName;
+        newPacket.mLeaseTime = leaseTime;
+        newPacket.mMessage = message;
+        newPacket.mRequestedIp = requestedIp;
+        newPacket.mRequestedParams = expectedParams;
+        newPacket.mServerIdentifier = serverIdentifier;
+        newPacket.mSubnetMask = netMask;
+        return newPacket;
+    }
+
+    /**
+     * Parse a packet from an array of bytes.
+     */
+    public static DhcpPacket decodeFullPacket(byte[] packet, int pktType)
+    {
+        ByteBuffer buffer = ByteBuffer.wrap(packet).order(ByteOrder.BIG_ENDIAN);
+        return decodeFullPacket(buffer, pktType);
+    }
+
+    /**
+     * Builds a DHCP-DISCOVER packet from the required specified
+     * parameters.
+     */
+    public static ByteBuffer buildDiscoverPacket(int encap, int transactionId,
+        byte[] clientMac, boolean broadcast, byte[] expectedParams) {
+        DhcpPacket pkt = new DhcpDiscoverPacket(
+            transactionId, clientMac, broadcast);
+        pkt.mRequestedParams = expectedParams;
+        return pkt.buildPacket(encap, DHCP_SERVER, DHCP_CLIENT);
+    }
+
+    /**
+     * Builds a DHCP-OFFER packet from the required specified
+     * parameters.
+     */
+    public static ByteBuffer buildOfferPacket(int encap, int transactionId,
+        boolean broadcast, InetAddress serverIpAddr, InetAddress clientIpAddr,
+        byte[] mac, Integer timeout, InetAddress netMask, InetAddress bcAddr,
+        InetAddress gateway, List<InetAddress> dnsServers,
+        InetAddress dhcpServerIdentifier, String domainName) {
+        DhcpPacket pkt = new DhcpOfferPacket(
+            transactionId, broadcast, serverIpAddr, clientIpAddr, mac);
+        pkt.mGateway = gateway;
+        pkt.mDnsServers = dnsServers;
+        pkt.mLeaseTime = timeout;
+        pkt.mDomainName = domainName;
+        pkt.mServerIdentifier = dhcpServerIdentifier;
+        pkt.mSubnetMask = netMask;
+        pkt.mBroadcastAddress = bcAddr;
+        return pkt.buildPacket(encap, DHCP_CLIENT, DHCP_SERVER);
+    }
+
+    /**
+     * Builds a DHCP-ACK packet from the required specified parameters.
+     */
+    public static ByteBuffer buildAckPacket(int encap, int transactionId,
+        boolean broadcast, InetAddress serverIpAddr, InetAddress clientIpAddr,
+        byte[] mac, Integer timeout, InetAddress netMask, InetAddress bcAddr,
+        InetAddress gateway, List<InetAddress> dnsServers,
+        InetAddress dhcpServerIdentifier, String domainName) {
+        DhcpPacket pkt = new DhcpAckPacket(
+            transactionId, broadcast, serverIpAddr, clientIpAddr, mac);
+        pkt.mGateway = gateway;
+        pkt.mDnsServers = dnsServers;
+        pkt.mLeaseTime = timeout;
+        pkt.mDomainName = domainName;
+        pkt.mSubnetMask = netMask;
+        pkt.mServerIdentifier = dhcpServerIdentifier;
+        pkt.mBroadcastAddress = bcAddr;
+        return pkt.buildPacket(encap, DHCP_CLIENT, DHCP_SERVER);
+    }
+
+    /**
+     * Builds a DHCP-NAK packet from the required specified parameters.
+     */
+    public static ByteBuffer buildNakPacket(int encap, int transactionId,
+        InetAddress serverIpAddr, InetAddress clientIpAddr, byte[] mac) {
+        DhcpPacket pkt = new DhcpNakPacket(transactionId, clientIpAddr,
+            serverIpAddr, serverIpAddr, serverIpAddr, mac);
+        pkt.mMessage = "requested address not available";
+        pkt.mRequestedIp = clientIpAddr;
+        return pkt.buildPacket(encap, DHCP_CLIENT, DHCP_SERVER);
+    }
+
+    /**
+     * Builds a DHCP-REQUEST packet from the required specified parameters.
+     */
+    public static ByteBuffer buildRequestPacket(int encap,
+        int transactionId, InetAddress clientIp, boolean broadcast,
+        byte[] clientMac, InetAddress requestedIpAddress,
+        InetAddress serverIdentifier, byte[] requestedParams, String hostName) {
+        DhcpPacket pkt = new DhcpRequestPacket(transactionId, clientIp,
+            clientMac, broadcast);
+        pkt.mRequestedIp = requestedIpAddress;
+        pkt.mServerIdentifier = serverIdentifier;
+        pkt.mHostName = hostName;
+        pkt.mRequestedParams = requestedParams;
+        ByteBuffer result = pkt.buildPacket(encap, DHCP_SERVER, DHCP_CLIENT);
+        return result;
+    }
+}
diff --git a/core/java/android/net/dhcp/DhcpRequestPacket.java b/core/java/android/net/dhcp/DhcpRequestPacket.java
new file mode 100644
index 0000000..cf32957
--- /dev/null
+++ b/core/java/android/net/dhcp/DhcpRequestPacket.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.dhcp;
+
+import android.util.Log;
+
+import java.net.InetAddress;
+import java.net.Inet4Address;
+import java.nio.ByteBuffer;
+
+/**
+ * This class implements the DHCP-REQUEST packet.
+ */
+class DhcpRequestPacket extends DhcpPacket {
+    /**
+     * Generates a REQUEST packet with the specified parameters.
+     */
+    DhcpRequestPacket(int transId, InetAddress clientIp, byte[] clientMac,
+                      boolean broadcast) {
+        super(transId, clientIp, Inet4Address.ANY, Inet4Address.ANY,
+          Inet4Address.ANY, clientMac, broadcast);
+    }
+
+    public String toString() {
+        String s = super.toString();
+        return s + " REQUEST, desired IP " + mRequestedIp + " from host '"
+            + mHostName + "', param list length "
+            + (mRequestedParams == null ? 0 : mRequestedParams.length);
+    }
+
+    /**
+     * Fills in a packet with the requested REQUEST attributes.
+     */
+    public ByteBuffer buildPacket(int encap, short destUdp, short srcUdp) {
+        ByteBuffer result = ByteBuffer.allocate(MAX_LENGTH);
+
+        fillInPacket(encap, Inet4Address.ALL, Inet4Address.ANY, destUdp, srcUdp,
+            result, DHCP_BOOTREQUEST, mBroadcast);
+        result.flip();
+        return result;
+    }
+
+    /**
+     * Adds the optional parameters to the client-generated REQUEST packet.
+     */
+    void finishPacket(ByteBuffer buffer) {
+        byte[] clientId = new byte[7];
+
+        // assemble client identifier
+        clientId[0] = CLIENT_ID_ETHER;
+        System.arraycopy(mClientMac, 0, clientId, 1, 6);
+
+        addTlv(buffer, DHCP_MESSAGE_TYPE, DHCP_MESSAGE_TYPE_REQUEST);
+        addTlv(buffer, DHCP_PARAMETER_LIST, mRequestedParams);
+        addTlv(buffer, DHCP_REQUESTED_IP, mRequestedIp);
+        addTlv(buffer, DHCP_SERVER_IDENTIFIER, mServerIdentifier);
+        addTlv(buffer, DHCP_CLIENT_IDENTIFIER, clientId);
+        addTlvEnd(buffer);
+    }
+
+    /**
+     * Notifies the specified state machine of the REQUEST packet parameters.
+     */
+    public void doNextOp(DhcpStateMachine machine) {
+        InetAddress clientRequest =
+            mRequestedIp == null ? mClientIp : mRequestedIp;
+        Log.v(TAG, "requested IP is " + mRequestedIp + " and client IP is " +
+            mClientIp);
+        machine.onRequestReceived(mBroadcast, mTransId, mClientMac,
+            clientRequest, mRequestedParams, mHostName);
+    }
+}
diff --git a/core/java/android/net/dhcp/DhcpStateMachine.java b/core/java/android/net/dhcp/DhcpStateMachine.java
new file mode 100644
index 0000000..b6c384d
--- /dev/null
+++ b/core/java/android/net/dhcp/DhcpStateMachine.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.net.dhcp;
+
+import java.net.InetAddress;
+import java.nio.ByteBuffer;
+import java.util.List;
+
+/**
+ * This class defines the "next steps" which occur after a given DHCP
+ * packet has been received.
+ */
+interface DhcpStateMachine {
+    /**
+     * Signals that an offer packet has been received with the specified
+     * parameters.
+     */
+    public void onOfferReceived(boolean broadcast, int transactionId,
+        byte[] myMac, InetAddress offeredIpAddress,
+        InetAddress serverIpAddress);
+
+    /**
+     * Signals that a NAK packet has been received.
+     */
+    public void onNakReceived();
+
+    /**
+     * Signals that the final ACK has been received from the server.
+     */
+    public void onAckReceived(InetAddress myIpAddress, InetAddress myNetMask,
+        InetAddress myGateway, List<InetAddress> myDnsServers,
+        InetAddress myDhcpServer, int leaseTime);
+
+    /**
+     * Signals that a client's DISCOVER packet has been received with the
+     * specified parameters.
+     */
+    public void onDiscoverReceived(boolean broadcast, int transactionId,
+        byte[] clientMac, byte[] requestedParameterList);
+
+    /**
+     * Signals that a client's REQUEST packet has been received with the
+     * specified parameters.
+     */
+    public void onRequestReceived(boolean broadcast, int transactionId,
+        byte[] clientMac, InetAddress requestedIp, byte[] requestedParams,
+        String clientHostName);
+
+    /**
+     * Signals that a client's INFORM packet has been received with the
+     * specified parameters.
+     */
+    public void onInformReceived(int transactionId, byte[] clientMac,
+        InetAddress preassignedIp, byte[] requestedParams);
+
+    /**
+     * Signals that a client's DECLINE packet has been received with the
+     * specified parameters.
+     */
+    public void onDeclineReceived(byte[] clientMac, InetAddress declinedIp);
+}
diff --git a/core/java/android/os/FileUtils.java b/core/java/android/os/FileUtils.java
index 9d50fd9..f56f6a9 100644
--- a/core/java/android/os/FileUtils.java
+++ b/core/java/android/os/FileUtils.java
@@ -76,7 +76,12 @@
      * @return true if the file exists and false if it does not exist. If you do not have 
      * permission to stat the file, then this method will return false.
      */
-    public static native boolean getFileStatus(String path, FileStatus status);
+    public static boolean getFileStatus(String path, FileStatus status) {
+        StrictMode.noteDiskRead();
+        return getFileStatusNative(path, status);
+    }
+
+    private static native boolean getFileStatusNative(String path, FileStatus status);
 
     /** Regular expression for safe filenames: no spaces or metacharacters */
     private static final Pattern SAFE_FILENAME_PATTERN = Pattern.compile("[\\w%+,./=_-]+");
diff --git a/core/java/android/os/StrictMode.java b/core/java/android/os/StrictMode.java
index b00b9c9..e314fce 100644
--- a/core/java/android/os/StrictMode.java
+++ b/core/java/android/os/StrictMode.java
@@ -669,25 +669,46 @@
         CloseGuard.setEnabled(enabled);
     }
 
-    private static class StrictModeNetworkViolation extends BlockGuard.BlockGuardPolicyException {
+    /**
+     * @hide
+     */
+    public static class StrictModeViolation extends BlockGuard.BlockGuardPolicyException {
+        public StrictModeViolation(int policyState, int policyViolated, String message) {
+            super(policyState, policyViolated, message);
+        }
+    }
+
+    /**
+     * @hide
+     */
+    public static class StrictModeNetworkViolation extends StrictModeViolation {
         public StrictModeNetworkViolation(int policyMask) {
-            super(policyMask, DETECT_NETWORK);
+            super(policyMask, DETECT_NETWORK, null);
         }
     }
 
-    private static class StrictModeDiskReadViolation extends BlockGuard.BlockGuardPolicyException {
+    /**
+     * @hide
+     */
+    private static class StrictModeDiskReadViolation extends StrictModeViolation {
         public StrictModeDiskReadViolation(int policyMask) {
-            super(policyMask, DETECT_DISK_READ);
+            super(policyMask, DETECT_DISK_READ, null);
         }
     }
 
-    private static class StrictModeDiskWriteViolation extends BlockGuard.BlockGuardPolicyException {
+     /**
+     * @hide
+     */
+   private static class StrictModeDiskWriteViolation extends StrictModeViolation {
         public StrictModeDiskWriteViolation(int policyMask) {
-            super(policyMask, DETECT_DISK_WRITE);
+            super(policyMask, DETECT_DISK_WRITE, null);
         }
     }
 
-    private static class StrictModeCustomViolation extends BlockGuard.BlockGuardPolicyException {
+    /**
+     * @hide
+     */
+    private static class StrictModeCustomViolation extends StrictModeViolation {
         public StrictModeCustomViolation(int policyMask, String name) {
             super(policyMask, DETECT_CUSTOM, name);
         }
@@ -1007,9 +1028,16 @@
             // thread, in "gather" mode.  In this case, the duration
             // of the violation is computed by the ultimate caller and
             // its Looper, if any.
+            //
+            // Also, as a special short-cut case when the only penalty
+            // bit is death, we die immediately, rather than timing
+            // the violation's duration.  This makes it convenient to
+            // use in unit tests too, rather than waiting on a Looper.
+            //
             // TODO: if in gather mode, ignore Looper.myLooper() and always
             //       go into this immediate mode?
-            if (looper == null) {
+            if (looper == null ||
+                (info.policy & PENALTY_MASK) == PENALTY_DEATH) {
                 info.durationMillis = -1;  // unknown (redundant, already set)
                 handleViolation(info);
                 return;
@@ -1179,13 +1207,16 @@
             }
 
             if ((info.policy & PENALTY_DEATH) != 0) {
-                System.err.println("StrictMode policy violation with POLICY_DEATH; shutting down.");
-                Process.killProcess(Process.myPid());
-                System.exit(10);
+                executeDeathPenalty(info);
             }
         }
     }
 
+    private static void executeDeathPenalty(ViolationInfo info) {
+        int violationBit = parseViolationFromMessage(info.crashInfo.exceptionMessage);
+        throw new StrictModeViolation(info.policy, violationBit, null);
+    }
+
     /**
      * In the common case, as set by conditionallyEnableDebugLogging,
      * we're just dropboxing any violations but not showing a dialog,
@@ -1597,6 +1628,31 @@
     }
 
     /**
+     * @hide
+     */
+    public static void noteDiskRead() {
+        BlockGuard.Policy policy = BlockGuard.getThreadPolicy();
+        Log.d(TAG, "noteDiskRead; policy=" + policy);
+        if (!(policy instanceof AndroidBlockGuardPolicy)) {
+            // StrictMode not enabled.
+            return;
+        }
+        ((AndroidBlockGuardPolicy) policy).onReadFromDisk();
+    }
+
+    /**
+     * @hide
+     */
+    public static void noteDiskWrite() {
+        BlockGuard.Policy policy = BlockGuard.getThreadPolicy();
+        if (!(policy instanceof AndroidBlockGuardPolicy)) {
+            // StrictMode not enabled.
+            return;
+        }
+        ((AndroidBlockGuardPolicy) policy).onWriteToDisk();
+    }
+
+    /**
      * Parcelable that gets sent in Binder call headers back to callers
      * to report violations that happened during a cross-process call.
      *
diff --git a/core/java/android/os/Vibrator.java b/core/java/android/os/Vibrator.java
index e9428f7..3769cfe 100644
--- a/core/java/android/os/Vibrator.java
+++ b/core/java/android/os/Vibrator.java
@@ -22,6 +22,7 @@
  * Class that operates the vibrator on the device.
  * <p>
  * If your process exits, any vibration you started with will stop.
+ * </p>
  */
 public class Vibrator
 {
@@ -56,7 +57,7 @@
     /**
      * Turn the vibrator on.
      *
-     * @param milliseconds How long to vibrate for.
+     * @param milliseconds The number of milliseconds to vibrate.
      */
     public void vibrate(long milliseconds)
     {
@@ -75,12 +76,17 @@
      * Vibrate with a given pattern.
      *
      * <p>
-     * Pass in an array of ints that are the times at which to turn on or off
-     * the vibrator.  The first one is how long to wait before turning it on,
-     * and then after that it alternates.  If you want to repeat, pass the
-     * index into the pattern at which to start the repeat.
+     * Pass in an array of ints that are the durations for which to turn on or off
+     * the vibrator in milliseconds.  The first value indicates the number of milliseconds
+     * to wait before turning the vibrator on.  The next value indicates the number of milliseconds
+     * for which to keep the vibrator on before turning it off.  Subsequent values alternate
+     * between durations in milliseconds to turn the vibrator off or to turn the vibrator on.
+     * </p><p>
+     * To cause the pattern to repeat, pass the index into the pattern array at which
+     * to start the repeat, or -1 to disable repeating.
+     * </p>
      *
-     * @param pattern an array of longs of times to turn the vibrator on or off.
+     * @param pattern an array of longs of times for which to turn the vibrator on or off.
      * @param repeat the index into pattern at which to repeat, or -1 if
      *        you don't want to repeat.
      */
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java
index d9039ab..7a186f3 100644
--- a/core/java/android/preference/PreferenceActivity.java
+++ b/core/java/android/preference/PreferenceActivity.java
@@ -1005,6 +1005,21 @@
             mFragmentBreadCrumbs.setActivity(this);
         }
         mFragmentBreadCrumbs.setTitle(title, shortTitle);
+        mFragmentBreadCrumbs.setParentTitle(null, null, null);
+    }
+
+    /**
+     * Should be called after onCreate to ensure that the breadcrumbs, if any, were created.
+     * This prepends a title to the fragment breadcrumbs and attaches a listener to any clicks
+     * on the parent entry.
+     * @param title the title for the breadcrumb
+     * @param shortTitle the short title for the breadcrumb
+     */
+    public void setParentTitle(CharSequence title, CharSequence shortTitle,
+            OnClickListener listener) {
+        if (mFragmentBreadCrumbs != null) {
+            mFragmentBreadCrumbs.setParentTitle(title, shortTitle, listener);
+        }
     }
 
     void setSelectedHeader(Header header) {
diff --git a/core/java/android/server/BluetoothService.java b/core/java/android/server/BluetoothService.java
index 1f19f9e..9e5abdc 100644
--- a/core/java/android/server/BluetoothService.java
+++ b/core/java/android/server/BluetoothService.java
@@ -75,6 +75,7 @@
 import java.io.InputStreamReader;
 import java.io.PrintWriter;
 import java.io.UnsupportedEncodingException;
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashMap;
@@ -1660,20 +1661,10 @@
         try {
             ifcg = service.getInterfaceConfig(iface);
             if (ifcg != null) {
-                String[] addr = BLUETOOTH_NETMASK.split("\\.");
-                ifcg.netmask = (Integer.parseInt(addr[0]) << 24) +
-                        (Integer.parseInt(addr[1]) << 16) +
-                        (Integer.parseInt(addr[2]) << 8) +
-                        (Integer.parseInt(addr[3]));
-                if (ifcg.ipAddr == 0) {
-                    addr = address.split("\\.");
-
-                    ifcg.ipAddr = (Integer.parseInt(addr[0]) << 24) +
-                            (Integer.parseInt(addr[1]) << 16) +
-                            (Integer.parseInt(addr[2]) << 8) +
-                            (Integer.parseInt(addr[3]));
-                    ifcg.interfaceFlags =
-                        ifcg.interfaceFlags.replace("down", "up");
+                ifcg.mask = InetAddress.getByName(BLUETOOTH_NETMASK);
+                if (ifcg.addr == null) {
+                    ifcg.addr = InetAddress.getByName(address);
+                    ifcg.interfaceFlags = ifcg.interfaceFlags.replace("down", "up");
                 }
                 ifcg.interfaceFlags = ifcg.interfaceFlags.replace("running", "");
                 ifcg.interfaceFlags = ifcg.interfaceFlags.replace("  "," ");
diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java
index 9bda637..95949b9 100644
--- a/core/java/android/view/ViewRoot.java
+++ b/core/java/android/view/ViewRoot.java
@@ -865,6 +865,9 @@
                 childWidthMeasureSpec = getRootMeasureSpec(desiredWindowWidth, lp.width);
                 childHeightMeasureSpec = getRootMeasureSpec(desiredWindowHeight, lp.height);
                 host.measure(childWidthMeasureSpec, childHeightMeasureSpec);
+                if (mWidth != host.getMeasuredWidth() || mHeight != host.getMeasuredHeight()) {
+                    windowSizeMayChange = true;
+                }
             }
 
             if (DBG) {
diff --git a/core/java/android/widget/Adapter.java b/core/java/android/widget/Adapter.java
index 9b6c5a4..88b54bf 100644
--- a/core/java/android/widget/Adapter.java
+++ b/core/java/android/widget/Adapter.java
@@ -17,7 +17,6 @@
 package android.widget;
 
 import android.database.DataSetObserver;
-import android.view.KeyEvent;
 import android.view.View;
 import android.view.ViewGroup;
 
@@ -91,6 +90,9 @@
      * @param convertView The old view to reuse, if possible. Note: You should check that this view
      *        is non-null and of an appropriate type before using. If it is not possible to convert
      *        this view to display the correct data, this method can create a new view.
+     *        Heterogeneous lists can specify their number of view types, so that this View is
+     *        always of the right type (see {@link #getViewTypeCount()} and
+     *        {@link #getItemViewType(int)}).
      * @param parent The parent that this view will eventually be attached to
      * @return A View corresponding to the data at the specified position.
      */
diff --git a/core/java/android/widget/PopupWindow.java b/core/java/android/widget/PopupWindow.java
index 0f61cd4..591a2d4 100644
--- a/core/java/android/widget/PopupWindow.java
+++ b/core/java/android/widget/PopupWindow.java
@@ -600,7 +600,6 @@
      * @return true if the touch splitting is enabled, false otherwise
      * 
      * @see #setSplitTouchEnabled(boolean)
-     * @hide
      */
     public boolean isSplitTouchEnabled() {
         if (mSplitTouchEnabled < 0 && mContext != null) {
@@ -621,7 +620,6 @@
      *
      * @param enabled true if the split touches should be enabled, false otherwise
      * @see #isSplitTouchEnabled()
-     * @hide
      */
     public void setSplitTouchEnabled(boolean enabled) {
         mSplitTouchEnabled = enabled ? 1 : 0;
diff --git a/core/java/android/widget/Switch.java b/core/java/android/widget/Switch.java
index 4223040..8fb6fa3 100644
--- a/core/java/android/widget/Switch.java
+++ b/core/java/android/widget/Switch.java
@@ -192,12 +192,6 @@
 
         setSwitchTypefaceByIndex(typefaceIndex, styleIndex);
 
-        int lineHeight = appearance.getDimensionPixelSize(
-                com.android.internal.R.styleable.TextAppearance_textLineHeight, 0);
-        if (lineHeight != 0) {
-            setLineHeight(lineHeight);
-        }
-
         appearance.recycle();
     }
 
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 751cd53..c7ee57b 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -766,13 +766,6 @@
                 mEditTextMultilineBackground = a.getDrawable(attr);
                 break;
 
-            case com.android.internal.R.styleable.TextView_textLineHeight:
-                int lineHeight = a.getDimensionPixelSize(attr, 0);
-                if (lineHeight != 0) {
-                    setLineHeight(lineHeight);
-                }
-                break;
-
             case com.android.internal.R.styleable.TextView_textIsSelectable:
                 mTextIsSelectable = a.getBoolean(attr, false);
                 break;
@@ -1133,15 +1126,9 @@
      * within the text can cause individual lines to be taller or shorter
      * than this height, and the layout may contain additional first-
      * or last-line padding.
-     *
-     * @attr ref android.R.styleable#TextView_textLineHeight
      */
     public int getLineHeight() {
-        if (mLineHeight != 0) {
-            return mLineHeight;
-        }
-        return FastMath.round(mTextPaint.getFontMetricsInt(null) * mSpacingMult
-                          + mSpacingAdd);
+        return FastMath.round(mTextPaint.getFontMetricsInt(null) * mSpacingMult + mSpacingAdd);
     }
 
     /**
@@ -1728,26 +1715,10 @@
 
         setTypefaceByIndex(typefaceIndex, styleIndex);
         
-        int lineHeight = appearance.getDimensionPixelSize(
-                com.android.internal.R.styleable.TextAppearance_textLineHeight, 0);
-        if (lineHeight != 0) {
-            setLineHeight(lineHeight);
-        }
-
         appearance.recycle();
     }
 
     /**
-     * Set the height of a line of text in pixels. This value will override line height
-     * values stored in the font modified by lineSpacingExtra and lineSpacingMultiplier.
-     *
-     * @param lineHeight Desired height of a single line of text in pixels
-     */
-    public void setLineHeight(int lineHeight) {
-        mLineHeight = lineHeight;
-    }
-
-    /**
      * @return the size (in pixels) of the default text size in this TextView.
      */
     public float getTextSize() {
@@ -7646,7 +7617,7 @@
             if (start == end) {
                 // Cases where the text ends with a '.' and we select from the end of the line
                 // (right after the dot), or when we select from the space character in "aaa, bbb".
-                final char c = mTransformed.charAt(start);
+                final char c = mTransformed.charAt(start - 1);
                 final int type = Character.getType(c);
                 if (type == Character.OTHER_PUNCTUATION) continue;
             }
@@ -8465,13 +8436,6 @@
         public static final int CENTER = 1;
         public static final int RIGHT = 2;
 
-        class LongPressCallback implements Runnable {
-            public void run() {
-                mController.hide();
-                startSelectionActionMode();
-            }
-        }
-
         public HandleView(CursorController controller, int pos) {
             super(TextView.this.mContext);
             mController = controller;
@@ -9400,7 +9364,6 @@
 
     private float                   mSpacingMult = 1;
     private float                   mSpacingAdd = 0;
-    private int                     mLineHeight = 0;
     private boolean                 mTextIsSelectable = false;
 
     private static final int        LINES = 1;
diff --git a/core/java/com/android/internal/view/menu/MenuPopupHelper.java b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
index 2cb78a5..a5fd38e 100644
--- a/core/java/com/android/internal/view/menu/MenuPopupHelper.java
+++ b/core/java/com/android/internal/view/menu/MenuPopupHelper.java
@@ -96,6 +96,7 @@
         }
 
         mPopup.setContentWidth(Math.min(measureContentWidth(adapter), mPopupMaxWidth));
+        mPopup.setInputMethodMode(PopupWindow.INPUT_METHOD_NOT_NEEDED);
         mPopup.show();
         mPopup.getListView().setOnKeyListener(this);
     }
@@ -163,6 +164,9 @@
             final View anchor = mAnchorView != null ? mAnchorView.get() : null;
             if (anchor != null && !anchor.isShown()) {
                 dismiss();
+            } else {
+                // Recompute window size and position
+                mPopup.show();
             }
         }
     }
diff --git a/core/jni/android_os_FileUtils.cpp b/core/jni/android_os_FileUtils.cpp
index d3faa2f..d8a3db3 100644
--- a/core/jni/android_os_FileUtils.cpp
+++ b/core/jni/android_os_FileUtils.cpp
@@ -177,7 +177,7 @@
     {"getPermissions",  "(Ljava/lang/String;[I)I", (void*)android_os_FileUtils_getPermissions},
     {"setUMask",        "(I)I",                    (void*)android_os_FileUtils_setUMask},
     {"getFatVolumeId",  "(Ljava/lang/String;)I", (void*)android_os_FileUtils_getFatVolumeId},
-    {"getFileStatus",  "(Ljava/lang/String;Landroid/os/FileUtils$FileStatus;)Z", (void*)android_os_FileUtils_getFileStatus},
+    {"getFileStatusNative", "(Ljava/lang/String;Landroid/os/FileUtils$FileStatus;)Z", (void*)android_os_FileUtils_getFileStatus},
 };
 
 static const char* const kFileUtilsPathName = "android/os/FileUtils";
@@ -211,4 +211,3 @@
 }
 
 }
-
diff --git a/core/res/res/drawable-hdpi/spinner_active_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_active_holo_dark.9.png
index bbf2861..752b416 100644
--- a/core/res/res/drawable-hdpi/spinner_active_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/spinner_active_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_active_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_active_holo_light.9.png
index a10098d..afc0c57 100644
--- a/core/res/res/drawable-hdpi/spinner_active_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/spinner_active_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_cab_active_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_cab_active_holo_dark.9.png
index ffae7e7..7cad0c9 100644
--- a/core/res/res/drawable-hdpi/spinner_cab_active_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/spinner_cab_active_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_cab_active_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_cab_active_holo_light.9.png
index eaa38e2..7cad0c9 100644
--- a/core/res/res/drawable-hdpi/spinner_cab_active_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/spinner_cab_active_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_cab_default_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_cab_default_holo_dark.9.png
index 8693710..b3f3cf7 100644
--- a/core/res/res/drawable-hdpi/spinner_cab_default_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/spinner_cab_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_cab_default_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_cab_default_holo_light.9.png
index 941739e..af46631 100644
--- a/core/res/res/drawable-hdpi/spinner_cab_default_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/spinner_cab_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_cab_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_cab_pressed_holo_dark.9.png
index dc236ec..8b6f9dd 100644
--- a/core/res/res/drawable-hdpi/spinner_cab_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/spinner_cab_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_cab_pressed_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_cab_pressed_holo_light.9.png
index 17e3a27..4f0c476 100644
--- a/core/res/res/drawable-hdpi/spinner_cab_pressed_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/spinner_cab_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_default_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_default_holo_dark.9.png
index 7189c6d..ac36c06 100644
--- a/core/res/res/drawable-hdpi/spinner_default_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/spinner_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_default_holo_light.9.png b/core/res/res/drawable-hdpi/spinner_default_holo_light.9.png
index 996ef15..6821599 100644
--- a/core/res/res/drawable-hdpi/spinner_default_holo_light.9.png
+++ b/core/res/res/drawable-hdpi/spinner_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/spinner_pressed_holo_dark.9.png b/core/res/res/drawable-hdpi/spinner_pressed_holo_dark.9.png
index 5428b0a..3b26017 100644
--- a/core/res/res/drawable-hdpi/spinner_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-hdpi/spinner_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_active_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_active_holo_dark.9.png
index c235501..1f0521a 100644
--- a/core/res/res/drawable-mdpi/spinner_active_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/spinner_active_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_active_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_active_holo_light.9.png
index 06e2bde..9604e1f 100644
--- a/core/res/res/drawable-mdpi/spinner_active_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/spinner_active_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_cab_active_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_cab_active_holo_dark.9.png
index bb57d8d..617c379 100644
--- a/core/res/res/drawable-mdpi/spinner_cab_active_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/spinner_cab_active_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_cab_active_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_cab_active_holo_light.9.png
index 4e3edff..617c379 100644
--- a/core/res/res/drawable-mdpi/spinner_cab_active_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/spinner_cab_active_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_cab_default_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_cab_default_holo_dark.9.png
index 62d2f6e..d76b123 100644
--- a/core/res/res/drawable-mdpi/spinner_cab_default_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/spinner_cab_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_cab_default_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_cab_default_holo_light.9.png
index df80aa6..ee91044 100644
--- a/core/res/res/drawable-mdpi/spinner_cab_default_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/spinner_cab_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_cab_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_cab_pressed_holo_dark.9.png
index 9b8a54b..df0a935 100644
--- a/core/res/res/drawable-mdpi/spinner_cab_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/spinner_cab_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_cab_pressed_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_cab_pressed_holo_light.9.png
index 6d4fa54..b43177b 100644
--- a/core/res/res/drawable-mdpi/spinner_cab_pressed_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/spinner_cab_pressed_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_default_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_default_holo_dark.9.png
index 3dba2352..99b1605 100644
--- a/core/res/res/drawable-mdpi/spinner_default_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/spinner_default_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_default_holo_light.9.png b/core/res/res/drawable-mdpi/spinner_default_holo_light.9.png
index 4614cfa..c820e40 100644
--- a/core/res/res/drawable-mdpi/spinner_default_holo_light.9.png
+++ b/core/res/res/drawable-mdpi/spinner_default_holo_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/spinner_pressed_holo_dark.9.png b/core/res/res/drawable-mdpi/spinner_pressed_holo_dark.9.png
index 25aaed2..083194a 100644
--- a/core/res/res/drawable-mdpi/spinner_pressed_holo_dark.9.png
+++ b/core/res/res/drawable-mdpi/spinner_pressed_holo_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable/background_cache_hint_selector_holo_dark.xml b/core/res/res/drawable/background_cache_hint_selector_holo_dark.xml
new file mode 100644
index 0000000..b18c5b7
--- /dev/null
+++ b/core/res/res/drawable/background_cache_hint_selector_holo_dark.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_accelerated="false"
+            android:color="@android:color/background_holo_dark" />
+    <item android:color="@android:color/transparent" />
+</selector>
diff --git a/core/res/res/drawable/background_cache_hint_selector_holo_light.xml b/core/res/res/drawable/background_cache_hint_selector_holo_light.xml
new file mode 100644
index 0000000..9d80944
--- /dev/null
+++ b/core/res/res/drawable/background_cache_hint_selector_holo_light.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2010 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:state_accelerated="false"
+            android:color="@android:color/background_holo_light" />
+    <item android:color="@android:color/transparent" />
+</selector>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 181bbcc..f10e90f 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -722,9 +722,6 @@
     <!-- Color of link text (URLs). -->
     <attr name="textColorLink" format="reference|color" />
 
-    <!-- Height of a line of text. -->
-    <attr name="textLineHeight" format="dimension" />
-
     <!-- Indicates that the content of a non-editable TextView can be selected.
      Default value is false. EditText content is always selectable. -->
     <attr name="textIsSelectable" format="boolean" />
@@ -2429,8 +2426,6 @@
         <attr name="textColorHint" />
         <!-- Color of the links. -->
         <attr name="textColorLink" />
-        <!-- Height of a single line of text. -->
-        <attr name="textLineHeight" />
     </declare-styleable>
     <declare-styleable name="TextSwitcher">
     </declare-styleable>
@@ -2672,10 +2667,7 @@
         <attr name="textEditPasteWindowLayout" />
         <!-- Variation of textEditPasteWindowLayout displayed when the clipboard is empty. -->
         <attr name="textEditNoPasteWindowLayout" />
-
-        <!-- Height of a line of text. -->
-        <attr name="textLineHeight" />
-        <!-- Indicates that a non-editable text can be selected. -->
+        <!-- Indicates that the content of a non-editable text can be selected. -->
         <attr name="textIsSelectable" />
         <!--  A specific background drawable used by multi-line EditText only. -->
         <attr name="multilineBackground" format="reference"/>
diff --git a/core/res/res/values/public.xml b/core/res/res/values/public.xml
index dcc88f0..3a5b238 100644
--- a/core/res/res/values/public.xml
+++ b/core/res/res/values/public.xml
@@ -1358,7 +1358,6 @@
   <public type="attr" name="loopViews" />
   <public type="attr" name="dialogTheme" />
   <public type="attr" name="alertDialogTheme" />
-  <public type="attr" name="textLineHeight" />
   <public type="attr" name="dividerVertical" />
   <public type="attr" name="homeAsUpIndicator" />
   <public type="attr" name="enterFadeDuration" />
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index d34c6c1..f0f101e 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -690,7 +690,7 @@
         <item name="colorForeground">@android:color/bright_foreground_holo_dark</item>
         <item name="colorForegroundInverse">@android:color/bright_foreground_inverse_holo_dark</item>
         <item name="colorBackground">@android:color/background_holo_dark</item>
-        <item name="colorBackgroundCacheHint">?android:attr/colorBackground</item>
+        <item name="colorBackgroundCacheHint">@android:drawable/background_cache_hint_selector_holo_dark</item>
         <item name="disabledAlpha">0.5</item>
         <item name="backgroundDimAmount">0.6</item>
 
@@ -952,7 +952,7 @@
         <item name="colorForeground">@android:color/bright_foreground_holo_light</item>
         <item name="colorForegroundInverse">@android:color/bright_foreground_inverse_holo_light</item>
         <item name="colorBackground">@android:color/background_holo_light</item>
-        <item name="colorBackgroundCacheHint">?android:attr/colorBackground</item>
+        <item name="colorBackgroundCacheHint">@android:drawable/background_cache_hint_selector_holo_light</item>
         <item name="disabledAlpha">0.5</item>
         <item name="backgroundDimAmount">0.6</item>
 
diff --git a/docs/html/guide/appendix/api-levels.jd b/docs/html/guide/appendix/api-levels.jd
index 50e5149..5898fe5 100644
--- a/docs/html/guide/appendix/api-levels.jd
+++ b/docs/html/guide/appendix/api-levels.jd
@@ -160,7 +160,6 @@
 element might look like this: </p>
 
 <pre>&lt;manifest&gt;
-  ...
   &lt;uses-sdk android:minSdkVersion="5" /&gt;
   ...
 &lt;/manifest&gt;</pre>
diff --git a/docs/html/guide/developing/eclipse-adt.jd b/docs/html/guide/developing/eclipse-adt.jd
index 1594159..e8d2416 100644
--- a/docs/html/guide/developing/eclipse-adt.jd
+++ b/docs/html/guide/developing/eclipse-adt.jd
@@ -541,7 +541,6 @@
     &lt;activity android:name="GameActivity" /&gt;
     ...
   &lt;/application&gt;
-  ...
 &lt;/manifest&gt;</pre>
 
 
@@ -611,7 +610,6 @@
     &lt;activity android:name="com.example.android.tictactoe.library.GameActivity" /&gt;
     ...
   &lt;/application&gt;
-  ...
 &lt;/manifest&gt;</pre>
 
 <p>For more information about the manifest file, see the documentation for <a
diff --git a/docs/html/guide/developing/other-ide.jd b/docs/html/guide/developing/other-ide.jd
index 8c61771a..95b3680 100644
--- a/docs/html/guide/developing/other-ide.jd
+++ b/docs/html/guide/developing/other-ide.jd
@@ -700,7 +700,6 @@
     &lt;activity android:name="GameActivity" /&gt;
     ...
   &lt;/application&gt;
-  ...
 &lt;/manifest&gt;</pre>
 
 <h4>Updating a library project</h4>
@@ -796,7 +795,6 @@
     &lt;activity android:name="com.example.android.tictactoe.library.GameActivity" /&gt;
     ...
   &lt;/application&gt;
-  ...
 &lt;/manifest&gt;</pre>
 
 <p>For more information about the manifest file, see the documentation for <a
diff --git a/docs/html/guide/developing/testing/testing_otheride.jd b/docs/html/guide/developing/testing/testing_otheride.jd
index 523a8e5..adb0efa 100644
--- a/docs/html/guide/developing/testing/testing_otheride.jd
+++ b/docs/html/guide/developing/testing/testing_otheride.jd
@@ -296,7 +296,7 @@
 <h2 id="RunTestsCommand">Running Tests</h2>
 <p>
     You run tests from the command line, either with Ant or with an
-    <a href="{@docRoot}http://developer.android.com/guide/developing/tools/adb.html">
+    <a href="{@docRoot}guide/developing/tools/adb.html">
     Android Debug Bridge (adb)</a> shell.
 </p>
 <h3 id="RunTestsAnt">Quick build and run with Ant</h3>
@@ -318,7 +318,7 @@
 <h3 id="RunTestsDevice">Running tests on a device or emulator</h3>
 <p>
     When you run tests from the command line with
-    <a href="{@docRoot}http://developer.android.com/guide/developing/tools/adb.html">
+    <a href="{@docRoot}guide/developing/tools/adb.html">
     Android Debug Bridge (adb)</a>, you get more options for choosing the tests
     to run than with any other method. You can select individual test methods, filter tests
     according to their annotation, or specify testing options. Since the test run is controlled
diff --git a/docs/html/guide/developing/tools/emulator.jd b/docs/html/guide/developing/tools/emulator.jd
index f07cdd5..2250979 100644
--- a/docs/html/guide/developing/tools/emulator.jd
+++ b/docs/html/guide/developing/tools/emulator.jd
@@ -496,8 +496,8 @@
   <td>Enable the root shell (as in <code>-shell</code> and specify the QEMU character 
   device to use for communication with the shell.</td>
   <td>&lt;device&gt; must be a QEMU device type. See the documentation for '-serial <em>dev</em>' at 
-  <a href="http://www.nongnu.org/qemu/qemu-doc.html#SEC10">http://www.bellard.org/qemu/qemu-doc.html#SEC10</a> 
-  for a list of device types.</p>
+  <a href="http://wiki.qemu.org/download/qemu-doc.html">wiki.qemu.org</a> 
+  for more information.</p>
 
 <p>Here are some examples: </p>
 <ul>
diff --git a/docs/html/guide/practices/screens_support.jd b/docs/html/guide/practices/screens_support.jd
index 7811d90..b70be07 100644
--- a/docs/html/guide/practices/screens_support.jd
+++ b/docs/html/guide/practices/screens_support.jd
@@ -693,13 +693,13 @@
 
 <pre>
 &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"&gt;
-    ...
     &lt;supports-screens
         android:smallScreens="true"
         android:normalScreens="true"
         android:largeScreens="true"
         android:xlargeScreens="true"
         android:anyDensity="true" /&gt;
+    ...
 &lt;/manifest&gt;
 </pre>
 <!--  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; android:resizeable="true" -->
diff --git a/docs/html/guide/publishing/licensing.jd b/docs/html/guide/publishing/licensing.jd
index fc83ec0..40439f0 100644
--- a/docs/html/guide/publishing/licensing.jd
+++ b/docs/html/guide/publishing/licensing.jd
@@ -784,7 +784,6 @@
 <pre>&lt;?xml version="1.0" encoding="utf-8"?&gt;
 
 &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android" ..."&gt;
-    ...
     &lt;!-- Devices &gt;= 3 have version of Android Market that supports licensing. --&gt;
     &lt;uses-sdk android:minSdkVersion="3" /&gt;
     &lt;!-- Required permission to check licensing. --&gt;
diff --git a/docs/html/guide/topics/admin/device-admin.jd b/docs/html/guide/topics/admin/device-admin.jd
index fda716a..b86a5f0 100644
--- a/docs/html/guide/topics/admin/device-admin.jd
+++ b/docs/html/guide/topics/admin/device-admin.jd
@@ -156,14 +156,14 @@
 <h2 id="sample">Sample Application</h2>
 
 <p>The examples used in this document are based on the <a
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/
-android/apis/app/DeviceAdminSample.html">Device Administration API
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.html">
+Device Administration API
 sample</a>, which is included in the SDK samples. For information on downloading and
 installing the SDK samples, see <a
 href="{@docRoot}resources/samples/get.html">
 Getting the Samples</a>. Here is the  <a
-href="{@docRoot}resources/samples/ApiDemos/src/com/example/
-android/apis/app/DeviceAdminSample.html">complete code</a> for
+href="{@docRoot}resources/samples/ApiDemos/src/com/example/android/apis/app/DeviceAdminSample.html">
+complete code</a> for
 the sample. </p>
 <p>The
 sample application offers a demo of device admin features. It presents users
diff --git a/docs/html/guide/topics/data/backup.jd b/docs/html/guide/topics/data/backup.jd
index 623ee22..7661a0e 100644
--- a/docs/html/guide/topics/data/backup.jd
+++ b/docs/html/guide/topics/data/backup.jd
@@ -166,6 +166,7 @@
 
 <pre>
 &lt;manifest ... &gt;
+    ...
     &lt;application android:label="MyApplication"
                  <b>android:backupAgent="MyBackupAgent"</b>&gt;
         &lt;activity ... &gt;
diff --git a/docs/html/guide/topics/manifest/manifest-intro.jd b/docs/html/guide/topics/manifest/manifest-intro.jd
index efbfa5a..d7a3e3e 100644
--- a/docs/html/guide/topics/manifest/manifest-intro.jd
+++ b/docs/html/guide/topics/manifest/manifest-intro.jd
@@ -441,6 +441,7 @@
 <pre>
 &lt;manifest . . . &gt;
     &lt;permission android:name="com.example.project.DEBIT_ACCT" . . . /&gt;
+    &lt;uses-permission android:name="com.example.project.DEBIT_ACCT" /&gt;
     . . .
     &lt;application . . .&gt;
         &lt;activity android:name="com.example.project.FreneticActivity"
@@ -449,9 +450,6 @@
             . . .
         &lt;/activity&gt;
     &lt;/application&gt;
-    . . .
-    &lt;uses-permission android:name="com.example.project.DEBIT_ACCT" /&gt;
-    . . .
 &lt;/manifest&gt;
 </pre>
 
diff --git a/docs/html/guide/topics/manifest/permission-tree-element.jd b/docs/html/guide/topics/manifest/permission-tree-element.jd
index aecc930..6d6cd0a 100644
--- a/docs/html/guide/topics/manifest/permission-tree-element.jd
+++ b/docs/html/guide/topics/manifest/permission-tree-element.jd
@@ -42,7 +42,7 @@
 reference to a string resource, so that it can be localized like other 
 strings in the user interface.</dd>
 
-<dt><a name="nm"</a>{@code android:name}</dt>
+<dt><a name="nm"></a>{@code android:name}</dt>
 <dd>The name that's at the base of the permission tree.  It serves as 
 a prefix to all permission names in the tree.  Java-style scoping should 
 be used to ensure that the name is unique.  The name must have more than 
diff --git a/docs/html/guide/topics/manifest/uses-feature-element.jd b/docs/html/guide/topics/manifest/uses-feature-element.jd
index 6652aff..5242126 100644
--- a/docs/html/guide/topics/manifest/uses-feature-element.jd
+++ b/docs/html/guide/topics/manifest/uses-feature-element.jd
@@ -339,7 +339,7 @@
 <p class="caution">It's important to understand that the permissions that you
 request in <code>&lt;uses-permission&gt;</code> elements can directly affect how
 Android Market filters your application. The reference section <a
-href="permissions-features">Permissions that Imply Feature Requirements</a>,
+href="#permissions">Permissions that Imply Feature Requirements</a>,
 below, lists the full set of permissions that imply feature requirements and
 therefore trigger filtering.</p>
 
@@ -403,10 +403,9 @@
 </dl>
 
 <pre>&lt;manifest ...>
-...
     &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
     &lt;uses-sdk android:minSdkVersion="3" />
-...
+    ...
 &lt;/manifest></pre>
 
 <dl>
@@ -418,10 +417,9 @@
 </dl>
 
 <pre>&lt;manifest ...>
-...
     &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
     &lt;uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5" />
-...
+    ...
 &lt;/manifest></pre>
 
 <dl>
@@ -430,11 +428,10 @@
 </dl>
 
 <pre>&lt;manifest ...>
-...
     &lt;uses-feature android:name="android.hardware.bluetooth" />
     &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
     &lt;uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5" />
-...
+    ...
 &lt;/manifest></pre>
 
 <dl>
@@ -445,11 +442,10 @@
 </dl>
 
 <pre>&lt;manifest ...>
-...
     &lt;uses-feature android:name="android.hardware.bluetooth" android:required="false" />
     &lt;uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
     &lt;uses-sdk android:minSdkVersion="3" android:targetSdkVersion="5" />
-...
+    ...
 &lt;/manifest></pre>
 
 
diff --git a/docs/html/guide/topics/resources/layout-resource.jd b/docs/html/guide/topics/resources/layout-resource.jd
index 36369d3..b069521 100644
--- a/docs/html/guide/topics/resources/layout-resource.jd
+++ b/docs/html/guide/topics/resources/layout-resource.jd
@@ -181,7 +181,7 @@
 in another layout file using <a href="#include-element"><code>&lt;include&gt;</code></a> and
 this layout doesn't require a different {@link android.view.ViewGroup} container. For more
 information about merging layouts, read <a
-href="{@docRoot}resources/articles/layout-tricks-merging.html">Layout
+href="{@docRoot}resources/articles/layout-tricks-merge.html">Layout
 Tricks: Merging</a>.</dd>
 
   </dl>
diff --git a/docs/html/guide/topics/security/security.jd b/docs/html/guide/topics/security/security.jd
index de0c6e5..2e31940 100644
--- a/docs/html/guide/topics/security/security.jd
+++ b/docs/html/guide/topics/security/security.jd
@@ -120,9 +120,8 @@
 
 <pre>&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
     package=&quot;com.android.app.myapp&quot; &gt;
-
     &lt;uses-permission android:name=&quot;android.permission.RECEIVE_SMS&quot; /&gt;
-
+    ...
 &lt;/manifest&gt;</pre>
 
 <p>At application install time, permissions requested by the application are
@@ -175,13 +174,12 @@
 
 <pre>&lt;manifest xmlns:android=&quot;http://schemas.android.com/apk/res/android&quot;
     package=&quot;com.me.app.myapp&quot; &gt;
-
     &lt;permission android:name=&quot;com.me.app.myapp.permission.DEADLY_ACTIVITY&quot;
         android:label=&quot;&#64;string/permlab_deadlyActivity&quot;
         android:description=&quot;&#64;string/permdesc_deadlyActivity&quot;
         android:permissionGroup=&quot;android.permission-group.COST_MONEY&quot;
         android:protectionLevel=&quot;dangerous&quot; /&gt;
-
+    ...
 &lt;/manifest&gt;</pre>
 
 <p>The {@link android.R.styleable#AndroidManifestPermission_protectionLevel
diff --git a/docs/html/guide/topics/testing/contentprovider_testing.jd b/docs/html/guide/topics/testing/contentprovider_testing.jd
index 279e347..e42e631 100644
--- a/docs/html/guide/topics/testing/contentprovider_testing.jd
+++ b/docs/html/guide/topics/testing/contentprovider_testing.jd
@@ -37,7 +37,7 @@
       <ol>
         <li>
           <a
-          href="{@docRoot}guide/topics/testing/topics/testing_android.html">
+          href="{@docRoot}guide/topics/testing/testing_android.html">
           Testing Fundamentals</a>
         </li>
         <li>
@@ -123,7 +123,8 @@
     The constructor then creates a {@link android.test.mock.MockContentResolver} to use as the
     resolver for the test. The {@link android.test.mock.MockContentResolver} class is described in
     detail in the section
-    <a href="{@docRoot}guide/topics/testing/test_android#MockObjectClasses">Mock object classes</a>.
+    <a href="{@docRoot}guide/topics/testing/testing_android.html#MockObjectClasses">Mock object
+classes</a>.
 </p>
 <p>
     Lastly, the constructor creates an instance of the provider under test. This is a normal
@@ -137,7 +138,7 @@
     {@link android.test.ProviderTestCase2} uses {@link android.test.IsolatedContext} and
     {@link android.test.mock.MockContentResolver}, which are standard mock object classes. To
     learn more about them, please read
-    <a href="{@docRoot}guide/topics/testing/test_android#MockObjectClasses">
+    <a href="{@docRoot}guide/topics/testing/testing_android.html#MockObjectClasses">
     Testing Fundamentals</a>.
 </p>
 <h2 id="WhatToTest">What To Test</h2>
diff --git a/docs/html/guide/topics/testing/index.jd b/docs/html/guide/topics/testing/index.jd
index 762a897..cf87187 100644
--- a/docs/html/guide/topics/testing/index.jd
+++ b/docs/html/guide/topics/testing/index.jd
@@ -73,6 +73,7 @@
         to test applications and devices.
     </li>
 </ul>
+<!--
 <h4>Samples</h4>
 <ul>
     <li>
@@ -82,3 +83,4 @@
         testing a {@link android.app.Service}.
     </li>
 </ul>
+-->
diff --git a/docs/html/guide/topics/testing/what_to_test.jd b/docs/html/guide/topics/testing/what_to_test.jd
index e13538a..e8a27da 100644
--- a/docs/html/guide/topics/testing/what_to_test.jd
+++ b/docs/html/guide/topics/testing/what_to_test.jd
@@ -79,6 +79,6 @@
     <a href="{@docRoot}guide/developing/tools/emulator.html#netspeed">Network Speed Emulation</a>.
     To test GPS, you can use the emulator console and {@link android.location.LocationManager}. To
     learn more about the emulator console, please see
-    <a href="{@docRoot}/guide/developing/tools/emulator.html#console">
+    <a href="{@docRoot}guide/developing/tools/emulator.html#console">
     Using the Emulator Console</a>.
 </p>
diff --git a/docs/html/images/developing/avd-dialog.png b/docs/html/images/developing/avd-dialog.png
old mode 100755
new mode 100644
index 693aa42..d0e2eec
--- a/docs/html/images/developing/avd-dialog.png
+++ b/docs/html/images/developing/avd-dialog.png
Binary files differ
diff --git a/docs/html/images/sdk_manager_packages.png b/docs/html/images/sdk_manager_packages.png
old mode 100755
new mode 100644
index 027cce7..fd59ac6
--- a/docs/html/images/sdk_manager_packages.png
+++ b/docs/html/images/sdk_manager_packages.png
Binary files differ
diff --git a/docs/html/resources/articles/layout-tricks-merge.jd b/docs/html/resources/articles/layout-tricks-merge.jd
index 3e165d2..00e0479 100644
--- a/docs/html/resources/articles/layout-tricks-merge.jd
+++ b/docs/html/resources/articles/layout-tricks-merge.jd
@@ -1,7 +1,9 @@
 page.title=Layout Tricks: Merging Layouts
 @jd:body
 
-<p>The <a href=""></a> articles showed you how to use the <code>&lt;include /&gt;</code> tag in XML layouts, to reuse and share your layout code. This article explains the <code>&lt;merge /&gt;</code> tag and how it complements the  <code>&lt;include /&gt;</code> tag.</p>
+<p>The articles showed you how to use the <code>&lt;include /&gt;</code> tag in XML layouts, to
+reuse and share your layout code. This article explains the <code>&lt;merge /&gt;</code> tag and how
+it complements the  <code>&lt;include /&gt;</code> tag.</p>
 
 <p>The <code>&lt;merge /&gt;</code> tag was created for the purpose of
 optimizing Android layouts by reducing the number of levels in view trees. It's
diff --git a/docs/html/resources/articles/layout-tricks-stubs.jd b/docs/html/resources/articles/layout-tricks-stubs.jd
index 88e4b25..88bcb78 100644
--- a/docs/html/resources/articles/layout-tricks-stubs.jd
+++ b/docs/html/resources/articles/layout-tricks-stubs.jd
@@ -17,7 +17,7 @@
 inflated and added to the user interface only when you decide so.</p>
 
 <p>The following screenshot comes from the <a
-href="http://code.google/p/shelves">Shelves</a> application. The main purpose of
+href="http://code.google.com/p/shelves">Shelves</a> application. The main purpose of
 the activity shown in the screenshot is to present the user with a browsable
 list of books:</p>
 
diff --git a/docs/html/resources/tutorials/images/hello_world_0.png b/docs/html/resources/tutorials/images/hello_world_0.png
index 330a07c..2674045 100644
--- a/docs/html/resources/tutorials/images/hello_world_0.png
+++ b/docs/html/resources/tutorials/images/hello_world_0.png
Binary files differ
diff --git a/docs/html/resources/tutorials/images/hello_world_1.png b/docs/html/resources/tutorials/images/hello_world_1.png
index 1ff8e2b..dc4b4ad 100644
--- a/docs/html/resources/tutorials/images/hello_world_1.png
+++ b/docs/html/resources/tutorials/images/hello_world_1.png
Binary files differ
diff --git a/docs/html/resources/tutorials/testing/activity_test.jd b/docs/html/resources/tutorials/testing/activity_test.jd
index 87dd183..ec878d2 100644
--- a/docs/html/resources/tutorials/testing/activity_test.jd
+++ b/docs/html/resources/tutorials/testing/activity_test.jd
@@ -368,14 +368,14 @@
       package="com.android.example.spinner.test"
       android:versionCode="1"
       android:versionName="1.0"&gt;
-    &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
-
-    &lt;uses-library android:name="android.test.runner" /&gt;
-    &lt;/application&gt;
     &lt;uses-sdk android:minSdkVersion="3" /&gt;
     &lt;instrumentation
         android:targetPackage="com.android.example.spinner"
         android:name="android.test.InstrumentationTestRunner" /&gt;
+    &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
+        &lt;uses-library android:name="android.test.runner" /&gt;
+        ...
+    &lt;/application&gt;
 &lt;/manifest&gt;
 </pre>
 <p>
diff --git a/docs/html/sdk/adding-components.jd b/docs/html/sdk/adding-components.jd
index d2e55d8..ca27bba 100644
--- a/docs/html/sdk/adding-components.jd
+++ b/docs/html/sdk/adding-components.jd
@@ -132,7 +132,7 @@
 
 <p>When you see that a new revision is available, you can use the Android SDK
 and AVD Manager to quickly download it to your environment. Follow the same
-procedure as given in <a href="">Installing SDK Components</a>, above. The new
+procedure as given in <a href="#InstallingComponents">Installing SDK Components</a>, above. The new
 component is installed in place of the old, but without impacting your
 applications. </p>
 
diff --git a/docs/html/sdk/android-2.3-highlights.jd b/docs/html/sdk/android-2.3-highlights.jd
index f60bf51..1a603af 100644
--- a/docs/html/sdk/android-2.3-highlights.jd
+++ b/docs/html/sdk/android-2.3-highlights.jd
@@ -258,7 +258,7 @@
 href="http://www.khronos.org/opensles/">Khronos OpenSL ES</a>, a standard API
 that gives applications access to powerful audio controls and effects from
 native code. Applications can use the API to manage audio devices and control
-low-latency audio input, output and processing directly from native code</p>
+audio input, output, and processing directly from native code.</p>
 
 <p style="margin-top:1.25em;margin-bottom:.75em;"><strong>Native graphics
 management</strong></p>
diff --git a/docs/html/sdk/android-2.3.jd b/docs/html/sdk/android-2.3.jd
index 5438adc..f996fa2 100644
--- a/docs/html/sdk/android-2.3.jd
+++ b/docs/html/sdk/android-2.3.jd
@@ -124,7 +124,7 @@
 API since the previous version.</p>
 
 
-<h3 id="sip">SIP-based VOIP</h3>
+<h3 id="sip">SIP-based VoIP</h3>
 
 <p>The platform now includes a SIP protocol stack and framework API that lets
 developers build internet telephony applications. Using the API, applications can offer
@@ -679,7 +679,8 @@
 
 <ul>
 <li>New <code>xlargeScreens</code> attribute for <a
-href="{@docRoot}guide/topics/manifest/supports-screens.html"><code>&lt;supports-screens&gt;</code></a>
+href="{@docRoot}guide/topics/manifest/supports-screens-element.html"><code>&lt;supports-screens&gt;<
+/ code > < /a>
 element, to indicate whether the application supports
 extra large screen form-factors. For details, see <a
 href="{@docRoot}guide/practices/screens_support.html">Supporting Multiple
@@ -718,7 +719,7 @@
 <li><code>android.permission.USE_SIP</code> &mdash; Allows an application to use
 the {@link android.net.sip SIP API} to make or receive internet calls.
 <li><code>android.permission.NFC</code> &mdash; Allows an application to use the
-{@link android.nfc NFC API} to make or receive internet calls.</li>
+{@link android.nfc NFC API} to read NFC tags.</li>
 </ul>
 
 <h3 id="feature_constants">New Feature Constants</h3>
@@ -747,13 +748,13 @@
 <li>{@link android.content.pm.PackageManager#FEATURE_SIP android.software.sip}
 &mdash; The application uses the SIP API on the device.</li>
 <li>{@link android.content.pm.PackageManager#FEATURE_SIP_VOIP
-android.software.sip.voip} &mdash; The application uses a SIP-based VOIP
+android.software.sip.voip} &mdash; The application uses a SIP-based VoIP
 service on the device.</li>
 <li>{@link
 android.content.pm.PackageManager#FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND
 android.hardware.touchscreen.multitouch.jazzhand} &mdash; The application uses
 advanced multipoint multitouch capabilities on the device screen, for tracking
-up to five points fully independently.</li>
+five or more points fully independently.</li>
 </ul>
 
 <p>For full information about how to declare features and use them for
diff --git a/docs/html/sdk/ndk/index.jd b/docs/html/sdk/ndk/index.jd
index 2c8e4c2..19f4d02 100644
--- a/docs/html/sdk/ndk/index.jd
+++ b/docs/html/sdk/ndk/index.jd
@@ -299,7 +299,8 @@
   <p>Before you get started make sure that you have downloaded the latest <a href=
   "{@docRoot}sdk/index.html">Android SDK</a> and upgraded your applications and environment as
   needed. The NDK is compatible with older platform versions but not older versions of the SDK tools.
-  Also, take a moment to review the <a href="{@docRoot}sdk/ndk/reqs.html">System and Software Requirements</a>
+  Also, take a moment to review the <a href="{@docRoot}sdk/ndk/overview.html#reqs">System and
+Software Requirements</a>
   for the NDK, if you haven't already.</p>
 
   <p>To install the NDK, follow these steps:</p>
diff --git a/docs/html/sdk/ndk/overview.jd b/docs/html/sdk/ndk/overview.jd
index f6d148a..56b9201 100644
--- a/docs/html/sdk/ndk/overview.jd
+++ b/docs/html/sdk/ndk/overview.jd
@@ -489,7 +489,6 @@
       <code>android:minSdkVersion</code> attribute value of "3" or higher. For example:
       <pre style="margin:1em;">
 &lt;manifest&gt;
-  ...
   &lt;uses-sdk android:minSdkVersion="3" /&gt;
   ...
 &lt;/manifest&gt;
@@ -540,7 +539,6 @@
     to users whose devices are capable of supporting your application. For example:
       <pre style="margin:1em;">
 &lt;manifest&gt;
-  ... 
 <!-- Declare that the application uses the OpenGL ES 2.0 API and is designed
      to run only on devices that support OpenGL ES 2.0 or higher. -->
   &lt;uses-feature android:glEsVersion="0x00020000" /&gt;
diff --git a/docs/html/sdk/requirements.jd b/docs/html/sdk/requirements.jd
index 3679d44..a359dad 100644
--- a/docs/html/sdk/requirements.jd
+++ b/docs/html/sdk/requirements.jd
@@ -8,12 +8,14 @@
 <ul>
   <li>Windows XP (32-bit), Vista (32- or 64-bit), or Windows 7 (32- or 64-bit)</li>
   <li>Mac OS X 10.5.8 or later (x86 only)</li>
-  <li>Linux (tested on Linux Ubuntu Hardy Heron and Lucid Lynx)
+  <li>Linux (tested on Ubuntu Linux, Lucid Lynx)
     <ul>
+      <li>GNU C Library (glibc) 2.11 or later is required.</li>
+      <li>On Ubuntu Linux, Lucid Lynx or later release is required.</li>
       <li>64-bit distributions must be capable of running 32-bit applications. 
       For information about how to add support for 32-bit applications, see
       the <a href="installing.html#troubleshooting">Ubuntu Linux
-installation notes</a>.</li>
+      installation notes</a>.</li>
     </ul>
   </li>
 </ul>
diff --git a/docs/html/sdk/win-usb.jd b/docs/html/sdk/win-usb.jd
index 37d2cbb..8ea7088 100644
--- a/docs/html/sdk/win-usb.jd
+++ b/docs/html/sdk/win-usb.jd
@@ -160,7 +160,7 @@
 <a href="adding-components.html">Adding SDK Components</a> to launch the Android
 SDK and AVD Manager. From the <strong>Available Packages</strong> panel, select
 "Usb Driver Package" and download it to your computer. The driver files are
-downloaded into the <code>&lt;sdk&gt;\usb_driver</code> directory.</p>
+downloaded into the <code>&lt;sdk&gt;\google-usb_driver\</code> directory.</p>
 
 <p>After the download, follow the instructions below to install or upgrade the
 driver, based on your needs and Windows operating system version. If you are
diff --git a/graphics/java/android/renderscript/RSSurfaceView.java b/graphics/java/android/renderscript/RSSurfaceView.java
index 0211a4a..507f41f 100644
--- a/graphics/java/android/renderscript/RSSurfaceView.java
+++ b/graphics/java/android/renderscript/RSSurfaceView.java
@@ -119,7 +119,7 @@
     }
 
     public RenderScriptGL createRenderScriptGL(RenderScriptGL.SurfaceConfig sc) {
-        RenderScriptGL rs = new RenderScriptGL(sc);
+      RenderScriptGL rs = new RenderScriptGL(this.getContext(), sc);
         setRenderScriptGL(rs);
         return rs;
     }
@@ -137,4 +137,3 @@
         return mRS;
     }
 }
-
diff --git a/graphics/java/android/renderscript/RenderScript.java b/graphics/java/android/renderscript/RenderScript.java
index c6dcff5..5f93f5b 100644
--- a/graphics/java/android/renderscript/RenderScript.java
+++ b/graphics/java/android/renderscript/RenderScript.java
@@ -18,6 +18,7 @@
 
 import java.lang.reflect.Field;
 
+import android.content.Context;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.util.Config;
@@ -42,9 +43,9 @@
     @SuppressWarnings({"UnusedDeclaration", "deprecation"})
     static final boolean LOG_ENABLED = DEBUG ? Config.LOGD : Config.LOGV;
 
+    private Context mApplicationContext;
 
-
-     /*
+    /*
      * We use a class initializer to allow the native code to cache some
      * field offsets.
      */
@@ -416,9 +417,9 @@
     synchronized void nScriptCSetScript(byte[] script, int offset, int length) {
         rsnScriptCSetScript(mContext, script, offset, length);
     }
-    native int  rsnScriptCCreate(int con, String val);
-    synchronized int nScriptCCreate(String val) {
-        return rsnScriptCCreate(mContext, val);
+    native int  rsnScriptCCreate(int con, String val, String cacheDir);
+    synchronized int nScriptCCreate(String resName, String cacheDir) {
+      return rsnScriptCCreate(mContext, resName, cacheDir);
     }
 
     native void rsnSamplerBegin(int con);
@@ -776,17 +777,27 @@
         }
     }
 
-    RenderScript() {
+    RenderScript(Context ctx) {
+        mApplicationContext = ctx.getApplicationContext();
+    }
+
+    /**
+     * Gets the application context associated with the RenderScript context.
+     *
+     * @return The application context.
+     */
+    public final Context getApplicationContext() {
+        return mApplicationContext;
     }
 
     /**
      * Create a basic RenderScript context.
      *
-     *
+     * @param ctx The context.
      * @return RenderScript
      */
-    public static RenderScript create() {
-        RenderScript rs = new RenderScript();
+    public static RenderScript create(Context ctx) {
+        RenderScript rs = new RenderScript(ctx);
 
         rs.mDev = rs.nDeviceCreate();
         rs.mContext = rs.nContextCreate(rs.mDev, 0);
diff --git a/graphics/java/android/renderscript/RenderScriptGL.java b/graphics/java/android/renderscript/RenderScriptGL.java
index 0886db4..5adb682 100644
--- a/graphics/java/android/renderscript/RenderScriptGL.java
+++ b/graphics/java/android/renderscript/RenderScriptGL.java
@@ -18,6 +18,7 @@
 
 import java.lang.reflect.Field;
 
+import android.content.Context;
 import android.graphics.PixelFormat;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
@@ -168,10 +169,11 @@
     /**
      * Construct a new RenderScriptGL context.
      *
-     *
+     * @param ctx The context.
      * @param sc The desired format of the primart rendering surface.
      */
-    public RenderScriptGL(SurfaceConfig sc) {
+    public RenderScriptGL(Context ctx, SurfaceConfig sc) {
+        super(ctx);
         mSurfaceConfig = new SurfaceConfig(sc);
 
         mSurface = null;
@@ -304,5 +306,3 @@
     }
 
 }
-
-
diff --git a/graphics/java/android/renderscript/ScriptC.java b/graphics/java/android/renderscript/ScriptC.java
index 64ed75b..b10247c 100644
--- a/graphics/java/android/renderscript/ScriptC.java
+++ b/graphics/java/android/renderscript/ScriptC.java
@@ -16,9 +16,11 @@
 
 package android.renderscript;
 
+import android.content.Context;
 import android.content.res.Resources;
 import android.util.Log;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Map.Entry;
@@ -76,6 +78,7 @@
         rs.nScriptCBegin();
         rs.nScriptCSetScript(pgm, 0, pgmLength);
         Log.v(TAG, "Create script for resource = " + resources.getResourceName(resourceID));
-        return rs.nScriptCCreate(resources.getResourceName(resourceID));
+        String cacheDir = rs.getApplicationContext().getCacheDir().toString();
+        return rs.nScriptCCreate(resources.getResourceName(resourceID), cacheDir);
     }
 }
diff --git a/graphics/jni/android_renderscript_RenderScript.cpp b/graphics/jni/android_renderscript_RenderScript.cpp
index 04a7b41..a8343b3 100644
--- a/graphics/jni/android_renderscript_RenderScript.cpp
+++ b/graphics/jni/android_renderscript_RenderScript.cpp
@@ -902,11 +902,15 @@
 }
 
 static jint
-nScriptCCreate(JNIEnv *_env, jobject _this, RsContext con, jstring resName)
+nScriptCCreate(JNIEnv *_env, jobject _this, RsContext con, jstring resName, jstring cacheDir)
 {
     LOG_API("nScriptCCreate, con(%p)", con);
     const char* resNameUTF = _env->GetStringUTFChars(resName, NULL);
-    return (jint)rsScriptCCreate(con, resNameUTF);
+    const char* cacheDirUTF = _env->GetStringUTFChars(cacheDir, NULL);
+    jint i = (jint)rsScriptCCreate(con, resNameUTF, cacheDirUTF);
+    _env->ReleaseStringUTFChars(resName, resNameUTF);
+    _env->ReleaseStringUTFChars(cacheDir, cacheDirUTF);
+    return i;
 }
 
 // ---------------------------------------------------------------------------
@@ -1297,7 +1301,7 @@
 
 {"rsnScriptCBegin",                  "(I)V",                                  (void*)nScriptCBegin },
 {"rsnScriptCSetScript",              "(I[BII)V",                              (void*)nScriptCSetScript },
-{"rsnScriptCCreate",                 "(ILjava/lang/String;)I",                (void*)nScriptCCreate },
+{"rsnScriptCCreate",                 "(ILjava/lang/String;Ljava/lang/String;)I",  (void*)nScriptCCreate },
 
 {"rsnProgramStoreBegin",             "(III)V",                                (void*)nProgramStoreBegin },
 {"rsnProgramStoreDepthFunc",         "(II)V",                                 (void*)nProgramStoreDepthFunc },
@@ -1372,4 +1376,3 @@
 bail:
     return result;
 }
-
diff --git a/include/surfaceflinger/Surface.h b/include/surfaceflinger/Surface.h
index cef439c..2df8ca3 100644
--- a/include/surfaceflinger/Surface.h
+++ b/include/surfaceflinger/Surface.h
@@ -249,7 +249,7 @@
             uint32_t *pWidth, uint32_t *pHeight,
             uint32_t *pFormat, uint32_t *pUsage) const;
 
-    static void cleanCachedSurfaces();
+    static void cleanCachedSurfacesLocked();
 
     class BufferInfo {
         uint32_t mWidth;
diff --git a/include/utils/CallStack.h b/include/utils/CallStack.h
index c2c8ce5..8817120 100644
--- a/include/utils/CallStack.h
+++ b/include/utils/CallStack.h
@@ -50,7 +50,7 @@
     
     void clear();
 
-    void update(int32_t ignoreDepth=0, int32_t maxDepth=MAX_DEPTH);
+    void update(int32_t ignoreDepth=1, int32_t maxDepth=MAX_DEPTH);
 
     // Dump a stack trace to the log
     void dump(const char* prefix = 0) const;
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index a8fe646..e99f73a 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -849,13 +849,23 @@
 void OpenGLRenderer::setupDrawColor(int color) {
     mColorA = ((color >> 24) & 0xFF) / 255.0f;
     const float a = mColorA / 255.0f;
-    mColorR = mColorA * ((color >> 16) & 0xFF);
-    mColorG = mColorA * ((color >>  8) & 0xFF);
-    mColorB = mColorA * ((color      ) & 0xFF);
+    mColorR = a * ((color >> 16) & 0xFF);
+    mColorG = a * ((color >>  8) & 0xFF);
+    mColorB = a * ((color      ) & 0xFF);
     mColorSet = true;
     mSetShaderColor = mDescription.setColor(mColorR, mColorG, mColorB, mColorA);
 }
 
+void OpenGLRenderer::setupDrawAlpha8Color(int color, int alpha) {
+    mColorA = alpha / 255.0f;
+    const float a = mColorA / 255.0f;
+    mColorR = a * ((color >> 16) & 0xFF);
+    mColorG = a * ((color >>  8) & 0xFF);
+    mColorB = a * ((color      ) & 0xFF);
+    mColorSet = true;
+    mSetShaderColor = mDescription.setAlpha8Color(mColorR, mColorG, mColorB, mColorA);
+}
+
 void OpenGLRenderer::setupDrawColor(float r, float g, float b, float a) {
     mColorA = a;
     mColorR = r;
@@ -865,6 +875,15 @@
     mSetShaderColor = mDescription.setColor(r, g, b, a);
 }
 
+void OpenGLRenderer::setupDrawAlpha8Color(float r, float g, float b, float a) {
+    mColorA = a;
+    mColorR = r;
+    mColorG = g;
+    mColorB = b;
+    mColorSet = true;
+    mSetShaderColor = mDescription.setAlpha8Color(r, g, b, a);
+}
+
 void OpenGLRenderer::setupDrawShader() {
     if (mShader) {
         mShader->describe(mDescription, mCaches.extensions);
@@ -912,20 +931,29 @@
     if (!ignoreModelView) {
         mModelView.loadTranslate(left, top, 0.0f);
         mModelView.scale(right - left, bottom - top, 1.0f);
-        if (!ignoreTransform) {
-            mCaches.currentProgram->set(mOrthoMatrix, mModelView, *mSnapshot->transform);
-            if (mTrackDirtyRegions) dirtyLayer(left, top, right, bottom, *mSnapshot->transform);
-        } else {
-            mCaches.currentProgram->set(mOrthoMatrix, mModelView, mIdentity);
-            if (mTrackDirtyRegions) dirtyLayer(left, top, right, bottom);
-        }
     } else {
         mModelView.loadIdentity();
     }
+    bool dirty = right - left > 0.0f && bottom - top > 0.0f;
+    if (!ignoreTransform) {
+        mCaches.currentProgram->set(mOrthoMatrix, mModelView, *mSnapshot->transform);
+        if (mTrackDirtyRegions && dirty) {
+            dirtyLayer(left, top, right, bottom, *mSnapshot->transform);
+        }
+    } else {
+        mCaches.currentProgram->set(mOrthoMatrix, mModelView, mIdentity);
+        if (mTrackDirtyRegions && dirty) dirtyLayer(left, top, right, bottom);
+    }
 }
 
 void OpenGLRenderer::setupDrawColorUniforms() {
-    if (mColorSet && mSetShaderColor) {
+    if (mColorSet || (mShader && mSetShaderColor)) {
+        mCaches.currentProgram->setColor(mColorR, mColorG, mColorB, mColorA);
+    }
+}
+
+void OpenGLRenderer::setupDrawPureColorUniforms() {
+    if (mSetShaderColor) {
         mCaches.currentProgram->setColor(mColorR, mColorG, mColorB, mColorA);
     }
 }
@@ -994,7 +1022,7 @@
         return;
     }
 
-    glActiveTexture(GL_TEXTURE0);
+    glActiveTexture(gTextureUnits[0]);
     Texture* texture = mCaches.textureCache.get(bitmap);
     if (!texture) return;
     const AutoTexture autoCleanup(texture);
@@ -1011,7 +1039,7 @@
         return;
     }
 
-    glActiveTexture(GL_TEXTURE0);
+    glActiveTexture(gTextureUnits[0]);
     Texture* texture = mCaches.textureCache.get(bitmap);
     if (!texture) return;
     const AutoTexture autoCleanup(texture);
@@ -1319,48 +1347,60 @@
         y = (int) floorf(y + mSnapshot->transform->getTranslateY() + 0.5f);
     }
 
-    int alpha;
-    SkXfermode::Mode mode;
-    getAlphaAndMode(paint, &alpha, &mode);
-
-    uint32_t color = paint->getColor();
-    const GLfloat a = alpha / 255.0f;
-    const GLfloat r = a * ((color >> 16) & 0xFF) / 255.0f;
-    const GLfloat g = a * ((color >>  8) & 0xFF) / 255.0f;
-    const GLfloat b = a * ((color      ) & 0xFF) / 255.0f;
-
     FontRenderer& fontRenderer = mCaches.fontRenderer.getFontRenderer(paint);
     fontRenderer.setFont(paint, SkTypeface::UniqueID(paint->getTypeface()),
             paint->getTextSize());
 
-    setupDraw();
+    int alpha;
+    SkXfermode::Mode mode;
+    getAlphaAndMode(paint, &alpha, &mode);
 
     if (mHasShadow) {
-        glActiveTexture(gTextureUnits[0]);
         mCaches.dropShadowCache.setFontRenderer(fontRenderer);
         const ShadowTexture* shadow = mCaches.dropShadowCache.get(paint, text, bytesCount,
                 count, mShadowRadius);
         const AutoTexture autoCleanup(shadow);
 
-        setupShadow(shadow, x, y, mode, a, pureTranslate);
+        const float sx = x - shadow->left + mShadowDx;
+        const float sy = y - shadow->top + mShadowDy;
 
-        // Draw the mesh
+        const int shadowAlpha = ((mShadowColor >> 24) & 0xFF);
+
+        glActiveTexture(gTextureUnits[0]);
+        setupDraw();
+        setupDrawWithTexture(true);
+        setupDrawAlpha8Color(mShadowColor, shadowAlpha < 255 ? shadowAlpha : alpha);
+        setupDrawBlending(true, mode);
+        setupDrawProgram();
+        setupDrawModelView(sx, sy, sx + shadow->width, sy + shadow->height, pureTranslate);
+        setupDrawTexture(shadow->id);
+        setupDrawPureColorUniforms();
+        setupDrawMesh(NULL, (GLvoid*) gMeshTextureOffset);
+
         glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount);
-        glDisableVertexAttribArray(mCaches.currentProgram->getAttrib("texCoords"));
+        finishDrawTexture();
     }
 
-    GLuint textureUnit = 0;
-    glActiveTexture(gTextureUnits[textureUnit]);
-
     // Pick the appropriate texture filtering
     bool linearFilter = mSnapshot->transform->changesBounds();
     if (pureTranslate && !linearFilter) {
         linearFilter = fabs(y - (int) y) > 0.0f || fabs(x - (int) x) > 0.0f;
     }
 
-    // Dimensions are set to (0,0), the layer (if any) won't be dirtied
-    setupTextureAlpha8(fontRenderer.getTexture(linearFilter), 0, 0, textureUnit,
-            x, y, r, g, b, a, mode, false, true, NULL, NULL, 0, pureTranslate);
+    glActiveTexture(gTextureUnits[0]);
+    setupDraw();
+    setupDrawDirtyRegionsDisabled();
+    setupDrawWithTexture(true);
+    setupDrawAlpha8Color(paint->getColor(), alpha);
+    setupDrawColorFilter();
+    setupDrawShader();
+    setupDrawBlending(true, mode);
+    setupDrawProgram();
+    setupDrawModelView(x, y, x, y, pureTranslate, true);
+    setupDrawTexture(fontRenderer.getTexture(linearFilter));
+    setupDrawPureColorUniforms();
+    setupDrawColorFilterUniforms();
+    setupDrawShaderUniforms(pureTranslate);
 
     const Rect* clip = pureTranslate ? mSnapshot->clipRect : &mSnapshot->getLocalClip();
     Rect bounds(FLT_MAX / 2.0f, FLT_MAX / 2.0f, FLT_MIN / 2.0f, FLT_MIN / 2.0f);
@@ -1415,19 +1455,23 @@
     SkXfermode::Mode mode;
     getAlphaAndMode(paint, &alpha, &mode);
 
-    uint32_t color = paint->getColor();
-    const GLfloat a = alpha / 255.0f;
-    const GLfloat r = a * ((color >> 16) & 0xFF) / 255.0f;
-    const GLfloat g = a * ((color >>  8) & 0xFF) / 255.0f;
-    const GLfloat b = a * ((color      ) & 0xFF) / 255.0f;
-
-    setupTextureAlpha8(texture, textureUnit, x, y, r, g, b, a, mode, true, true);
-
     setupDraw();
+    setupDrawWithTexture(true);
+    setupDrawAlpha8Color(paint->getColor(), alpha);
+    setupDrawColorFilter();
+    setupDrawShader();
+    setupDrawBlending(true, mode);
+    setupDrawProgram();
+    setupDrawModelView(x, y, x + texture->width, y + texture->height);
+    setupDrawTexture(texture->id);
+    setupDrawPureColorUniforms();
+    setupDrawColorFilterUniforms();
+    setupDrawShaderUniforms();
+    setupDrawMesh(NULL, (GLvoid*) gMeshTextureOffset);
 
-    // Draw the mesh
     glDrawArrays(GL_TRIANGLE_STRIP, 0, gMeshCount);
-    glDisableVertexAttribArray(mCaches.currentProgram->getAttrib("texCoords"));
+
+    finishDrawTexture();
 }
 
 ///////////////////////////////////////////////////////////////////////////////
@@ -1477,118 +1521,6 @@
 // Drawing implementation
 ///////////////////////////////////////////////////////////////////////////////
 
-void OpenGLRenderer::setupShadow(const ShadowTexture* texture, float x, float y,
-        SkXfermode::Mode mode, float alpha, bool ignoreTransforms) {
-    const float sx = x - texture->left + mShadowDx;
-    const float sy = y - texture->top + mShadowDy;
-
-    const int shadowAlpha = ((mShadowColor >> 24) & 0xFF);
-    const GLfloat a = shadowAlpha < 255 ? shadowAlpha / 255.0f : alpha;
-    const GLfloat r = a * ((mShadowColor >> 16) & 0xFF) / 255.0f;
-    const GLfloat g = a * ((mShadowColor >>  8) & 0xFF) / 255.0f;
-    const GLfloat b = a * ((mShadowColor      ) & 0xFF) / 255.0f;
-
-    GLuint textureUnit = 0;
-    setupTextureAlpha8(texture->id, texture->width, texture->height, textureUnit,
-            sx, sy, r, g, b, a, mode, true, false,
-            (GLvoid*) 0, (GLvoid*) gMeshTextureOffset, 0, ignoreTransforms);
-}
-
-void OpenGLRenderer::setupTextureAlpha8(const Texture* texture, GLuint& textureUnit,
-        float x, float y, float r, float g, float b, float a, SkXfermode::Mode mode,
-        bool transforms, bool applyFilters) {
-    setupTextureAlpha8(texture->id, texture->width, texture->height, textureUnit,
-            x, y, r, g, b, a, mode, transforms, applyFilters,
-            (GLvoid*) 0, (GLvoid*) gMeshTextureOffset);
-}
-
-void OpenGLRenderer::setupTextureAlpha8(GLuint texture, uint32_t width, uint32_t height,
-        GLuint& textureUnit, float x, float y, float r, float g, float b, float a,
-        SkXfermode::Mode mode, bool transforms, bool applyFilters) {
-    setupTextureAlpha8(texture, width, height, textureUnit, x, y, r, g, b, a, mode,
-            transforms, applyFilters, (GLvoid*) 0, (GLvoid*) gMeshTextureOffset);
-}
-
-void OpenGLRenderer::setupTextureAlpha8(GLuint texture, uint32_t width, uint32_t height,
-        GLuint& textureUnit, float x, float y, float r, float g, float b, float a,
-        SkXfermode::Mode mode, bool transforms, bool applyFilters,
-        GLvoid* vertices, GLvoid* texCoords, GLuint vbo, bool ignoreTransform) {
-     // Describe the required shaders
-     ProgramDescription description;
-     description.hasTexture = true;
-     description.hasAlpha8Texture = true;
-     const bool setColor = description.setAlpha8Color(r, g, b, a);
-
-     if (applyFilters) {
-         if (mShader) {
-             mShader->describe(description, mCaches.extensions);
-         }
-         if (mColorFilter) {
-             mColorFilter->describe(description, mCaches.extensions);
-         }
-     }
-
-     // Setup the blending mode
-     chooseBlending(true, mode, description);
-
-     // Build and use the appropriate shader
-     useProgram(mCaches.programCache.get(description));
-
-     bindTexture(texture);
-     glUniform1i(mCaches.currentProgram->getUniform("sampler"), textureUnit);
-
-     int texCoordsSlot = mCaches.currentProgram->getAttrib("texCoords");
-     glEnableVertexAttribArray(texCoordsSlot);
-
-     if (texCoords) {
-         // Setup attributes
-         if (!vertices) {
-             mCaches.bindMeshBuffer(vbo == 0 ? mCaches.meshBuffer : vbo);
-         } else {
-             mCaches.unbindMeshBuffer();
-         }
-         glVertexAttribPointer(mCaches.currentProgram->position, 2, GL_FLOAT, GL_FALSE,
-                 gMeshStride, vertices);
-         glVertexAttribPointer(texCoordsSlot, 2, GL_FLOAT, GL_FALSE, gMeshStride, texCoords);
-     }
-
-     // Setup uniforms
-     if (transforms) {
-         mModelView.loadTranslate(x, y, 0.0f);
-         mModelView.scale(width, height, 1.0f);
-     } else {
-         mModelView.loadIdentity();
-     }
-
-     mat4 t;
-     if (!ignoreTransform) {
-         t.load(*mSnapshot->transform);
-     }
-
-     mCaches.currentProgram->set(mOrthoMatrix, mModelView, t);
-     if (width > 0 && height > 0) {
-         dirtyLayer(x, y, x + width, y + height, t);
-     }
-
-     if (setColor) {
-         mCaches.currentProgram->setColor(r, g, b, a);
-     }
-
-     textureUnit++;
-     if (applyFilters) {
-         // Setup attributes and uniforms required by the shaders
-         if (mShader) {
-             if (ignoreTransform) {
-                 mModelView.loadInverse(*mSnapshot->transform);
-             }
-             mShader->setupProgram(mCaches.currentProgram, mModelView, *mSnapshot, &textureUnit);
-         }
-         if (mColorFilter) {
-             mColorFilter->setupProgram(mCaches.currentProgram);
-         }
-     }
-}
-
 // Same values used by Skia
 #define kStdStrikeThru_Offset   (-6.0f / 21.0f)
 #define kStdUnderline_Offset    (1.0f / 9.0f)
@@ -1721,7 +1653,7 @@
     } else {
         setupDrawModelViewTranslate(left, top, right, bottom, ignoreTransform);
     }
-    setupDrawColorUniforms();
+    setupDrawPureColorUniforms();
     setupDrawColorFilterUniforms();
     setupDrawTexture(texture);
     setupDrawMesh(vertices, texCoords, vbo);
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index 82b27b0..c3c6ad6 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -279,73 +279,6 @@
             bool ignoreScale = false, bool dirty = true);
 
     /**
-     * Prepares the renderer to draw the specified shadow. The active texture
-     * unit must be 0 and the other units must be unbound.
-     *
-     * @param texture The shadow texture
-     * @param x The x coordinate of the shadow
-     * @param y The y coordinate of the shadow
-     * @param mode The blending mode
-     * @param alpha The alpha value
-     * @param ignoreTransforms True if the coordinates are already in screen space
-     */
-    void setupShadow(const ShadowTexture* texture, float x, float y, SkXfermode::Mode mode,
-            float alpha, bool ignoreTransforms = false);
-
-    /**
-     * Prepares the renderer to draw the specified Alpha8 texture as a rectangle.
-     *
-     * @param texture The texture to render with
-     * @param textureUnit The texture unit to use, may be modified
-     * @param x The x coordinate of the rectangle to draw
-     * @param y The y coordinate of the rectangle to draw
-     * @param r The red component of the color
-     * @param g The green component of the color
-     * @param b The blue component of the color
-     * @param a The alpha component of the color
-     * @param mode The blending mode
-     * @param transforms True if the matrix passed to the shader should be multiplied
-     *        by the model-view matrix
-     * @param applyFilters Whether or not to take color filters and
-     *        shaders into account
-     */
-    void setupTextureAlpha8(const Texture* texture, GLuint& textureUnit, float x, float y,
-            float r, float g, float b, float a, SkXfermode::Mode mode, bool transforms,
-            bool applyFilters);
-
-    /**
-     * Prepares the renderer to draw the specified Alpha8 texture as a rectangle.
-     *
-     * @param texture The texture to render with
-     * @param width The width of the texture
-     * @param height The height of the texture
-     * @param textureUnit The texture unit to use, may be modified
-     * @param x The x coordinate of the rectangle to draw
-     * @param y The y coordinate of the rectangle to draw
-     * @param r The red component of the color
-     * @param g The green component of the color
-     * @param b The blue component of the color
-     * @param a The alpha component of the color
-     * @param mode The blending mode
-     * @param transforms True if the matrix passed to the shader should be multiplied
-     *        by the model-view matrix
-     * @param applyFilters Whether or not to take color filters and
-     *        shaders into account
-     */
-    void setupTextureAlpha8(GLuint texture, uint32_t width, uint32_t height,
-            GLuint& textureUnit, float x, float y, float r, float g, float b, float a,
-            SkXfermode::Mode mode, bool transforms, bool applyFilters);
-
-    /**
-     * Same as above setupTextureAlpha8() but specifies the mesh's vertices
-     * and texCoords pointers. The pointers become offsets when a VBO is bound.
-     */
-    void setupTextureAlpha8(GLuint texture, uint32_t width, uint32_t height,
-            GLuint& textureUnit, float x, float y, float r, float g, float b, float a,
-            SkXfermode::Mode mode, bool transforms, bool applyFilters,
-            GLvoid* vertices, GLvoid* texCoords, GLuint vbo = 0, bool ignoreTransform = false);
-
-    /**
      * Draws text underline and strike-through if needed.
      *
      * @param text The text to decor
@@ -430,6 +363,8 @@
     void setupDrawWithTexture(bool isAlpha8 = false);
     void setupDrawColor(int color);
     void setupDrawColor(float r, float g, float b, float a);
+    void setupDrawAlpha8Color(int color, int alpha);
+    void setupDrawAlpha8Color(float r, float g, float b, float a);
     void setupDrawShader();
     void setupDrawColorFilter();
     void setupDrawBlending(SkXfermode::Mode mode = SkXfermode::kSrcOver_Mode,
@@ -443,6 +378,7 @@
     void setupDrawModelViewTranslate(float left, float top, float right, float bottom,
             bool ignoreTransform = false);
     void setupDrawColorUniforms();
+    void setupDrawPureColorUniforms();
     void setupDrawShaderUniforms(bool ignoreTransform = false);
     void setupDrawColorFilterUniforms();
     void setupDrawSimpleMesh();
diff --git a/libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java b/libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
index 09654ab..5de09f7 100644
--- a/libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
+++ b/libs/rs/java/ImageProcessing/src/com/android/rs/image/ImageProcessingActivity.java
@@ -362,7 +362,7 @@
     }
 
     private void createScript() {
-        mRS = RenderScript.create();
+        mRS = RenderScript.create(this);
         mRS.setMessageHandler(new FilterCallback());
 
         mInPixelsAllocation = Allocation.createFromBitmap(mRS, mBitmapIn,
diff --git a/libs/rs/java/tests/src/com/android/rs/test/RSTestCore.java b/libs/rs/java/tests/src/com/android/rs/test/RSTestCore.java
index c1f652f..265e1d6 100644
--- a/libs/rs/java/tests/src/com/android/rs/test/RSTestCore.java
+++ b/libs/rs/java/tests/src/com/android/rs/test/RSTestCore.java
@@ -16,6 +16,7 @@
 
 package com.android.rs.test;
 
+import android.content.Context;
 import android.content.res.Resources;
 import android.renderscript.*;
 import android.util.Log;
@@ -28,8 +29,10 @@
 public class RSTestCore {
     int mWidth;
     int mHeight;
+    Context mCtx;
 
-    public RSTestCore() {
+    public RSTestCore(Context ctx) {
+        mCtx = ctx;
     }
 
     private Resources mRes;
@@ -61,10 +64,10 @@
 
         unitTests = new ArrayList<UnitTest>();
 
-        unitTests.add(new UT_primitives(this, mRes));
-        unitTests.add(new UT_rsdebug(this, mRes));
-        unitTests.add(new UT_rstypes(this, mRes));
-        unitTests.add(new UT_fp_mad(this, mRes));
+        unitTests.add(new UT_primitives(this, mRes, mCtx));
+        unitTests.add(new UT_rsdebug(this, mRes, mCtx));
+        unitTests.add(new UT_rstypes(this, mRes, mCtx));
+        unitTests.add(new UT_fp_mad(this, mRes, mCtx));
         /*
         unitTests.add(new UnitTest(null, "<Pass>", 1));
         unitTests.add(new UnitTest());
diff --git a/libs/rs/java/tests/src/com/android/rs/test/RSTestView.java b/libs/rs/java/tests/src/com/android/rs/test/RSTestView.java
index 2f7542d..368f286 100644
--- a/libs/rs/java/tests/src/com/android/rs/test/RSTestView.java
+++ b/libs/rs/java/tests/src/com/android/rs/test/RSTestView.java
@@ -41,8 +41,11 @@
 
 public class RSTestView extends RSSurfaceView {
 
+    private Context mCtx;
+
     public RSTestView(Context context) {
         super(context);
+        mCtx = context;
         //setFocusable(true);
     }
 
@@ -55,7 +58,7 @@
             RenderScriptGL.SurfaceConfig sc = new RenderScriptGL.SurfaceConfig();
             mRS = createRenderScriptGL(sc);
             mRS.setSurface(holder, w, h);
-            mRender = new RSTestCore();
+            mRender = new RSTestCore(mCtx);
             mRender.init(mRS, getResources(), w, h);
         }
     }
@@ -92,5 +95,3 @@
         return ret;
     }
 }
-
-
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UT_fp_mad.java b/libs/rs/java/tests/src/com/android/rs/test/UT_fp_mad.java
index 409192b..f2c91af 100644
--- a/libs/rs/java/tests/src/com/android/rs/test/UT_fp_mad.java
+++ b/libs/rs/java/tests/src/com/android/rs/test/UT_fp_mad.java
@@ -16,19 +16,20 @@
 
 package com.android.rs.test;
 
+import android.content.Context;
 import android.content.res.Resources;
 import android.renderscript.*;
 
 public class UT_fp_mad extends UnitTest {
     private Resources mRes;
 
-    protected UT_fp_mad(RSTestCore rstc, Resources res) {
-        super(rstc, "Fp_Mad");
+    protected UT_fp_mad(RSTestCore rstc, Resources res, Context ctx) {
+        super(rstc, "Fp_Mad", ctx);
         mRes = res;
     }
 
     public void run() {
-        RenderScript pRS = RenderScript.create();
+        RenderScript pRS = RenderScript.create(mCtx);
         ScriptC_fp_mad s = new ScriptC_fp_mad(pRS, mRes, R.raw.fp_mad);
         pRS.setMessageHandler(mRsMessage);
         s.invoke_fp_mad_test(0, 0);
@@ -37,4 +38,3 @@
         pRS.destroy();
     }
 }
-
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UT_primitives.java b/libs/rs/java/tests/src/com/android/rs/test/UT_primitives.java
index 6e0859a..b7a65a5 100644
--- a/libs/rs/java/tests/src/com/android/rs/test/UT_primitives.java
+++ b/libs/rs/java/tests/src/com/android/rs/test/UT_primitives.java
@@ -16,14 +16,15 @@
 
 package com.android.rs.test;
 
+import android.content.Context;
 import android.content.res.Resources;
 import android.renderscript.*;
 
 public class UT_primitives extends UnitTest {
     private Resources mRes;
 
-    protected UT_primitives(RSTestCore rstc, Resources res) {
-        super(rstc, "Primitives");
+    protected UT_primitives(RSTestCore rstc, Resources res, Context ctx) {
+        super(rstc, "Primitives", ctx);
         mRes = res;
     }
 
@@ -87,7 +88,7 @@
     }
 
     public void run() {
-        RenderScript pRS = RenderScript.create();
+        RenderScript pRS = RenderScript.create(mCtx);
         ScriptC_primitives s = new ScriptC_primitives(pRS, mRes, R.raw.primitives);
         pRS.setMessageHandler(mRsMessage);
         if (!initializeGlobals(s)) {
@@ -101,4 +102,3 @@
         pRS.destroy();
     }
 }
-
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UT_rsdebug.java b/libs/rs/java/tests/src/com/android/rs/test/UT_rsdebug.java
index df31f98..0614b1a 100644
--- a/libs/rs/java/tests/src/com/android/rs/test/UT_rsdebug.java
+++ b/libs/rs/java/tests/src/com/android/rs/test/UT_rsdebug.java
@@ -16,19 +16,20 @@
 
 package com.android.rs.test;
 
+import android.content.Context;
 import android.content.res.Resources;
 import android.renderscript.*;
 
 public class UT_rsdebug extends UnitTest {
     private Resources mRes;
 
-    protected UT_rsdebug(RSTestCore rstc, Resources res) {
-        super(rstc, "rsDebug");
+    protected UT_rsdebug(RSTestCore rstc, Resources res, Context ctx) {
+        super(rstc, "rsDebug", ctx);
         mRes = res;
     }
 
     public void run() {
-        RenderScript pRS = RenderScript.create();
+        RenderScript pRS = RenderScript.create(mCtx);
         ScriptC_rsdebug s = new ScriptC_rsdebug(pRS, mRes, R.raw.rsdebug);
         pRS.setMessageHandler(mRsMessage);
         s.invoke_test_rsdebug(0, 0);
@@ -37,4 +38,3 @@
         pRS.destroy();
     }
 }
-
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UT_rstypes.java b/libs/rs/java/tests/src/com/android/rs/test/UT_rstypes.java
index d1232ce..74211c8 100644
--- a/libs/rs/java/tests/src/com/android/rs/test/UT_rstypes.java
+++ b/libs/rs/java/tests/src/com/android/rs/test/UT_rstypes.java
@@ -16,19 +16,20 @@
 
 package com.android.rs.test;
 
+import android.content.Context;
 import android.content.res.Resources;
 import android.renderscript.*;
 
 public class UT_rstypes extends UnitTest {
     private Resources mRes;
 
-    protected UT_rstypes(RSTestCore rstc, Resources res) {
-        super(rstc, "rsTypes");
+    protected UT_rstypes(RSTestCore rstc, Resources res, Context ctx) {
+        super(rstc, "rsTypes", ctx);
         mRes = res;
     }
 
     public void run() {
-        RenderScript pRS = RenderScript.create();
+        RenderScript pRS = RenderScript.create(mCtx);
         ScriptC_rstypes s = new ScriptC_rstypes(pRS, mRes, R.raw.rstypes);
         pRS.setMessageHandler(mRsMessage);
         s.invoke_test_rstypes(0, 0);
@@ -37,4 +38,3 @@
         pRS.destroy();
     }
 }
-
diff --git a/libs/rs/java/tests/src/com/android/rs/test/UnitTest.java b/libs/rs/java/tests/src/com/android/rs/test/UnitTest.java
index 8923a19..a7722c7 100644
--- a/libs/rs/java/tests/src/com/android/rs/test/UnitTest.java
+++ b/libs/rs/java/tests/src/com/android/rs/test/UnitTest.java
@@ -15,6 +15,7 @@
  */
 
 package com.android.rs.test;
+import android.content.Context;
 import android.renderscript.RenderScript.RSMessageHandler;
 import android.util.Log;
 
@@ -24,6 +25,7 @@
     private ScriptField_ListAllocs_s.Item mItem;
     private RSTestCore mRSTC;
     private boolean msgHandled;
+    protected Context mCtx;
 
     /* These constants must match those in shared.rsh */
     public static final int RS_MSG_TEST_PASSED = 100;
@@ -32,25 +34,26 @@
     private static int numTests = 0;
     public int testID;
 
-    protected UnitTest(RSTestCore rstc, String n, int initResult) {
+    protected UnitTest(RSTestCore rstc, String n, int initResult, Context ctx) {
         super();
         mRSTC = rstc;
         name = n;
         msgHandled = false;
+        mCtx = ctx;
         result = initResult;
         testID = numTests++;
     }
 
-    protected UnitTest(RSTestCore rstc, String n) {
-        this(rstc, n, 0);
+    protected UnitTest(RSTestCore rstc, String n, Context ctx) {
+        this(rstc, n, 0, ctx);
     }
 
-    protected UnitTest(RSTestCore rstc) {
-        this (rstc, "<Unknown>");
+    protected UnitTest(RSTestCore rstc, Context ctx) {
+        this (rstc, "<Unknown>", ctx);
     }
 
-    protected UnitTest() {
-        this (null);
+    protected UnitTest(Context ctx) {
+        this (null, ctx);
     }
 
     protected RSMessageHandler mRsMessage = new RSMessageHandler() {
@@ -101,4 +104,3 @@
         }
     }
 }
-
diff --git a/libs/rs/rs.spec b/libs/rs/rs.spec
index 9f817b6..5daba08 100644
--- a/libs/rs/rs.spec
+++ b/libs/rs/rs.spec
@@ -322,6 +322,7 @@
 
 ScriptCCreate {
         param const char * resName
+        param const char * cacheDir
 	ret RsScript
 	}
 
diff --git a/libs/rs/rsAllocation.cpp b/libs/rs/rsAllocation.cpp
index aab789a..78b570a 100644
--- a/libs/rs/rsAllocation.cpp
+++ b/libs/rs/rsAllocation.cpp
@@ -36,7 +36,7 @@
 
     mUsageFlags = usages;
 
-    mPtr = malloc(mType->getSizeBytes());
+    allocScriptMemory();
     if (mType->getElement()->getHasReferences()) {
         memset(mPtr, 0, mType->getSizeBytes());
     }
@@ -75,10 +75,9 @@
 Allocation::~Allocation() {
     if (mUserBitmapCallback != NULL) {
         mUserBitmapCallback(mUserBitmapCallbackData);
-    } else {
-        free(mPtr);
+        mPtr = NULL;
     }
-    mPtr = NULL;
+    freeScriptMemory();
 
     if (mBufferID) {
         // Causes a SW crash....
@@ -108,12 +107,9 @@
     return false;
 }
 
-void Allocation::deferedUploadToTexture(const Context *rsc, bool genMipmap, uint32_t lodOffset) {
-    rsAssert(lodOffset < mType->getLODCount());
+void Allocation::deferedUploadToTexture(const Context *rsc) {
     mUsageFlags |= RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE;
-    mTextureLOD = lodOffset;
     mUploadDefered = true;
-    mTextureGenMipmap = !mType->getDimLOD() && genMipmap;
 }
 
 uint32_t Allocation::getGLTarget() const {
@@ -130,6 +126,20 @@
     return 0;
 }
 
+void Allocation::allocScriptMemory() {
+    rsAssert(!mPtr);
+    mPtr = malloc(mType->getSizeBytes());
+}
+
+void Allocation::freeScriptMemory() {
+    rsAssert(!(mUsageFlags & RS_ALLOCATION_USAGE_SCRIPT));
+    if (mPtr) {
+        free(mPtr);
+        mPtr = NULL;
+    }
+}
+
+
 void Allocation::syncAll(Context *rsc, RsAllocationUsageType src) {
     rsAssert(src == RS_ALLOCATION_USAGE_SCRIPT);
 
@@ -153,6 +163,10 @@
         return;
     }
 
+    if (!mPtr) {
+        return;
+    }
+
     bool isFirstUpload = false;
 
     if (!mTextureID) {
@@ -171,41 +185,46 @@
     }
 
     GLenum target = (GLenum)getGLTarget();
-    glBindTexture(target, mTextureID);
-    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-
     if (target == GL_TEXTURE_2D) {
-        upload2DTexture(isFirstUpload);
+        upload2DTexture(isFirstUpload, mPtr);
     } else if (target == GL_TEXTURE_CUBE_MAP) {
         uploadCubeTexture(isFirstUpload);
     }
 
-    if (mTextureGenMipmap) {
+    if (mMipmapControl == RS_ALLOCATION_MIPMAP_ON_SYNC_TO_TEXTURE) {
 #ifndef ANDROID_RS_BUILD_FOR_HOST
         glGenerateMipmap(target);
 #endif //ANDROID_RS_BUILD_FOR_HOST
     }
 
+
+    if (!(mUsageFlags & RS_ALLOCATION_USAGE_SCRIPT)) {
+        freeScriptMemory();
+    }
+
     rsc->checkError("Allocation::uploadToTexture");
 }
 
-void Allocation::upload2DTexture(bool isFirstUpload) {
+void Allocation::upload2DTexture(bool isFirstUpload, const void *ptr) {
     GLenum type = mType->getElement()->getComponent().getGLType();
     GLenum format = mType->getElement()->getComponent().getGLFormat();
 
-    Adapter2D adapt(getContext(), this);
-    for (uint32_t lod = 0; (lod + mTextureLOD) < mType->getLODCount(); lod++) {
-        adapt.setLOD(lod+mTextureLOD);
+    GLenum target = (GLenum)getGLTarget();
+    glBindTexture(target, mTextureID);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
 
-        uint16_t * ptr = static_cast<uint16_t *>(adapt.getElement(0,0));
+    for (uint32_t lod = 0; lod < mType->getLODCount(); lod++) {
+        const uint8_t *p = (const uint8_t *)ptr;
+        p += mType->getLODOffset(lod);
+
         if (isFirstUpload) {
             glTexImage2D(GL_TEXTURE_2D, lod, format,
-                         adapt.getDimX(), adapt.getDimY(),
-                         0, format, type, ptr);
+                         mType->getLODDimX(lod), mType->getLODDimY(lod),
+                         0, format, type, p);
         } else {
             glTexSubImage2D(GL_TEXTURE_2D, lod, 0, 0,
-                            adapt.getDimX(), adapt.getDimY(),
-                            format, type, ptr);
+                            mType->getLODDimX(lod), mType->getLODDimY(lod),
+                            format, type, p);
         }
     }
 }
@@ -214,6 +233,10 @@
     GLenum type = mType->getElement()->getComponent().getGLType();
     GLenum format = mType->getElement()->getComponent().getGLFormat();
 
+    GLenum target = (GLenum)getGLTarget();
+    glBindTexture(target, mTextureID);
+    glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
+
     GLenum faceOrder[] = {
         GL_TEXTURE_CUBE_MAP_POSITIVE_X,
         GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
@@ -227,8 +250,8 @@
     for (uint32_t face = 0; face < 6; face ++) {
         adapt.setFace(face);
 
-        for (uint32_t lod = 0; (lod + mTextureLOD) < mType->getLODCount(); lod++) {
-            adapt.setLOD(lod+mTextureLOD);
+        for (uint32_t lod = 0; lod < mType->getLODCount(); lod++) {
+            adapt.setLOD(lod);
 
             uint16_t * ptr = static_cast<uint16_t *>(adapt.getElement(0,0));
 
@@ -585,7 +608,7 @@
 
 void rsi_AllocationUploadToTexture(Context *rsc, RsAllocation va, bool genmip, uint32_t baseMipLevel) {
     Allocation *alloc = static_cast<Allocation *>(va);
-    alloc->deferedUploadToTexture(rsc, genmip, baseMipLevel);
+    alloc->deferedUploadToTexture(rsc);
 }
 
 void rsi_AllocationUploadToBufferObject(Context *rsc, RsAllocation va) {
@@ -681,16 +704,21 @@
         return;
     }
 
-    memcpy(texAlloc->getPtr(), data, s);
-    if (genMips) {
-        Adapter2D adapt(rsc, texAlloc);
-        Adapter2D adapt2(rsc, texAlloc);
-        for (uint32_t lod=0; lod < (texAlloc->getType()->getLODCount() -1); lod++) {
-            adapt.setLOD(lod);
-            adapt2.setLOD(lod + 1);
-            mip(adapt2, adapt);
+    if (texAlloc->getIsScript()) {
+        memcpy(texAlloc->getPtr(), data, s);
+        if (genMips) {
+            Adapter2D adapt(rsc, texAlloc);
+            Adapter2D adapt2(rsc, texAlloc);
+            for (uint32_t lod=0; lod < (texAlloc->getType()->getLODCount() -1); lod++) {
+                adapt.setLOD(lod);
+                adapt2.setLOD(lod + 1);
+                mip(adapt2, adapt);
+            }
         }
+    } else {
+        texAlloc->upload2DTexture(false, data);
     }
+
 }
 
 void rsi_AllocationCopyToBitmap(Context *rsc, RsAllocation va, void *data, size_t dataLen) {
@@ -792,7 +820,7 @@
         }
     }
 
-    texAlloc->deferedUploadToTexture(rsc, false, 0);
+    texAlloc->deferedUploadToTexture(rsc);
     return texAlloc;
 }
 
@@ -836,6 +864,6 @@
         }
     }
 
-    texAlloc->deferedUploadToTexture(rsc, false, 0);
+    texAlloc->deferedUploadToTexture(rsc);
     return texAlloc;
 }
diff --git a/libs/rs/rsAllocation.h b/libs/rs/rsAllocation.h
index d1dcb73..4a5f3da 100644
--- a/libs/rs/rsAllocation.h
+++ b/libs/rs/rsAllocation.h
@@ -45,7 +45,7 @@
 
     void syncAll(Context *rsc, RsAllocationUsageType src);
 
-    void deferedUploadToTexture(const Context *rsc, bool genMipmap, uint32_t lodOffset);
+    void deferedUploadToTexture(const Context *rsc);
     void uploadToTexture(const Context *rsc);
     uint32_t getTextureID() const {return mTextureID;}
 
@@ -87,6 +87,9 @@
 
     virtual void uploadCheck(Context *rsc);
 
+    bool getIsScript() const {
+        return (mUsageFlags & RS_ALLOCATION_USAGE_SCRIPT) != 0;
+    }
     bool getIsTexture() const {
         return (mUsageFlags & RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE) != 0;
     }
@@ -98,7 +101,11 @@
     void decRefs(const void *ptr, size_t ct, size_t startOff = 0) const;
 
     void sendDirty() const;
-    bool getHasGraphicsMipmaps() const {return mTextureGenMipmap;}
+    bool getHasGraphicsMipmaps() const {
+        return mMipmapControl != RS_ALLOCATION_MIPMAP_NONE;
+    }
+
+    void upload2DTexture(bool isFirstUpload, const void *ptr);
 
 protected:
     ObjectBaseRef<const Type> mType;
@@ -129,8 +136,6 @@
 
     // Is this a legal structure to be used as a texture source.
     // Initially this will require 1D or 2D and color data
-    bool mTextureGenMipmap;
-    uint32_t mTextureLOD;
     uint32_t mTextureID;
 
     // Is this a legal structure to be used as a vertex source.
@@ -142,8 +147,11 @@
 
 private:
     void init(Context *rsc, const Type *);
-    void upload2DTexture(bool isFirstUpload);
     void uploadCubeTexture(bool isFirstUpload);
+
+    void allocScriptMemory();
+    void freeScriptMemory();
+
 };
 
 }
diff --git a/libs/rs/rsFont.cpp b/libs/rs/rsFont.cpp
index 3d17be2..3f9a9d6 100644
--- a/libs/rs/rsFont.cpp
+++ b/libs/rs/rsFont.cpp
@@ -463,7 +463,7 @@
 
     // This will dirty the texture and the shader so next time
     // we draw it will upload the data
-    mTextTexture->deferedUploadToTexture(mRSC, false, 0);
+    mTextTexture->deferedUploadToTexture(mRSC);
     mFontShaderF->bindTexture(mRSC, 0, mTextTexture.get());
 
     // Some debug code
@@ -529,7 +529,7 @@
 
     Allocation *cacheAlloc = new Allocation(mRSC, texType, RS_ALLOCATION_USAGE_SCRIPT | RS_ALLOCATION_USAGE_GRAPHICS_TEXTURE);
     mTextTexture.set(cacheAlloc);
-    mTextTexture->deferedUploadToTexture(mRSC, false, 0);
+    mTextTexture->deferedUploadToTexture(mRSC);
 
     // Split up our cache texture into lines of certain widths
     int32_t nextLine = 0;
diff --git a/libs/rs/rsScriptC.cpp b/libs/rs/rsScriptC.cpp
index b3dbf11..507430d 100644
--- a/libs/rs/rsScriptC.cpp
+++ b/libs/rs/rsScriptC.cpp
@@ -402,7 +402,7 @@
 extern const char rs_runtime_lib_bc[];
 extern unsigned rs_runtime_lib_bc_size;
 
-void ScriptCState::runCompiler(Context *rsc, ScriptC *s, const char *resName) {
+void ScriptCState::runCompiler(Context *rsc, ScriptC *s, const char *resName, const char *cacheDir) {
     {
         s->mBccScript = bccCreateScript();
         s->mEnviroment.mIsThreadable = true;
@@ -413,7 +413,8 @@
         if (bccReadBC(s->mBccScript,
                       s->mEnviroment.mScriptText,
                       s->mEnviroment.mScriptTextLength,
-                      resName) >= 0) {
+                      resName,
+                      cacheDir) >= 0) {
           //bccLinkBC(s->mBccScript, rs_runtime_lib_bc, rs_runtime_lib_bc_size);
           bccCompileBC(s->mBccScript);
         } else {
@@ -534,7 +535,7 @@
     ss->mScript->mEnviroment.mScriptTextLength = len;
 }
 
-RsScript rsi_ScriptCCreate(Context * rsc, const char *resName)
+RsScript rsi_ScriptCCreate(Context * rsc, const char *resName, const char *cacheDir)
 {
     ScriptCState *ss = &rsc->mScriptC;
 
@@ -542,7 +543,7 @@
     ss->mScript.clear();
     s->incUserRef();
 
-    ss->runCompiler(rsc, s.get(), resName);
+    ss->runCompiler(rsc, s.get(), resName, cacheDir);
     ss->clear(rsc);
     return s.get();
 }
diff --git a/libs/rs/rsScriptC.h b/libs/rs/rsScriptC.h
index ab2db5c8..a714132 100644
--- a/libs/rs/rsScriptC.h
+++ b/libs/rs/rsScriptC.h
@@ -83,7 +83,7 @@
     void init(Context *rsc);
 
     void clear(Context *rsc);
-    void runCompiler(Context *rsc, ScriptC *s, const char *resName);
+    void runCompiler(Context *rsc, ScriptC *s, const char *resName, const char *cacheDir);
 
     struct SymbolTable_t {
         const char * mName;
diff --git a/libs/surfaceflinger_client/Surface.cpp b/libs/surfaceflinger_client/Surface.cpp
index 9467a4c..aa0c2e8 100644
--- a/libs/surfaceflinger_client/Surface.cpp
+++ b/libs/surfaceflinger_client/Surface.cpp
@@ -384,7 +384,7 @@
 
 
 Mutex Surface::sCachedSurfacesLock;
-DefaultKeyedVector<wp<IBinder>, wp<Surface> > Surface::sCachedSurfaces(wp<Surface>(0));
+DefaultKeyedVector<wp<IBinder>, wp<Surface> > Surface::sCachedSurfaces;
 
 sp<Surface> Surface::readFromParcel(const Parcel& data) {
     Mutex::Autolock _l(sCachedSurfacesLock);
@@ -397,13 +397,13 @@
     if (surface->mSurface == 0) {
       surface = 0;
     }
-    cleanCachedSurfaces();
+    cleanCachedSurfacesLocked();
     return surface;
 }
 
 // Remove the stale entries from the surface cache.  This should only be called
 // with sCachedSurfacesLock held.
-void Surface::cleanCachedSurfaces() {
+void Surface::cleanCachedSurfacesLocked() {
     for (int i = sCachedSurfaces.size()-1; i >= 0; --i) {
         wp<Surface> s(sCachedSurfaces.valueAt(i));
         if (s == 0 || s.promote() == 0) {
@@ -489,6 +489,9 @@
         LOGE("[Surface] using an invalid surface, "
                 "identity=%u should be %d",
                 mIdentity, identity);
+        CallStack stack;
+        stack.update();
+        stack.dump("Surface");
         return NO_INIT;
     }
 
@@ -497,6 +500,9 @@
     if (err != NO_ERROR) {
         LOGE("surface (identity=%u) is invalid, err=%d (%s)",
                 mIdentity, err, strerror(-err));
+        CallStack stack;
+        stack.update();
+        stack.dump("Surface");
         return err;
     }
 
diff --git a/media/java/android/media/MtpDatabase.java b/media/java/android/media/MtpDatabase.java
index 688c7b3..db08b27 100644
--- a/media/java/android/media/MtpDatabase.java
+++ b/media/java/android/media/MtpDatabase.java
@@ -725,26 +725,38 @@
         }
     }
 
-    private int deleteRecursive(int handle) throws RemoteException {
-        int[] children = getObjectList(0 /* storageID */, 0 /* format */, handle);
-        Uri uri = Files.getMtpObjectsUri(mVolumeName, handle);
-        // delete parent first, to avoid potential infinite recursion
-        int count = mMediaProvider.delete(uri, null, null);
-        if (count == 1) {
-            if (children != null) {
-                for (int i = 0; i < children.length; i++) {
-                    count += deleteRecursive(children[i]);
-                }
-            }
-        }
-        return count;
-    }
-
     private int deleteFile(int handle) {
         Log.d(TAG, "deleteFile: " + handle);
         mDatabaseModified = true;
+        String path = null;
+        int format = 0;
+
+        Cursor c = null;
         try {
-            if (deleteRecursive(handle) > 0) {
+            c = mMediaProvider.query(mObjectsUri, PATH_SIZE_FORMAT_PROJECTION,
+                            ID_WHERE, new String[] {  Integer.toString(handle) }, null);
+            if (c != null && c.moveToNext()) {
+                // don't convert to media path here, since we will be matching
+                // against paths in the database matching /data/media
+                path = c.getString(1);
+                format = c.getInt(3);
+            } else {
+                return MtpConstants.RESPONSE_INVALID_OBJECT_HANDLE;
+            }
+
+            if (path == null || format == 0) {
+                return MtpConstants.RESPONSE_GENERAL_ERROR;
+            }
+
+            if (format == MtpConstants.FORMAT_ASSOCIATION) {
+                // recursive case - delete all children first
+                Uri uri = Files.getMtpObjectsUri(mVolumeName);
+                int count = mMediaProvider.delete(uri, "_data LIKE ?",
+                        new String[] { path + "/%"});
+            }
+
+            Uri uri = Files.getMtpObjectsUri(mVolumeName, handle);
+            if (mMediaProvider.delete(uri, null, null) > 0) {
                 return MtpConstants.RESPONSE_OK;
             } else {
                 return MtpConstants.RESPONSE_INVALID_OBJECT_HANDLE;
@@ -752,6 +764,10 @@
         } catch (RemoteException e) {
             Log.e(TAG, "RemoteException in deleteFile", e);
             return MtpConstants.RESPONSE_GENERAL_ERROR;
+        } finally {
+            if (c != null) {
+                c.close();
+            }
         }
     }
 
diff --git a/media/libstagefright/WAVExtractor.cpp b/media/libstagefright/WAVExtractor.cpp
index 446021c..9332120 100644
--- a/media/libstagefright/WAVExtractor.cpp
+++ b/media/libstagefright/WAVExtractor.cpp
@@ -318,7 +318,7 @@
     int64_t seekTimeUs;
     ReadOptions::SeekMode mode;
     if (options != NULL && options->getSeekTo(&seekTimeUs, &mode)) {
-        int64_t pos = (seekTimeUs * mSampleRate) / 1000000 * mNumChannels * 2;
+        int64_t pos = (seekTimeUs * mSampleRate) / 1000000 * mNumChannels * (mBitsPerSample >> 3);
         if (pos > mSize) {
             pos = mSize;
         }
diff --git a/opengl/tests/hwc/hwc_stress.cpp b/opengl/tests/hwc/hwc_stress.cpp
index 35e53ab..580eb83 100644
--- a/opengl/tests/hwc/hwc_stress.cpp
+++ b/opengl/tests/hwc/hwc_stress.cpp
@@ -202,18 +202,19 @@
 };
 
 // File scope constants
-static const struct {
+static const struct graphicFormat {
     unsigned int format;
     const char *desc;
+    unsigned int wMod, hMod; // Width/height mod this value must equal zero
 } graphicFormat[] = {
-    {HAL_PIXEL_FORMAT_RGBA_8888, "RGBA8888"},
-    {HAL_PIXEL_FORMAT_RGBX_8888, "RGBX8888"},
-    {HAL_PIXEL_FORMAT_RGB_888, "RGB888"},
-    {HAL_PIXEL_FORMAT_RGB_565, "RGB565"},
-    {HAL_PIXEL_FORMAT_BGRA_8888, "BGRA8888"},
-    {HAL_PIXEL_FORMAT_RGBA_5551, "RGBA5551"},
-    {HAL_PIXEL_FORMAT_RGBA_4444, "RGBA4444"},
-    {HAL_PIXEL_FORMAT_YV12, "YV12"},
+    {HAL_PIXEL_FORMAT_RGBA_8888, "RGBA8888", 1, 1},
+    {HAL_PIXEL_FORMAT_RGBX_8888, "RGBX8888", 1, 1},
+    {HAL_PIXEL_FORMAT_RGB_888, "RGB888", 1, 1},
+    {HAL_PIXEL_FORMAT_RGB_565, "RGB565", 1, 1},
+    {HAL_PIXEL_FORMAT_BGRA_8888, "BGRA8888", 1, 1},
+    {HAL_PIXEL_FORMAT_RGBA_5551, "RGBA5551", 1, 1},
+    {HAL_PIXEL_FORMAT_RGBA_4444, "RGBA4444", 1, 1},
+    {HAL_PIXEL_FORMAT_YV12, "YV12", 2, 2},
 };
 const unsigned int blendingOps[] = {
     HWC_BLENDING_NONE,
@@ -478,7 +479,7 @@
             exit(20);
         }
 
-	// Prandomly select a subset of frames to be used by this pass.
+        // Prandomly select a subset of frames to be used by this pass.
         vector <vector <sp<GraphicBuffer> > > selectedFrames;
         selectedFrames = vectorRandSelect(frames, list->numHwLayers);
 
@@ -749,7 +750,6 @@
 {
     unsigned char* buf = NULL;
     status_t err;
-    unsigned int numPixels = gBuf->getWidth() * gBuf->getHeight();
     uint32_t pixel;
 
     // RGB 2 YUV conversion ratios
@@ -835,9 +835,16 @@
         exit(51);
     }
 
-    for (unsigned int n1 = 0; n1 < numPixels; n1++) {
-        memmove(buf, &pixel, attrib->bytes);
-        buf += attrib->bytes;
+    for (unsigned int row = 0; row < gBuf->getHeight(); row++) {
+        for (unsigned int col = 0; col < gBuf->getWidth(); col++) {
+          memmove(buf, &pixel, attrib->bytes);
+          buf += attrib->bytes;
+        }
+        for (unsigned int pad = 0;
+             pad < (gBuf->getStride() - gBuf->getWidth()) * attrib->bytes;
+             pad++) {
+            *buf++ = testRandMod(256);
+        }
     }
 
     err = gBuf->unlock();
@@ -856,14 +863,13 @@
 
     const struct yuvAttrib {
         int format;
-        size_t padWidth;
         bool   planar;
         unsigned int uSubSampX;
         unsigned int uSubSampY;
         unsigned int vSubSampX;
         unsigned int vSubSampY;
     } yuvAttributes[] = {
-        { HAL_PIXEL_FORMAT_YV12, 16, true, 2, 2, 2, 2},
+        { HAL_PIXEL_FORMAT_YV12, true, 2, 2, 2, 2},
     };
 
     const struct yuvAttrib *attrib;
@@ -879,12 +885,6 @@
 
     assert(attrib->planar == true); // So far, only know how to handle planar
 
-    // If needed round width up to pad size
-    if (width % attrib->padWidth) {
-        width += attrib->padWidth - (width % attrib->padWidth);
-    }
-    assert((width % attrib->padWidth) == 0);
-
     err = gBuf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&buf));
     if (err != 0) {
         testPrintE("fillColor lock failed: %d", err);
@@ -892,23 +892,35 @@
     }
 
     // Fill in Y component
-    for (unsigned int x = 0; x < width; x++) {
-        for (unsigned int y = 0; y < height; y++) {
-            *buf++ = (x < gBuf->getWidth()) ? (255 * color.y()) : 0;
+    for (unsigned int row = 0; row < height; row++) {
+        for (unsigned int col = 0; col < width; col++) {
+            *buf++ = 255 * color.y();
+        }
+        for (unsigned int pad = 0; pad < gBuf->getStride() - gBuf->getWidth();
+             pad++) {
+             *buf++ = testRandMod(256);
         }
     }
 
     // Fill in U component
-    for (unsigned int x = 0; x < width; x += attrib->uSubSampX) {
-        for (unsigned int y = 0; y < height; y += attrib->uSubSampY) {
-            *buf++ = (x < gBuf->getWidth()) ? (255 * color.u()) : 0;
+    for (unsigned int row = 0; row < height; row += attrib->uSubSampY) {
+        for (unsigned int col = 0; col < width; col += attrib->uSubSampX) {
+            *buf++ = 255 * color.u();
+        }
+        for (unsigned int pad = 0; pad < gBuf->getStride() - gBuf->getWidth();
+             pad += attrib->uSubSampX) {
+            *buf++ = testRandMod(256);
         }
     }
 
     // Fill in V component
-    for (unsigned int x = 0; x < width; x += attrib->vSubSampX) {
-        for (unsigned int y = 0; y < height; y += attrib->vSubSampY) {
-            *buf++ = (x < gBuf->getWidth()) ? (255 * color.v()) : 0;
+    for (unsigned int row = 0; row < height; row += attrib->vSubSampY) {
+        for (unsigned int col = 0; col < width; col += attrib->vSubSampX) {
+            *buf++ = 255 * color.v();
+        }
+        for (unsigned int pad = 0; pad < gBuf->getStride() - gBuf->getWidth();
+             pad += attrib->vSubSampX) {
+            *buf++ = testRandMod(256);
         }
     }
 
@@ -989,7 +1001,7 @@
     eglQuerySurface(dpy, surface, EGL_HEIGHT, &height);
     checkEglError("eglQuerySurface");
 
-    fprintf(stderr, "Window dimensions: %d x %d", width, height);
+    testPrintI("Window dimensions: %d x %d", width, height);
 
     printGLString("Version", GL_VERSION);
     printGLString("Vendor", GL_VENDOR);
@@ -1017,7 +1029,7 @@
  *
  * Creates an array of graphic buffers, within the global variable
  * named frames.  The graphic buffers are contained within a vector of
- * verctors.  All the graphic buffers in a particular row are of the same
+ * vectors.  All the graphic buffers in a particular row are of the same
  * format and dimension.  Each graphic buffer is uniformly filled with a
  * prandomly selected color.  It is likely that each buffer, even
  * in the same row, will be filled with a unique color.
@@ -1039,11 +1051,22 @@
     for (unsigned int row = 0; row < rows; row++) {
         // All frames within a row have to have the same format and
         // dimensions.  Width and height need to be >= 1.
-        int format = graphicFormat[testRandMod(NUMA(graphicFormat))].format;
+        unsigned int formatIdx = testRandMod(NUMA(graphicFormat));
+        const struct graphicFormat *formatPtr = &graphicFormat[formatIdx];
+        int format = formatPtr->format;
+
+        // Pick width and height, which must be >= 1 and the size
+        // mod the wMod/hMod value must be equal to 0.
         size_t w = (width * maxSizeRatio) * testRandFract();
         size_t h = (height * maxSizeRatio) * testRandFract();
         w = max(1u, w);
         h = max(1u, h);
+        if ((w % formatPtr->wMod) != 0) {
+            w += formatPtr->wMod - (w % formatPtr->wMod);
+        }
+        if ((h % formatPtr->hMod) != 0) {
+            h += formatPtr->hMod - (h % formatPtr->hMod);
+        }
         if (verbose) {
             testPrintI("  frame %u width: %u height: %u format: %u %s",
                        row, w, h, format, graphicFormat2str(format));
diff --git a/packages/SettingsProvider/res/xml/bookmarks.xml b/packages/SettingsProvider/res/xml/bookmarks.xml
index dfaeeaf..83229f4 100644
--- a/packages/SettingsProvider/res/xml/bookmarks.xml
+++ b/packages/SettingsProvider/res/xml/bookmarks.xml
@@ -4,9 +4,9 @@
      Licensed under the Apache License, Version 2.0 (the "License");
      you may not use this file except in compliance with the License.
      You may obtain a copy of the License at
-  
+
           http://www.apache.org/licenses/LICENSE-2.0
-  
+
      Unless required by applicable law or agreed to in writing, software
      distributed under the License is distributed on an "AS IS" BASIS,
      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -14,6 +14,22 @@
      limitations under the License.
 -->
 
+<!--
+     Default system bookmarks for AOSP.
+     Bookmarks for vendor apps should be added to a bookmarks resource overlay; not here.
+
+     Typical shortcuts (not necessarily defined here):
+       'b': Browser
+       'c': Contacts
+       'e': Email
+       'g': GMail
+       'l': Calendar
+       'm': Maps
+       'p': Music
+       's': SMS
+       't': Talk
+       'y': YouTube
+-->
 <bookmarks>
     <bookmark
         package="com.android.browser"
@@ -21,30 +37,16 @@
         shortcut="b" />
     <bookmark
         package="com.android.contacts"
-        class="com.android.contacts.DialtactsContactsEntryActivity"
+        class="com.android.contacts.activities.ContactsFrontDoor"
         shortcut="c" />
     <bookmark
-        package="com.android.email"
+        package="com.google.android.email"
         class="com.android.email.activity.Welcome"
         shortcut="e" />
     <bookmark
-        package="com.google.android.gm"
-        class="com.google.android.gm.ConversationListActivityGmail"
-        shortcut="g" />
-    <bookmark
-        package="com.android.im"
-        class="com.android.im.app.LandingPage"
-        shortcut="i" />
-    <bookmark
-        package="com.android.calendar"
+        package="com.google.android.calendar"
         class="com.android.calendar.LaunchActivity"
         shortcut="l" />
-<!--
-    <bookmark
-        package="com.google.android.apps.maps"
-        class="com.google.android.maps.MapsActivity"
-        shortcut="m" />
--->
     <bookmark
         package="com.android.music"
         class="com.android.music.MusicBrowserActivity"
diff --git a/packages/SystemUI/res/xml/bookmarks.xml b/packages/SystemUI/res/xml/bookmarks.xml
deleted file mode 100644
index dfaeeaf..0000000
--- a/packages/SystemUI/res/xml/bookmarks.xml
+++ /dev/null
@@ -1,56 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 The Android Open Source Project
-
-     Licensed under the Apache License, Version 2.0 (the "License");
-     you may not use this file except in compliance with the License.
-     You may obtain a copy of the License at
-  
-          http://www.apache.org/licenses/LICENSE-2.0
-  
-     Unless required by applicable law or agreed to in writing, software
-     distributed under the License is distributed on an "AS IS" BASIS,
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<bookmarks>
-    <bookmark
-        package="com.android.browser"
-        class="com.android.browser.BrowserActivity"
-        shortcut="b" />
-    <bookmark
-        package="com.android.contacts"
-        class="com.android.contacts.DialtactsContactsEntryActivity"
-        shortcut="c" />
-    <bookmark
-        package="com.android.email"
-        class="com.android.email.activity.Welcome"
-        shortcut="e" />
-    <bookmark
-        package="com.google.android.gm"
-        class="com.google.android.gm.ConversationListActivityGmail"
-        shortcut="g" />
-    <bookmark
-        package="com.android.im"
-        class="com.android.im.app.LandingPage"
-        shortcut="i" />
-    <bookmark
-        package="com.android.calendar"
-        class="com.android.calendar.LaunchActivity"
-        shortcut="l" />
-<!--
-    <bookmark
-        package="com.google.android.apps.maps"
-        class="com.google.android.maps.MapsActivity"
-        shortcut="m" />
--->
-    <bookmark
-        package="com.android.music"
-        class="com.android.music.MusicBrowserActivity"
-        shortcut="p" />
-    <bookmark
-        package="com.android.mms"
-        class="com.android.mms.ui.ConversationList"
-        shortcut="s" />
-</bookmarks>
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index 79bf9d0..c6984a4 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1330,38 +1330,40 @@
                 }
             } else if (keyCode == mShortcutKeyPressed) {
                 mShortcutKeyPressed = -1;
-                
                 if (mConsumeShortcutKeyUp) {
-                    // Consume the up-event
                     mConsumeShortcutKeyUp = false;
                     return true;
                 }
             }
+            return false;
         } else if (keyCode == KeyEvent.KEYCODE_APP_SWITCH) {
             if (!down) {
                 showRecentAppsDialog();
             }
             return true;
         }
-        
+
         // Shortcuts are invoked through Search+key, so intercept those here
-        if (mShortcutKeyPressed != -1 && !mConsumeShortcutKeyUp) {
-            if (down && repeatCount == 0 && !keyguardOn) {
-                final KeyCharacterMap kcm = event.getKeyCharacterMap();
-                Intent shortcutIntent = mShortcutManager.getIntent(kcm, keyCode, metaState);
-                if (shortcutIntent != null) {
-                    shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-                    mContext.startActivity(shortcutIntent);
-                    
-                    /*
-                     * We launched an app, so the up-event of the search key
-                     * should be consumed
-                     */
-                    if (mShortcutKeyPressed != -1) {
-                        mConsumeShortcutKeyUp = true;
+        // Any printing key that is chorded with Search should be consumed
+        // even if no shortcut was invoked.  This prevents text from being
+        // inadvertently inserted when using a keyboard that has built-in macro
+        // shortcut keys (that emit Search+x) and some of them are not registered.
+        if (mShortcutKeyPressed != -1) {
+            final KeyCharacterMap kcm = event.getKeyCharacterMap();
+            if (kcm.isPrintingKey(keyCode)) {
+                mConsumeShortcutKeyUp = true;
+                if (down && repeatCount == 0 && !keyguardOn) {
+                    Intent shortcutIntent = mShortcutManager.getIntent(kcm, keyCode, metaState);
+                    if (shortcutIntent != null) {
+                        shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                        mContext.startActivity(shortcutIntent);
+                    } else {
+                        Slog.i(TAG, "Dropping unregistered shortcut key combination: "
+                                + KeyEvent.keyCodeToString(mShortcutKeyPressed)
+                                + "+" + KeyEvent.keyCodeToString(keyCode));
                     }
-                    return true;
                 }
+                return true;
             }
         }
 
diff --git a/services/java/com/android/server/BackupManagerService.java b/services/java/com/android/server/BackupManagerService.java
index 601fa21..5b4fb1f 100644
--- a/services/java/com/android/server/BackupManagerService.java
+++ b/services/java/com/android/server/BackupManagerService.java
@@ -149,9 +149,9 @@
             return "BackupRequest{app=" + appInfo + " full=" + fullBackup + "}";
         }
     }
-    // Backups that we haven't started yet.
-    HashMap<ApplicationInfo,BackupRequest> mPendingBackups
-            = new HashMap<ApplicationInfo,BackupRequest>();
+    // Backups that we haven't started yet.  Keys are package names.
+    HashMap<String,BackupRequest> mPendingBackups
+            = new HashMap<String,BackupRequest>();
 
     // Pseudoname that we use for the Package Manager metadata "package"
     static final String PACKAGE_MANAGER_SENTINEL = "@pm@";
@@ -929,42 +929,48 @@
     // 'packageName' is null, *all* participating apps will be removed.
     void removePackageParticipantsLocked(String packageName) {
         if (DEBUG) Slog.v(TAG, "removePackageParticipantsLocked: " + packageName);
-        List<PackageInfo> allApps = null;
+        List<String> allApps = new ArrayList<String>();
         if (packageName != null) {
-            allApps = new ArrayList<PackageInfo>();
-            try {
-                int flags = PackageManager.GET_SIGNATURES;
-                allApps.add(mPackageManager.getPackageInfo(packageName, flags));
-            } catch (Exception e) {
-                // just skip it (???)
-            }
+            allApps.add(packageName);
         } else {
             // all apps with agents
-            allApps = allAgentPackages();
+            List<PackageInfo> knownPackages = allAgentPackages();
+            for (PackageInfo pkg : knownPackages) {
+                allApps.add(pkg.packageName);
+            }
         }
         removePackageParticipantsLockedInner(packageName, allApps);
     }
 
     private void removePackageParticipantsLockedInner(String packageName,
-            List<PackageInfo> agents) {
+            List<String> allPackageNames) {
         if (DEBUG) {
             Slog.v(TAG, "removePackageParticipantsLockedInner (" + packageName
-                    + ") removing " + agents.size() + " entries");
-            for (PackageInfo p : agents) {
+                    + ") removing " + allPackageNames.size() + " entries");
+            for (String p : allPackageNames) {
                 Slog.v(TAG, "    - " + p);
             }
         }
-        for (PackageInfo pkg : agents) {
-            if (packageName == null || pkg.packageName.equals(packageName)) {
-                int uid = pkg.applicationInfo.uid;
+        for (String pkg : allPackageNames) {
+            if (packageName == null || pkg.equals(packageName)) {
+                int uid = -1;
+                try {
+                    PackageInfo info = mPackageManager.getPackageInfo(packageName, 0);
+                    uid = info.applicationInfo.uid;
+                } catch (NameNotFoundException e) {
+                    // we don't know this package name, so just skip it for now
+                    continue;
+                }
+
                 HashSet<ApplicationInfo> set = mBackupParticipants.get(uid);
                 if (set != null) {
                     // Find the existing entry with the same package name, and remove it.
                     // We can't just remove(app) because the instances are different.
                     for (ApplicationInfo entry: set) {
-                        if (entry.packageName.equals(pkg.packageName)) {
+                        if (entry.packageName.equals(pkg)) {
+                            if (DEBUG) Slog.v(TAG, "  removing participant " + pkg);
                             set.remove(entry);
-                            removeEverBackedUp(pkg.packageName);
+                            removeEverBackedUp(pkg);
                             break;
                         }
                     }
@@ -1014,7 +1020,11 @@
 
         // brute force but small code size
         List<PackageInfo> allApps = allAgentPackages();
-        removePackageParticipantsLockedInner(packageName, allApps);
+        List<String> allAppNames = new ArrayList<String>();
+        for (PackageInfo pkg : allApps) {
+            allAppNames.add(pkg.packageName);
+        }
+        removePackageParticipantsLockedInner(packageName, allAppNames);
         addPackageParticipantsLockedInner(packageName, allApps);
     }
 
@@ -1381,6 +1391,17 @@
             for (BackupRequest request : mQueue) {
                 Slog.d(TAG, "starting agent for backup of " + request);
 
+                // Verify that the requested app exists; it might be something that
+                // requested a backup but was then uninstalled.  The request was
+                // journalled and rather than tamper with the journal it's safer
+                // to sanity-check here.
+                try {
+                    mPackageManager.getPackageInfo(request.appInfo.packageName, 0);
+                } catch (NameNotFoundException e) {
+                    Slog.d(TAG, "Package does not exist; skipping");
+                    continue;
+                }
+
                 IBackupAgent agent = null;
                 int mode = (request.fullBackup)
                         ? IApplicationThread.BACKUP_MODE_FULL
@@ -2068,7 +2089,7 @@
                     // Add the caller to the set of pending backups.  If there is
                     // one already there, then overwrite it, but no harm done.
                     BackupRequest req = new BackupRequest(app, false);
-                    if (mPendingBackups.put(app, req) == null) {
+                    if (mPendingBackups.put(app.packageName, req) == null) {
                         // Journal this request in case of crash.  The put()
                         // operation returned null when this package was not already
                         // in the set; we want to avoid touching the disk redundantly.
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 8dbd3e7..4290ce7 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -219,28 +219,6 @@
         }
     }
 
-    private static int stringToIpAddr(String addrString) throws UnknownHostException {
-        try {
-            String[] parts = addrString.split("\\.");
-            if (parts.length != 4) {
-                throw new UnknownHostException(addrString);
-            }
-
-            int a = Integer.parseInt(parts[0]) << 24;
-            int b = Integer.parseInt(parts[1]) << 16;
-            int c = Integer.parseInt(parts[2]) <<  8;
-            int d = Integer.parseInt(parts[3])      ;
-
-            return a | b | c | d;
-        } catch (NumberFormatException ex) {
-            throw new UnknownHostException(addrString);
-        }
-    }
-
-    public static String intToIpString(int i) {
-        return ((i >> 24 ) & 0xFF) + "." + ((i >> 16 ) & 0xFF) + "." + ((i >>  8 ) & 0xFF) + "." +
-               (i & 0xFF);
-    }
 
     //
     // INetworkManagementService members
@@ -288,18 +266,17 @@
             cfg = new InterfaceConfiguration();
             cfg.hwAddr = st.nextToken(" ");
             try {
-                cfg.ipAddr = stringToIpAddr(st.nextToken(" "));
+                cfg.addr = InetAddress.getByName(st.nextToken(" "));
             } catch (UnknownHostException uhe) {
                 Slog.e(TAG, "Failed to parse ipaddr", uhe);
-                cfg.ipAddr = 0;
             }
 
             try {
-                cfg.netmask = stringToIpAddr(st.nextToken(" "));
+                cfg.mask = InetAddress.getByName(st.nextToken(" "));
             } catch (UnknownHostException uhe) {
                 Slog.e(TAG, "Failed to parse netmask", uhe);
-                cfg.netmask = 0;
             }
+
             cfg.interfaceFlags = st.nextToken("]").trim() +"]";
         } catch (NoSuchElementException nsee) {
             throw new IllegalStateException(
@@ -312,7 +289,8 @@
     public void setInterfaceConfig(
             String iface, InterfaceConfiguration cfg) throws IllegalStateException {
         String cmd = String.format("interface setcfg %s %s %s %s", iface,
-                intToIpString(cfg.ipAddr), intToIpString(cfg.netmask), cfg.interfaceFlags);
+                cfg.addr.getHostAddress(), cfg.mask.getHostAddress(),
+                cfg.interfaceFlags);
         try {
             mConnector.doCommand(cmd);
         } catch (NativeDaemonConnectorException e) {
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index 07813b0..ff703fd 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -58,6 +58,7 @@
 import android.text.TextUtils;
 import android.util.Slog;
 
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
@@ -347,8 +348,8 @@
                         ifcg = service.getInterfaceConfig(intf);
                         if (ifcg != null) {
                             /* IP/netmask: 192.168.43.1/255.255.255.0 */
-                            ifcg.ipAddr = (192 << 24) + (168 << 16) + (43 << 8) + 1;
-                            ifcg.netmask = (255 << 24) + (255 << 16) + (255 << 8) + 0;
+                            ifcg.addr = InetAddress.getByName("192.168.43.1");
+                            ifcg.mask = InetAddress.getByName("255.255.255.0");
                             ifcg.interfaceFlags = "[up]";
 
                             service.setInterfaceConfig(intf, ifcg);
diff --git a/services/java/com/android/server/connectivity/Tethering.java b/services/java/com/android/server/connectivity/Tethering.java
index 75a0e82..d742d4c 100644
--- a/services/java/com/android/server/connectivity/Tethering.java
+++ b/services/java/com/android/server/connectivity/Tethering.java
@@ -51,6 +51,7 @@
 
 import java.io.FileDescriptor;
 import java.io.PrintWriter;
+import java.net.InetAddress;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.LinkedList;
@@ -585,16 +586,8 @@
                 try {
                     ifcg = service.getInterfaceConfig(iface);
                     if (ifcg != null) {
-                        String[] addr = USB_NEAR_IFACE_ADDR.split("\\.");
-                        ifcg.ipAddr = (Integer.parseInt(addr[0]) << 24) +
-                                (Integer.parseInt(addr[1]) << 16) +
-                                (Integer.parseInt(addr[2]) << 8) +
-                                (Integer.parseInt(addr[3]));
-                        addr = USB_NETMASK.split("\\.");
-                        ifcg.netmask = (Integer.parseInt(addr[0]) << 24) +
-                                (Integer.parseInt(addr[1]) << 16) +
-                                (Integer.parseInt(addr[2]) << 8) +
-                                (Integer.parseInt(addr[3]));
+                        ifcg.addr = InetAddress.getByName(USB_NEAR_IFACE_ADDR);
+                        ifcg.mask = InetAddress.getByName(USB_NETMASK);
                         if (enabled) {
                             ifcg.interfaceFlags = ifcg.interfaceFlags.replace("down", "up");
                         } else {
diff --git a/services/surfaceflinger/Android.mk b/services/surfaceflinger/Android.mk
index 74d1ac9..8a00a2e 100644
--- a/services/surfaceflinger/Android.mk
+++ b/services/surfaceflinger/Android.mk
@@ -35,7 +35,6 @@
 
 LOCAL_SHARED_LIBRARIES := \
 	libcutils \
-	libpixelflinger \
 	libhardware \
 	libutils \
 	libEGL \
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 80aef5f..5a0f115 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -83,8 +83,28 @@
             sharedClient, token, mBufferManager.getDefaultBufferCount(),
             getIdentity());
 
-    status_t err = mUserClientRef.setToken(userClient, lcblk, token);
 
+    sp<UserClient> ourClient(mUserClientRef.getClient());
+
+    /*
+     *  Here it is guaranteed that userClient != ourClient
+     *  (see UserClient::getTokenForSurface()).
+     *
+     *  We release the token used by this surface in ourClient below.
+     *  This should be safe to do so now, since this layer won't be attached
+     *  to this client, it should be okay to reuse that id.
+     *
+     *  If this causes problems, an other solution would be to keep a list
+     *  of all the {UserClient, token} ever used and release them when the
+     *  Layer is destroyed.
+     *
+     */
+
+    if (ourClient != 0) {
+        ourClient->detachLayer(this);
+    }
+
+    status_t err = mUserClientRef.setToken(userClient, lcblk, token);
     LOGE_IF(err != NO_ERROR,
             "ClientRef::setToken(%p, %p, %u) failed",
             userClient.get(), lcblk.get(), token);
@@ -226,9 +246,10 @@
 void Layer::setPerFrameData(hwc_layer_t* hwcl) {
     sp<GraphicBuffer> buffer(mBufferManager.getActiveBuffer());
     if (buffer == NULL) {
-        // this situation can happen if we ran out of memory for instance.
-        // not much we can do. continue to use whatever texture was bound
-        // to this context.
+        // this can happen if the client never drew into this layer yet,
+        // or if we ran out of memory. In that case, don't let
+        // HWC handle it.
+        hwcl->flags |= HWC_SKIP_LAYER;
         hwcl->handle = NULL;
         return;
     }
@@ -561,12 +582,20 @@
     }
 
     // we retired a buffer, which becomes the new front buffer
+
+    const bool noActiveBuffer = !mBufferManager.hasActiveBuffer();
     if (mBufferManager.setActiveBufferIndex(buf) < NO_ERROR) {
         LOGE("retireAndLock() buffer index (%d) out of range", int(buf));
         mPostedDirtyRegion.clear();
         return;
     }
 
+    if (noActiveBuffer) {
+        // we didn't have an active buffer, we need to recompute
+        // our visible region
+        recomputeVisibleRegions = true;
+    }
+
     sp<GraphicBuffer> newFrontBuffer(getBuffer(buf));
     if (newFrontBuffer != NULL) {
         // get the dirty region
@@ -868,6 +897,10 @@
     return result;
 }
 
+bool Layer::BufferManager::hasActiveBuffer() const {
+    return mActiveBuffer >= 0;
+}
+
 sp<GraphicBuffer> Layer::BufferManager::detachBuffer(size_t index)
 {
     BufferData* const buffers = mBufferData;
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 30021d3..c367a8d 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -188,6 +188,8 @@
         size_t getActiveBufferIndex() const;
         // return the active buffer
         sp<GraphicBuffer> getActiveBuffer() const;
+        // return wether we have an active buffer
+        bool hasActiveBuffer() const;
         // return the active texture (or fail-over)
         Texture getActiveTexture() const;
         // frees resources associated with all buffers
diff --git a/tests/CoreTests/android/core/ArrayListTest.java b/tests/CoreTests/android/core/ArrayListTest.java
deleted file mode 100644
index 763bf99..0000000
--- a/tests/CoreTests/android/core/ArrayListTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.util.ArrayList;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * This test case tests several often used functionality of ArrayLists.
- */
-public class ArrayListTest extends TestCase {
-
-    @SuppressWarnings("unchecked")
-    @SmallTest
-    public void testArrayList() throws Exception {
-        ArrayList array = new ArrayList();
-        assertEquals(0, array.size());
-        assertTrue(array.isEmpty());
-
-        array.add(new Integer(0));
-        array.add(0, new Integer(1));
-        array.add(1, new Integer(2));
-        array.add(new Integer(3));
-        array.add(new Integer(1));
-
-        assertEquals(5, array.size());
-        assertFalse(array.isEmpty());
-
-        assertEquals(1, ((Integer) array.get(0)).intValue());
-        assertEquals(2, ((Integer) array.get(1)).intValue());
-        assertEquals(0, ((Integer) array.get(2)).intValue());
-        assertEquals(3, ((Integer) array.get(3)).intValue());
-        assertEquals(1, ((Integer) array.get(4)).intValue());
-
-        assertFalse(array.contains(null));
-        assertTrue(array.contains(new Integer(2)));
-        assertEquals(0, array.indexOf(new Integer(1)));
-        assertEquals(4, array.lastIndexOf(new Integer(1)));
-        assertTrue(array.indexOf(new Integer(5)) < 0);
-        assertTrue(array.lastIndexOf(new Integer(5)) < 0);
-
-
-        array.remove(1);
-        array.remove(1);
-
-        assertEquals(3, array.size());
-        assertFalse(array.isEmpty());
-        assertEquals(1, ((Integer) array.get(0)).intValue());
-        assertEquals(3, ((Integer) array.get(1)).intValue());
-        assertEquals(1, ((Integer) array.get(2)).intValue());
-
-        assertFalse(array.contains(null));
-        assertFalse(array.contains(new Integer(2)));
-        assertEquals(0, array.indexOf(new Integer(1)));
-        assertEquals(2, array.lastIndexOf(new Integer(1)));
-        assertTrue(array.indexOf(new Integer(5)) < 0);
-        assertTrue(array.lastIndexOf(new Integer(5)) < 0);
-
-        array.clear();
-
-        assertEquals(0, array.size());
-        assertTrue(array.isEmpty());
-        assertTrue(array.indexOf(new Integer(5)) < 0);
-        assertTrue(array.lastIndexOf(new Integer(5)) < 0);
-
-        ArrayList al = new ArrayList();
-
-        assertFalse(al.remove(null));
-        assertFalse(al.remove("string"));
-
-        al.add("string");
-        al.add(null);
-
-        assertTrue(al.remove(null));
-        assertTrue(al.remove("string"));
-    }
-}
-
diff --git a/tests/CoreTests/android/core/BooleanTest.java b/tests/CoreTests/android/core/BooleanTest.java
deleted file mode 100644
index 211947e..0000000
--- a/tests/CoreTests/android/core/BooleanTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Tests some basic functionality of Booleans.
- */
-public class BooleanTest extends TestCase {
-
-    @SmallTest
-    public void testBoolean() throws Exception {
-        Boolean a = new Boolean(true);
-        Boolean b = new Boolean("True");
-        Boolean c = new Boolean(false);
-        Boolean d = new Boolean("Yes");
-
-        assertEquals(a, b);
-        assertEquals(c, d);
-        assertTrue(a.booleanValue());
-        assertFalse(c.booleanValue());
-        assertEquals("true", a.toString());
-        assertEquals("false", c.toString());
-        assertEquals(Boolean.TRUE, a);
-        assertEquals(Boolean.FALSE, c);
-        assertSame(Boolean.valueOf(true), Boolean.TRUE);
-        assertSame(Boolean.valueOf(false), Boolean.FALSE);
-    }
-}
-
diff --git a/tests/CoreTests/android/core/BufferedInputStreamTest.java b/tests/CoreTests/android/core/BufferedInputStreamTest.java
deleted file mode 100644
index 1ad95a1..0000000
--- a/tests/CoreTests/android/core/BufferedInputStreamTest.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayInputStream;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Tests to verify that simple functionality works for BufferedInputStreams.
- */
-public class BufferedInputStreamTest extends TestCase {
-
-    @SmallTest
-    public void testBufferedInputStream() throws Exception {
-        String str = "AbCdEfGhIjKlM\nOpQrStUvWxYz";
-        ByteArrayInputStream aa = new ByteArrayInputStream(str.getBytes());
-        ByteArrayInputStream ba = new ByteArrayInputStream(str.getBytes());
-        ByteArrayInputStream ca = new ByteArrayInputStream(str.getBytes());
-        ByteArrayInputStream da = new ByteArrayInputStream(str.getBytes());
-        ByteArrayInputStream ea = new ByteArrayInputStream(str.getBytes());
-
-        BufferedInputStream a = new BufferedInputStream(aa, 6);
-        try {
-            assertEquals(str, IOUtil.read(a));
-        } finally {
-            a.close();
-        }
-
-        BufferedInputStream b = new BufferedInputStream(ba, 7);
-        try {
-            assertEquals("AbCdEfGhIj", IOUtil.read(b, 10));
-        } finally {
-            b.close();
-        }
-
-        BufferedInputStream c = new BufferedInputStream(ca, 9);
-        try {
-            assertEquals("bdfhjl\nprtvxz", IOUtil.skipRead(c));
-        } finally {
-            c.close();
-        }
-
-        BufferedInputStream d = new BufferedInputStream(da, 9);
-        try {
-            assertEquals('A', d.read());
-            d.mark(15);
-            assertEquals('b', d.read());
-            assertEquals('C', d.read());
-            d.reset();
-            assertEquals('b', d.read());
-        } finally {
-            d.close();
-        }
-
-        BufferedInputStream e = new BufferedInputStream(ea, 11);
-        try {
-            // test that we can ask for more than is present, and that we'll get
-            // back only what is there.
-            assertEquals(str, IOUtil.read(e, 10000));
-        } finally {
-            e.close();
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/BufferedOutputStreamTest.java b/tests/CoreTests/android/core/BufferedOutputStreamTest.java
deleted file mode 100644
index cd8ec08..0000000
--- a/tests/CoreTests/android/core/BufferedOutputStreamTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayOutputStream;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Tests to verify that simple functionality works for BufferedOutputStreams.
- */
-public class BufferedOutputStreamTest extends TestCase {
-
-    @SmallTest
-    public void testBufferedOutputStream() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-        ByteArrayOutputStream aa = new ByteArrayOutputStream();
-        BufferedOutputStream a = new BufferedOutputStream(aa, 15);
-        try {
-            a.write(str.getBytes(), 0, 26);
-            a.write('A');
-
-            assertEquals(26, aa.size());
-            assertEquals(aa.toString(), str);
-
-            a.flush();
-
-            assertEquals(27, aa.size());
-            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzA", aa.toString());
-        } finally {
-            a.close();
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/BufferedReaderTest.java b/tests/CoreTests/android/core/BufferedReaderTest.java
deleted file mode 100644
index a94ca02..0000000
--- a/tests/CoreTests/android/core/BufferedReaderTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.BufferedReader;
-import java.io.StringReader;
-import android.test.suitebuilder.annotation.MediumTest;
-
-/**
- * Tests to verify that simple functionality works for BufferedReaders.
- */
-public class BufferedReaderTest extends TestCase {
-
-    @MediumTest
-    public void testBufferedReader() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-        StringReader aa = new StringReader(str);
-        StringReader ba = new StringReader(str);
-        StringReader ca = new StringReader(str);
-        StringReader da = new StringReader(str);
-
-        BufferedReader a = new BufferedReader(aa, 5);
-        try {
-            assertEquals(str, IOUtil.read(a));
-        } finally {
-            a.close();
-        }
-
-        BufferedReader b = new BufferedReader(ba, 15);
-        try {
-            assertEquals("AbCdEfGhIj", IOUtil.read(b, 10));
-        } finally {
-            b.close();
-        }
-
-        BufferedReader c = new BufferedReader(ca);
-        try {
-            assertEquals("bdfhjlnprtvxz", IOUtil.skipRead(c));
-        } finally {
-            c.close();
-        }
-
-        BufferedReader d = new BufferedReader(da);
-        try {
-            assertEquals("AbCdEfGdEfGhIjKlMnOpQrStUvWxYz", IOUtil.markRead(d, 3, 4));
-        } finally {
-            d.close();
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/BufferedWriterTest.java b/tests/CoreTests/android/core/BufferedWriterTest.java
deleted file mode 100644
index 12dfcef2..0000000
--- a/tests/CoreTests/android/core/BufferedWriterTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.BufferedWriter;
-import java.io.StringWriter;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Some basic tests for BufferedWriter.
- */
-public class BufferedWriterTest extends TestCase {
-
-    @SmallTest
-    public void testBufferedWriter() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-        StringWriter aa = new StringWriter();
-
-        BufferedWriter a = new BufferedWriter(aa, 20);
-        try {
-            a.write(str.toCharArray(), 0, 26);
-            a.write('X');
-            a.flush();
-            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzX", aa.toString());
-
-            a.write("alphabravodelta", 5, 5);
-            a.flush();
-            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzXbravo", aa.toString());
-            a.newLine();
-            a.write("I'm on a new line.");
-            a.flush();
-            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzXbravo\nI\'m on a new line.", aa.toString());
-        } finally {
-            a.close();
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/ByteArrayInputStreamTest.java b/tests/CoreTests/android/core/ByteArrayInputStreamTest.java
deleted file mode 100644
index d964102..0000000
--- a/tests/CoreTests/android/core/ByteArrayInputStreamTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Tests to verify that simple functionality works for ByteArrayInputStreams.
- */
-public class ByteArrayInputStreamTest extends TestCase {
-
-    @SmallTest
-    public void testByteArrayInputStream() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-
-        ByteArrayInputStream a = new ByteArrayInputStream(str.getBytes());
-        ByteArrayInputStream b = new ByteArrayInputStream(str.getBytes());
-        ByteArrayInputStream c = new ByteArrayInputStream(str.getBytes());
-        ByteArrayInputStream d = new ByteArrayInputStream(str.getBytes());
-
-        assertEquals(str, IOUtil.read(a));
-        assertEquals("AbCdEfGhIj", IOUtil.read(b, 10));
-        assertEquals("bdfhjlnprtvxz", IOUtil.skipRead(c));
-        assertEquals("AbCdEfGdEfGhIjKlMnOpQrStUvWxYz", IOUtil.markRead(d, 3, 4));
-    }
-}
diff --git a/tests/CoreTests/android/core/ByteArrayOutputStreamTest.java b/tests/CoreTests/android/core/ByteArrayOutputStreamTest.java
deleted file mode 100644
index e605214..0000000
--- a/tests/CoreTests/android/core/ByteArrayOutputStreamTest.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayOutputStream;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * A basic test for ByteArrayOutputStraem.
- */
-public class ByteArrayOutputStreamTest extends TestCase {
-
-    @SmallTest
-    public void testByteArrayOutputStream() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-        ByteArrayOutputStream a = new ByteArrayOutputStream();
-        ByteArrayOutputStream b = new ByteArrayOutputStream(10);
-
-        a.write(str.getBytes(), 0, 26);
-        a.write('X');
-        a.writeTo(b);
-
-        assertEquals(27, a.size());
-        assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzX", a.toString());
-        assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzX", b.toString());
-    }
-}
diff --git a/tests/CoreTests/android/core/CharArrayReaderTest.java b/tests/CoreTests/android/core/CharArrayReaderTest.java
deleted file mode 100644
index 50a217a..0000000
--- a/tests/CoreTests/android/core/CharArrayReaderTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.CharArrayReader;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Basic tests for CharArrayReader.
- */
-public class CharArrayReaderTest extends TestCase {
-
-    @SmallTest
-    public void testCharArrayReader() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-        CharArrayReader a = new CharArrayReader(str.toCharArray());
-        CharArrayReader b = new CharArrayReader(str.toCharArray());
-        CharArrayReader c = new CharArrayReader(str.toCharArray());
-        CharArrayReader d = new CharArrayReader(str.toCharArray());
-
-        assertEquals(str, IOUtil.read(a));
-        assertEquals("AbCdEfGhIj", IOUtil.read(b, 10));
-        assertEquals("bdfhjlnprtvxz", IOUtil.skipRead(c));
-        assertEquals("AbCdEfGdEfGhIjKlMnOpQrStUvWxYz", IOUtil.markRead(d, 3, 4));
-    }
-}
diff --git a/tests/CoreTests/android/core/ChecksumTest.java b/tests/CoreTests/android/core/ChecksumTest.java
deleted file mode 100644
index 24fb739..0000000
--- a/tests/CoreTests/android/core/ChecksumTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.util.zip.Adler32;
-import java.util.zip.CRC32;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * tests for CRC32 and Adler32 checksum algorithms.
- */
-public class ChecksumTest extends TestCase {
-
-    @SmallTest
-    public void testChecksum() throws Exception {
-        /*
-         * Values computed experimentally, using C interfaces.
-         */
-        adler32Test(mTestString, 0x9de210dbL);
-        cRC32Test(mTestString, 0x939f04afL);
-
-        // Test for issue 1016037
-        wrongChecksumWithAdler32Test();
-    }
-
-    private void adler32Test(byte[] values, long expected) {
-        Adler32 adler = new Adler32();
-
-        // try it all at once
-        adler.update(values);
-        assertEquals(adler.getValue(), expected);
-
-        // try resetting and computing one byte at a time
-        adler.reset();
-        for (int i = 0; i < values.length; i++) {
-            adler.update(values[i]);
-        }
-        assertEquals(adler.getValue(), expected);
-    }
-
-    private void cRC32Test(byte[] values, long expected) {
-        CRC32 crc = new CRC32();
-
-        // try it all at once
-        crc.update(values);
-        assertEquals(crc.getValue(), expected);
-
-        // try resetting and computing one byte at a time
-        crc.reset();
-        for (int i = 0; i < values.length; i++) {
-            crc.update(values[i]);
-        }
-        assertEquals(crc.getValue(), expected);
-    }
-
-    // "The quick brown fox jumped over the lazy dogs\n"
-    private static byte[] mTestString = {
-            0x54, 0x68, 0x65, 0x20, 0x71, 0x75, 0x69, 0x63,
-            0x6b, 0x20, 0x62, 0x72, 0x6f, 0x77, 0x6e, 0x20,
-            0x66, 0x6f, 0x78, 0x20, 0x6a, 0x75, 0x6d, 0x70,
-            0x65, 0x64, 0x20, 0x6f, 0x76, 0x65, 0x72, 0x20,
-            0x74, 0x68, 0x65, 0x20, 0x6c, 0x61, 0x7a, 0x79,
-            0x20, 0x64, 0x6f, 0x67, 0x73, 0x2e, 0x0a
-    };
-
-
-    // Test for issue 1016037
-    private void wrongChecksumWithAdler32Test() {
-        byte[] bytes = {1, 0, 5, 0, 15, 0, 1, 11, 0, 1};
-        Adler32 adler = new Adler32();
-        adler.update(bytes);
-        long arrayChecksum = adler.getValue();
-        adler.reset();
-        for (int i = 0; i < bytes.length; i++) {
-            adler.update(bytes[i]);
-        }
-        assertEquals("Checksums not equal: expected: " + arrayChecksum +
-                " actual: " + adler.getValue(), arrayChecksum, adler.getValue());
-    }
-}
-
diff --git a/tests/CoreTests/android/core/DataInputStreamTest.java b/tests/CoreTests/android/core/DataInputStreamTest.java
deleted file mode 100644
index ca801d6..0000000
--- a/tests/CoreTests/android/core/DataInputStreamTest.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.DataInputStream;
-import java.io.DataOutputStream;
-import android.test.suitebuilder.annotation.SmallTest;
-
-public class DataInputStreamTest extends TestCase {
-
-    @SmallTest
-    public void testDataInputStream() throws Exception {
-        String str = "AbCdEfGhIjKlM\nOpQ\rStUvWxYz";
-        ByteArrayInputStream aa = new ByteArrayInputStream(str.getBytes());
-        ByteArrayInputStream ba = new ByteArrayInputStream(str.getBytes());
-        ByteArrayInputStream ca = new ByteArrayInputStream(str.getBytes());
-        ByteArrayInputStream da = new ByteArrayInputStream(str.getBytes());
-
-        DataInputStream a = new DataInputStream(aa);
-        try {
-            assertEquals(str, IOUtil.read(a));
-        } finally {
-            a.close();
-        }
-
-        DataInputStream b = new DataInputStream(ba);
-        try {
-            assertEquals("AbCdEfGhIj", IOUtil.read(b, 10));
-        } finally {
-            b.close();
-        }
-
-        DataInputStream c = new DataInputStream(ca);
-        try {
-            assertEquals("bdfhjl\np\rtvxz", IOUtil.skipRead(c));
-        } finally {
-            c.close();
-        }
-
-        DataInputStream d = new DataInputStream(da);
-        try {
-            assertEquals("AbCdEfGhIjKlM", d.readLine());
-            assertEquals("OpQ", d.readLine());
-            assertEquals("StUvWxYz", d.readLine());
-        } finally {
-            d.close();
-        }
-
-        ByteArrayOutputStream e = new ByteArrayOutputStream();
-        DataOutputStream f = new DataOutputStream(e);
-        try {
-            f.writeBoolean(true);
-            f.writeByte('a');
-            f.writeBytes("BCD");
-            f.writeChar('e');
-            f.writeChars("FGH");
-            f.writeUTF("ijklm");
-            f.writeDouble(1);
-            f.writeFloat(2);
-            f.writeInt(3);
-            f.writeLong(4);
-            f.writeShort(5);
-        } finally {
-            f.close();
-        }
-        
-        ByteArrayInputStream ga = new ByteArrayInputStream(e.toByteArray());
-        DataInputStream g = new DataInputStream(ga);
-
-        try {
-            assertTrue(g.readBoolean());
-            assertEquals('a', g.readByte());
-            assertEquals(2, g.skipBytes(2));
-            assertEquals('D', g.readByte());
-            assertEquals('e', g.readChar());
-            assertEquals('F', g.readChar());
-            assertEquals('G', g.readChar());
-            assertEquals('H', g.readChar());
-            assertEquals("ijklm", g.readUTF());
-            assertEquals(1, g.readDouble(), 0);
-            assertEquals(2f, g.readFloat(), 0f);
-            assertEquals(3, g.readInt());
-            assertEquals(4, g.readLong());
-            assertEquals(5, g.readShort());
-        } finally {
-            g.close();
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/DataOutputStreamTest.java b/tests/CoreTests/android/core/DataOutputStreamTest.java
deleted file mode 100644
index 95502b3..0000000
--- a/tests/CoreTests/android/core/DataOutputStreamTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Basic tests for DataOutputStreams.
- */
-public class DataOutputStreamTest extends TestCase {
-
-    @SmallTest
-    public void testDataOutputStream() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-        ByteArrayOutputStream aa = new ByteArrayOutputStream();
-        DataOutputStream a = new DataOutputStream(aa);
-
-        try {
-            a.write(str.getBytes(), 0, 26);
-            a.write('A');
-
-            assertEquals(27, aa.size());
-            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzA", aa.toString());
-
-            a.writeByte('B');
-            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzAB", aa.toString());
-            a.writeBytes("BYTES");
-            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzABBYTES", aa.toString());
-        } finally {
-            a.close();
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/DatagramTest.java b/tests/CoreTests/android/core/DatagramTest.java
deleted file mode 100644
index 355a267..0000000
--- a/tests/CoreTests/android/core/DatagramTest.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.DatagramSocket;
-import java.net.InetAddress;
-import java.net.SocketTimeoutException;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Implements some simple tests for datagrams. Not as excessive as the core
- * tests, but good enough for the harness.
- */
-public class DatagramTest extends TestCase {
-
-    /**
-     * Helper class that listens to incoming datagrams and reflects them to the
-     * sender. Incoming datagram is interpreted as a String. It is uppercased
-     * before being sent back.
-     */
-
-    class Reflector extends Thread {
-        // Helper class for reflecting incoming datagrams. 
-        DatagramSocket socket;
-
-        boolean alive = true;
-
-        byte[] buffer = new byte[256];
-
-        DatagramPacket packet;
-
-        /**
-         * Main loop. Receives datagrams and reflects them.
-         */
-        @Override
-        public void run() {
-            try {
-                while (alive) {
-                    try {
-                        packet.setLength(buffer.length);
-                        socket.receive(packet);
-                        String s = stringFromPacket(packet);
-                        // System.out.println(s + " (from " + packet.getAddress() + ":" + packet.getPort() + ")");
-
-                        try {
-                            Thread.sleep(100);
-                        } catch (InterruptedException ex) {
-                            // Ignore.
-                        }
-
-                        stringToPacket(s.toUpperCase(), packet);
-
-                        packet.setAddress(InetAddress.getLocalHost());
-                        packet.setPort(2345);
-
-                        socket.send(packet);
-                    } catch (java.io.InterruptedIOException e) {
-                    }
-                }
-            } catch (java.io.IOException ex) {
-                ex.printStackTrace();
-            } finally {
-                socket.close();
-            }
-        }
-
-        /**
-         * Creates a new Relfector object for the given local address and port.
-         */
-        public Reflector(int port, InetAddress address) {
-            try {
-                packet = new DatagramPacket(buffer, buffer.length);
-                socket = new DatagramSocket(port, address);
-            } catch (IOException ex) {
-                throw new RuntimeException(
-                        "Creating datagram reflector failed", ex);
-            }
-        }
-    }
-
-    /**
-     * Converts a given datagram packet's contents to a String.
-     */
-    static String stringFromPacket(DatagramPacket packet) {
-        return new String(packet.getData(), 0, packet.getLength());
-    }
-
-    /**
-     * Converts a given String into a datagram packet.
-     */
-    static void stringToPacket(String s, DatagramPacket packet) {
-        byte[] bytes = s.getBytes();
-        System.arraycopy(bytes, 0, packet.getData(), 0, bytes.length);
-        packet.setLength(bytes.length);
-    }
-
-    /**
-     * Implements the main part of the Datagram test.
-     */
-    @LargeTest
-    public void testDatagram() throws Exception {
-
-        Reflector reflector = null;
-        DatagramSocket socket = null;
-
-        try {
-            // Setup the reflector, so we have a partner to send to
-            reflector = new Reflector(1234, InetAddress.getLocalHost());
-            reflector.start();
-
-            byte[] buffer = new byte[256];
-
-            DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
-            socket = new DatagramSocket(2345, InetAddress.getLocalHost());
-
-            // Send ten simple packets and check for the expected responses.
-            for (int i = 1; i <= 10; i++) {
-                String s = "Hello, Android world #" + i + "!";
-                stringToPacket(s, packet);
-
-                packet.setAddress(InetAddress.getLocalHost());
-                packet.setPort(1234);
-
-                socket.send(packet);
-
-                try {
-                    Thread.sleep(100);
-                } catch (InterruptedException ex) {
-                    // Ignore.
-                }
-
-                packet.setLength(buffer.length);
-                socket.receive(packet);
-                String t = stringFromPacket(packet);
-                // System.out.println(t + " (from " + packet.getAddress() + ":" + packet.getPort() + ")");
-
-                assertEquals(s.toUpperCase(), t);
-            }
-        } finally {
-            if (reflector != null) {
-                reflector.alive = false;
-            }
-
-            if (socket != null) {
-                socket.close();
-            }
-        }
-    }
-
-    // Regression test for issue 1018003: DatagramSocket ignored a set timeout.
-    @LargeTest
-    public void testDatagramSocketSetSOTimeout() throws Exception {
-        DatagramSocket sock = null;
-        int timeout = 5000;
-        long start = System.currentTimeMillis();
-        try {
-            sock = new DatagramSocket();
-            DatagramPacket pack = new DatagramPacket(new byte[100], 100);
-            sock.setSoTimeout(timeout);
-            sock.receive(pack);
-        } catch (SocketTimeoutException e) {
-            // expected
-            long delay = System.currentTimeMillis() - start;
-            if (Math.abs(delay - timeout) > 1000) {
-                fail("timeout was not accurate. expected: " + timeout
-                        + " actual: " + delay + " miliseconds.");
-            }
-        } finally {
-            if (sock != null) {
-                sock.close();
-            }
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/DeflateTest.java b/tests/CoreTests/android/core/DeflateTest.java
deleted file mode 100644
index d68d697..0000000
--- a/tests/CoreTests/android/core/DeflateTest.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.UnsupportedEncodingException;
-import java.util.zip.DataFormatException;
-import java.util.zip.Deflater;
-import java.util.zip.Inflater;
-import android.test.suitebuilder.annotation.LargeTest;
-
-public class DeflateTest extends TestCase {
-
-    @LargeTest
-    public void testDeflate() throws Exception {
-        simpleTest();
-
-        bigTest(0, 1738149618);
-        bigTest(1, 934350518);
-        bigTest(2, -532869390);
-    }
-
-    /*
-     * Simple inflate/deflate test, taken from the reference docs for the
-     * Inflater/Deflater classes.
-     */
-    private void simpleTest()
-            throws UnsupportedEncodingException, DataFormatException {
-        // Encode a String into bytes
-        String inputString = "blahblahblah??";
-        byte[] input = inputString.getBytes("UTF-8");
-
-        // Compress the bytes
-        byte[] output = new byte[100];
-        Deflater compresser = new Deflater();
-        compresser.setInput(input);
-        compresser.finish();
-        int compressedDataLength = compresser.deflate(output);
-
-        // Decompress the bytes
-        Inflater decompresser = new Inflater();
-        decompresser.setInput(output, 0, compressedDataLength);
-        byte[] result = new byte[100];
-        int resultLength = decompresser.inflate(result);
-
-        // Decode the bytes into a String
-        String outputString = new String(result, 0, resultLength, "UTF-8");
-
-        assertEquals(inputString, outputString);
-        assertEquals(compresser.getAdler(), decompresser.getAdler());
-
-        decompresser.end();
-    }
-
-    /*
-     * "step" determines how compressible the data is.
-     *
-     * Note we must set "nowrap" to false, or the Adler-32 doesn't get
-     * computed.
-     */
-    private void bigTest(int step, int expectedAdler)
-            throws UnsupportedEncodingException, DataFormatException {
-        byte[] input = new byte[128 * 1024];
-        byte[] comp = new byte[128 * 1024 + 512];
-        byte[] output = new byte[128 * 1024 + 512];
-        Inflater inflater = new Inflater(false);
-        Deflater deflater = new Deflater(Deflater.BEST_COMPRESSION, false);
-
-        createSample(input, step);
-
-        compress(deflater, input, comp);
-        expand(inflater, comp, (int) deflater.getBytesWritten(), output);
-
-        assertEquals(inflater.getBytesWritten(), input.length);
-        assertEquals(deflater.getAdler(), inflater.getAdler());
-        assertEquals(deflater.getAdler(), expectedAdler);
-    }
-
-    /*
-     * Create a large data sample.
-     * stepStep = 0 --> >99% compression
-     * stepStep = 1 --> ~30% compression
-     * stepStep = 2 --> no compression
-     */
-    private void createSample(byte[] sample, int stepStep) {
-        byte val, step;
-        int i, j, offset;
-
-        assertTrue(sample.length >= 128 * 1024);
-
-        val = 0;
-        step = 1;
-        offset = 0;
-        for (i = 0; i < (128 * 1024) / 256; i++) {
-            for (j = 0; j < 256; j++) {
-                sample[offset++] = val;
-                val += step;
-            }
-
-            step += stepStep;
-        }
-    }
-
-    private static final int LOCAL_BUF_SIZE = 256;
-
-    /*
-     * Compress all data in "in" to "out".  We use a small window on input
-     * and output to exercise that part of the code.
-     *
-     * It's the caller's responsibility to ensure that "out" has enough
-     * space.
-     */
-    private void compress(Deflater deflater, byte[] inBuf, byte[] outBuf) {
-        int inCount = inBuf.length;        // use all
-        int inPosn;
-        int outPosn;
-
-        inPosn = outPosn = 0;
-
-        //System.out.println("### starting compress");
-
-        while (!deflater.finished()) {
-            int want = -1, got;
-
-            // only read if the input buffer is empty
-            if (deflater.needsInput() && inCount != 0) {
-                want = (inCount < LOCAL_BUF_SIZE) ? inCount : LOCAL_BUF_SIZE;
-
-                deflater.setInput(inBuf, inPosn, want);
-
-                inCount -= want;
-                inPosn += want;
-                if (inCount == 0) {
-                    deflater.finish();
-                }
-            }
-
-            // deflate to current position in output buffer
-            int compCount;
-
-            compCount = deflater.deflate(outBuf, outPosn, LOCAL_BUF_SIZE);
-            outPosn += compCount;
-
-            //System.out.println("Compressed " + want + ", output " + compCount);
-        }
-    }
-
-    /*
-     * Expand data from "inBuf" to "outBuf".  Uses a small window to better
-     * exercise the code.
-     */
-    private void expand(Inflater inflater, byte[] inBuf, int inCount,
-            byte[] outBuf) throws DataFormatException {
-        int inPosn;
-        int outPosn;
-
-        inPosn = outPosn = 0;
-
-        //System.out.println("### starting expand, inCount is " + inCount);
-
-        while (!inflater.finished()) {
-            int want = -1, got;
-
-            // only read if the input buffer is empty
-            if (inflater.needsInput() && inCount != 0) {
-                want = (inCount < LOCAL_BUF_SIZE) ? inCount : LOCAL_BUF_SIZE;
-
-                inflater.setInput(inBuf, inPosn, want);
-
-                inCount -= want;
-                inPosn += want;
-            }
-
-            // inflate to current position in output buffer
-            int compCount;
-
-            compCount = inflater.inflate(outBuf, outPosn, LOCAL_BUF_SIZE);
-            outPosn += compCount;
-
-            //System.out.println("Expanded " + want + ", output " + compCount);
-        }
-    }
-}
-
diff --git a/tests/CoreTests/android/core/EnumTest.java b/tests/CoreTests/android/core/EnumTest.java
deleted file mode 100644
index d479491..0000000
--- a/tests/CoreTests/android/core/EnumTest.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Tests basic behavior of enums.
- */
-public class EnumTest extends TestCase {
-    enum MyEnum {
-        ZERO, ONE, TWO, THREE, FOUR {boolean isFour() {
-        return true;
-    }};
-
-        boolean isFour() {
-            return false;
-        }
-    }
-
-    enum MyEnumTwo {
-        FIVE, SIX
-    }
-
-    @SmallTest
-    public void testEnum() throws Exception {
-        assertTrue(MyEnum.ZERO.compareTo(MyEnum.ONE) < 0);
-        assertEquals(MyEnum.ZERO, MyEnum.ZERO);
-        assertTrue(MyEnum.TWO.compareTo(MyEnum.ONE) > 0);
-        assertTrue(MyEnum.FOUR.compareTo(MyEnum.ONE) > 0);
-
-        assertEquals("ONE", MyEnum.ONE.name());
-        assertSame(MyEnum.ONE.getDeclaringClass(), MyEnum.class);
-        assertSame(MyEnum.FOUR.getDeclaringClass(), MyEnum.class);
-
-        assertTrue(MyEnum.FOUR.isFour());
-
-        MyEnum e;
-
-        e = MyEnum.ZERO;
-
-        switch (e) {
-            case ZERO:
-                break;
-            default:
-                fail("wrong switch");
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/FileTest.java b/tests/CoreTests/android/core/FileTest.java
deleted file mode 100644
index 980452e..0000000
--- a/tests/CoreTests/android/core/FileTest.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.File;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Checks creation and deletion of a file.
- */
-public class FileTest extends TestCase {
-
-    @SmallTest
-    public void testFile() throws Exception {
-
-        File file = File.createTempFile(String.valueOf(System.currentTimeMillis()), null, null);
-
-        assertTrue(file.exists());
-        assertTrue(file.delete());
-        assertFalse(file.exists());
-    }
-}
diff --git a/tests/CoreTests/android/core/FloatDoubleTest.java b/tests/CoreTests/android/core/FloatDoubleTest.java
deleted file mode 100644
index 8c8455b..0000000
--- a/tests/CoreTests/android/core/FloatDoubleTest.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Tests for basic functionality of floats and doubles.
- */
-public class FloatDoubleTest extends TestCase {
-
-    @SmallTest
-    public void testFloatDouble() throws Exception {
-        Double d = Double.valueOf(1.0);
-        Float f = Float.valueOf(1.0f);
-        Object o = new Object();
-
-        assertFalse(f.equals(d));
-        assertFalse(d.equals(f));
-        assertFalse(f.equals(o));
-        assertFalse(d.equals(o));
-        assertFalse(f.equals(null));
-        assertFalse(d.equals(null));
-    }
-
-    @SmallTest
-    public void testFloat() throws Exception {
-        float pz = 0.0f;
-        float nz = -0.0f;
-
-        float pzero = 1.0f / Float.POSITIVE_INFINITY;
-        float nzero = 1.0f / Float.NEGATIVE_INFINITY;
-
-        // Everything compares as '=='
-        assertTrue(pz == pz);
-        assertTrue(pz == nz);
-        assertTrue(pz == pzero);
-        assertTrue(pz == nzero);
-
-        assertTrue(nz == pz);
-        assertTrue(nz == nz);
-        assertTrue(nz == pzero);
-        assertTrue(nz == nzero);
-
-        assertTrue(pzero == pz);
-        assertTrue(pzero == nz);
-        assertTrue(pzero == pzero);
-        assertTrue(pzero == nzero);
-
-        assertTrue(nzero == pz);
-        assertTrue(nzero == nz);
-        assertTrue(nzero == pzero);
-        assertTrue(nzero == nzero);
-
-        // +-0 are distinct as Floats
-        assertEquals(Float.valueOf(pz), Float.valueOf(pz));
-        assertTrue(!Float.valueOf(pz).equals(Float.valueOf(nz)));
-        assertEquals(Float.valueOf(pz), Float.valueOf(pzero));
-        assertTrue(!Float.valueOf(pz).equals(Float.valueOf(nzero)));
-
-        assertTrue(!Float.valueOf(nz).equals(Float.valueOf(pz)));
-        assertEquals(Float.valueOf(nz), Float.valueOf(nz));
-        assertTrue(!Float.valueOf(nz).equals(Float.valueOf(pzero)));
-        assertEquals(Float.valueOf(nz), Float.valueOf(nzero));
-
-        assertEquals(Float.valueOf(pzero), Float.valueOf(pz));
-        assertTrue(!Float.valueOf(pzero).equals(Float.valueOf(nz)));
-        assertEquals(Float.valueOf(pzero), Float.valueOf(pzero));
-        assertTrue(!Float.valueOf(pzero).equals(Float.valueOf(nzero)));
-
-        assertTrue(!Float.valueOf(nzero).equals(Float.valueOf(pz)));
-        assertEquals(Float.valueOf(nzero), Float.valueOf(nz));
-        assertTrue(!Float.valueOf(nzero).equals(Float.valueOf(pzero)));
-        assertEquals(Float.valueOf(nzero), Float.valueOf(nzero));
-
-        // Nan's compare as equal
-        Float sqrtm2 = Float.valueOf((float) Math.sqrt(-2.0f));
-        Float sqrtm3 = Float.valueOf((float) Math.sqrt(-3.0f));
-        assertEquals(sqrtm2, sqrtm3);
-    }
-
-    @SmallTest
-    public void testDouble() throws Exception {
-        double pz = 0.0;
-        double nz = -0.0;
-
-        double pzero = 1.0 / Double.POSITIVE_INFINITY;
-        double nzero = 1.0 / Double.NEGATIVE_INFINITY;
-
-        // Everything compares as '=='
-        assertTrue(pz == pz);
-        assertTrue(pz == nz);
-        assertTrue(pz == pzero);
-        assertTrue(pz == nzero);
-
-        assertTrue(nz == pz);
-        assertTrue(nz == nz);
-        assertTrue(nz == pzero);
-        assertTrue(nz == nzero);
-
-        assertTrue(pzero == pz);
-        assertTrue(pzero == nz);
-        assertTrue(pzero == pzero);
-        assertTrue(pzero == nzero);
-
-        assertTrue(nzero == pz);
-        assertTrue(nzero == nz);
-        assertTrue(nzero == pzero);
-        assertTrue(nzero == nzero);
-
-        // +-0 are distinct as Doubles
-        assertEquals(Double.valueOf(pz), Double.valueOf(pz));
-        assertTrue(!Double.valueOf(pz).equals(Double.valueOf(nz)));
-        assertEquals(Double.valueOf(pz), Double.valueOf(pzero));
-        assertTrue(!Double.valueOf(pz).equals(Double.valueOf(nzero)));
-
-        assertTrue(!Double.valueOf(nz).equals(Double.valueOf(pz)));
-        assertEquals(Double.valueOf(nz), Double.valueOf(nz));
-        assertTrue(!Double.valueOf(nz).equals(Double.valueOf(pzero)));
-        assertEquals(Double.valueOf(nz), Double.valueOf(nzero));
-
-        assertEquals(Double.valueOf(pzero), Double.valueOf(pz));
-        assertTrue(!Double.valueOf(pzero).equals(Double.valueOf(nz)));
-        assertEquals(Double.valueOf(pzero), Double.valueOf(pzero));
-        assertTrue(!Double.valueOf(pzero).equals(Double.valueOf(nzero)));
-
-        assertTrue(!Double.valueOf(nzero).equals(Double.valueOf(pz)));
-        assertEquals(Double.valueOf(nzero), Double.valueOf(nz));
-        assertTrue(!Double.valueOf(nzero).equals(Double.valueOf(pzero)));
-        assertEquals(Double.valueOf(nzero), Double.valueOf(nzero));
-
-        // Nan's compare as equal
-        Double sqrtm2 = Double.valueOf(Math.sqrt(-2.0));
-        Double sqrtm3 = Double.valueOf(Math.sqrt(-3.0));
-        assertEquals(sqrtm2, sqrtm3);
-    }
-}
diff --git a/tests/CoreTests/android/core/GZIPStreamTest.java b/tests/CoreTests/android/core/GZIPStreamTest.java
deleted file mode 100644
index dd56fb7..0000000
--- a/tests/CoreTests/android/core/GZIPStreamTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
-import android.test.suitebuilder.annotation.MediumTest;
-
-/**
- * Deflates and inflates some test data with GZipStreams
- */
-public class GZIPStreamTest extends TestCase {
-
-    @MediumTest
-    public void testGZIPStream() throws Exception {
-        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
-        createGZIP(bytesOut);
-
-        byte[] zipData;
-        zipData = bytesOut.toByteArray();
-
-        /*
-        FileOutputStream outFile = new FileOutputStream("/tmp/foo.gz");
-        outFile.write(zipData, 0, zipData.length);
-        outFile.close();
-        */
-
-        /*
-        FileInputStream inFile = new FileInputStream("/tmp/foo.gz");
-        int inputLength = inFile.available();
-        zipData = new byte[inputLength];
-        if (inFile.read(zipData) != inputLength)
-            throw new RuntimeException();
-        inFile.close();
-        */
-
-        ByteArrayInputStream bytesIn = new ByteArrayInputStream(zipData);
-        scanGZIP(bytesIn);
-    }
-
-    /*
-     * stepStep == 0 --> >99% compression
-     * stepStep == 1 --> ~30% compression
-     * stepStep == 2 --> no compression
-     */
-    static byte[] makeSampleFile(int stepStep) throws IOException {
-        byte[] sample = new byte[128 * 1024];
-        byte val, step;
-        int i, j, offset;
-
-        val = 0;
-        step = 1;
-        offset = 0;
-        for (i = 0; i < (128 * 1024) / 256; i++) {
-            for (j = 0; j < 256; j++) {
-                sample[offset++] = val;
-                val += step;
-            }
-
-            step += stepStep;
-        }
-
-        return sample;
-    }
-
-    static void createGZIP(ByteArrayOutputStream bytesOut) throws IOException {
-        GZIPOutputStream out = new GZIPOutputStream(bytesOut);
-        try {
-            byte[] input = makeSampleFile(1);
-            out.write(input, 0, input.length);
-            //out.finish();
-        } finally {
-            out.close();
-        }
-    }
-
-    static void scanGZIP(ByteArrayInputStream bytesIn) throws IOException {
-        GZIPInputStream in = new GZIPInputStream(bytesIn);
-        try {
-            ByteArrayOutputStream contents = new ByteArrayOutputStream();
-            byte[] buf = new byte[4096];
-            int len, totalLen = 0;
-
-            while ((len = in.read(buf)) > 0) {
-                contents.write(buf, 0, len);
-                totalLen += len;
-            }
-
-            assertEquals(totalLen, 128 * 1024);
-        } finally {
-            in.close();
-        }
-    }
-}
-
diff --git a/tests/CoreTests/android/core/HashMapTest.java b/tests/CoreTests/android/core/HashMapTest.java
deleted file mode 100644
index 99b2a47..0000000
--- a/tests/CoreTests/android/core/HashMapTest.java
+++ /dev/null
@@ -1,281 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Test cases for Hashmap.
- */
-public class HashMapTest extends TestCase {
-    private static final Integer ONE = new Integer(1);
-    private static final Integer TWO = new Integer(2);
-    private static final Integer THREE = new Integer(3);
-    private static final Integer FOUR = new Integer(4);
-
-    private void addItems(HashMap map) {
-        map.put("one", ONE);
-        map.put("two", TWO);
-        map.put("three", THREE);
-        map.put("four", FOUR);
-
-        assertEquals(4, map.size());
-
-        assertEquals(ONE, map.get("one"));
-        assertEquals(TWO, map.get("two"));
-        assertEquals(THREE, map.get("three"));
-        assertEquals(FOUR, map.get("four"));
-    }
-
-    /**
-     * checks if simple adding elements works.
-     */
-    @SmallTest
-    public void testAdd() throws Exception {
-        HashMap map = new HashMap();
-        addItems(map);
-    }
-
-    /**
-     * checks if clearing the map works.
-     */
-    @SmallTest
-    public void testClear() throws Exception {
-        HashMap map = new HashMap();
-
-        addItems(map);
-        map.clear();
-        assertEquals(0, map.size());
-    }
-
-    /**
-     * checks if removing an elemt works.
-     */
-    @SmallTest
-    public void testRemove() throws Exception {
-        HashMap map = new HashMap();
-
-        addItems(map);
-        map.remove("three");
-        assertNull(map.get("three"));
-    }
-
-    /**
-     * does some manipulation with a filled HashMap and checks
-     * if they work as intended
-     */
-    @SmallTest
-    public void testManipulate() throws Exception {
-        HashMap map = new HashMap();
-
-        assertTrue(map.isEmpty());
-        assertEquals(0, map.size());
-        assertNull(map.get(null));
-        assertNull(map.get("one"));
-        assertFalse(map.containsKey("one"));
-        assertFalse(map.containsValue(new Integer(1)));
-        assertNull(map.remove(null));
-        assertNull(map.remove("one"));
-
-        assertNull(map.put(null, new Integer(-1)));
-        assertNull(map.put("one", new Integer(1)));
-        assertNull(map.put("two", new Integer(2)));
-        assertNull(map.put("three", new Integer(3)));
-        assertEquals(-1, ((Integer) map.put(null, new Integer(0))).intValue());
-
-        assertEquals(0, ((Integer) map.get(null)).intValue());
-        assertEquals(1, ((Integer) map.get("one")).intValue());
-        assertEquals(2, ((Integer) map.get("two")).intValue());
-        assertEquals(3, ((Integer) map.get("three")).intValue());
-
-        assertTrue(map.containsKey(null));
-        assertTrue(map.containsKey("one"));
-        assertTrue(map.containsKey("two"));
-        assertTrue(map.containsKey("three"));
-
-        assertTrue(map.containsValue(new Integer(0)));
-        assertTrue(map.containsValue(new Integer(1)));
-        assertTrue(map.containsValue(new Integer(2)));
-        assertTrue(map.containsValue(new Integer(3)));
-
-        assertEquals(0, ((Integer) map.remove(null)).intValue());
-        assertEquals(1, ((Integer) map.remove("one")).intValue());
-        assertEquals(2, ((Integer) map.remove("two")).intValue());
-        assertEquals(3, ((Integer) map.remove("three")).intValue());
-
-        assertTrue(map.isEmpty());
-        assertEquals(0, map.size());
-        assertNull(map.get(null));
-        assertNull(map.get("one"));
-        assertFalse(map.containsKey("one"));
-        assertFalse(map.containsValue(new Integer(1)));
-        assertNull(map.remove(null));
-        assertNull(map.remove("one"));
-    }
-
-    /**
-     * checks if the key iterator of HashMaps work.
-     */
-    @SmallTest
-    public void testKeyIterator() throws Exception {
-        HashMap map = new HashMap();
-
-        boolean[] slots = new boolean[4];
-
-        addItems(map);
-
-        Iterator iter = map.keySet().iterator();
-
-        while (iter.hasNext()) {
-            int slot = 0;
-            Object key = iter.next();
-
-            if (key.equals("one"))
-                slot = 0;
-            else if (key.equals("two"))
-                slot = 1;
-            else if (key.equals("three"))
-                slot = 2;
-            else if (key.equals("four"))
-                slot = 3;
-            else
-                fail("Unkown key in hashmap");
-
-            if (slots[slot])
-                fail("key returned more than once");
-            else
-                slots[slot] = true;
-        }
-
-        assertTrue(slots[0]);
-        assertTrue(slots[1]);
-        assertTrue(slots[2]);
-        assertTrue(slots[3]);
-    }
-
-    /**
-     * checks if the value iterator works.
-     */
-    @SmallTest
-    public void testValueIterator() throws Exception {
-        HashMap map = new HashMap();
-
-        boolean[] slots = new boolean[4];
-
-        addItems(map);
-
-        Iterator iter = map.values().iterator();
-
-        while (iter.hasNext()) {
-            int slot = 0;
-            Object value = iter.next();
-
-            if (value.equals(ONE))
-                slot = 0;
-            else if (value.equals(TWO))
-                slot = 1;
-            else if (value.equals(THREE))
-                slot = 2;
-            else if (value.equals(FOUR))
-                slot = 3;
-            else
-                fail("Unkown value in hashmap");
-
-            if (slots[slot])
-                fail("value returned more than once");
-            else
-                slots[slot] = true;
-        }
-
-        assertTrue(slots[0]);
-        assertTrue(slots[1]);
-        assertTrue(slots[2]);
-        assertTrue(slots[3]);
-    }
-
-    /**
-     * checks if the entry iterator works for HashMaps.
-     */
-    @SmallTest
-    public void testEntryIterator() throws Exception {
-        HashMap map = new HashMap();
-
-        boolean[] slots = new boolean[4];
-
-        addItems(map);
-
-        Iterator iter = map.entrySet().iterator();
-
-        while (iter.hasNext()) {
-            int slot = 0;
-            Object entry = iter.next();
-
-            if (entry.toString().equals("one=1"))
-                slot = 0;
-            else if (entry.toString().equals("two=2"))
-                slot = 1;
-            else if (entry.toString().equals("three=3"))
-                slot = 2;
-            else if (entry.toString().equals("four=4"))
-                slot = 3;
-            else
-                fail("Unkown entry in hashmap");
-
-            if (slots[slot])
-                fail("entry returned more than once");
-            else
-                slots[slot] = true;
-        }
-
-        assertTrue(slots[0]);
-        assertTrue(slots[1]);
-        assertTrue(slots[2]);
-        assertTrue(slots[3]);
-    }
-
-    /**
-     * checks if the HashMap equals method works.
-     */
-    @SmallTest
-    public void testEquals() throws Exception {
-        HashMap map1 = new HashMap();
-        HashMap map2 = new HashMap();
-        HashMap map3 = new HashMap();
-
-        map1.put("one", "1");
-        map1.put("two", "2");
-        map1.put("three", "3");
-
-        map2.put("one", new String("1"));
-        map2.put(new String("two"), "2");
-        map2.put(new String("three"), new String("3"));
-
-        assertTrue(map1.equals(map2));
-
-        map3.put("one", "1");
-        map3.put("two", "1");
-        map3.put("three", "1");
-
-        assertFalse(map1.equals(map3));
-        assertFalse(map2.equals(map3));
-    }
-}
-
diff --git a/tests/CoreTests/android/core/IOUtil.java b/tests/CoreTests/android/core/IOUtil.java
deleted file mode 100644
index 6f69418..0000000
--- a/tests/CoreTests/android/core/IOUtil.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.InputStreamReader;
-
-public final class IOUtil {
-
-    private IOUtil() {
-    }
-
-    /**
-     * returns the content of an InputStream as a String.
-     *
-     * @param a the input stream.
-     * @return the string
-     * @throws java.io.IOException
-     */
-    public static String read(InputStream a) throws IOException {
-        int r;
-        StringBuilder builder = new StringBuilder();
-        do {
-            r = a.read();
-            if (r != -1)
-                builder.append((char) r);
-        } while (r != -1);
-        return builder.toString();
-    }
-
-    /**
-     * reads characters from a reader and returns them as a string.
-     *
-     * @param a the reader.
-     * @return the string.
-     * @throws IOException
-     */
-    public static String read(Reader a) throws IOException {
-        int r;
-        StringBuilder builder = new StringBuilder();
-        do {
-            r = a.read();
-            if (r != -1)
-                builder.append((char) r);
-        } while (r != -1);
-        return builder.toString();
-    }
-
-    /**
-     * returns the content of an InputStream as a String. It reads x characters.
-     *
-     * @param a the input stream.
-     * @param x number of characters to read.
-     * @return the string
-     * @throws IOException
-     */
-    public static String read(InputStream a, int x) throws IOException {
-        byte[] b = new byte[x];
-        int len = a.read(b, 0, x);
-        if (len < 0) {
-            return "";
-        }
-        return new String(b, 0, len);
-    }
-
-    /**
-     * reads a number of characters from a reader and returns them as a string.
-     *
-     * @param a the reader.
-     * @param x the number of characters to read.
-     * @return the string.
-     * @throws IOException
-     */
-    public static String read(Reader a, int x) throws IOException {
-        char[] b = new char[x];
-        int len = a.read(b, 0, x);
-        if (len < 0) {
-            return "";
-        }
-        return new String(b, 0, len);
-    }
-
-    /**
-     * returns the content of the input stream as a String. It only appends
-     * every second character.
-     *
-     * @param a the input stream.
-     * @return the string created from every second character of the input stream.
-     * @throws IOException
-     */
-    public static String skipRead(InputStream a) throws IOException {
-        int r;
-        StringBuilder builder = new StringBuilder();
-        do {
-            a.skip(1);
-            r = a.read();
-            if (r != -1)
-                builder.append((char) r);
-        } while (r != -1);
-        return builder.toString();
-    }
-
-    /**
-     * reads every second characters from a reader and returns them as a string.
-     *
-     * @param a the reader.
-     * @return the string.
-     * @throws IOException
-     */
-    public static String skipRead(Reader a) throws IOException {
-        int r;
-        StringBuilder builder = new StringBuilder();
-        do {
-            a.skip(1);
-            r = a.read();
-            if (r != -1)
-                builder.append((char) r);
-        } while (r != -1);
-        return builder.toString();
-    }
-
-    /**
-     * reads characters from a InputStream, skips back y characters and continues
-     * reading from that new position up to the end.
-     *
-     * @param a the InputStream.
-     * @param x the position of the mark. the marks position is x+y
-     * @param y the number of characters to jump back after the position x+y was reached.
-     * @return the string.
-     * @throws IOException
-     */
-    public static String markRead(InputStream a, int x, int y) throws IOException {
-        int m = 0;
-        int r;
-        StringBuilder builder = new StringBuilder();
-        do {
-            m++;
-            r = a.read();
-            if (m == x)
-                a.mark((x + y));
-            if (m == (x + y))
-                a.reset();
-
-            if (r != -1)
-                builder.append((char) r);
-        } while (r != -1);
-        return builder.toString();
-    }
-
-    /**
-     * reads characters from a reader, skips back y characters and continues
-     * reading from that new position up to the end.
-     *
-     * @param a the reader.
-     * @param x the position of the mark. the marks position is x+y
-     * @param y the number of characters to jump back after the position x+y was reached.
-     * @return the string.
-     * @throws IOException
-     */
-    public static String markRead(Reader a, int x, int y) throws IOException {
-        int m = 0;
-        int r;
-        StringBuilder builder = new StringBuilder();
-        do {
-            m++;
-            r = a.read();
-            if (m == x)
-                a.mark((x + y));
-            if (m == (x + y))
-                a.reset();
-
-            if (r != -1)
-                builder.append((char) r);
-        } while (r != -1);
-        return builder.toString();
-    }
-}
diff --git a/tests/CoreTests/android/core/InputStreamReaderTest.java b/tests/CoreTests/android/core/InputStreamReaderTest.java
deleted file mode 100644
index 1e8d87c..0000000
--- a/tests/CoreTests/android/core/InputStreamReaderTest.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStreamReader;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Checks basic InputStreamReader functionality.
- */
-public class InputStreamReaderTest extends TestCase {
-
-    /**
-     * Checks if ASCII encoding works with InputStreamReader
-     */
-    @SmallTest
-    public void testAscii() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYzX";
-        ByteArrayInputStream aa = new ByteArrayInputStream(str.getBytes("ISO8859_1"));
-        InputStreamReader a = new InputStreamReader(aa, "ISO8859_1");
-
-        try {
-            int x = a.read();
-            assertEquals('A', x);
-            char[] c = new char[26];
-            x = a.read(c, 0, 26);
-            assertTrue(a.getEncoding().equalsIgnoreCase("ISO8859_1"));
-            assertEquals(26, x);
-            assertEquals("bCdEfGhIjKlMnOpQrStUvWxYzX", String.valueOf(c));
-        } finally {
-            a.close();
-        }
-    }
-
-    /**
-     * Checks if Utf8 encoding works with InputStreamReader
-     */
-    @SmallTest
-    public void testUtf8() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYzX" +
-                "\u00a3\u00c5\u00c9";       // total of 30 characters
-        ByteArrayInputStream aa =
-                new ByteArrayInputStream(str.getBytes());
-
-        InputStreamReader a = new InputStreamReader(aa);
-
-        try {
-            assertEquals("UTF8", a.getEncoding());
-
-            int x = a.read();
-            assertEquals('A', x);
-
-            char[] c = new char[29];
-            x = a.read(c, 0, 3);
-            assertEquals(3, x);
-            assertEquals("bCd", new String(c, 0, 3));
-
-            x = a.read(c, 3, 26);
-            assertEquals(26, x);
-            assertEquals("EfGhIjKlMnOpQrStUvWxYzX\u00a3\u00c5\u00c9", new String(c, 3, 26));
-        } finally {
-            a.close();
-        }
-    }
-
-    /**
-     * Checks if several encodings works with InputStreamReader
-     */
-    @SmallTest
-    public void testStringy() throws Exception {
-        String src = "The quick brown fox\u00A0\u00FF" +
-                "\uFFFC\uD7C5\uDC03bloof";
-
-        String[] enc = new String[]{
-                "utf-8", "us-ascii", "iso-8859-1", "utf-16be", "utf-16le",
-                "utf-16",
-        };
-
-        for (int i = 0; i < enc.length; i++) {
-            byte[] ba = src.getBytes(enc[i]);
-
-            String s1 = new String(ba, enc[i]);
-
-            ByteArrayInputStream bais = new ByteArrayInputStream(ba);
-            InputStreamReader r = new InputStreamReader(bais, enc[i]);
-            try {
-                char[] ca = new char[600];
-                int n = r.read(ca, 0, 600);
-
-                String s2 = new String(ca, 0, n);
-                assertEquals(s1, s2);
-            } finally {
-                r.close();
-            }
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/InstanceofTest.java b/tests/CoreTests/android/core/InstanceofTest.java
deleted file mode 100644
index b35ef6b..0000000
--- a/tests/CoreTests/android/core/InstanceofTest.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- * Copyright (C) 2006 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-
-
-public class InstanceofTest extends TestCase {
-
-    protected A mA;
-    protected ChildOfAOne mOne;
-    protected ChildOfAOne mTwo;
-    protected ChildOfAOne mThree;
-    protected ChildOfAOne mFour;
-    protected ChildOfAFive mFive;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        mA = new A();
-        mOne = new ChildOfAOne();
-        mTwo = new ChildOfATwo();
-        mThree = new ChildOfAThree();
-        mFour = new ChildOfAFour();
-        mFive = new ChildOfAFive();
-    }
-
-
-    @MediumTest
-    public void testNoInterface() throws Exception {
-        A a = mA;
-        for (int i = 0; i < 100000; i++) {
-            assertFalse("m_a should not be a ChildOfAFive", a instanceof ChildOfAFive);
-        }
-    }
-
-    @MediumTest
-    public void testDerivedOne() throws Exception {
-        InterfaceOne one = mOne;
-        for (int i = 0; i < 100000; i++) {
-            assertFalse("m_one should not be a ChildOfAFive", one instanceof ChildOfAFive);
-        }
-    }
-
-    @MediumTest
-    public void testDerivedTwo() throws Exception {
-        InterfaceTwo two = mTwo;
-        for (int i = 0; i < 100000; i++) {
-            assertFalse("m_two should not be a ChildOfAFive", two instanceof ChildOfAFive);
-        }
-    }
-
-    @MediumTest
-    public void testDerivedThree() throws Exception {
-        InterfaceThree three = mThree;
-        for (int i = 0; i < 100000; i++) {
-            assertFalse("m_three should not be a ChildOfAFive", three instanceof ChildOfAFive);
-        }
-    }
-
-    @MediumTest
-    public void testDerivedFour() throws Exception {
-        InterfaceFour four = mFour;
-        for (int i = 0; i < 100000; i++) {
-            assertFalse("m_four should not be a ChildOfAFive", four instanceof ChildOfAFive);
-        }
-    }
-
-    @MediumTest
-    public void testSuccessClass() throws Exception {
-        ChildOfAOne five = mFive;
-        for (int i = 0; i < 100000; i++) {
-            assertTrue("m_five is suppose to be a ChildOfAFive", five instanceof ChildOfAFive);
-        }
-    }
-
-    @MediumTest
-    public void testSuccessInterface() throws Exception {
-        ChildOfAFive five = mFive;
-        for (int i = 0; i < 100000; i++) {
-            assertTrue("m_five is suppose to be a InterfaceFour", five instanceof InterfaceFour);
-        }
-    }
-
-    @MediumTest
-    public void testFailInterface() throws Exception {
-        InterfaceOne one = mFive;
-        for (int i = 0; i < 100000; i++) {
-            assertFalse("m_five does not implement InterfaceFive", one instanceof InterfaceFive);
-        }
-    }
-
-    private interface InterfaceOne {
-    }
-
-    private interface InterfaceTwo {
-    }
-
-    private interface InterfaceThree {
-    }
-
-    private interface InterfaceFour {
-    }
-
-    private interface InterfaceFive {
-    }
-
-    private static class A {
-    }
-
-    private static class ChildOfAOne extends A implements InterfaceOne, InterfaceTwo, InterfaceThree, InterfaceFour {
-    }
-
-    private static class ChildOfATwo extends ChildOfAOne {
-    }
-
-    private static class ChildOfAThree extends ChildOfATwo {
-    }
-
-    private static class ChildOfAFour extends ChildOfAThree {
-    }
-
-    private static class ChildOfAFive extends ChildOfAFour {
-    }
-}
diff --git a/tests/CoreTests/android/core/LineNumberReaderTest.java b/tests/CoreTests/android/core/LineNumberReaderTest.java
deleted file mode 100644
index 6380ebe..0000000
--- a/tests/CoreTests/android/core/LineNumberReaderTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.LineNumberReader;
-import java.io.StringReader;
-import android.test.suitebuilder.annotation.MediumTest;
-
-/**
- * Checks basic functionality for LineNumberReader.
- */
-public class LineNumberReaderTest extends TestCase {
-
-    @MediumTest
-    public void testLineNumberReader() throws Exception {
-        String str = "AbCdEfGhIjKlM\nOpQrStUvWxYz";
-
-        StringReader aa = new StringReader(str);
-        StringReader ba = new StringReader(str);
-        StringReader ca = new StringReader(str);
-        StringReader da = new StringReader(str);
-        StringReader ea = new StringReader(str);
-
-        LineNumberReader a = new LineNumberReader(aa);
-        try {
-            assertEquals(0, a.getLineNumber());
-            assertEquals(str, IOUtil.read(a));
-            assertEquals(1, a.getLineNumber());
-            a.setLineNumber(5);
-            assertEquals(5, a.getLineNumber());
-        } finally {
-            a.close();
-        }
-
-        LineNumberReader b = new LineNumberReader(ba);
-        try {
-            assertEquals("AbCdEfGhIj", IOUtil.read(b, 10));
-        } finally {
-            b.close();
-        }
-
-        LineNumberReader c = new LineNumberReader(ca);
-        try {
-            assertEquals("bdfhjl\nprtvxz", IOUtil.skipRead(c));
-        } finally {
-            c.close();
-        }
-
-        LineNumberReader d = new LineNumberReader(da);
-        try {
-            assertEquals("AbCdEfGdEfGhIjKlM\nOpQrStUvWxYz", IOUtil.markRead(d, 3, 4));
-        } finally {
-            d.close();
-        }
-
-        LineNumberReader e = new LineNumberReader(ea);
-        try {
-            assertEquals("AbCdEfGhIjKlM", e.readLine());
-        } finally {
-            e.close();
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/LocaleTest.java b/tests/CoreTests/android/core/LocaleTest.java
deleted file mode 100644
index 72489c6..0000000
--- a/tests/CoreTests/android/core/LocaleTest.java
+++ /dev/null
@@ -1,243 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.nio.charset.Charset;
-import java.text.DateFormatSymbols;
-import java.util.Calendar;
-import java.util.Currency;
-import java.util.Locale;
-import java.util.Set;
-import java.util.TimeZone;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.test.suitebuilder.annotation.LargeTest;
-import android.test.suitebuilder.annotation.Suppress;
-
-/**
- * Test some locale-dependent stuff for Android. This test mainly ensures that
- * our ICU configuration is correct and contains all the needed locales and
- * resource bundles. 
- */
-public class LocaleTest extends TestCase {
-
-    // Test basic Locale infrastructure.
-    @SmallTest
-    public void testLocale() throws Exception {
-        Locale locale = new Locale("en");
-        assertEquals("en", locale.toString());
-
-        locale = new Locale("en", "US");
-        assertEquals("en_US", locale.toString());
-
-        locale = new Locale("en", "", "POSIX");
-        assertEquals("en__POSIX", locale.toString());
-
-        locale = new Locale("en", "US", "POSIX");
-        assertEquals("en_US_POSIX", locale.toString());
-    }
-
-    /*
-     * Tests some must-have locales. TODO: Add back "de". See discussion
-     * immediately below this method.
-     */
-    @LargeTest
-    public void testResourceBundles() throws Exception {
-        Locale eng = new Locale("en", "US");
-        DateFormatSymbols engSymbols = new DateFormatSymbols(eng);
-        
-        //Locale deu = new Locale("de", "DE");
-        //DateFormatSymbols deuSymbols = new DateFormatSymbols(deu);
-        
-        TimeZone berlin = TimeZone.getTimeZone("Europe/Berlin");
-        
-        assertEquals("January", engSymbols.getMonths()[0]);
-        //assertEquals("Januar", deuSymbols.getMonths()[0]);
-
-        assertEquals("Sunday", engSymbols.getWeekdays()[Calendar.SUNDAY]);
-        //assertEquals("Sonntag", deuSymbols.getWeekdays()[Calendar.SUNDAY]);
-        
-        assertEquals("Central European Time",
-                berlin.getDisplayName(false, TimeZone.LONG, eng));
-        assertEquals("Central European Summer Time",
-                berlin.getDisplayName(true, TimeZone.LONG, eng));
-
-        //assertEquals("Mitteleurop\u00E4ische Zeit",
-        //        berlin.getDisplayName(false, TimeZone.LONG, deu));
-        //assertEquals("Mitteleurop\u00E4ische Sommerzeit",
-        //        berlin.getDisplayName(true, TimeZone.LONG, deu));
-        
-        assertTrue(engSymbols.getZoneStrings().length > 100);
-    }
-
-    /*
-     * Disabled version of the above test. The version above omits
-     * checks for stuff in the "de" locale, because we stripped that
-     * out as part of the flash reduction effort (so that we could
-     * still ship on Dream). We expect to have a baseline target that
-     * includes a large enough system partition to include "de"
-     * immediately after the last official release for Dream (whenever
-     * that may be).
-     * 
-    // Test some must-have locales.
-    @LargeTest
-    public void testResourceBundles() throws Exception {
-        Locale eng = new Locale("en", "US");
-        DateFormatSymbols engSymbols = new DateFormatSymbols(eng);
-        
-        Locale deu = new Locale("de", "DE");
-        DateFormatSymbols deuSymbols = new DateFormatSymbols(deu);
-        
-        TimeZone berlin = TimeZone.getTimeZone("Europe/Berlin");
-        
-        assertEquals("January", engSymbols.getMonths()[0]);
-        assertEquals("Januar", deuSymbols.getMonths()[0]);
-
-        assertEquals("Sunday", engSymbols.getWeekdays()[Calendar.SUNDAY]);
-        assertEquals("Sonntag", deuSymbols.getWeekdays()[Calendar.SUNDAY]);
-        
-        assertEquals("Central European Time",
-                berlin.getDisplayName(false, TimeZone.LONG, eng));
-        assertEquals("Central European Summer Time",
-                berlin.getDisplayName(true, TimeZone.LONG, eng));
-
-        assertEquals("Mitteleurop\u00E4ische Zeit",
-                berlin.getDisplayName(false, TimeZone.LONG, deu));
-        assertEquals("Mitteleurop\u00E4ische Sommerzeit",
-                berlin.getDisplayName(true, TimeZone.LONG, deu));
-        
-        assertTrue(engSymbols.getZoneStrings().length > 100);
-    }
-    */
-
-    // This one makes sure we have all necessary locales installed.
-    // Suppress this flaky test for now.
-    @Suppress
-    public void testICULocales() {
-        String[] locales = new String[] {
-                // List of locales currently required for Android.
-                "en_US", "es_US", "en_GB", "fr_FR", "de_DE", "de_AT", "cs_CZ", "nl_NL" };
-        
-        String[] mondays = new String[] {
-                "Monday", "lunes", "Monday", "lundi", "Montag", "Montag", "pond\u011bl\u00ed", "maandag" };
-        
-        String[] currencies = new String[] {
-                "USD", "USD", "GBP", "EUR", "EUR", "EUR", "CZK", "EUR"};
-
-        for (int i = 0; i < locales.length; i++) {
-            Locale l = new Locale(locales[i].substring(0, 2), locales[i].substring(3));
-            
-            // Check language part of locale.
-            DateFormatSymbols d = new DateFormatSymbols(l);
-            assertEquals("Monday name for " + locales[i] + " must match",
-                    mondays[i], d.getWeekdays()[2]);
-            
-            // Check country part of locale.
-            Currency c = Currency.getInstance(l);
-            assertEquals("Currency code for " + locales[i] + " must match",
-                    currencies[i], c.getCurrencyCode());
-        }
-    }
-
-    // Regression test for 1118570: Create test cases for tracking ICU config
-    // changes. This one makes sure we have the necessary converters installed
-    // and don't lose the changes to the converter alias table.
-    @MediumTest
-    public void testICUConverters() {
-        // List of encodings currently required for Android.
-        String[] encodings = new String[] {
-                // Encoding required by the language specification.
-                "US-ASCII",
-                "UTF-8",
-                "UTF-16",
-                "UTF-16BE",
-                "UTF-16LE",
-                "ISO-8859-1",
-                
-                // Additional encodings included in standard ICU
-                "ISO-8859-2",
-                "ISO-8859-3",
-                "ISO-8859-4",
-                "ISO-8859-5",
-                "ISO-8859-6",
-                "ISO-8859-7",
-                "ISO-8859-8",
-                "ISO-8859-8-I",
-                "ISO-8859-9",
-                "ISO-8859-10", 
-                "ISO-8859-11", 
-                "ISO-8859-13",
-                "ISO-8859-14", 
-                "ISO-8859-15",
-                "ISO-8859-16", 
-                "ISO-2022-JP",
-                "Windows-950",
-                "Windows-1250",
-                "Windows-1251",
-                "Windows-1252",
-                "Windows-1253",
-                "Windows-1254",
-                "Windows-1255",
-                "Windows-1256",
-                "Windows-1257",
-                "Windows-1258",              
-                "Big5",
-                "CP864",
-                "CP874",
-                "EUC-CN",
-                "EUC-JP",
-                "KOI8-R",
-                "Macintosh",
-                "GBK",
-                "GB2312",
-                "EUC-KR",
-                
-                // Additional encoding not included in standard ICU.
-                "GSM0338" };
-        
-        for (int i = 0; i < encodings.length; i++) {
-            assertTrue("Charset " + encodings[i] + " must be supported",
-                    Charset.isSupported(encodings[i]));
-            
-            Charset cs = Charset.forName(encodings[i]);
-            android.util.Log.d("LocaleTest", cs.name());
-            
-            Set<String> aliases = cs.aliases();
-            for (String s: aliases) {
-                android.util.Log.d("LocaleTest", " - " + s);
-            }
-        }
-        
-        // Test for valid encoding that is not included in Android. IBM-37 is
-        // a perfect candidate for this, as it is being used for mainframes and
-        // thus somewhat out of the scope of Android.
-        assertFalse("Charset IBM-37 must not be supported",
-                Charset.isSupported("IBM-37"));
-
-        // Test for a bogus encoding.
-        assertFalse("Charset KLINGON must not be supported",
-                Charset.isSupported("KLINGON"));
-        
-        // Make sure our local change to the real translation table used for
-        // EUC-JP doesn't get lost.
-        Charset cs = Charset.forName("EUC-JP");
-        assertTrue("EUC-JP must use 'ibm-954_P101-2007'", cs.aliases().contains("ibm-954_P101-2007"));
-    }
-    
-}
diff --git a/tests/CoreTests/android/core/MathTest.java b/tests/CoreTests/android/core/MathTest.java
deleted file mode 100644
index 50009db..0000000
--- a/tests/CoreTests/android/core/MathTest.java
+++ /dev/null
@@ -1,831 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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 android.core;
-
-import junit.framework.Assert;
-import junit.framework.TestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.test.suitebuilder.annotation.MediumTest;
-
-public class MathTest extends TestCase {
-
-    private final double HYP = Math.sqrt(2.0);
-
-    private final double OPP = 1.0;
-
-    private final double ADJ = 1.0;
-
-    /* Required to make previous preprocessor flags work - do not remove */
-    int unused = 0;
-
-    public static void assertEquals(String message, double expected, double actual, double delta) {
-        if (delta == 0D) {
-            Assert.assertEquals(message, expected, actual, Math.ulp(expected));
-        } else {
-            Assert.assertEquals(message, expected, actual, delta);
-        }
-    }
-
-    public static void assertEquals(String message, float expected, float actual, float delta) {
-        if (delta == 0F) {
-            Assert.assertEquals(message, expected, actual, Math.ulp(expected));
-        } else {
-            Assert.assertEquals(message, expected, actual, delta);
-        }
-    }
-    
-    /**
-     * @tests java.lang.Math#abs(double)
-     */
-    @SmallTest
-    public void testAbsD() {
-        // Test for method double java.lang.Math.abs(double)
-
-        assertTrue("Incorrect double abs value",
-                (Math.abs(-1908.8976) == 1908.8976));
-        assertTrue("Incorrect double abs value",
-                (Math.abs(1908.8976) == 1908.8976));
-    }
-
-    /**
-     * @tests java.lang.Math#abs(float)
-     */
-    @SmallTest
-    public void testAbsF() {
-        // Test for method float java.lang.Math.abs(float)
-        assertTrue("Incorrect float abs value",
-                (Math.abs(-1908.8976f) == 1908.8976f));
-        assertTrue("Incorrect float abs value",
-                (Math.abs(1908.8976f) == 1908.8976f));
-    }
-
-    /**
-     * @tests java.lang.Math#abs(int)
-     */
-    @SmallTest
-    public void testAbsI() {
-        // Test for method int java.lang.Math.abs(int)
-        assertTrue("Incorrect int abs value", (Math.abs(-1908897) == 1908897));
-        assertTrue("Incorrect int abs value", (Math.abs(1908897) == 1908897));
-    }
-
-    /**
-     * @tests java.lang.Math#abs(long)
-     */
-    @SmallTest
-    public void testAbsJ() {
-        // Test for method long java.lang.Math.abs(long)
-        assertTrue("Incorrect long abs value",
-                (Math.abs(-19088976000089L) == 19088976000089L));
-        assertTrue("Incorrect long abs value",
-                (Math.abs(19088976000089L) == 19088976000089L));
-    }
-
-    /**
-     * @tests java.lang.Math#acos(double)
-     */
-    @SmallTest
-    public void testAcosD() {
-        // Test for method double java.lang.Math.acos(double)
-        double r = Math.cos(Math.acos(ADJ / HYP));
-        long lr = Double.doubleToLongBits(r);
-        long t = Double.doubleToLongBits(ADJ / HYP);
-        assertTrue("Returned incorrect arc cosine", lr == t || (lr + 1) == t
-                || (lr - 1) == t);
-    }
-
-    /**
-     * @tests java.lang.Math#asin(double)
-     */
-    @SmallTest
-    public void testAsinD() {
-        // Test for method double java.lang.Math.asin(double)
-        double r = Math.sin(Math.asin(OPP / HYP));
-        long lr = Double.doubleToLongBits(r);
-        long t = Double.doubleToLongBits(OPP / HYP);
-        assertTrue("Returned incorrect arc sine", lr == t || (lr + 1) == t
-                || (lr - 1) == t);
-    }
-
-    /**
-     * @tests java.lang.Math#atan(double)
-     */
-    @SmallTest
-    public void testAtanD() {
-        // Test for method double java.lang.Math.atan(double)
-        double answer = Math.tan(Math.atan(1.0));
-        assertTrue("Returned incorrect arc tangent: " + answer, answer <= 1.0
-                && answer >= 9.9999999999999983E-1);
-    }
-
-    /**
-     * @tests java.lang.Math#atan2(double, double)
-     */
-    @SmallTest
-    public void testAtan2DD() {
-        // Test for method double java.lang.Math.atan2(double, double)
-        double answer = Math.atan(Math.tan(1.0));
-        assertTrue("Returned incorrect arc tangent: " + answer, answer <= 1.0
-                && answer >= 9.9999999999999983E-1);
-    }
-    
-     /**
-     * @tests java.lang.Math#cbrt(double)
-     */
-    @SmallTest
-    public void testCbrtD() {
-        //Test for special situations
-        assertTrue("Should return Double.NaN", Double.isNaN(Math
-                .cbrt(Double.NaN)));
-        assertEquals("Should return Double.POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math
-                        .cbrt(Double.POSITIVE_INFINITY), 0D);
-        assertEquals("Should return Double.NEGATIVE_INFINITY",
-                Double.NEGATIVE_INFINITY, Math
-                        .cbrt(Double.NEGATIVE_INFINITY), 0D);
-        assertEquals(Double.doubleToLongBits(0.0), Double.doubleToLongBits(Math
-                .cbrt(0.0)));
-        assertEquals(Double.doubleToLongBits(+0.0), Double.doubleToLongBits(Math
-                .cbrt(+0.0)));
-        assertEquals(Double.doubleToLongBits(-0.0), Double.doubleToLongBits(Math
-                .cbrt(-0.0)));
-
-        assertEquals("Should return 3.0", 3.0, Math.cbrt(27.0), 0D);
-        assertEquals("Should return 23.111993172558684", 23.111993172558684,
-                Math.cbrt(12345.6), 0D);
-        assertEquals("Should return 5.643803094122362E102",
-                5.643803094122362E102, Math.cbrt(Double.MAX_VALUE), 0D);
-        assertEquals("Should return 0.01", 0.01, Math.cbrt(0.000001), 0D);
-
-        assertEquals("Should return -3.0", -3.0, Math.cbrt(-27.0), 0D);
-        assertEquals("Should return -23.111993172558684", -23.111993172558684,
-                Math.cbrt(-12345.6), 0D);
-        assertEquals("Should return 1.7031839360032603E-108",
-                1.7031839360032603E-108, Math.cbrt(Double.MIN_VALUE), 0D);
-        assertEquals("Should return -0.01", -0.01, Math.cbrt(-0.000001), 0D);
-    }
-
-    /**
-     * @tests java.lang.Math#ceil(double)
-     */
-    @SmallTest
-    public void testCeilD() {
-        // Test for method double java.lang.Math.ceil(double)
-                assertEquals("Incorrect ceiling for double",
-                             79, Math.ceil(78.89), 0);
-        assertEquals("Incorrect ceiling for double",
-                             -78, Math.ceil(-78.89), 0);
-    }
-
-    /**
-     * @tests java.lang.Math#cos(double)
-     */
-    @SmallTest
-    public void testCosD() {
-        // Test for method double java.lang.Math.cos(double)
-        assertEquals("Incorrect answer", 1.0, Math.cos(0), 0D);
-        assertEquals("Incorrect answer", 0.5403023058681398, Math.cos(1), 0D);
-    }
-
-    /**
-     * @tests java.lang.Math#cosh(double)
-     */
-    @SmallTest
-    public void testCoshD() {
-        // Test for special situations
-        assertTrue(Double.isNaN(Math.cosh(Double.NaN)));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.cosh(Double.POSITIVE_INFINITY), 0D);
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.cosh(Double.NEGATIVE_INFINITY), 0D);
-        assertEquals("Should return 1.0", 1.0, Math.cosh(+0.0), 0D);
-        assertEquals("Should return 1.0", 1.0, Math.cosh(-0.0), 0D);
-
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.cosh(1234.56), 0D);
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.cosh(-1234.56), 0D);
-        assertEquals("Should return 1.0000000000005", 1.0000000000005, Math
-                .cosh(0.000001), 0D);
-        assertEquals("Should return 1.0000000000005", 1.0000000000005, Math
-                .cosh(-0.000001), 0D);
-        assertEquals("Should return 5.212214351945598", 5.212214351945598, Math
-                .cosh(2.33482), 0D);
-
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.cosh(Double.MAX_VALUE), 0D);
-        assertEquals("Should return 1.0", 1.0, Math.cosh(Double.MIN_VALUE), 0D);
-    }
-    
-    /**
-     * @tests java.lang.Math#exp(double)
-     */
-    @SmallTest
-    public void testExpD() {
-        // Test for method double java.lang.Math.exp(double)
-        assertTrue("Incorrect answer returned for simple power", Math.abs(Math
-                .exp(4D)
-                - Math.E * Math.E * Math.E * Math.E) < 0.1D);
-        assertTrue("Incorrect answer returned for larger power", Math.log(Math
-                .abs(Math.exp(5.5D)) - 5.5D) < 10.0D);
-    }
-    
-    /**
-     * @tests java.lang.Math#expm1(double)
-     */
-    @SmallTest
-    public void testExpm1D() {
-        // Test for special cases
-        assertTrue("Should return NaN", Double.isNaN(Math.expm1(Double.NaN)));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.expm1(Double.POSITIVE_INFINITY), 0D);
-        assertEquals("Should return -1.0", -1.0, Math
-                .expm1(Double.NEGATIVE_INFINITY), 0D);
-        assertEquals(Double.doubleToLongBits(0.0), Double.doubleToLongBits(Math
-                .expm1(0.0)));
-        assertEquals(Double.doubleToLongBits(+0.0), Double
-                .doubleToLongBits(Math.expm1(+0.0)));
-        assertEquals(Double.doubleToLongBits(-0.0), Double
-                .doubleToLongBits(Math.expm1(-0.0)));
-
-        assertEquals("Should return -9.999950000166666E-6",
-                -9.999950000166666E-6, Math.expm1(-0.00001), 0D);
-        assertEquals("Should return 1.0145103074469635E60",
-                1.0145103074469635E60, Math.expm1(138.16951162), 0D);
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math
-                        .expm1(123456789123456789123456789.4521584223), 0D);
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.expm1(Double.MAX_VALUE), 0D);
-        assertEquals("Should return MIN_VALUE", Double.MIN_VALUE, Math
-                .expm1(Double.MIN_VALUE), 0D);
-    }
-
-    /**
-     * @tests java.lang.Math#floor(double)
-     */
-    @SmallTest
-    public void testFloorD() {
-        // Test for method double java.lang.Math.floor(double)
-                assertEquals("Incorrect floor for double",
-                             78, Math.floor(78.89), 0);
-        assertEquals("Incorrect floor for double",
-                             -79, Math.floor(-78.89), 0);
-    }
-    
-    /**
-     * @tests java.lang.Math#hypot(double, double)
-     */
-    @SmallTest
-    public void testHypotDD() {
-        // Test for special cases
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.hypot(Double.POSITIVE_INFINITY,
-                        1.0), 0D);
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.hypot(Double.NEGATIVE_INFINITY,
-                        123.324), 0D);
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.hypot(-758.2587,
-                        Double.POSITIVE_INFINITY), 0D);
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.hypot(5687.21,
-                        Double.NEGATIVE_INFINITY), 0D);
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.hypot(Double.POSITIVE_INFINITY,
-                        Double.NEGATIVE_INFINITY), 0D);
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.hypot(Double.NEGATIVE_INFINITY,
-                        Double.POSITIVE_INFINITY), 0D);        
-        assertTrue("Should be NaN", Double.isNaN(Math.hypot(Double.NaN,
-                2342301.89843)));
-        assertTrue("Should be NaN", Double.isNaN(Math.hypot(-345.2680,
-                Double.NaN)));        
-
-        assertEquals("Should return 2396424.905416697", 2396424.905416697, Math
-                .hypot(12322.12, -2396393.2258), 0D);
-        assertEquals("Should return 138.16958070558556", 138.16958070558556,
-                Math.hypot(-138.16951162, 0.13817035864), 0D);
-        assertEquals("Should return 1.7976931348623157E308",
-                1.7976931348623157E308, Math.hypot(Double.MAX_VALUE, 211370.35), 0D);
-        assertEquals("Should return 5413.7185", 5413.7185, Math.hypot(
-                -5413.7185, Double.MIN_VALUE), 0D);
-    }
-
-    /**
-     * @tests java.lang.Math#IEEEremainder(double, double)
-     */
-    @SmallTest
-    public void testIEEEremainderDD() {
-        // Test for method double java.lang.Math.IEEEremainder(double, double)
-        assertEquals("Incorrect remainder returned",
-                0.0, Math.IEEEremainder(1.0, 1.0), 0D);
-        assertTrue("Incorrect remainder returned", Math.IEEEremainder(1.32,
-                89.765) >= 1.4705063220631647E-2
-                || Math.IEEEremainder(1.32, 89.765) >= 1.4705063220631649E-2);
-    }
-
-    /**
-     * @tests java.lang.Math#log(double)
-     */
-    @SmallTest
-    public void testLogD() {
-        // Test for method double java.lang.Math.log(double)
-        for (double d = 10; d >= -10; d -= 0.5) {
-            double answer = Math.log(Math.exp(d));
-            assertTrue("Answer does not equal expected answer for d = " + d
-                    + " answer = " + answer, Math.abs(answer - d) <= Math
-                    .abs(d * 0.00000001));
-        }
-    }
-    
-    /**
-     * @tests java.lang.Math#log10(double)
-     */
-    @SuppressWarnings("boxing")
-    @SmallTest
-    public void testLog10D() {
-        // Test for special cases
-        assertTrue(Double.isNaN(Math.log10(Double.NaN)));
-        assertTrue(Double.isNaN(Math.log10(-2541.05745687234187532)));
-        assertTrue(Double.isNaN(Math.log10(-0.1)));
-        assertEquals(Double.POSITIVE_INFINITY, Math.log10(Double.POSITIVE_INFINITY));
-        assertEquals(Double.NEGATIVE_INFINITY, Math.log10(0.0));
-        assertEquals(Double.NEGATIVE_INFINITY, Math.log10(+0.0));
-        assertEquals(Double.NEGATIVE_INFINITY, Math.log10(-0.0));
-        
-        assertEquals(3.0, Math.log10(1000.0));
-        assertEquals(14.0, Math.log10(Math.pow(10, 14)));
-        assertEquals(3.7389561269540406, Math.log10(5482.2158));
-        assertEquals(14.661551142893833, Math.log10(458723662312872.125782332587));
-        assertEquals(-0.9083828622192334, Math.log10(0.12348583358871));
-        assertEquals(308.25471555991675, Math.log10(Double.MAX_VALUE));
-        assertEquals(-323.3062153431158, Math.log10(Double.MIN_VALUE));
-    }
-    
-    /**
-     * @tests java.lang.Math#log1p(double)
-     */
-    @SmallTest
-    public void testLog1pD() {
-        // Test for special cases
-        assertTrue("Should return NaN", Double.isNaN(Math.log1p(Double.NaN)));
-        assertTrue("Should return NaN", Double.isNaN(Math.log1p(-32.0482175)));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.log1p(Double.POSITIVE_INFINITY), 0D);
-        assertEquals(Double.doubleToLongBits(0.0), Double.doubleToLongBits(Math
-                .log1p(0.0)));
-        assertEquals(Double.doubleToLongBits(+0.0), Double
-                .doubleToLongBits(Math.log1p(+0.0)));
-        assertEquals(Double.doubleToLongBits(-0.0), Double
-                .doubleToLongBits(Math.log1p(-0.0)));
-
-        assertEquals("Should return -0.2941782295312541", -0.2941782295312541,
-                Math.log1p(-0.254856327), 0D);
-        assertEquals("Should return 7.368050685564151", 7.368050685564151, Math
-                .log1p(1583.542), 0D);
-        assertEquals("Should return 0.4633708685409921", 0.4633708685409921,
-                Math.log1p(0.5894227), 0D);
-        assertEquals("Should return 709.782712893384", 709.782712893384, Math
-                .log1p(Double.MAX_VALUE), 0D);
-        assertEquals("Should return Double.MIN_VALUE", Double.MIN_VALUE, Math
-                .log1p(Double.MIN_VALUE), 0D);
-    }
-
-    /**
-     * @tests java.lang.Math#max(double, double)
-     */
-    @SmallTest
-    public void testMaxDD() {
-        // Test for method double java.lang.Math.max(double, double)
-        assertEquals("Incorrect double max value", 1908897.6000089, Math.max(-1908897.6000089,
-                1908897.6000089), 0D);
-        assertEquals("Incorrect double max value",
-                1908897.6000089, Math.max(2.0, 1908897.6000089), 0D);
-        assertEquals("Incorrect double max value", -2.0, Math.max(-2.0,
-                -1908897.6000089), 0D);
-
-    }
-
-    /**
-     * @tests java.lang.Math#max(float, float)
-     */
-    @SmallTest
-    public void testMaxFF() {
-        // Test for method float java.lang.Math.max(float, float)
-        assertTrue("Incorrect float max value", Math.max(-1908897.600f,
-                1908897.600f) == 1908897.600f);
-        assertTrue("Incorrect float max value",
-                Math.max(2.0f, 1908897.600f) == 1908897.600f);
-        assertTrue("Incorrect float max value",
-                Math.max(-2.0f, -1908897.600f) == -2.0f);
-    }
-
-    /**
-     * @tests java.lang.Math#max(int, int)
-     */
-    @SmallTest
-    public void testMaxII() {
-        // Test for method int java.lang.Math.max(int, int)
-        assertEquals("Incorrect int max value",
-                19088976, Math.max(-19088976, 19088976));
-        assertEquals("Incorrect int max value",
-                19088976, Math.max(20, 19088976));
-        assertEquals("Incorrect int max value", -20, Math.max(-20, -19088976));
-    }
-
-    /**
-     * @tests java.lang.Math#max(long, long)
-     */
-    @SmallTest
-    public void testMaxJJ() {
-        // Test for method long java.lang.Math.max(long, long)
-        assertEquals("Incorrect long max value", 19088976000089L, Math.max(-19088976000089L,
-                19088976000089L));
-        assertEquals("Incorrect long max value",
-                19088976000089L, Math.max(20, 19088976000089L));
-        assertEquals("Incorrect long max value",
-                -20, Math.max(-20, -19088976000089L));
-    }
-
-    /**
-     * @tests java.lang.Math#min(double, double)
-     */
-    @SmallTest
-    public void testMinDD() {
-        // Test for method double java.lang.Math.min(double, double)
-        assertEquals("Incorrect double min value", -1908897.6000089, Math.min(-1908897.6000089,
-                1908897.6000089), 0D);
-        assertEquals("Incorrect double min value",
-                2.0, Math.min(2.0, 1908897.6000089), 0D);
-        assertEquals("Incorrect double min value", -1908897.6000089, Math.min(-2.0,
-                -1908897.6000089), 0D);
-    }
-
-    /**
-     * @tests java.lang.Math#min(float, float)
-     */
-    @SmallTest
-    public void testMinFF() {
-        // Test for method float java.lang.Math.min(float, float)
-        assertTrue("Incorrect float min value", Math.min(-1908897.600f,
-                1908897.600f) == -1908897.600f);
-        assertTrue("Incorrect float min value",
-                Math.min(2.0f, 1908897.600f) == 2.0f);
-        assertTrue("Incorrect float min value",
-                Math.min(-2.0f, -1908897.600f) == -1908897.600f);
-    }
-
-    /**
-     * @tests java.lang.Math#min(int, int)
-     */
-    @SmallTest
-    public void testMinII() {
-        // Test for method int java.lang.Math.min(int, int)
-        assertEquals("Incorrect int min value",
-                -19088976, Math.min(-19088976, 19088976));
-        assertEquals("Incorrect int min value", 20, Math.min(20, 19088976));
-        assertEquals("Incorrect int min value",
-                -19088976, Math.min(-20, -19088976));
-
-    }
-
-    /**
-     * @tests java.lang.Math#min(long, long)
-     */
-    @SmallTest
-    public void testMinJJ() {
-        // Test for method long java.lang.Math.min(long, long)
-        assertEquals("Incorrect long min value", -19088976000089L, Math.min(-19088976000089L,
-                19088976000089L));
-        assertEquals("Incorrect long min value",
-                20, Math.min(20, 19088976000089L));
-        assertEquals("Incorrect long min value",
-                -19088976000089L, Math.min(-20, -19088976000089L));
-    }
-
-    /**
-     * @tests java.lang.Math#pow(double, double)
-     */
-    @SmallTest
-    public void testPowDD() {
-        // Test for method double java.lang.Math.pow(double, double)
-        assertTrue("pow returned incorrect value",
-                (long) Math.pow(2, 8) == 256l);
-        assertTrue("pow returned incorrect value",
-                Math.pow(2, -8) == 0.00390625d);
-        assertEquals("Incorrect root returned1",
-                             2, Math.sqrt(Math.pow(Math.sqrt(2), 4)), 0);
-    }
-
-    /**
-     * @tests java.lang.Math#rint(double)
-     */
-    @SmallTest
-    public void testRintD() {
-        // Test for method double java.lang.Math.rint(double)
-        assertEquals("Failed to round properly - up to odd",
-                3.0, Math.rint(2.9), 0D);
-        assertTrue("Failed to round properly - NaN", Double.isNaN(Math
-                .rint(Double.NaN)));
-        assertEquals("Failed to round properly down  to even",
-                2.0, Math.rint(2.1), 0D);
-        assertTrue("Failed to round properly " + 2.5 + " to even", Math
-                .rint(2.5) == 2.0);
-    }
-
-    /**
-     * @tests java.lang.Math#round(double)
-     */
-    @SmallTest
-    public void testRoundD() {
-        // Test for method long java.lang.Math.round(double)
-        assertEquals("Incorrect rounding of a float", -91, Math.round(-90.89d));
-    }
-
-    /**
-     * @tests java.lang.Math#round(float)
-     */
-    @SmallTest
-    public void testRoundF() {
-        // Test for method int java.lang.Math.round(float)
-        assertEquals("Incorrect rounding of a float", -91, Math.round(-90.89f));
-    }
-    
-    /**
-     * @tests java.lang.Math#signum(double)
-     */
-    @SmallTest
-    public void testSignumD() {
-        assertTrue(Double.isNaN(Math.signum(Double.NaN)));
-        assertTrue(Double.isNaN(Math.signum(Double.NaN)));
-        assertEquals(Double.doubleToLongBits(0.0), Double.doubleToLongBits(Math
-                .signum(0.0)));
-        assertEquals(Double.doubleToLongBits(+0.0), Double
-                .doubleToLongBits(Math.signum(+0.0)));
-        assertEquals(Double.doubleToLongBits(-0.0), Double
-                .doubleToLongBits(Math.signum(-0.0)));
-
-        assertEquals(1.0, Math.signum(253681.2187962), 0D);
-        assertEquals(-1.0, Math.signum(-125874693.56), 0D);
-        assertEquals(1.0, Math.signum(1.2587E-308), 0D);
-        assertEquals(-1.0, Math.signum(-1.2587E-308), 0D);
-
-        assertEquals(1.0, Math.signum(Double.MAX_VALUE), 0D);
-        assertEquals(1.0, Math.signum(Double.MIN_VALUE), 0D);
-        assertEquals(-1.0, Math.signum(-Double.MAX_VALUE), 0D);
-        assertEquals(-1.0, Math.signum(-Double.MIN_VALUE), 0D);
-        assertEquals(1.0, Math.signum(Double.POSITIVE_INFINITY), 0D);
-        assertEquals(-1.0, Math.signum(Double.NEGATIVE_INFINITY), 0D);
-    }
-
-    /**
-     * @tests java.lang.Math#signum(float)
-     */
-    @SmallTest
-    public void testSignumF() {
-        assertTrue(Float.isNaN(Math.signum(Float.NaN)));
-        assertEquals(Float.floatToIntBits(0.0f), Float
-                .floatToIntBits(Math.signum(0.0f)));
-        assertEquals(Float.floatToIntBits(+0.0f), Float
-                .floatToIntBits(Math.signum(+0.0f)));
-        assertEquals(Float.floatToIntBits(-0.0f), Float
-                .floatToIntBits(Math.signum(-0.0f)));
-
-        assertEquals(1.0f, Math.signum(253681.2187962f), 0f);
-        assertEquals(-1.0f, Math.signum(-125874693.56f), 0f);
-        assertEquals(1.0f, Math.signum(1.2587E-11f), 0f);
-        assertEquals(-1.0f, Math.signum(-1.2587E-11f), 0f);
-
-        assertEquals(1.0f, Math.signum(Float.MAX_VALUE), 0f);
-        assertEquals(1.0f, Math.signum(Float.MIN_VALUE), 0f);
-        assertEquals(-1.0f, Math.signum(-Float.MAX_VALUE), 0f);
-        assertEquals(-1.0f, Math.signum(-Float.MIN_VALUE), 0f);
-        assertEquals(1.0f, Math.signum(Float.POSITIVE_INFINITY), 0f);
-        assertEquals(-1.0f, Math.signum(Float.NEGATIVE_INFINITY), 0f);
-    }
-
-    /**
-     * @tests java.lang.Math#sin(double)
-     */
-    @SmallTest
-    public void testSinD() {
-        // Test for method double java.lang.Math.sin(double)
-        assertEquals("Incorrect answer", 0.0, Math.sin(0), 0D);
-        assertEquals("Incorrect answer", 0.8414709848078965, Math.sin(1), 0D);
-    }
-    
-    /**
-     * @tests java.lang.Math#sinh(double)
-     */
-    @SmallTest
-    public void testSinhD() {
-        // Test for special situations
-        assertTrue("Should return NaN", Double.isNaN(Math.sinh(Double.NaN)));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.sinh(Double.POSITIVE_INFINITY), 0D);
-        assertEquals("Should return NEGATIVE_INFINITY",
-                Double.NEGATIVE_INFINITY, Math.sinh(Double.NEGATIVE_INFINITY), 0D);
-        assertEquals(Double.doubleToLongBits(0.0), Double.doubleToLongBits(Math
-                .sinh(0.0)));
-        assertEquals(Double.doubleToLongBits(+0.0), Double
-                .doubleToLongBits(Math.sinh(+0.0)));
-        assertEquals(Double.doubleToLongBits(-0.0), Double
-                .doubleToLongBits(Math.sinh(-0.0)));
-
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.sinh(1234.56), 0D);
-        assertEquals("Should return NEGATIVE_INFINITY",
-                Double.NEGATIVE_INFINITY, Math.sinh(-1234.56), 0D);
-        assertEquals("Should return 1.0000000000001666E-6",
-                1.0000000000001666E-6, Math.sinh(0.000001), 0D);
-        assertEquals("Should return -1.0000000000001666E-6",
-                -1.0000000000001666E-6, Math.sinh(-0.000001), 0D);
-        assertEquals("Should return 5.115386441963859", 5.115386441963859, Math
-                .sinh(2.33482), 0D);
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, Math.sinh(Double.MAX_VALUE), 0D);
-        assertEquals("Should return 4.9E-324", 4.9E-324, Math
-                .sinh(Double.MIN_VALUE), 0D);
-    }
-    
-    /**
-     * @tests java.lang.Math#sqrt(double)
-     */
-    @SmallTest
-    public void testSqrtD() {
-        // Test for method double java.lang.Math.sqrt(double)
-                assertEquals("Incorrect root returned2", 7, Math.sqrt(49), 0);
-    }
-
-    /**
-     * @tests java.lang.Math#tan(double)
-     */
-    @SmallTest
-    public void testTanD() {
-        // Test for method double java.lang.Math.tan(double)
-        assertEquals("Incorrect answer", 0.0, Math.tan(0), 0D);
-        assertEquals("Incorrect answer", 1.5574077246549023, Math.tan(1), 0D);
-
-    }
-
-    /**
-     * @tests java.lang.Math#tanh(double)
-     */
-    @SmallTest
-    public void testTanhD() {
-        // Test for special situations
-        assertTrue("Should return NaN", Double.isNaN(Math.tanh(Double.NaN)));
-        assertEquals("Should return +1.0", +1.0, Math
-                .tanh(Double.POSITIVE_INFINITY), 0D);
-        assertEquals("Should return -1.0", -1.0, Math
-                .tanh(Double.NEGATIVE_INFINITY), 0D);
-        assertEquals(Double.doubleToLongBits(0.0), Double.doubleToLongBits(Math
-                .tanh(0.0)));
-        assertEquals(Double.doubleToLongBits(+0.0), Double
-                .doubleToLongBits(Math.tanh(+0.0)));
-        assertEquals(Double.doubleToLongBits(-0.0), Double
-                .doubleToLongBits(Math.tanh(-0.0)));
-
-        assertEquals("Should return 1.0", 1.0, Math.tanh(1234.56), 0D);
-        assertEquals("Should return -1.0", -1.0, Math.tanh(-1234.56), 0D);
-        assertEquals("Should return 9.999999999996666E-7",
-                9.999999999996666E-7, Math.tanh(0.000001), 0D);
-        assertEquals("Should return 0.981422884124941", 0.981422884124941, Math
-                .tanh(2.33482), 0D);
-        assertEquals("Should return 1.0", 1.0, Math.tanh(Double.MAX_VALUE), 0D);
-        assertEquals("Should return 4.9E-324", 4.9E-324, Math
-                .tanh(Double.MIN_VALUE), 0D);
-    }
-    
-    /**
-     * @tests java.lang.Math#random()
-     */
-    @MediumTest
-    public void testRandom() {
-        // There isn't a place for these tests so just stick them here
-        assertEquals("Wrong value E",
-                4613303445314885481L, Double.doubleToLongBits(Math.E));
-        assertEquals("Wrong value PI",
-                4614256656552045848L, Double.doubleToLongBits(Math.PI));
-
-        for (int i = 500; i >= 0; i--) {
-            double d = Math.random();
-            assertTrue("Generated number is out of range: " + d, d >= 0.0
-                    && d < 1.0);
-        }
-    }
-
-    /**
-     * @tests java.lang.Math#toRadians(double)
-     */
-    @MediumTest
-    public void testToRadiansD() {
-        for (double d = 500; d >= 0; d -= 1.0) {
-            double converted = Math.toDegrees(Math.toRadians(d));
-            assertTrue("Converted number not equal to original. d = " + d,
-                    converted >= d * 0.99999999 && converted <= d * 1.00000001);
-        }
-    }
-
-    /**
-     * @tests java.lang.Math#toDegrees(double)
-     */
-    @MediumTest
-    public void testToDegreesD() {
-        for (double d = 500; d >= 0; d -= 1.0) {
-            double converted = Math.toRadians(Math.toDegrees(d));
-            assertTrue("Converted number not equal to original. d = " + d,
-                    converted >= d * 0.99999999 && converted <= d * 1.00000001);
-        }
-    }
-    
-    /**
-     * @tests java.lang.Math#ulp(double)
-     */
-    @SuppressWarnings("boxing")
-    @SmallTest
-    public void testUlpD() {
-        // Test for special cases
-        assertTrue("Should return NaN", Double.isNaN(Math.ulp(Double.NaN)));
-        assertEquals("Returned incorrect value", Double.POSITIVE_INFINITY, Math
-                .ulp(Double.POSITIVE_INFINITY), 0D);
-        assertEquals("Returned incorrect value", Double.POSITIVE_INFINITY, Math
-                .ulp(Double.NEGATIVE_INFINITY), 0D);
-        assertEquals("Returned incorrect value", Double.MIN_VALUE, Math
-                .ulp(0.0), 0D);
-        assertEquals("Returned incorrect value", Double.MIN_VALUE, Math
-                .ulp(+0.0), 0D);
-        assertEquals("Returned incorrect value", Double.MIN_VALUE, Math
-                .ulp(-0.0), 0D);
-        assertEquals("Returned incorrect value", Math.pow(2, 971), Math
-                .ulp(Double.MAX_VALUE), 0D);
-        assertEquals("Returned incorrect value", Math.pow(2, 971), Math
-                .ulp(-Double.MAX_VALUE), 0D);
-
-        assertEquals("Returned incorrect value", Double.MIN_VALUE, Math
-                .ulp(Double.MIN_VALUE), 0D);
-        assertEquals("Returned incorrect value", Double.MIN_VALUE, Math
-                .ulp(-Double.MIN_VALUE), 0D);
-
-        assertEquals("Returned incorrect value", 2.220446049250313E-16, Math
-                .ulp(1.0), 0D);
-        assertEquals("Returned incorrect value", 2.220446049250313E-16, Math
-                .ulp(-1.0), 0D);
-        assertEquals("Returned incorrect value", 2.2737367544323206E-13, Math
-                .ulp(1153.0), 0D);
-    }
-
-    /**
-     * @tests java.lang.Math#ulp(float)
-     */
-    @SuppressWarnings("boxing")
-    @SmallTest
-    public void testUlpf() {
-        // Test for special cases
-        assertTrue("Should return NaN", Float.isNaN(Math.ulp(Float.NaN)));
-        assertEquals("Returned incorrect value", Float.POSITIVE_INFINITY, Math
-                .ulp(Float.POSITIVE_INFINITY), 0f);
-        assertEquals("Returned incorrect value", Float.POSITIVE_INFINITY, Math
-                .ulp(Float.NEGATIVE_INFINITY), 0f);
-        assertEquals("Returned incorrect value", Float.MIN_VALUE, Math
-                .ulp(0.0f), 0f);
-        assertEquals("Returned incorrect value", Float.MIN_VALUE, Math
-                .ulp(+0.0f), 0f);
-        assertEquals("Returned incorrect value", Float.MIN_VALUE, Math
-                .ulp(-0.0f), 0f);
-        assertEquals("Returned incorrect value", 2.028241E31f, Math
-                .ulp(Float.MAX_VALUE), 0f);
-        assertEquals("Returned incorrect value", 2.028241E31f, Math
-                .ulp(-Float.MAX_VALUE), 0f);
-
-        assertEquals("Returned incorrect value", 1.4E-45f, Math
-                .ulp(Float.MIN_VALUE), 0f);
-        assertEquals("Returned incorrect value", 1.4E-45f, Math
-                .ulp(-Float.MIN_VALUE), 0f);
-
-        assertEquals("Returned incorrect value", 1.1920929E-7f, Math.ulp(1.0f),
-                0f);
-        assertEquals("Returned incorrect value", 1.1920929E-7f,
-                Math.ulp(-1.0f), 0f);
-        assertEquals("Returned incorrect value", 1.2207031E-4f, Math
-                .ulp(1153.0f), 0f);
-        assertEquals("Returned incorrect value", 5.6E-45f, Math
-                .ulp(9.403954E-38f), 0f);
-    }
-}
diff --git a/tests/CoreTests/android/core/MonitorTest.java b/tests/CoreTests/android/core/MonitorTest.java
deleted file mode 100644
index 73c33db..0000000
--- a/tests/CoreTests/android/core/MonitorTest.java
+++ /dev/null
@@ -1,469 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.LargeTest;
-import android.test.suitebuilder.annotation.SmallTest;
-
-public class MonitorTest extends TestCase {
-
-    @MediumTest
-    public void testWaitArgumentsTest() throws Exception {
-            /* Try some valid arguments.  These should all
-             * return very quickly.
-             */
-            try {
-                synchronized (this) {
-                    /* millisecond version */
-                    wait(1);
-                    wait(10);
-
-                    /* millisecond + nanosecond version */
-                    wait(0, 1);
-                    wait(0, 999999);
-                    wait(1, 1);
-                    wait(1, 999999);
-                }
-            } catch (InterruptedException ex) {
-                throw new RuntimeException("good Object.wait() interrupted",
-                        ex);
-            } catch (Exception ex) {
-                throw new RuntimeException("Unexpected exception when calling" +
-                        "Object.wait() with good arguments", ex);
-            }
-
-            /* Try some invalid arguments.
-             */
-            boolean sawException = false;
-            try {
-                synchronized (this) {
-                    wait(-1);
-                }
-            } catch (InterruptedException ex) {
-                throw new RuntimeException("bad Object.wait() interrupted", ex);
-            } catch (IllegalArgumentException ex) {
-                sawException = true;
-            } catch (Exception ex) {
-                throw new RuntimeException("Unexpected exception when calling" +
-                        "Object.wait() with bad arguments", ex);
-            }
-            if (!sawException) {
-                throw new RuntimeException("bad call to Object.wait() should " +
-                        "have thrown IllegalArgumentException");
-            }
-
-            sawException = false;
-            try {
-                synchronized (this) {
-                    wait(0, -1);
-                }
-            } catch (InterruptedException ex) {
-                throw new RuntimeException("bad Object.wait() interrupted", ex);
-            } catch (IllegalArgumentException ex) {
-                sawException = true;
-            } catch (Exception ex) {
-                throw new RuntimeException("Unexpected exception when calling" +
-                        "Object.wait() with bad arguments", ex);
-            }
-            if (!sawException) {
-                throw new RuntimeException("bad call to Object.wait() should " +
-                        "have thrown IllegalArgumentException");
-            }
-
-            sawException = false;
-            try {
-                synchronized (this) {
-                    /* The legal range of nanos is 0-999999. */
-                    wait(0, 1000000);
-                }
-            } catch (InterruptedException ex) {
-                throw new RuntimeException("bad Object.wait() interrupted", ex);
-            } catch (IllegalArgumentException ex) {
-                sawException = true;
-            } catch (Exception ex) {
-                throw new RuntimeException("Unexpected exception when calling" +
-                        "Object.wait() with bad arguments", ex);
-            }
-            if (!sawException) {
-                throw new RuntimeException("bad call to Object.wait() should " +
-                        "have thrown IllegalArgumentException");
-            }
-    }
-
-    private class Interrupter extends Thread {
-            Waiter waiter;
-
-            Interrupter(String name, Waiter waiter) {
-                super(name);
-                this.waiter = waiter;
-            }
-
-            public void run() {
-                try {
-                    run_inner();
-                } catch (Throwable t) {
-                    MonitorTest.errorException = t;
-                    MonitorTest.testThread.interrupt();
-                }
-            }
-
-            void run_inner() {
-                waiter.spin = true;
-                // System.out.println("InterruptTest: starting waiter");
-                waiter.start();
-
-                try {
-                    Thread.currentThread().sleep(500);
-                } catch (InterruptedException ex) {
-                    throw new RuntimeException("Test sleep interrupted.", ex);
-                }
-
-                /* Waiter is spinning, and its monitor should still be thin.
-                 */
-                // System.out.println("Test interrupting waiter");
-                waiter.interrupt();
-                waiter.spin = false;
-
-                for (int i = 0; i < 3; i++) {
-                    /* Wait for the waiter to start waiting.
-                     */
-                    synchronized (waiter.interrupterLock) {
-                        try {
-                            waiter.interrupterLock.wait();
-                        } catch (InterruptedException ex) {
-                            throw new RuntimeException("Test wait interrupted.", ex);
-                        }
-                    }
-
-                    /* Before interrupting, grab the waiter lock, which
-                     * guarantees that the waiter is already sitting in wait().
-                     */
-                    synchronized (waiter) {
-                        //System.out.println("Test interrupting waiter (" + i + ")");
-                        waiter.interrupt();
-                    }
-                }
-
-                // System.out.println("Test waiting for waiter to die.");
-                try {
-                    waiter.join();
-                } catch (InterruptedException ex) {
-                    throw new RuntimeException("Test join interrupted.", ex);
-                }
-                // System.out.println("InterruptTest done.");
-            }
-        }
-
-    private class Waiter extends Thread {
-            Object interrupterLock = new Object();
-            Boolean spin = false;
-
-            Waiter(String name) {
-                super(name);
-            }
-
-            public void run() {
-                try {
-                    run_inner();
-                } catch (Throwable t) {
-                    MonitorTest.errorException = t;
-                    MonitorTest.testThread.interrupt();
-                }
-            }
-
-            void run_inner() {
-                // System.out.println("Waiter spinning");
-                while (spin) {
-                    // We're going to get interrupted while we spin.
-                }
-                if (interrupted()) {
-                    // System.out.println("Waiter done spinning; interrupted.");
-                } else {
-                    throw new RuntimeException("Thread not interrupted " +
-                                               "during spin");
-                }
-
-                synchronized (this) {
-                    Boolean sawEx = false;
-
-                    try {
-                        synchronized (interrupterLock) {
-                            interrupterLock.notify();
-                        }
-                        // System.out.println("Waiter calling wait()");
-                        this.wait();
-                    } catch (InterruptedException ex) {
-                        sawEx = true;
-                        // System.out.println("wait(): Waiter caught " + ex);
-                    }
-                    // System.out.println("wait() finished");
-
-                    if (!sawEx) {
-                        throw new RuntimeException("Thread not interrupted " +
-                                                   "during wait()");
-                    }
-                }
-                synchronized (this) {
-                    Boolean sawEx = false;
-
-                    try {
-                        synchronized (interrupterLock) {
-                            interrupterLock.notify();
-                        }
-                        // System.out.println("Waiter calling wait(1000)");
-                        this.wait(1000);
-                    } catch (InterruptedException ex) {
-                        sawEx = true;
-                        // System.out.println("wait(1000): Waiter caught " + ex);
-                    }
-                    // System.out.println("wait(1000) finished");
-
-                    if (!sawEx) {
-                        throw new RuntimeException("Thread not interrupted " +
-                                                   "during wait(1000)");
-                    }
-                }
-                synchronized (this) {
-                    Boolean sawEx = false;
-
-                    try {
-                        synchronized (interrupterLock) {
-                            interrupterLock.notify();
-                        }
-                        // System.out.println("Waiter calling wait(1000, 5000)");
-                        this.wait(1000, 5000);
-                    } catch (InterruptedException ex) {
-                        sawEx = true;
-                        // System.out.println("wait(1000, 5000): Waiter caught " + ex);
-                    }
-                    // System.out.println("wait(1000, 5000) finished");
-
-                    if (!sawEx) {
-                        throw new RuntimeException("Thread not interrupted " +
-                                                   "during wait(1000, 5000)");
-                    }
-                }
-
-               //  System.out.println("Waiter returning");
-            }
-        }
-
-    private static Throwable errorException;
-    private static Thread testThread;
-
-    // TODO: Flaky test. Add back MediumTest annotation once fixed
-    public void testInterruptTest() throws Exception {
-
-
-            testThread = Thread.currentThread();
-            errorException = null;
-
-            Waiter waiter = new Waiter("InterruptTest Waiter");
-            Interrupter interrupter =
-                    new Interrupter("InterruptTest Interrupter", waiter);
-            interrupter.start();
-
-            try {
-                interrupter.join();
-                waiter.join();
-            } catch (InterruptedException ex) {
-                throw new RuntimeException("Test join interrupted.", ex);
-            }
-
-            if (errorException != null) {
-                throw new RuntimeException("InterruptTest failed",
-                                           errorException);
-            }
-
-
-
-
-    }
-
-     private static void deepWait(int depth, Object lock) {
-            synchronized (lock) {
-                if (depth > 0) {
-                    deepWait(depth - 1, lock);
-                } else {
-                    String threadName = Thread.currentThread().getName();
-                    try {
-                        // System.out.println(threadName + " waiting");
-                        lock.wait();
-                        // System.out.println(threadName + " done waiting");
-                    } catch (InterruptedException ex) {
-                        // System.out.println(threadName + " interrupted.");
-                    }
-                }
-            }
-        }
-
-        private class Worker extends Thread {
-            Object lock;
-            int id;
-
-            Worker(int id, Object lock) {
-                super("Worker(" + id + ")");
-                this.id = id;
-                this.lock = lock;
-            }
-
-            public void run() {
-                int iterations = 0;
-
-                while (MonitorTest.running) {
-                    MonitorTest.deepWait(id, lock);
-                    iterations++;
-                }
-                // System.out.println(getName() + " done after " + iterations + " iterations.");
-            }
-        }
-
-    private static Object commonLock = new Object();
-        private static Boolean running = false;
-
-
-    @LargeTest
-    public void testNestedMonitors() throws Exception {
-        final int NUM_WORKERS = 5;
-
-            Worker w[] = new Worker[NUM_WORKERS];
-            int i;
-
-            for (i = 0; i < NUM_WORKERS; i++) {
-                w[i] = new Worker(i * 2 - 1, new Object());
-            }
-
-            running = true;
-
-            // System.out.println("NestedMonitors: starting workers");
-            for (i = 0; i < NUM_WORKERS; i++) {
-                w[i].start();
-            }
-
-            try {
-                Thread.currentThread().sleep(1000);
-            } catch (InterruptedException ex) {
-               // System.out.println("Test sleep interrupted.");
-            }
-
-            for (i = 0; i < 100; i++) {
-                for (int j = 0; j < NUM_WORKERS; j++) {
-                    synchronized (w[j].lock) {
-                        w[j].lock.notify();
-                    }
-                }
-            }
-
-            // System.out.println("NesterMonitors: stopping workers");
-            running = false;
-            for (i = 0; i < NUM_WORKERS; i++) {
-                synchronized (w[i].lock) {
-                    w[i].lock.notifyAll();
-                }
-            }
-    }
-
-    private static class CompareAndExchange extends Thread {
-        static Object toggleLock = null;
-        static int toggle = -1;
-        static Boolean running = false;
-
-        public void run() {
-            toggleLock = new Object();
-            toggle = -1;
-
-            Worker w1 = new Worker(0, 1);
-            Worker w2 = new Worker(2, 3);
-            Worker w3 = new Worker(4, 5);
-            Worker w4 = new Worker(6, 7);
-
-            running = true;
-
-            // System.out.println("CompareAndExchange: starting workers");
-
-            w1.start();
-            w2.start();
-            w3.start();
-            w4.start();
-
-            try {
-                this.sleep(10000);
-            } catch (InterruptedException ex) {
-                // System.out.println(getName() + " interrupted.");
-            }
-
-            // System.out.println("MonitorTest: stopping workers");
-            running = false;
-
-            toggleLock = null;
-        }
-
-        class Worker extends Thread {
-            int i1;
-            int i2;
-
-            Worker(int i1, int i2) {
-                super("Worker(" + i1 + ", " + i2 + ")");
-                this.i1 = i1;
-                this.i2 = i2;
-            }
-
-            public void run() {
-                int iterations = 0;
-
-                /* Latch this because run() may set the static field to
-                 * null at some point.
-                 */
-                Object toggleLock = CompareAndExchange.toggleLock;
-
-                // System.out.println(getName() + " running");
-                try {
-                    while (CompareAndExchange.running) {
-                        synchronized (toggleLock) {
-                            int test;
-                            int check;
-
-                            if (CompareAndExchange.toggle == i1) {
-                                this.sleep(5 + i2);
-                                CompareAndExchange.toggle = test = i2;
-                            } else {
-                                this.sleep(5 + i1);
-                                CompareAndExchange.toggle = test = i1;
-                            }
-                            if ((check = CompareAndExchange.toggle) != test) {
-//                                System.out.println("Worker(" + i1 + ", " +
-//                                                   i2 + ") " + "test " + test +
-//                                                   " != toggle " + check);
-                                throw new RuntimeException(
-                                        "locked value changed");
-                            }
-                        }
-
-                        iterations++;
-                    }
-                } catch (InterruptedException ex) {
-                   // System.out.println(getName() + " interrupted.");
-                }
-
-//                System.out.println(getName() + " done after " +
-//                                   iterations + " iterations.");
-            }
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/NIOTest.java b/tests/CoreTests/android/core/NIOTest.java
deleted file mode 100644
index 9476d07..0000000
--- a/tests/CoreTests/android/core/NIOTest.java
+++ /dev/null
@@ -1,707 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.nio.Buffer;
-import java.nio.BufferOverflowException;
-import java.nio.BufferUnderflowException;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.FloatBuffer;
-import java.nio.IntBuffer;
-import java.nio.ShortBuffer;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Tests for some buffers from the java.nio package.
- */
-public class NIOTest extends TestCase {
-
-    void checkBuffer(Buffer b) {
-        assertTrue(0 <= b.position());
-        assertTrue(b.position() <= b.limit());
-        assertTrue(b.limit() <= b.capacity());
-    }
-
-    @SmallTest
-    public void testNIO_byte_array() throws Exception {
-        // Test byte array-based buffer
-        byteBufferTest(ByteBuffer.allocate(12));
-    }
-
-    public void testNIO_direct() throws Exception {
-        // Test native heap-allocated buffer
-        byteBufferTest(ByteBuffer.allocateDirect(12));
-    }
-
-    public void testNIO_short_array() throws Exception {
-        // Test short array-based buffer
-        short[] shortArray = new short[8];
-        ShortBuffer sb = ShortBuffer.wrap(shortArray);
-        shortBufferTest(sb);
-    }
-
-    public void testNIO_int_array() throws Exception {
-        // Test int array-based buffer
-        int[] intArray = new int[8];
-        IntBuffer ib = IntBuffer.wrap(intArray);
-        intBufferTest(ib);
-    }
-
-    public void testNIO_float_array() throws Exception {
-        // Test float array-based buffer
-        float[] floatArray = new float[8];
-        FloatBuffer fb = FloatBuffer.wrap(floatArray);
-        floatBufferTest(fb);
-    }
-
-    private void byteBufferTest(ByteBuffer b) {
-        checkBuffer(b);
-
-        // Duplicate buffers revert to big-endian.
-        b.order(ByteOrder.LITTLE_ENDIAN);
-        ByteBuffer dupe = b.duplicate();
-        assertEquals(ByteOrder.BIG_ENDIAN, dupe.order());
-        b.order(ByteOrder.BIG_ENDIAN);
-
-        // Bounds checks
-        try {
-            b.put(-1, (byte) 0);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        try {
-            b.put(b.limit(), (byte) 0);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // IndexOutOfBoundsException: offset < 0
-        try {
-            byte[] data = new byte[8];
-            b.position(0);
-            b.put(data, -1, 2);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // IndexOutOfBoundsException: length > array.length - offset
-        try {
-            byte[] data = new byte[8];
-            b.position(0);
-            b.put(data, 1, 8);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // BufferOverflowException: length > remaining()
-        try {
-            byte[] data = new byte[8];
-            b.position(b.limit() - 2);
-            b.put(data, 0, 3);
-            fail("expected exception not thrown");
-        } catch (BufferOverflowException e) {
-            // expected
-        }
-
-        // Fill buffer with bytes A0 A1 A2 A3 ...
-        b.position(0);
-        for (int i = 0; i < b.capacity(); i++) {
-            b.put((byte) (0xA0 + i));
-        }
-        try {
-            b.put((byte) 0xFF);
-            fail("expected exception not thrown");
-        } catch (BufferOverflowException e) {
-            // expected
-        }
-
-        b.position(0);
-        assertEquals((byte) 0xA7, b.get(7));
-        try {
-            b.get(12);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-        try {
-            b.get(-10);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        b.position(0);
-        b.order(ByteOrder.LITTLE_ENDIAN);
-        assertEquals((byte) 0xA0, b.get());
-        assertEquals((byte) 0xA1, b.get());
-        assertEquals((byte) 0xA2, b.get());
-        assertEquals((byte) 0xA3, b.get());
-        assertEquals((byte) 0xA4, b.get());
-        assertEquals((byte) 0xA5, b.get());
-        assertEquals((byte) 0xA6, b.get());
-        assertEquals((byte) 0xA7, b.get());
-        assertEquals((byte) 0xA8, b.get());
-        assertEquals((byte) 0xA9, b.get());
-        assertEquals((byte) 0xAA, b.get());
-        assertEquals((byte) 0xAB, b.get());
-        try {
-            b.get();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-
-        b.position(0);
-        b.order(ByteOrder.BIG_ENDIAN);
-        assertEquals((byte) 0xA0, b.get());
-        assertEquals((byte) 0xA1, b.get());
-        assertEquals((byte) 0xA2, b.get());
-        assertEquals((byte) 0xA3, b.get());
-        assertEquals((byte) 0xA4, b.get());
-        assertEquals((byte) 0xA5, b.get());
-        assertEquals((byte) 0xA6, b.get());
-        assertEquals((byte) 0xA7, b.get());
-        assertEquals((byte) 0xA8, b.get());
-        assertEquals((byte) 0xA9, b.get());
-        assertEquals((byte) 0xAA, b.get());
-        assertEquals((byte) 0xAB, b.get());
-        try {
-            b.get();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-
-        b.position(6);
-        b.limit(10);
-        assertEquals((byte) 0xA6, b.get());
-
-        // Check sliced buffer
-        b.position(6);
-
-        ByteBuffer bb = b.slice();
-        checkBuffer(bb);
-
-        assertEquals(0, bb.position());
-        assertEquals(4, bb.limit());
-        assertEquals(4, bb.capacity());
-
-        assertEquals((byte) 0xA6, bb.get());
-        assertEquals((byte) 0xA7, bb.get());
-        assertEquals((byte) 0xA8, bb.get());
-        assertEquals((byte) 0xA9, bb.get());
-        try {
-            bb.get();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-
-        // Reset position and limit
-        b.position(0);
-        b.limit(b.capacity());
-
-        // Check 'getShort'
-        b.order(ByteOrder.LITTLE_ENDIAN);
-        b.position(0);
-        assertEquals((short) 0xA1A0, b.getShort());
-        assertEquals((short) 0xA3A2, b.getShort());
-        assertEquals((short) 0xA5A4, b.getShort());
-        assertEquals((short) 0xA7A6, b.getShort());
-        assertEquals((short) 0xA9A8, b.getShort());
-        assertEquals((short) 0xABAA, b.getShort());
-        try {
-            bb.getShort();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-
-        b.order(ByteOrder.BIG_ENDIAN);
-        b.position(0);
-        assertEquals((short) 0xA0A1, b.getShort());
-        assertEquals((short) 0xA2A3, b.getShort());
-        assertEquals((short) 0xA4A5, b.getShort());
-        assertEquals((short) 0xA6A7, b.getShort());
-        assertEquals((short) 0xA8A9, b.getShort());
-        assertEquals((short) 0xAAAB, b.getShort());
-        try {
-            bb.getShort();
-           fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-
-        // Check 'getInt'
-        b.order(ByteOrder.LITTLE_ENDIAN);
-        b.position(0);
-        assertEquals(0xA3A2A1A0, b.getInt());
-        assertEquals(0xA7A6A5A4, b.getInt());
-        assertEquals(0xABAAA9A8, b.getInt());
-        try {
-            bb.getInt();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-
-        b.order(ByteOrder.BIG_ENDIAN);
-        b.position(0);
-        assertEquals(0xA0A1A2A3, b.getInt());
-        assertEquals(0xA4A5A6A7, b.getInt());
-        assertEquals(0xA8A9AAAB, b.getInt());
-        try {
-            bb.getInt();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-
-        // Check 'getFloat'
-        b.order(ByteOrder.LITTLE_ENDIAN);
-        b.position(0);
-        assertEquals(0xA3A2A1A0, Float.floatToRawIntBits(b.getFloat()));
-        assertEquals(0xA7A6A5A4, Float.floatToRawIntBits(b.getFloat()));
-        assertEquals(0xABAAA9A8, Float.floatToRawIntBits(b.getFloat()));
-        try {
-            b.getFloat();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-
-        b.order(ByteOrder.BIG_ENDIAN);
-        b.position(0);
-        assertEquals(0xA0A1A2A3, Float.floatToRawIntBits(b.getFloat()));
-        assertEquals(0xA4A5A6A7, Float.floatToRawIntBits(b.getFloat()));
-        assertEquals(0xA8A9AAAB, Float.floatToRawIntBits(b.getFloat()));
-        try {
-            b.getFloat();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-
-        // Check 'getDouble(int position)'
-        b.order(ByteOrder.LITTLE_ENDIAN);
-        assertEquals(0xA7A6A5A4A3A2A1A0L, Double.doubleToRawLongBits(b.getDouble(0)));
-        assertEquals(0xA8A7A6A5A4A3A2A1L, Double.doubleToRawLongBits(b.getDouble(1)));
-        try {
-            b.getDouble(-1);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-        try {
-            b.getDouble(5);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        b.order(ByteOrder.BIG_ENDIAN);
-        assertEquals(0xA0A1A2A3A4A5A6A7L, Double.doubleToRawLongBits(b.getDouble(0)));
-        assertEquals(0xA1A2A3A4A5A6A7A8L, Double.doubleToRawLongBits(b.getDouble(1)));
-        try {
-            b.getDouble(-1);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-        try {
-            b.getDouble(5);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // Slice and check 'getInt'
-        b.position(1);
-        b.limit(5);
-        b.order(ByteOrder.LITTLE_ENDIAN);
-        bb = b.slice();
-        assertEquals(4, bb.capacity());
-        assertEquals(ByteOrder.BIG_ENDIAN, bb.order());
-        assertEquals(0xA1A2A3A4, bb.getInt(0));
-        bb.order(ByteOrder.LITTLE_ENDIAN);
-        assertEquals(0xA4A3A2A1, bb.getInt(0));
-
-        bb.order(ByteOrder.LITTLE_ENDIAN);
-        ShortBuffer sb = bb.asShortBuffer();
-
-        checkBuffer(sb);
-        assertEquals(2, sb.capacity());
-        assertEquals((short) 0xA2A1, sb.get());
-        assertEquals((short) 0xA4A3, sb.get());
-
-        bb.order(ByteOrder.BIG_ENDIAN);
-        sb = bb.asShortBuffer();
-
-        checkBuffer(sb);
-        assertEquals(2, sb.capacity());
-        assertEquals((short) 0xA1A2, sb.get());
-        assertEquals((short) 0xA3A4, sb.get());
-
-        bb.order(ByteOrder.LITTLE_ENDIAN);
-        IntBuffer ib = bb.asIntBuffer();
-
-        checkBuffer(ib);
-        assertEquals(1, ib.capacity());
-        assertEquals(0xA4A3A2A1, ib.get());
-
-        bb.order(ByteOrder.BIG_ENDIAN);
-        ib = bb.asIntBuffer();
-
-        checkBuffer(ib);
-        assertEquals(1, ib.capacity());
-        assertEquals(0xA1A2A3A4, ib.get());
-
-        bb.order(ByteOrder.LITTLE_ENDIAN);
-        FloatBuffer fb = bb.asFloatBuffer();
-
-        checkBuffer(fb);
-        assertEquals(1, fb.capacity());
-        assertEquals(0xA4A3A2A1, Float.floatToRawIntBits(fb.get()));
-
-        bb.order(ByteOrder.BIG_ENDIAN);
-        fb = bb.asFloatBuffer();
-
-        checkBuffer(fb);
-        assertEquals(1, fb.capacity());
-        assertEquals(0xA1A2A3A4, Float.floatToRawIntBits(fb.get()));
-    }
-
-    private void shortBufferTest(ShortBuffer sb) {
-        checkBuffer(sb);
-
-        try {
-            sb.put(-1, (short) 0);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        try {
-            sb.put(sb.limit(), (short) 0);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // IndexOutOfBoundsException: offset < 0
-        try {
-            short[] data = new short[8];
-            sb.position(0);
-            sb.put(data, -1, 2);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // IndexOutOfBoundsException: length > array.length - offset
-        try {
-            short[] data = new short[8];
-            sb.position(0);
-            sb.put(data, 1, 8);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // BufferOverflowException: length > remaining()
-        try {
-            short[] data = new short[8];
-            sb.position(sb.limit() - 2);
-            sb.put(data, 0, 3);
-            fail("expected exception not thrown");
-        } catch (BufferOverflowException e) {
-            // expected
-        }
-
-        short[] data = {0, 10, 20, 30, 40, 50, 60, 70};
-        sb.position(0);
-        sb.put(data);
-
-        try {
-            sb.get();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-
-        sb.position(0);
-        assertEquals((short) 0, sb.get());
-        assertEquals((short) 10, sb.get());
-        assertEquals((short) 20, sb.get());
-        assertEquals((short) 30, sb.get());
-        assertEquals((short) 40, sb.get());
-        assertEquals((short) 50, sb.get());
-        assertEquals((short) 60, sb.get());
-        assertEquals((short) 70, sb.get());
-        try {
-            sb.get();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-        sb.position(1);
-        sb.put((short) 11);
-        assertEquals((short) 11, sb.get(1));
-
-        short[] ss1 = {33, 44, 55, 66};
-        sb.position(3);
-        sb.put(ss1);
-        sb.position(0);
-        assertEquals((short) 0, sb.get());
-        assertEquals((short) 11, sb.get());
-        assertEquals((short) 20, sb.get());
-        assertEquals((short) 33, sb.get());
-        assertEquals((short) 44, sb.get());
-        assertEquals((short) 55, sb.get());
-        assertEquals((short) 66, sb.get());
-        assertEquals((short) 70, sb.get());
-
-        short[] ss2 = {10, 22, 30};
-        sb.position(2);
-        sb.put(ss2, 1, 1);
-        sb.position(0);
-        assertEquals((short) 0, sb.get());
-        assertEquals((short) 11, sb.get());
-        assertEquals((short) 22, sb.get());
-        assertEquals((short) 33, sb.get());
-        assertEquals((short) 44, sb.get());
-        assertEquals((short) 55, sb.get());
-        assertEquals((short) 66, sb.get());
-        assertEquals((short) 70, sb.get());
-    }
-
-    private void intBufferTest(IntBuffer ib) {
-        checkBuffer(ib);
-
-        try {
-            ib.put(-1, (int) 0);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        try {
-            ib.put(ib.limit(), (int) 0);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // IndexOutOfBoundsException: offset < 0
-        try {
-            int[] data = new int[8];
-            ib.position(0);
-            ib.put(data, -1, 2);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // IndexOutOfBoundsException: length > array.length - offset
-        try {
-            int[] data = new int[8];
-            ib.position(0);
-            ib.put(data, 1, 8);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // BufferOverflowException: length > remaining()
-        try {
-            int[] data = new int[8];
-            ib.position(ib.limit() - 2);
-            ib.put(data, 0, 3);
-            fail("expected exception not thrown");
-        } catch (BufferOverflowException e) {
-            // expected
-        }
-
-        int[] data = {0, 10, 20, 30, 40, 50, 60, 70};
-        ib.position(0);
-        ib.put(data);
-
-        try {
-            ib.get();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-
-        ib.position(0);
-        assertEquals((int) 0, ib.get());
-        assertEquals((int) 10, ib.get());
-        assertEquals((int) 20, ib.get());
-        assertEquals((int) 30, ib.get());
-        assertEquals((int) 40, ib.get());
-        assertEquals((int) 50, ib.get());
-        assertEquals((int) 60, ib.get());
-        assertEquals((int) 70, ib.get());
-        try {
-            ib.get();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-        ib.position(1);
-        ib.put((int) 11);
-        assertEquals((int) 11, ib.get(1));
-
-        int[] ss1 = {33, 44, 55, 66};
-        ib.position(3);
-        ib.put(ss1);
-        ib.position(0);
-        assertEquals((int) 0, ib.get());
-        assertEquals((int) 11, ib.get());
-        assertEquals((int) 20, ib.get());
-        assertEquals((int) 33, ib.get());
-        assertEquals((int) 44, ib.get());
-        assertEquals((int) 55, ib.get());
-        assertEquals((int) 66, ib.get());
-        assertEquals((int) 70, ib.get());
-
-        int[] ss2 = {10, 22, 30};
-        ib.position(2);
-        ib.put(ss2, 1, 1);
-        ib.position(0);
-        assertEquals((int) 0, ib.get());
-        assertEquals((int) 11, ib.get());
-        assertEquals((int) 22, ib.get());
-        assertEquals((int) 33, ib.get());
-        assertEquals((int) 44, ib.get());
-        assertEquals((int) 55, ib.get());
-        assertEquals((int) 66, ib.get());
-        assertEquals((int) 70, ib.get());
-    }
-
-    void floatBufferTest(FloatBuffer fb) {
-        checkBuffer(fb);
-
-        try {
-            fb.put(-1, (float) 0);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        try {
-            fb.put(fb.limit(), (float) 0);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // IndexOutOfBoundsException: offset < 0
-        try {
-            float[] data = new float[8];
-            fb.position(0);
-            fb.put(data, -1, 2);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // IndexOutOfBoundsException: length > array.length - offset
-        try {
-            float[] data = new float[8];
-            fb.position(0);
-            fb.put(data, 1, 8);
-            fail("expected exception not thrown");
-        } catch (IndexOutOfBoundsException e) {
-            // expected
-        }
-
-        // BufferOverflowException: length > remaining()
-        try {
-            float[] data = new float[8];
-            fb.position(fb.limit() - 2);
-            fb.put(data, 0, 3);
-            fail("expected exception not thrown");
-        } catch (BufferOverflowException e) {
-            // expected
-        }
-
-        float[] data = {0, 10, 20, 30, 40, 50, 60, 70};
-        fb.position(0);
-        fb.put(data);
-
-        try {
-            fb.get();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-
-        fb.position(0);
-        assertEquals((float) 0, fb.get());
-        assertEquals((float) 10, fb.get());
-        assertEquals((float) 20, fb.get());
-        assertEquals((float) 30, fb.get());
-        assertEquals((float) 40, fb.get());
-        assertEquals((float) 50, fb.get());
-        assertEquals((float) 60, fb.get());
-        assertEquals((float) 70, fb.get());
-        try {
-            fb.get();
-            fail("expected exception not thrown");
-        } catch (BufferUnderflowException e) {
-            // expected
-        }
-        fb.position(1);
-        fb.put((float) 11);
-        assertEquals((float) 11, fb.get(1));
-
-        float[] ss1 = {33, 44, 55, 66};
-        fb.position(3);
-        fb.put(ss1);
-        fb.position(0);
-        assertEquals((float) 0, fb.get());
-        assertEquals((float) 11, fb.get());
-        assertEquals((float) 20, fb.get());
-        assertEquals((float) 33, fb.get());
-        assertEquals((float) 44, fb.get());
-        assertEquals((float) 55, fb.get());
-        assertEquals((float) 66, fb.get());
-        assertEquals((float) 70, fb.get());
-
-        float[] ss2 = {10, 22, 30};
-        fb.position(2);
-        fb.put(ss2, 1, 1);
-        fb.position(0);
-        assertEquals((float) 0, fb.get());
-        assertEquals((float) 11, fb.get());
-        assertEquals((float) 22, fb.get());
-        assertEquals((float) 33, fb.get());
-        assertEquals((float) 44, fb.get());
-        assertEquals((float) 55, fb.get());
-        assertEquals((float) 66, fb.get());
-        assertEquals((float) 70, fb.get());
-    }
-}
diff --git a/tests/CoreTests/android/core/OutputStreamWriterTest.java b/tests/CoreTests/android/core/OutputStreamWriterTest.java
deleted file mode 100644
index 1c0901e..0000000
--- a/tests/CoreTests/android/core/OutputStreamWriterTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayOutputStream;
-import java.io.OutputStreamWriter;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Tests basic functionality of an OutputStreamWriter.
- */
-public class OutputStreamWriterTest extends TestCase {
-    
-    @SmallTest
-    public void testOutputStreamWriter() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-        ByteArrayOutputStream aa = new ByteArrayOutputStream();
-        OutputStreamWriter a = new OutputStreamWriter(aa, "ISO8859_1");
-        try {
-            a.write(str, 0, 4);
-            a.write('A');
-            // We have to flush the OutputStreamWriter to guarantee
-            // that the results will appear in the underlying OutputStream
-            a.flush();
-            assertEquals("ISO8859_1", a.getEncoding());
-            assertEquals(5, aa.size());
-            assertEquals("AbCdA", aa.toString());
-        } finally {
-            a.close();
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/ParseIntTest.java b/tests/CoreTests/android/core/ParseIntTest.java
deleted file mode 100644
index 0e3b0c6..0000000
--- a/tests/CoreTests/android/core/ParseIntTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Tests for functionality of class Integer to parse integers.
- */
-public class ParseIntTest extends TestCase {
-    
-    @SmallTest
-    public void testParseInt() throws Exception {
-        assertEquals(0, Integer.parseInt("0", 10));
-        assertEquals(473, Integer.parseInt("473", 10));
-        assertEquals(0, Integer.parseInt("-0", 10));
-        assertEquals(-255, Integer.parseInt("-FF", 16));
-        assertEquals(102, Integer.parseInt("1100110", 2));
-        assertEquals(2147483647, Integer.parseInt("2147483647", 10));
-        assertEquals(-2147483648, Integer.parseInt("-2147483648", 10));
-
-        try {
-            Integer.parseInt("2147483648", 10);
-            fail();
-        } catch (NumberFormatException e) {
-            // ok
-        }
-
-        try {
-            Integer.parseInt("-2147483649", 10);
-            fail();
-        } catch (NumberFormatException e) {
-            // ok
-        }
-
-        // One digit too many
-        try {
-            Integer.parseInt("21474836470", 10);
-            fail();
-        } catch (NumberFormatException e) {
-            // ok
-        }
-
-        try {
-            Integer.parseInt("-21474836480", 10);
-            fail();
-        } catch (NumberFormatException e) {
-            // ok
-        }
-
-        try {
-            Integer.parseInt("21474836471", 10);
-            fail();
-        } catch (NumberFormatException e) {
-            // ok
-        }
-
-        try {
-            Integer.parseInt("-21474836481", 10);
-            fail();
-        } catch (NumberFormatException e) {
-            // ok
-        }
-
-        try {
-            Integer.parseInt("214748364710", 10);
-            fail();
-        } catch (NumberFormatException e) {
-            // ok
-        }
-
-        try {
-            Integer.parseInt("-214748364811", 10);
-            fail();
-        } catch (NumberFormatException e) {
-            // ok
-        }
-
-        try {
-            Integer.parseInt("99", 8);
-            fail();
-        } catch (NumberFormatException e) {
-            // ok
-        }
-
-        try {
-            Integer.parseInt("Kona", 10);
-            fail();
-        } catch (NumberFormatException e) {
-            // ok
-        }
-
-        assertEquals(411787, Integer.parseInt("Kona", 27));
-    }
-}
diff --git a/tests/CoreTests/android/core/PipedStreamTest.java b/tests/CoreTests/android/core/PipedStreamTest.java
deleted file mode 100644
index d98bc10..0000000
--- a/tests/CoreTests/android/core/PipedStreamTest.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.PipedInputStream;
-import java.io.PipedOutputStream;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.SmallTest;
-
-class Fibonacci {
-    int n1 = -1;
-    int n2;
-
-    public int next() {
-        if (n1 < 0) {
-            n1 = 0;
-            return 0;
-        } else if (n1 == 0) {
-            n2 = 0;
-            n1 = 1;
-            return 1;
-        } else {
-            int ret = n1 + n2;
-            n2 = n1;
-            n1 = ret;
-            return ret;
-        }
-    }
-}
-
-
-public class PipedStreamTest extends TestCase {
-
-    private abstract static class TestThread extends Thread {
-        public abstract void runTest() throws Exception;
-
-        public final void run() {
-            try {
-                runTest();
-            } catch (Throwable e) {
-                android.util.Log.e("PST", "Got exception " + e, e);
-                android.util.Log.e("PST", android.util.Log.getStackTraceString(e));
-                exception = e;
-            }
-        }
-
-        Throwable exception;
-        int countRead = 0;
-    }
-
-    @MediumTest
-    public void testA() throws Exception {
-
-        final PipedInputStream in = new PipedInputStream();
-        final PipedOutputStream out = new PipedOutputStream(in);
-
-        assertEquals(0, in.available());
-
-        TestThread reader, writer;
-
-        reader = new TestThread() {
-            Fibonacci fib = new Fibonacci();
-
-            @Override
-            public void runTest() throws Exception {
-                int readInt;
-                byte readByte;
-
-                for (; ;) {
-                    readInt = in.read();
-
-                    if (readInt == -1) {
-                        return;
-                    }
-
-                    readByte = (byte) readInt;
-                    assertEquals(readByte, (byte) fib.next());
-                    countRead++;
-                }
-            }
-        };
-
-        reader.start();
-
-        writer = new TestThread() {
-            Fibonacci fib = new Fibonacci();
-
-            @Override
-            public void runTest() throws Exception {
-                for (int i = 0; i < 2000; i++) {
-                    int toWrite = fib.next();
-                    out.write(toWrite);
-                }
-                out.close();
-            }
-        };
-
-        writer.start();
-
-
-        for (; ;) {
-            try {
-                reader.join(60 * 1000);
-                writer.join(1000);
-                break;
-            } catch (InterruptedException ex) {
-            }
-        }
-
-        assertEquals(2000, reader.countRead);
-
-        if (writer.exception != null) {
-            throw new Exception(writer.exception);
-        }
-        if (reader.exception != null) {
-            throw new Exception(reader.exception);
-        }
-    }
-
-    @MediumTest
-    public void testB() throws Exception {
-        final PipedInputStream in = new PipedInputStream();
-        final PipedOutputStream out = new PipedOutputStream(in);
-
-        assertEquals(0, in.available());
-
-        TestThread reader, writer;
-
-        reader = new TestThread() {
-            Fibonacci fib = new Fibonacci();
-
-            @Override
-            public void runTest() throws Exception {
-                byte readBytes[] = new byte[5];
-                int ret;
-
-                for (; ;) {
-                    int nread = 0;
-                    while (nread < 5) {
-                        ret = in.read(readBytes, nread, readBytes.length - nread);
-
-                        if (ret == -1) {
-                            return;
-                        }
-                        nread += ret;
-                    }
-
-                    assertEquals(5, nread);
-
-                    int readInt = (((int) readBytes[0] & 0xff) << 24)
-                            | (((int) readBytes[1] & 0xff) << 16)
-                            | (((int) readBytes[2] & 0xff) << 8)
-                            | (((int) readBytes[3] & 0xff));
-
-
-                    assertEquals("Error at " + countRead, fib.next(), readInt);
-                    assertEquals("Error at " + countRead, 0, readBytes[4]);
-                    countRead++;
-                }
-            }
-        };
-
-        reader.start();
-
-        writer = new TestThread() {
-            Fibonacci fib = new Fibonacci();
-
-            @Override
-            public void runTest() throws Exception {
-                byte writeBytes[] = new byte[5];
-                for (int i = 0; i < 2000; i++) {
-                    int toWrite = fib.next();
-                    writeBytes[0] = (byte) (toWrite >> 24);
-                    writeBytes[1] = (byte) (toWrite >> 16);
-                    writeBytes[2] = (byte) (toWrite >> 8);
-                    writeBytes[3] = (byte) (toWrite);
-                    writeBytes[4] = 0;
-                    out.write(writeBytes, 0, writeBytes.length);
-                }
-                out.close();
-            }
-        };
-
-        writer.start();
-
-
-        for (; ;) {
-            try {
-                reader.join(60 * 1000);
-                writer.join(1000);
-                break;
-            } catch (InterruptedException ex) {
-            }
-        }
-
-        if (reader.exception != null) {
-            throw new Exception(reader.exception);
-        }
-        if (writer.exception != null) {
-            throw new Exception(writer.exception);
-        }
-
-        assertEquals(2000, reader.countRead);
-    }
-
-    @SmallTest
-    public void testC() throws Exception {
-        final PipedInputStream in = new PipedInputStream();
-        final PipedOutputStream out = new PipedOutputStream(in);
-        final byte readBytes[] = new byte[1024 * 2];
-
-        assertEquals(0, in.available());
-
-        TestThread reader, writer;
-
-        reader = new TestThread() {
-            @Override
-            public void runTest() throws Exception {
-                int ret;
-
-                for (; ;) {
-                    int nread = 0;
-                    while (nread < readBytes.length) {
-                        ret = in.read(readBytes, nread, readBytes.length - nread);
-
-                        if (ret == -1) {
-                            return;
-                        }
-                        nread += ret;
-                    }
-                }
-            }
-        };
-
-        reader.start();
-
-        writer = new TestThread() {
-            Fibonacci fib = new Fibonacci();
-
-            @Override
-            public void runTest() throws Exception {
-                byte writeBytes[] = new byte[1024 * 2];
-                for (int i = 0; i < (writeBytes.length - 4); i += 4) {
-                    int toWrite = fib.next();
-                    writeBytes[i    ] = (byte) (toWrite >> 24);
-                    writeBytes[i + 1] = (byte) (toWrite >> 16);
-                    writeBytes[i + 2] = (byte) (toWrite >> 8);
-                    writeBytes[i + 3] = (byte) (toWrite);
-                }
-                out.write(writeBytes, 0, writeBytes.length);
-                out.close();
-            }
-        };
-
-        writer.start();
-
-
-        for (; ;) {
-            try {
-                reader.join(60 * 1000);
-                writer.join(1000);
-                break;
-            } catch (InterruptedException ex) {
-            }
-        }
-
-        if (reader.exception != null) {
-            throw new Exception(reader.exception);
-        }
-        if (writer.exception != null) {
-            throw new Exception(writer.exception);
-        }
-
-        Fibonacci fib = new Fibonacci();
-        for (int i = 0; i < (readBytes.length - 4); i += 4) {
-            int readInt = (((int) readBytes[i] & 0xff) << 24)
-                    | (((int) readBytes[i + 1] & 0xff) << 16)
-                    | (((int) readBytes[i + 2] & 0xff) << 8)
-                    | (((int) readBytes[i + 3] & 0xff));
-
-            assertEquals("Error at " + i, readInt, fib.next());
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/PrintWriterTest.java b/tests/CoreTests/android/core/PrintWriterTest.java
deleted file mode 100644
index 09ee389..0000000
--- a/tests/CoreTests/android/core/PrintWriterTest.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import android.test.suitebuilder.annotation.SmallTest;
-
-public class PrintWriterTest extends TestCase {
-
-    @SmallTest
-    public void testPrintWriter() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-        StringWriter aa = new StringWriter();
-        PrintWriter a = new PrintWriter(aa);
-
-        try {
-            a.write(str, 0, 26);
-            a.write('X');
-
-            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzX", aa.toString());
-
-            a.write("alphabravodelta", 5, 5);
-            a.append('X');
-            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzXbravoX", aa.toString());
-            a.append("omega");
-            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzXbravoXomega", aa.toString());
-            a.print("ZZZ");
-            assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzXbravoXomegaZZZ", aa.toString());
-        } finally {
-            a.close();
-        }
-
-        StringWriter ba = new StringWriter();
-        PrintWriter b = new PrintWriter(ba);
-        try {
-            b.print(true);
-            b.print((char) 'A');
-            b.print("BCD".toCharArray());
-            b.print((double) 1.2);
-            b.print((float) 3);
-            b.print((int) 4);
-            b.print((long) 5);
-            assertEquals("trueABCD1.23.045", ba.toString());
-            b.println();
-            b.println(true);
-            b.println((char) 'A');
-            b.println("BCD".toCharArray());
-            b.println((double) 1.2);
-            b.println((float) 3);
-            b.println((int) 4);
-            b.println((long) 5);
-            b.print("THE END");
-            assertEquals("trueABCD1.23.045\ntrue\nA\nBCD\n1.2\n3.0\n4\n5\nTHE END", ba.toString());
-        } finally {
-            b.close();
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/PushbackInputStreamTest.java b/tests/CoreTests/android/core/PushbackInputStreamTest.java
deleted file mode 100644
index 44cfd8a..0000000
--- a/tests/CoreTests/android/core/PushbackInputStreamTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.PushbackInputStream;
-import android.test.suitebuilder.annotation.SmallTest;
-
-public class PushbackInputStreamTest extends TestCase {
-
-    @SmallTest
-    public void testPushbackInputStream() throws Exception {
-        String str = "AbCdEfGhIjKlM\nOpQrStUvWxYz";
-        ByteArrayInputStream aa = new ByteArrayInputStream(str.getBytes());
-        ByteArrayInputStream ba = new ByteArrayInputStream(str.getBytes());
-        ByteArrayInputStream ca = new ByteArrayInputStream(str.getBytes());
-
-        PushbackInputStream a = new PushbackInputStream(aa, 7);
-        try {
-            a.unread("push".getBytes());
-            assertEquals("pushAbCdEfGhIjKlM\nOpQrStUvWxYz", IOUtil.read(a));
-        } finally {
-            a.close();
-        }
-
-        PushbackInputStream b = new PushbackInputStream(ba, 9);
-        try {
-            b.unread('X');
-            assertEquals("XAbCdEfGhI", IOUtil.read(b, 10));
-        } finally {
-            b.close();
-        }
-
-        PushbackInputStream c = new PushbackInputStream(ca);
-        try {
-            assertEquals("bdfhjl\nprtvxz", IOUtil.skipRead(c));
-        } finally {
-            c.close();
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/PushbackReaderTest.java b/tests/CoreTests/android/core/PushbackReaderTest.java
deleted file mode 100644
index ef62c28..0000000
--- a/tests/CoreTests/android/core/PushbackReaderTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.PushbackReader;
-import java.io.StringReader;
-import android.test.suitebuilder.annotation.SmallTest;
-
-public class PushbackReaderTest extends TestCase {
-
-    @SmallTest
-    public void testPushbackReader() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-        StringReader aa = new StringReader(str);
-        StringReader ba = new StringReader(str);
-        StringReader ca = new StringReader(str);
-
-        PushbackReader a = new PushbackReader(aa, 5);
-        try {
-            a.unread("PUSH".toCharArray());
-            assertEquals("PUSHAbCdEfGhIjKlMnOpQrStUvWxYz", IOUtil.read(a));
-        } finally {
-            a.close();
-        }
-
-        PushbackReader b = new PushbackReader(ba, 15);
-        try {
-            b.unread('X');
-            assertEquals("XAbCdEfGhI", IOUtil.read(b, 10));
-        } finally {
-            b.close();
-        }
-
-        PushbackReader c = new PushbackReader(ca);
-        try {
-            assertEquals("bdfhjlnprtvxz", IOUtil.skipRead(c));
-        } finally {
-            c.close();
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/ReflectArrayTest.java b/tests/CoreTests/android/core/ReflectArrayTest.java
deleted file mode 100644
index 20ee8a4..0000000
--- a/tests/CoreTests/android/core/ReflectArrayTest.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.lang.reflect.Array;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Test java.lang.reflect.Array methods.
- */
-public class ReflectArrayTest extends TestCase {
-
-    @SmallTest
-    public void testSingleInt() throws Exception {
-        Object intArray = Array.newInstance(Integer.TYPE, 2);
-
-        int[] array = (int[]) intArray;
-        array[0] = 5;
-        Array.setInt(intArray, 1, 6);
-
-        assertEquals(5, Array.getInt(intArray, 0));
-        assertEquals(6, array[1]);
-
-        try {
-            array[2] = 27;
-            fail("store should have failed");
-        } catch (ArrayIndexOutOfBoundsException abe) {
-            // expected
-        }
-
-        assertEquals(2, array.length);
-        assertEquals(Array.getLength(intArray), array.length);
-
-        try {
-            int[][] wrongArray = (int[][]) intArray;
-            fail("cast should have failed");
-        } catch (ClassCastException cce) {
-            // expected
-        }
-
-        intArray = Array.newInstance(Integer.TYPE, 0);
-        assertEquals(0, Array.getLength(intArray));
-    }
-
-    @SmallTest
-    public void testSingle() throws Exception {
-        Object strArray = Array.newInstance(String.class, 2);
-
-        String[] array = (String[]) strArray;
-        array[0] = "entry zero";
-        Array.set(strArray, 1, "entry one");
-
-        //System.out.println("array: " + array);
-
-        assertEquals("entry zero", Array.get(strArray, 0));
-        assertEquals("entry one", array[1]);
-
-        assertEquals(2, array.length);
-        assertEquals(Array.getLength(strArray), array.length);
-    }
-
-    @SmallTest
-    public void testMultiInt() throws Exception {
-        int[] dimensions = {3, 2, 1};
-        Object intIntIntArray = Array.newInstance(Integer.TYPE, dimensions);
-        int[][][] array3 = (int[][][]) intIntIntArray;
-
-        array3[0][0][0] = 123;
-        array3[2][1][0] = 456;
-
-        try {
-            array3[2][1][1] = 768;
-            fail("store should have failed");
-        } catch (ArrayIndexOutOfBoundsException abe) {
-            // expected
-        }
-
-        //System.out.println("array3: " + array3);
-    }
-
-    @SmallTest
-    public void testMulti() throws Exception {
-        int[] dimensions = {1, 2, 3};
-        Object strStrStrArray = Array.newInstance(String.class, dimensions);
-        String[][][] array3 = (String[][][]) strStrStrArray;
-
-        array3[0][0][0] = "zero zero zero";
-        array3[0][1][2] = "zero one two";
-
-        try {
-            array3[1][0][0] = "bad store";
-            fail("store should have failed");
-        } catch (ArrayIndexOutOfBoundsException abe) {
-            // expected
-        }
-
-        try {
-            String[][] array2 = (String[][]) strStrStrArray;
-            fail("expecting bad cast");
-        } catch (ClassCastException cce) {
-            // expected
-        }
-        //System.out.println("array3: " + array3);
-
-
-        int[] dimensions2 = {1, 2};
-        strStrStrArray = Array.newInstance(String[].class, dimensions2);
-        array3 = (String[][][]) strStrStrArray;
-        array3[0][1] = new String[3];
-        array3[0][1][2] = "zero one two";
-        try {
-            array3[1][0][0] = "bad store";
-            fail("store should have failed");
-        } catch (ArrayIndexOutOfBoundsException abe) {
-            // expected
-        }
-        //System.out.println("array3: " + array3);
-    }
-}
-
diff --git a/tests/CoreTests/android/core/SerializationTest.java b/tests/CoreTests/android/core/SerializationTest.java
deleted file mode 100644
index 9644d03..0000000
--- a/tests/CoreTests/android/core/SerializationTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.Serializable;
-import android.test.suitebuilder.annotation.SmallTest;
-
-/**
- * Tests serialization of user-level classes.
- */
-public class SerializationTest extends TestCase {
-
-    static class MySerializable implements Serializable {}
-
-    @SmallTest
-    public void testSerialization() throws IOException, ClassNotFoundException {
-        ByteArrayOutputStream bout = new ByteArrayOutputStream();
-        ObjectOutputStream oout = new ObjectOutputStream(bout);
-        oout.writeObject(new MySerializable());
-        oout.close();
-
-        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
-        Object o = new ObjectInputStream(bin).readObject();
-        assertTrue(o instanceof MySerializable);
-    }
-}
diff --git a/tests/CoreTests/android/core/StreamTokenizerTest.java b/tests/CoreTests/android/core/StreamTokenizerTest.java
deleted file mode 100644
index 5013860..0000000
--- a/tests/CoreTests/android/core/StreamTokenizerTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.StreamTokenizer;
-import java.io.StringReader;
-import android.test.suitebuilder.annotation.MediumTest;
-
-/**
- * Tests for the StreamTokenizer
- */
-public class StreamTokenizerTest extends TestCase {
-    
-    @MediumTest
-    public void testStreamTokenizer() throws Exception {
-        String str = "Testing 12345 \n alpha \r\n omega";
-        String strb = "-3.8 'BLIND mice' \r sEe /* how */ they run";
-        StringReader aa = new StringReader(str);
-        StringReader ba = new StringReader(strb);
-        StreamTokenizer a = new StreamTokenizer(aa);
-        StreamTokenizer b = new StreamTokenizer(ba);
-
-        assertEquals(1, a.lineno());
-        assertEquals(StreamTokenizer.TT_WORD, a.nextToken());
-        assertEquals("Token[Testing], line 1", a.toString());
-        assertEquals(StreamTokenizer.TT_NUMBER, a.nextToken());
-        assertEquals("Token[n=12345.0], line 1", a.toString());
-        assertEquals(StreamTokenizer.TT_WORD, a.nextToken());
-        assertEquals("Token[alpha], line 2", a.toString());
-        assertEquals(StreamTokenizer.TT_WORD, a.nextToken());
-        assertEquals("Token[omega], line 3", a.toString());
-        assertEquals(StreamTokenizer.TT_EOF, a.nextToken());
-        assertEquals("Token[EOF], line 3", a.toString());
-
-        b.commentChar('u');
-        b.eolIsSignificant(true);
-        b.lowerCaseMode(true);
-        b.ordinaryChar('y');
-        b.slashStarComments(true);
-
-        assertEquals(StreamTokenizer.TT_NUMBER, b.nextToken());
-        assertEquals(-3.8, b.nval);
-        assertEquals("Token[n=-3.8], line 1", b.toString());
-        assertEquals(39, b.nextToken()); // '
-        assertEquals("Token[BLIND mice], line 1", b.toString());
-        assertEquals(10, b.nextToken()); // \n
-        assertEquals("Token[EOL], line 2", b.toString());
-        assertEquals(StreamTokenizer.TT_WORD, b.nextToken());
-        assertEquals("Token[see], line 2", b.toString());
-        assertEquals(StreamTokenizer.TT_WORD, b.nextToken());
-        assertEquals("Token[the], line 2", b.toString());
-        assertEquals(121, b.nextToken()); // y
-        assertEquals("Token['y'], line 2", b.toString());
-        assertEquals(StreamTokenizer.TT_WORD, b.nextToken());
-        assertEquals("Token[r], line 2", b.toString());
-        assertEquals(StreamTokenizer.TT_EOF, b.nextToken());
-        assertEquals("Token[EOF], line 2", b.toString());
-
-        // A harmony regression test
-        byte[] data = new byte[]{(byte) '-'};
-        StreamTokenizer tokenizer = new StreamTokenizer(new ByteArrayInputStream(data));
-        tokenizer.nextToken();
-        String result = tokenizer.toString();
-        assertEquals("Token['-'], line 1", result);
-
-        // another harmony regression test
-        byte[] data2 = new byte[]{(byte) '"',
-                (byte) 'H',
-                (byte) 'e',
-                (byte) 'l',
-                (byte) 'l',
-                (byte) 'o',
-                (byte) '"'};
-        StreamTokenizer tokenizer2 = new StreamTokenizer(new ByteArrayInputStream(data2));
-        tokenizer2.nextToken();
-        result = tokenizer2.toString();
-        assertEquals("Token[Hello], line 1", result);
-    }
-}
diff --git a/tests/CoreTests/android/core/StrictMathTest.java b/tests/CoreTests/android/core/StrictMathTest.java
deleted file mode 100644
index 92e6cb6..0000000
--- a/tests/CoreTests/android/core/StrictMathTest.java
+++ /dev/null
@@ -1,855 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one or more
- *  contributor license agreements.  See the NOTICE file distributed with
- *  this work for additional information regarding copyright ownership.
- *  The ASF licenses this file to You 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 android.core;
-
-import junit.framework.TestCase;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.test.suitebuilder.annotation.MediumTest;
-
-public class StrictMathTest extends TestCase {
-
-    private final double HYP = StrictMath.sqrt(2.0);
-
-    private final double OPP = 1.0;
-
-    private final double ADJ = 1.0;
-
-    /* Required to make previous preprocessor flags work - do not remove */
-    int unused = 0;
-
-    /**
-     * @tests java.lang.StrictMath#abs(double)
-     */
-    @SmallTest
-    public void testAbsD() {
-        // Test for method double java.lang.StrictMath.abs(double)
-
-        assertTrue("Incorrect double abs value",
-                (StrictMath.abs(-1908.8976) == 1908.8976));
-        assertTrue("Incorrect double abs value",
-                (StrictMath.abs(1908.8976) == 1908.8976));
-    }
-
-    /**
-     * @tests java.lang.StrictMath#abs(float)
-     */
-    @SmallTest
-    public void testAbsF() {
-        // Test for method float java.lang.StrictMath.abs(float)
-        assertTrue("Incorrect float abs value",
-                (StrictMath.abs(-1908.8976f) == 1908.8976f));
-        assertTrue("Incorrect float abs value",
-                (StrictMath.abs(1908.8976f) == 1908.8976f));
-    }
-
-    /**
-     * @tests java.lang.StrictMath#abs(int)
-     */
-    @SmallTest
-    public void testAbsI() {
-        // Test for method int java.lang.StrictMath.abs(int)
-        assertTrue("Incorrect int abs value",
-                (StrictMath.abs(-1908897) == 1908897));
-        assertTrue("Incorrect int abs value",
-                (StrictMath.abs(1908897) == 1908897));
-    }
-
-    /**
-     * @tests java.lang.StrictMath#abs(long)
-     */
-    @SmallTest
-    public void testAbsJ() {
-        // Test for method long java.lang.StrictMath.abs(long)
-        assertTrue("Incorrect long abs value", (StrictMath
-                .abs(-19088976000089L) == 19088976000089L));
-        assertTrue("Incorrect long abs value",
-                (StrictMath.abs(19088976000089L) == 19088976000089L));
-    }
-
-    /**
-     * @tests java.lang.StrictMath#acos(double)
-     */
-    @SmallTest
-    public void testAcosD() {
-        // Test for method double java.lang.StrictMath.acos(double)
-        assertTrue("Returned incorrect arc cosine", StrictMath.cos(StrictMath
-                .acos(ADJ / HYP)) == ADJ / HYP);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#asin(double)
-     */
-    @SmallTest
-    public void testAsinD() {
-        // Test for method double java.lang.StrictMath.asin(double)
-        assertTrue("Returned incorrect arc sine", StrictMath.sin(StrictMath
-                .asin(OPP / HYP)) == OPP / HYP);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#atan(double)
-     */
-    @SmallTest
-    public void testAtanD() {
-        // Test for method double java.lang.StrictMath.atan(double)
-        double answer = StrictMath.tan(StrictMath.atan(1.0));
-        assertTrue("Returned incorrect arc tangent: " + answer, answer <= 1.0
-                && answer >= 9.9999999999999983E-1);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#atan2(double,double)
-     */
-    @SmallTest
-    public void testAtan2DD() {
-        // Test for method double java.lang.StrictMath.atan2(double, double)
-        double answer = StrictMath.atan(StrictMath.tan(1.0));
-        assertTrue("Returned incorrect arc tangent: " + answer, answer <= 1.0
-                && answer >= 9.9999999999999983E-1);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#cbrt(double)
-     */
-    @SuppressWarnings("boxing")
-    @SmallTest
-    public void testCbrtD() {
-        // Test for special situations
-        assertTrue("Should return Double.NaN", Double.isNaN(StrictMath
-                .cbrt(Double.NaN)));
-        assertEquals("Should return Double.POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath
-                .cbrt(Double.POSITIVE_INFINITY));
-        assertEquals("Should return Double.NEGATIVE_INFINITY",
-                Double.NEGATIVE_INFINITY, StrictMath
-                .cbrt(Double.NEGATIVE_INFINITY));
-        assertEquals(Double.doubleToLongBits(0.0), Double
-                .doubleToLongBits(StrictMath.cbrt(0.0)));
-        assertEquals(Double.doubleToLongBits(+0.0), Double
-                .doubleToLongBits(StrictMath.cbrt(+0.0)));
-        assertEquals(Double.doubleToLongBits(-0.0), Double
-                .doubleToLongBits(StrictMath.cbrt(-0.0)));
-
-        assertEquals("Should return 3.0", 3.0, StrictMath.cbrt(27.0));
-        assertEquals("Should return 23.111993172558684", 23.111993172558684,
-                StrictMath.cbrt(12345.6));
-        assertEquals("Should return 5.643803094122362E102",
-                5.643803094122362E102, StrictMath.cbrt(Double.MAX_VALUE));
-        assertEquals("Should return 0.01", 0.01, StrictMath.cbrt(0.000001));
-
-        assertEquals("Should return -3.0", -3.0, StrictMath.cbrt(-27.0));
-        assertEquals("Should return -23.111993172558684", -23.111993172558684,
-                StrictMath.cbrt(-12345.6));
-        assertEquals("Should return 1.7031839360032603E-108",
-                1.7031839360032603E-108, StrictMath.cbrt(Double.MIN_VALUE));
-        assertEquals("Should return -0.01", -0.01, StrictMath.cbrt(-0.000001));
-
-        try {
-            StrictMath.cbrt((Double) null);
-            fail("Should throw NullPointerException");
-        } catch (NullPointerException e) {
-            //expected
-        }
-    }
-
-    /**
-     * @tests java.lang.StrictMath#ceil(double)
-     */
-    @SmallTest
-    public void testCeilD() {
-        // Test for method double java.lang.StrictMath.ceil(double)
-        assertEquals("Incorrect ceiling for double",
-                79, StrictMath.ceil(78.89), 0.0);
-        assertEquals("Incorrect ceiling for double",
-                -78, StrictMath.ceil(-78.89), 0.0);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#cos(double)
-     */
-    @SmallTest
-    public void testCosD() {
-        // Test for method double java.lang.StrictMath.cos(double)
-
-        assertTrue("Returned incorrect cosine", StrictMath.cos(StrictMath
-                .acos(ADJ / HYP)) == ADJ / HYP);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#cosh(double)
-     */
-    @SuppressWarnings("boxing")
-    @SmallTest
-    public void testCosh_D() {
-        // Test for special situations        
-        assertTrue("Should return NaN", Double.isNaN(StrictMath
-                .cosh(Double.NaN)));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath
-                .cosh(Double.POSITIVE_INFINITY));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath
-                .cosh(Double.NEGATIVE_INFINITY));
-        assertEquals("Should return 1.0", 1.0, StrictMath.cosh(+0.0));
-        assertEquals("Should return 1.0", 1.0, StrictMath.cosh(-0.0));
-
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.cosh(1234.56));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.cosh(-1234.56));
-        assertEquals("Should return 1.0000000000005", 1.0000000000005,
-                StrictMath.cosh(0.000001));
-        assertEquals("Should return 1.0000000000005", 1.0000000000005,
-                StrictMath.cosh(-0.000001));
-        assertEquals("Should return 5.212214351945598", 5.212214351945598,
-                StrictMath.cosh(2.33482));
-
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.cosh(Double.MAX_VALUE));
-        assertEquals("Should return 1.0", 1.0, StrictMath
-                .cosh(Double.MIN_VALUE));
-    }
-
-    /**
-     * @tests java.lang.StrictMath#exp(double)
-     */
-    @SmallTest
-    public void testExpD() {
-        // Test for method double java.lang.StrictMath.exp(double)
-        assertTrue("Incorrect answer returned for simple power", StrictMath
-                .abs(StrictMath.exp(4D) - StrictMath.E * StrictMath.E
-                        * StrictMath.E * StrictMath.E) < 0.1D);
-        assertTrue("Incorrect answer returned for larger power", StrictMath
-                .log(StrictMath.abs(StrictMath.exp(5.5D)) - 5.5D) < 10.0D);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#expm1(double)
-     */
-    @SuppressWarnings("boxing")
-    @SmallTest
-    public void testExpm1D() {
-        //Test for special cases        
-        assertTrue("Should return NaN", Double.isNaN(StrictMath.expm1(Double.NaN)));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.expm1(Double.POSITIVE_INFINITY));
-        assertEquals("Should return -1.0", -1.0, StrictMath
-                .expm1(Double.NEGATIVE_INFINITY));
-        assertEquals(Double.doubleToLongBits(0.0), Double
-                .doubleToLongBits(StrictMath.expm1(0.0)));
-        assertEquals(Double.doubleToLongBits(+0.0), Double
-                .doubleToLongBits(StrictMath.expm1(+0.0)));
-        assertEquals(Double.doubleToLongBits(-0.0), Double
-                .doubleToLongBits(StrictMath.expm1(-0.0)));
-
-        assertEquals("Should return -9.999950000166666E-6",
-                -9.999950000166666E-6, StrictMath.expm1(-0.00001));
-        assertEquals("Should return 1.0145103074469635E60",
-                1.0145103074469635E60, StrictMath.expm1(138.16951162));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath
-                .expm1(123456789123456789123456789.4521584223));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.expm1(Double.MAX_VALUE));
-        assertEquals("Should return MIN_VALUE", Double.MIN_VALUE, StrictMath
-                .expm1(Double.MIN_VALUE));
-
-    }
-
-    /**
-     * @tests java.lang.StrictMath#floor(double)
-     */
-    @SmallTest
-    public void testFloorD() {
-        // Test for method double java.lang.StrictMath.floor(double)
-        assertEquals("Incorrect floor for double",
-                78, StrictMath.floor(78.89), 0.0);
-        assertEquals("Incorrect floor for double",
-                -79, StrictMath.floor(-78.89), 0.0);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#hypot(double,double)
-     */
-    @SuppressWarnings("boxing")
-    @SmallTest
-    public void testHypotDD() {
-        // Test for special cases
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.hypot(Double.POSITIVE_INFINITY,
-                1.0));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.hypot(Double.NEGATIVE_INFINITY,
-                123.324));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.hypot(-758.2587,
-                Double.POSITIVE_INFINITY));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.hypot(5687.21,
-                Double.NEGATIVE_INFINITY));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.hypot(Double.POSITIVE_INFINITY,
-                Double.NEGATIVE_INFINITY));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.hypot(Double.NEGATIVE_INFINITY,
-                Double.POSITIVE_INFINITY));
-        assertTrue("Should return NaN", Double.isNaN(StrictMath.hypot(Double.NaN,
-                2342301.89843)));
-        assertTrue("Should return NaN", Double.isNaN(StrictMath.hypot(-345.2680,
-                Double.NaN)));
-
-        assertEquals("Should return 2396424.905416697", 2396424.905416697, StrictMath
-                .hypot(12322.12, -2396393.2258));
-        assertEquals("Should return 138.16958070558556", 138.16958070558556,
-                StrictMath.hypot(-138.16951162, 0.13817035864));
-        assertEquals("Should return 1.7976931348623157E308",
-                1.7976931348623157E308, StrictMath.hypot(Double.MAX_VALUE, 211370.35));
-        assertEquals("Should return 5413.7185", 5413.7185, StrictMath.hypot(
-                -5413.7185, Double.MIN_VALUE));
-
-    }
-
-    /**
-     * @tests java.lang.StrictMath#IEEEremainder(double,double)
-     */
-    @SmallTest
-    public void testIEEEremainderDD() {
-        // Test for method double java.lang.StrictMath.IEEEremainder(double,
-        // double)
-        assertEquals("Incorrect remainder returned", 0.0, StrictMath.IEEEremainder(
-                1.0, 1.0), 0.0);
-        assertTrue(
-                "Incorrect remainder returned",
-                StrictMath.IEEEremainder(1.32, 89.765) >= 1.4705063220631647E-2
-                        || StrictMath.IEEEremainder(1.32, 89.765) >= 1.4705063220631649E-2);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#log(double)
-     */
-    @SmallTest
-    public void testLogD() {
-        // Test for method double java.lang.StrictMath.log(double)
-        for (double d = 10; d >= -10; d -= 0.5) {
-            double answer = StrictMath.log(StrictMath.exp(d));
-            assertTrue("Answer does not equal expected answer for d = " + d
-                    + " answer = " + answer,
-                    StrictMath.abs(answer - d) <= StrictMath
-                            .abs(d * 0.00000001));
-        }
-    }
-
-    /**
-     * @tests java.lang.StrictMath#log10(double)
-     */
-    @SuppressWarnings("boxing")
-    @SmallTest
-    public void testLog10D() {
-        // Test for special cases        
-        assertTrue("Should return NaN", Double.isNaN(StrictMath
-                .log10(Double.NaN)));
-        assertTrue("Should return NaN", Double.isNaN(StrictMath
-                .log10(-2541.05745687234187532)));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath
-                .log10(Double.POSITIVE_INFINITY));
-        assertEquals("Should return NEGATIVE_INFINITY",
-                Double.NEGATIVE_INFINITY, StrictMath.log10(0.0));
-        assertEquals("Should return NEGATIVE_INFINITY",
-                Double.NEGATIVE_INFINITY, StrictMath.log10(+0.0));
-        assertEquals("Should return NEGATIVE_INFINITY",
-                Double.NEGATIVE_INFINITY, StrictMath.log10(-0.0));
-        assertEquals("Should return 14.0", 14.0, StrictMath.log10(StrictMath
-                .pow(10, 14)));
-
-        assertEquals("Should return 3.7389561269540406", 3.7389561269540406,
-                StrictMath.log10(5482.2158));
-        assertEquals("Should return 14.661551142893833", 14.661551142893833,
-                StrictMath.log10(458723662312872.125782332587));
-        assertEquals("Should return -0.9083828622192334", -0.9083828622192334,
-                StrictMath.log10(0.12348583358871));
-        assertEquals("Should return 308.25471555991675", 308.25471555991675,
-                StrictMath.log10(Double.MAX_VALUE));
-        assertEquals("Should return -323.3062153431158", -323.3062153431158,
-                StrictMath.log10(Double.MIN_VALUE));
-    }
-
-    /**
-     * @tests java.lang.StrictMath#log1p(double)
-     */
-    @SuppressWarnings("boxing")
-    @SmallTest
-    public void testLog1pD() {
-        // Test for special cases
-        assertTrue("Should return NaN", Double.isNaN(StrictMath
-                .log1p(Double.NaN)));
-        assertTrue("Should return NaN", Double.isNaN(StrictMath
-                .log1p(-32.0482175)));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath
-                .log1p(Double.POSITIVE_INFINITY));
-        assertEquals(Double.doubleToLongBits(0.0), Double
-                .doubleToLongBits(StrictMath.log1p(0.0)));
-        assertEquals(Double.doubleToLongBits(+0.0), Double
-                .doubleToLongBits(StrictMath.log1p(+0.0)));
-        assertEquals(Double.doubleToLongBits(-0.0), Double
-                .doubleToLongBits(StrictMath.log1p(-0.0)));
-
-        assertEquals("Should return -0.2941782295312541", -0.2941782295312541,
-                StrictMath.log1p(-0.254856327));
-        assertEquals("Should return 7.368050685564151", 7.368050685564151,
-                StrictMath.log1p(1583.542));
-        assertEquals("Should return 0.4633708685409921", 0.4633708685409921,
-                StrictMath.log1p(0.5894227));
-        assertEquals("Should return 709.782712893384", 709.782712893384,
-                StrictMath.log1p(Double.MAX_VALUE));
-        assertEquals("Should return Double.MIN_VALUE", Double.MIN_VALUE,
-                StrictMath.log1p(Double.MIN_VALUE));
-    }
-
-    /**
-     * @tests java.lang.StrictMath#max(double,double)
-     */
-    @SmallTest
-    public void testMaxDD() {
-        // Test for method double java.lang.StrictMath.max(double, double)
-        assertEquals("Incorrect double max value", 1908897.6000089, StrictMath.max(
-                -1908897.6000089, 1908897.6000089), 0D);
-        assertEquals("Incorrect double max value", 1908897.6000089, StrictMath.max(2.0,
-                1908897.6000089), 0D);
-        assertEquals("Incorrect double max value", -2.0, StrictMath.max(-2.0,
-                -1908897.6000089), 0D);
-
-    }
-
-    /**
-     * @tests java.lang.StrictMath#max(float,float)
-     */
-    @SmallTest
-    public void testMaxFF() {
-        // Test for method float java.lang.StrictMath.max(float, float)
-        assertTrue("Incorrect float max value", StrictMath.max(-1908897.600f,
-                1908897.600f) == 1908897.600f);
-        assertTrue("Incorrect float max value", StrictMath.max(2.0f,
-                1908897.600f) == 1908897.600f);
-        assertTrue("Incorrect float max value", StrictMath.max(-2.0f,
-                -1908897.600f) == -2.0f);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#max(int,int)
-     */
-    @SmallTest
-    public void testMaxII() {
-        // Test for method int java.lang.StrictMath.max(int, int)
-        assertEquals("Incorrect int max value", 19088976, StrictMath.max(-19088976,
-                19088976));
-        assertEquals("Incorrect int max value",
-                19088976, StrictMath.max(20, 19088976));
-        assertEquals("Incorrect int max value",
-                -20, StrictMath.max(-20, -19088976));
-    }
-
-    /**
-     * @tests java.lang.StrictMath#max(long,long)
-     */
-    @SmallTest
-    public void testMaxJJ() {
-        // Test for method long java.lang.StrictMath.max(long, long)
-        assertEquals("Incorrect long max value", 19088976000089L, StrictMath.max(-19088976000089L,
-                19088976000089L));
-        assertEquals("Incorrect long max value", 19088976000089L, StrictMath.max(20,
-                19088976000089L));
-        assertEquals("Incorrect long max value", -20, StrictMath.max(-20,
-                -19088976000089L));
-    }
-
-    /**
-     * @tests java.lang.StrictMath#min(double,double)
-     */
-    @SmallTest
-    public void testMinDD() {
-        // Test for method double java.lang.StrictMath.min(double, double)
-        assertEquals("Incorrect double min value", -1908897.6000089, StrictMath.min(
-                -1908897.6000089, 1908897.6000089), 0D);
-        assertEquals("Incorrect double min value", 2.0, StrictMath.min(2.0,
-                1908897.6000089), 0D);
-        assertEquals("Incorrect double min value", -1908897.6000089, StrictMath.min(-2.0,
-                -1908897.6000089), 0D);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#min(float,float)
-     */
-    @SmallTest
-    public void testMinFF() {
-        // Test for method float java.lang.StrictMath.min(float, float)
-        assertTrue("Incorrect float min value", StrictMath.min(-1908897.600f,
-                1908897.600f) == -1908897.600f);
-        assertTrue("Incorrect float min value", StrictMath.min(2.0f,
-                1908897.600f) == 2.0f);
-        assertTrue("Incorrect float min value", StrictMath.min(-2.0f,
-                -1908897.600f) == -1908897.600f);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#min(int,int)
-     */
-    @SmallTest
-    public void testMinII() {
-        // Test for method int java.lang.StrictMath.min(int, int)
-        assertEquals("Incorrect int min value", -19088976, StrictMath.min(-19088976,
-                19088976));
-        assertEquals("Incorrect int min value",
-                20, StrictMath.min(20, 19088976));
-        assertEquals("Incorrect int min value",
-                -19088976, StrictMath.min(-20, -19088976));
-
-    }
-
-    /**
-     * @tests java.lang.StrictMath#min(long,long)
-     */
-    @SmallTest
-    public void testMinJJ() {
-        // Test for method long java.lang.StrictMath.min(long, long)
-        assertEquals("Incorrect long min value", -19088976000089L, StrictMath.min(-19088976000089L,
-                19088976000089L));
-        assertEquals("Incorrect long min value", 20, StrictMath.min(20,
-                19088976000089L));
-        assertEquals("Incorrect long min value", -19088976000089L, StrictMath.min(-20,
-                -19088976000089L));
-    }
-
-    /**
-     * @tests java.lang.StrictMath#pow(double,double)
-     */
-    @SmallTest
-    public void testPowDD() {
-        // Test for method double java.lang.StrictMath.pow(double, double)
-        assertTrue("pow returned incorrect value",
-                (long) StrictMath.pow(2, 8) == 256l);
-        assertTrue("pow returned incorrect value",
-                StrictMath.pow(2, -8) == 0.00390625d);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#rint(double)
-     */
-    @SmallTest
-    public void testRintD() {
-        // Test for method double java.lang.StrictMath.rint(double)
-        assertEquals("Failed to round properly - up to odd",
-                3.0, StrictMath.rint(2.9), 0D);
-        assertTrue("Failed to round properly - NaN", Double.isNaN(StrictMath
-                .rint(Double.NaN)));
-        assertEquals("Failed to round properly down  to even", 2.0, StrictMath
-                .rint(2.1), 0D);
-        assertTrue("Failed to round properly " + 2.5 + " to even", StrictMath
-                .rint(2.5) == 2.0);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#round(double)
-     */
-    @SmallTest
-    public void testRoundD() {
-        // Test for method long java.lang.StrictMath.round(double)
-        assertEquals("Incorrect rounding of a float",
-                -91, StrictMath.round(-90.89d));
-    }
-
-    /**
-     * @tests java.lang.StrictMath#round(float)
-     */
-    @SmallTest
-    public void testRoundF() {
-        // Test for method int java.lang.StrictMath.round(float)
-        assertEquals("Incorrect rounding of a float",
-                -91, StrictMath.round(-90.89f));
-    }
-
-    /**
-     * @tests java.lang.StrictMath#signum(double)
-     */
-    @SmallTest
-    public void testSignumD() {
-        assertTrue(Double.isNaN(StrictMath.signum(Double.NaN)));
-        assertEquals(Double.doubleToLongBits(0.0), Double
-                .doubleToLongBits(StrictMath.signum(0.0)));
-        assertEquals(Double.doubleToLongBits(+0.0), Double
-                .doubleToLongBits(StrictMath.signum(+0.0)));
-        assertEquals(Double.doubleToLongBits(-0.0), Double
-                .doubleToLongBits(StrictMath.signum(-0.0)));
-
-        assertEquals(1.0, StrictMath.signum(253681.2187962), 0D);
-        assertEquals(-1.0, StrictMath.signum(-125874693.56), 0D);
-        assertEquals(1.0, StrictMath.signum(1.2587E-308), 0D);
-        assertEquals(-1.0, StrictMath.signum(-1.2587E-308), 0D);
-
-        assertEquals(1.0, StrictMath.signum(Double.MAX_VALUE), 0D);
-        assertEquals(1.0, StrictMath.signum(Double.MIN_VALUE), 0D);
-        assertEquals(-1.0, StrictMath.signum(-Double.MAX_VALUE), 0D);
-        assertEquals(-1.0, StrictMath.signum(-Double.MIN_VALUE), 0D);
-        assertEquals(1.0, StrictMath.signum(Double.POSITIVE_INFINITY), 0D);
-        assertEquals(-1.0, StrictMath.signum(Double.NEGATIVE_INFINITY), 0D);
-
-    }
-
-    /**
-     * @tests java.lang.StrictMath#signum(float)
-     */
-    @SmallTest
-    public void testSignumF() {
-        assertTrue(Float.isNaN(StrictMath.signum(Float.NaN)));
-        assertEquals(Float.floatToIntBits(0.0f), Float
-                .floatToIntBits(StrictMath.signum(0.0f)));
-        assertEquals(Float.floatToIntBits(+0.0f), Float
-                .floatToIntBits(StrictMath.signum(+0.0f)));
-        assertEquals(Float.floatToIntBits(-0.0f), Float
-                .floatToIntBits(StrictMath.signum(-0.0f)));
-
-        assertEquals(1.0f, StrictMath.signum(253681.2187962f), 0f);
-        assertEquals(-1.0f, StrictMath.signum(-125874693.56f), 0f);
-        assertEquals(1.0f, StrictMath.signum(1.2587E-11f), 0f);
-        assertEquals(-1.0f, StrictMath.signum(-1.2587E-11f), 0f);
-
-        assertEquals(1.0f, StrictMath.signum(Float.MAX_VALUE), 0f);
-        assertEquals(1.0f, StrictMath.signum(Float.MIN_VALUE), 0f);
-        assertEquals(-1.0f, StrictMath.signum(-Float.MAX_VALUE), 0f);
-        assertEquals(-1.0f, StrictMath.signum(-Float.MIN_VALUE), 0f);
-        assertEquals(1.0f, StrictMath.signum(Float.POSITIVE_INFINITY), 0f);
-        assertEquals(-1.0f, StrictMath.signum(Float.NEGATIVE_INFINITY), 0f);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#sin(double)
-     */
-    @SmallTest
-    public void testSinD() {
-        // Test for method double java.lang.StrictMath.sin(double)
-        assertTrue("Returned incorrect sine", StrictMath.sin(StrictMath
-                .asin(OPP / HYP)) == OPP / HYP);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#sinh(double)
-     */
-    @SmallTest
-    public void testSinhD() {
-        // Test for special situations
-        assertTrue(Double.isNaN(StrictMath.sinh(Double.NaN)));
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath
-                .sinh(Double.POSITIVE_INFINITY), 0D);
-        assertEquals("Should return NEGATIVE_INFINITY",
-                Double.NEGATIVE_INFINITY, StrictMath
-                .sinh(Double.NEGATIVE_INFINITY), 0D);
-        assertEquals(Double.doubleToLongBits(0.0), Double
-                .doubleToLongBits(StrictMath.sinh(0.0)));
-        assertEquals(Double.doubleToLongBits(+0.0), Double
-                .doubleToLongBits(StrictMath.sinh(+0.0)));
-        assertEquals(Double.doubleToLongBits(-0.0), Double
-                .doubleToLongBits(StrictMath.sinh(-0.0)));
-
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.sinh(1234.56), 0D);
-        assertEquals("Should return NEGATIVE_INFINITY",
-                Double.NEGATIVE_INFINITY, StrictMath.sinh(-1234.56), 0D);
-        assertEquals("Should return 1.0000000000001666E-6",
-                1.0000000000001666E-6, StrictMath.sinh(0.000001), 0D);
-        assertEquals("Should return -1.0000000000001666E-6",
-                -1.0000000000001666E-6, StrictMath.sinh(-0.000001), 0D);
-        assertEquals("Should return 5.115386441963859", 5.115386441963859,
-                StrictMath.sinh(2.33482), 0D);
-        assertEquals("Should return POSITIVE_INFINITY",
-                Double.POSITIVE_INFINITY, StrictMath.sinh(Double.MAX_VALUE), 0D);
-        assertEquals("Should return 4.9E-324", 4.9E-324, StrictMath
-                .sinh(Double.MIN_VALUE), 0D);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#sqrt(double)
-     */
-    @SmallTest
-    public void testSqrtD() {
-        // Test for method double java.lang.StrictMath.sqrt(double)
-        assertEquals("Incorrect root returned1",
-                2, StrictMath.sqrt(StrictMath.pow(StrictMath.sqrt(2), 4)), 0.0);
-        assertEquals("Incorrect root returned2", 7, StrictMath.sqrt(49), 0.0);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#tan(double)
-     */
-    @SmallTest
-    public void testTanD() {
-        // Test for method double java.lang.StrictMath.tan(double)
-        assertTrue(
-                "Returned incorrect tangent: ",
-                StrictMath.tan(StrictMath.atan(1.0)) <= 1.0
-                        || StrictMath.tan(StrictMath.atan(1.0)) >= 9.9999999999999983E-1);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#tanh(double)
-     */
-    @SmallTest
-    public void testTanhD() {
-        // Test for special situations
-        assertTrue(Double.isNaN(StrictMath.tanh(Double.NaN)));
-        assertEquals("Should return +1.0", +1.0, StrictMath
-                .tanh(Double.POSITIVE_INFINITY), 0D);
-        assertEquals("Should return -1.0", -1.0, StrictMath
-                .tanh(Double.NEGATIVE_INFINITY), 0D);
-        assertEquals(Double.doubleToLongBits(0.0), Double
-                .doubleToLongBits(StrictMath.tanh(0.0)));
-        assertEquals(Double.doubleToLongBits(+0.0), Double
-                .doubleToLongBits(StrictMath.tanh(+0.0)));
-        assertEquals(Double.doubleToLongBits(-0.0), Double
-                .doubleToLongBits(StrictMath.tanh(-0.0)));
-
-        assertEquals("Should return 1.0", 1.0, StrictMath.tanh(1234.56), 0D);
-        assertEquals("Should return -1.0", -1.0, StrictMath.tanh(-1234.56), 0D);
-        assertEquals("Should return 9.999999999996666E-7",
-                9.999999999996666E-7, StrictMath.tanh(0.000001), 0D);
-        assertEquals("Should return 0.981422884124941", 0.981422884124941,
-                StrictMath.tanh(2.33482), 0D);
-        assertEquals("Should return 1.0", 1.0, StrictMath
-                .tanh(Double.MAX_VALUE), 0D);
-        assertEquals("Should return 4.9E-324", 4.9E-324, StrictMath
-                .tanh(Double.MIN_VALUE), 0D);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#random()
-     */
-    @MediumTest
-    public void testRandom() {
-        // There isn't a place for these tests so just stick them here
-        assertEquals("Wrong value E",
-                4613303445314885481L, Double.doubleToLongBits(StrictMath.E));
-        assertEquals("Wrong value PI",
-                4614256656552045848L, Double.doubleToLongBits(StrictMath.PI));
-
-        for (int i = 500; i >= 0; i--) {
-            double d = StrictMath.random();
-            assertTrue("Generated number is out of range: " + d, d >= 0.0
-                    && d < 1.0);
-        }
-    }
-
-    /**
-     * @tests java.lang.StrictMath#toRadians(double)
-     */
-    @MediumTest
-    public void testToRadiansD() {
-        for (double d = 500; d >= 0; d -= 1.0) {
-            double converted = StrictMath.toDegrees(StrictMath.toRadians(d));
-            assertTrue("Converted number not equal to original. d = " + d,
-                    converted >= d * 0.99999999 && converted <= d * 1.00000001);
-        }
-    }
-
-    /**
-     * @tests java.lang.StrictMath#toDegrees(double)
-     */
-    @MediumTest
-    public void testToDegreesD() {
-        for (double d = 500; d >= 0; d -= 1.0) {
-            double converted = StrictMath.toRadians(StrictMath.toDegrees(d));
-            assertTrue("Converted number not equal to original. d = " + d,
-                    converted >= d * 0.99999999 && converted <= d * 1.00000001);
-        }
-    }
-
-    /**
-     * @tests java.lang.StrictMath#ulp(double)
-     */
-    @SuppressWarnings("boxing")
-    @SmallTest
-    public void testUlp_D() {
-        // Test for special cases
-        assertTrue("Should return NaN", Double
-                .isNaN(StrictMath.ulp(Double.NaN)));
-        assertEquals("Returned incorrect value", Double.POSITIVE_INFINITY,
-                StrictMath.ulp(Double.POSITIVE_INFINITY), 0D);
-        assertEquals("Returned incorrect value", Double.POSITIVE_INFINITY,
-                StrictMath.ulp(Double.NEGATIVE_INFINITY), 0D);
-        assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
-                .ulp(0.0), 0D);
-        assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
-                .ulp(+0.0), 0D);
-        assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
-                .ulp(-0.0), 0D);
-        assertEquals("Returned incorrect value", StrictMath.pow(2, 971),
-                StrictMath.ulp(Double.MAX_VALUE), 0D);
-        assertEquals("Returned incorrect value", StrictMath.pow(2, 971),
-                StrictMath.ulp(-Double.MAX_VALUE), 0D);
-
-        assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
-                .ulp(Double.MIN_VALUE), 0D);
-        assertEquals("Returned incorrect value", Double.MIN_VALUE, StrictMath
-                .ulp(-Double.MIN_VALUE), 0D);
-
-        assertEquals("Returned incorrect value", 2.220446049250313E-16,
-                StrictMath.ulp(1.0), 0D);
-        assertEquals("Returned incorrect value", 2.220446049250313E-16,
-                StrictMath.ulp(-1.0), 0D);
-        assertEquals("Returned incorrect value", 2.2737367544323206E-13,
-                StrictMath.ulp(1153.0), 0D);
-    }
-
-    /**
-     * @tests java.lang.StrictMath#ulp(float)
-     */
-    @SuppressWarnings("boxing")
-    @SmallTest
-    public void testUlpF() {
-        // Test for special cases
-        assertTrue("Should return NaN", Float.isNaN(StrictMath.ulp(Float.NaN)));
-        assertEquals("Returned incorrect value", Float.POSITIVE_INFINITY,
-                StrictMath.ulp(Float.POSITIVE_INFINITY), 0f);
-        assertEquals("Returned incorrect value", Float.POSITIVE_INFINITY,
-                StrictMath.ulp(Float.NEGATIVE_INFINITY), 0f);
-        assertEquals("Returned incorrect value", Float.MIN_VALUE, StrictMath
-                .ulp(0.0f), 0f);
-        assertEquals("Returned incorrect value", Float.MIN_VALUE, StrictMath
-                .ulp(+0.0f), 0f);
-        assertEquals("Returned incorrect value", Float.MIN_VALUE, StrictMath
-                .ulp(-0.0f), 0f);
-        assertEquals("Returned incorrect value", 2.028241E31f, StrictMath
-                .ulp(Float.MAX_VALUE), 0f);
-        assertEquals("Returned incorrect value", 2.028241E31f, StrictMath
-                .ulp(-Float.MAX_VALUE), 0f);
-
-        assertEquals("Returned incorrect value", 1.4E-45f, StrictMath
-                .ulp(Float.MIN_VALUE), 0f);
-        assertEquals("Returned incorrect value", 1.4E-45f, StrictMath
-                .ulp(-Float.MIN_VALUE), 0f);
-
-        assertEquals("Returned incorrect value", 1.1920929E-7f, StrictMath
-                .ulp(1.0f), 0f);
-        assertEquals("Returned incorrect value", 1.1920929E-7f, StrictMath
-                .ulp(-1.0f), 0f);
-        assertEquals("Returned incorrect value", 1.2207031E-4f, StrictMath
-                .ulp(1153.0f), 0f);
-        assertEquals("Returned incorrect value", 5.6E-45f, Math
-                .ulp(9.403954E-38f), 0f);
-    }
-}
diff --git a/tests/CoreTests/android/core/StringReaderTest.java b/tests/CoreTests/android/core/StringReaderTest.java
deleted file mode 100644
index 66b3e81..0000000
--- a/tests/CoreTests/android/core/StringReaderTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.StringReader;
-import android.test.suitebuilder.annotation.SmallTest;
-
-public class StringReaderTest extends TestCase {
-
-    @SmallTest
-    public void testStringReader() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-
-        StringReader a = new StringReader(str);
-        StringReader b = new StringReader(str);
-        StringReader c = new StringReader(str);
-        StringReader d = new StringReader(str);
-
-        assertEquals(str, IOUtil.read(a));
-        assertEquals("AbCdEfGhIj", IOUtil.read(b, 10));
-        assertEquals("bdfhjlnprtvxz", IOUtil.skipRead(c));
-        assertEquals("AbCdEfGdEfGhIjKlMnOpQrStUvWxYz", IOUtil.markRead(d, 3, 4));
-    }
-}
diff --git a/tests/CoreTests/android/core/StringWriterTest.java b/tests/CoreTests/android/core/StringWriterTest.java
deleted file mode 100644
index fed2221..0000000
--- a/tests/CoreTests/android/core/StringWriterTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.StringWriter;
-import android.test.suitebuilder.annotation.SmallTest;
-
-public class StringWriterTest extends TestCase {
-
-    @SmallTest
-    public void testStringWriter() throws Exception {
-        String str = "AbCdEfGhIjKlMnOpQrStUvWxYz";
-        StringWriter a = new StringWriter(10);
-
-        a.write(str, 0, 26);
-        a.write('X');
-
-        assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzX", a.toString());
-
-        a.write("alphabravodelta", 5, 5);
-        a.append('X');
-        assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzXbravoX", a.toString());
-        a.append("omega");
-        assertEquals("AbCdEfGhIjKlMnOpQrStUvWxYzXbravoXomega", a.toString());
-    }
-}
diff --git a/tests/CoreTests/android/core/TreeMapTest.java b/tests/CoreTests/android/core/TreeMapTest.java
deleted file mode 100644
index 229d86d..0000000
--- a/tests/CoreTests/android/core/TreeMapTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.util.HashMap;
-import java.util.Random;
-import java.util.TreeMap;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Tests for basic functinality of TreeMaps
- */
-public class TreeMapTest extends TestCase {
-
-    private Random mRandom = new Random(1);
-
-    private static final boolean SPEW = false;
-
-    @LargeTest
-    public void testTreeMap() {
-        for (int i = 0; i < 10; i++) {
-            if (SPEW) System.out.println("Running doTest cycle #" + (i + 1));
-            doTest();
-        }
-    }
-
-    private void doTest() {
-        TreeMap<Integer, String> tm = new TreeMap<Integer, String>();
-        HashMap<Integer, String> hm = new HashMap<Integer, String>();
-
-        int minVal = Integer.MAX_VALUE;
-        int maxVal = Integer.MIN_VALUE;
-
-        for (int i = 0; i < 100; i++) {
-            int val = mRandom.nextInt(1000);
-            if (SPEW) System.out.println("Adding val = " + val);
-            if (val < minVal) {
-                minVal = val;
-            }
-            if (val > maxVal) {
-                maxVal = val;
-            }
-            tm.put(new Integer(val), "V:" + val);
-            hm.put(new Integer(val), "V:" + val);
-
-            if (SPEW) System.out.println("tm = " + tm);
-
-            if (SPEW) System.out.println("tm.size() = " + tm.size());
-            if (SPEW) System.out.println("hm.size() = " + hm.size());
-            assertEquals(tm.size(), hm.size());
-
-            if (SPEW) System.out.println("tm.firstKey() = " + tm.firstKey());
-            if (SPEW) System.out.println("minVal = " + minVal);
-            if (SPEW) System.out.println("tm.lastKey() = " + tm.lastKey());
-            if (SPEW) System.out.println("maxVal = " + maxVal);
-            assertEquals(minVal, tm.firstKey().intValue());
-            assertEquals(maxVal, tm.lastKey().intValue());
-        }
-
-        // Check for equality
-        for (int val = 0; val < 1000; val++) {
-            Integer vv = new Integer(val);
-            String tms = tm.get(vv);
-            String hms = hm.get(vv);
-            assertEquals(tms, hms);
-        }
-
-        for (int i = 0; i < 1000; i++) {
-            int val = mRandom.nextInt(1000);
-            if (SPEW) System.out.println("Removing val = " + val);
-
-            String tms = tm.remove(new Integer(val));
-            String hms = hm.remove(new Integer(val));
-
-            if (SPEW) System.out.println("tm = " + tm);
-
-            assertEquals(tm.size(), hm.size());
-            assertEquals(tms, hms);
-        }
-
-        // Check for equality
-        for (int val = 0; val < 1000; val++) {
-            Integer vv = new Integer(val);
-            String tms = tm.get(vv);
-            String hms = hm.get(vv);
-            assertEquals(tms, hms);
-        }
-    }
-}
diff --git a/tests/CoreTests/android/core/URITest.java b/tests/CoreTests/android/core/URITest.java
deleted file mode 100644
index 3b821d8..0000000
--- a/tests/CoreTests/android/core/URITest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.net.URI;
-import java.net.URISyntaxException;
-import android.test.suitebuilder.annotation.SmallTest;
-
-public class URITest extends TestCase {
-
-    @SmallTest
-    public void testConstruct() throws Exception {
-        construct("http://www.google.com/this/is-the/path?query#fragment",
-                "www.google.com", "/this/is-the/path", true);
-    }
-
-    private static void construct(String str, String host, String path, boolean absolute)
-            throws URISyntaxException {
-        URI uri = new URI(str);
-        assertEquals(host, uri.getHost());
-        assertEquals(path, uri.getPath());
-        assertEquals(absolute, uri.isAbsolute());
-    }
-
-    @SmallTest
-    public void testResolve() throws Exception {
-        resolve("http://www.google.com/your",
-                "mom",
-                "http://www.google.com/mom");
-    }
-
-    private static void resolve(String base, String uri, String expected) {
-        URI b = URI.create(base);
-        URI resolved = b.resolve(uri);
-//        System.out.println("base=" + base + " uri=" + uri
-//                + " resolved=" + resolved);
-        assertEquals(expected, resolved.toString());
-    }
-}
diff --git a/tests/CoreTests/android/core/ZipFileTest.java b/tests/CoreTests/android/core/ZipFileTest.java
deleted file mode 100644
index 04b476b..0000000
--- a/tests/CoreTests/android/core/ZipFileTest.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.util.Enumeration;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-import java.util.zip.ZipOutputStream;
-import android.test.suitebuilder.annotation.MediumTest;
-
-
-/**
- * Basic tests for ZipFile.
- */
-public class ZipFileTest extends TestCase {
-    private static final int SAMPLE_SIZE = 128 * 1024;
-
-    @MediumTest
-    public void testZipFile() throws Exception {
-
-        File file = File.createTempFile("ZipFileTest", ".zip");
-        try {
-            // create a test file; assume it's not going to collide w/anything
-            FileOutputStream outStream = new FileOutputStream(file);
-            createCompressedZip(outStream);
-//            System.out.println("CREATED " + file);
-
-            scanZip(file.getPath());
-            read2(file.getPath());
-        } finally {
-            file.delete();
-        }
-    }
-
-    /*
-     * stepStep == 0 --> >99% compression
-     * stepStep == 1 --> ~30% compression
-     * stepStep == 2 --> no compression
-     */
-    static byte[] makeSampleFile(int stepStep) throws IOException {
-        byte[] sample = new byte[SAMPLE_SIZE];
-        byte val, step;
-        int i, j, offset;
-
-        val = 0;
-        step = 1;
-        offset = 0;
-        for (i = 0; i < SAMPLE_SIZE / 256; i++) {
-            for (j = 0; j < 256; j++) {
-                sample[offset++] = val;
-                val += step;
-            }
-
-            step += stepStep;
-        }
-
-        return sample;
-    }
-
-    static void createCompressedZip(OutputStream bytesOut) throws IOException {
-        ZipOutputStream out = new ZipOutputStream(bytesOut);
-        try {
-            int i;
-
-            for (i = 0; i < 3; i++) {
-                byte[] input = makeSampleFile(i);
-                ZipEntry newEntry = new ZipEntry("file-" + i);
-
-                if (i != 1) {
-                    newEntry.setComment("this is file " + i);
-                }
-                out.putNextEntry(newEntry);
-                out.write(input, 0, input.length);
-                out.closeEntry();
-            }
-
-            out.setComment("This is a lovely compressed archive!");
-        } finally {
-            out.close();
-        }
-    }
-
-    static void scanZip(String fileName) throws IOException {
-        ZipFile zipFile = new ZipFile(fileName);
-        Enumeration fileList;
-        int idx = 0;
-
-//        System.out.println("Contents of " + zipFile + ":");
-        for (fileList = zipFile.entries(); fileList.hasMoreElements();) {
-            ZipEntry entry = (ZipEntry) fileList.nextElement();
-//            System.out.println("  " + entry.getName());
-            assertEquals(entry.getName(), "file-" + idx);
-            idx++;
-        }
-
-        zipFile.close();
-    }
-
-    /*
-     * Read compressed data from two different entries at the same time,
-     * to verify that the streams aren't getting confused.  If we do
-     * something wrong, the inflater will choke and throw a ZipException.
-     *
-     * This doesn't test synchronization in multi-threaded use.
-     */
-    static void read2(String fileName) throws IOException {
-        ZipFile zipFile;
-        ZipEntry entry1, entry2;
-        byte buf[] = new byte[16384];
-        InputStream stream1, stream2;
-        int len, totalLen1, totalLen2;
-
-        /* use file-1 and file-2 because the compressed data is large */
-        zipFile = new ZipFile(fileName);
-        entry1 = zipFile.getEntry("file-1");
-        entry2 = zipFile.getEntry("file-2");
-
-        /* make sure we got the right thing */
-        assertEquals("file-1", entry1.getName());
-        assertEquals("file-2", entry2.getName());
-
-        /* create streams */
-        stream1 = zipFile.getInputStream(entry1);
-        stream2 = zipFile.getInputStream(entry2);
-
-        /*
-         * Read a piece of file #1.
-         */
-        totalLen1 = stream1.read(buf);
-        assertTrue("initial read failed on #1", totalLen1 >= 0);
-
-        /*
-         * Read a piece of file #2.
-         */
-        totalLen2 = stream2.read(buf);
-        assertTrue("initial read failed on #2", totalLen2 >= 0);
-
-        /*
-         * Read the rest of file #1, and close the stream.
-         *
-         * If our streams are crossed up, we'll fail here.
-         */
-        while ((len = stream1.read(buf)) > 0) {
-            totalLen1 += len;
-        }
-        assertEquals(SAMPLE_SIZE, totalLen1);
-        stream1.close();
-
-        /*
-         * Read the rest of file #2, and close the stream.
-         */
-        while ((len = stream2.read(buf)) > 0) {
-            totalLen2 += len;
-        }
-        assertEquals(SAMPLE_SIZE, totalLen2);
-        stream2.close();
-
-        /*
-         * Open a new one.
-         */
-        stream1 = zipFile.getInputStream(zipFile.getEntry("file-0"));
-
-        /*
-         * Close the ZipFile. According to the RI, none if its InputStreams can
-         * be read after this point.
-         */
-        zipFile.close();
-        
-        Exception error = null;
-        try {
-            stream1.read(buf);
-        } catch (Exception ex) {
-            error = ex;
-        }
-        
-        assertNotNull("ZipFile shouldn't allow reading of closed files.", error);
-    }
-}
-
diff --git a/tests/CoreTests/android/core/ZipStreamTest.java b/tests/CoreTests/android/core/ZipStreamTest.java
deleted file mode 100644
index 74cfe82..0000000
--- a/tests/CoreTests/android/core/ZipStreamTest.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package android.core;
-
-import junit.framework.TestCase;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-import android.test.suitebuilder.annotation.LargeTest;
-
-/**
- * Basic tests for ZipStream
- */
-public class ZipStreamTest extends TestCase {
-
-    @LargeTest
-    public void testZipStream() throws Exception {
-        ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
-        createCompressedZip(bytesOut);
-
-        byte[] zipData = bytesOut.toByteArray();
-
-        /*
-        FileOutputStream outFile = new FileOutputStream("/tmp/foo.zip");
-        outFile.write(zipData, 0, zipData.length);
-        outFile.close();
-        */
-
-        /*
-        FileInputStream inFile = new FileInputStream("/tmp/foo.zip");
-        int inputLength = inFile.available();
-        zipData = new byte[inputLength];
-        if (inFile.read(zipData) != inputLength)
-            throw new RuntimeException();
-        inFile.close();
-        */
-
-        ByteArrayInputStream bytesIn = new ByteArrayInputStream(zipData);
-        scanZip(bytesIn);
-
-        bytesOut = new ByteArrayOutputStream();
-        createUncompressedZip(bytesOut);
-
-        zipData = bytesOut.toByteArray();
-
-        bytesIn = new ByteArrayInputStream(zipData);
-        scanZip(bytesIn);
-    }
-
-    /*
-     * stepStep == 0 --> >99% compression
-     * stepStep == 1 --> ~30% compression
-     * stepStep == 2 --> no compression
-     */
-    private static byte[] makeSampleFile(int stepStep) throws IOException {
-        byte[] sample = new byte[128 * 1024];
-        byte val, step;
-        int i, j, offset;
-
-        val = 0;
-        step = 1;
-        offset = 0;
-        for (i = 0; i < (128 * 1024) / 256; i++) {
-            for (j = 0; j < 256; j++) {
-                sample[offset++] = val;
-                val += step;
-            }
-
-            step += stepStep;
-        }
-
-        return sample;
-    }
-
-    private static void createCompressedZip(ByteArrayOutputStream bytesOut) throws IOException {
-        ZipOutputStream out = new ZipOutputStream(bytesOut);
-        try {
-            int i;
-
-            for (i = 0; i < 3; i++) {
-                byte[] input = makeSampleFile(i);
-                ZipEntry newEntry = new ZipEntry("file-" + i);
-
-                if (i != 1)
-                    newEntry.setComment("this is file " + i);
-                out.putNextEntry(newEntry);
-                out.write(input, 0, input.length);
-                out.closeEntry();
-            }
-
-            out.setComment("This is a lovely compressed archive!");
-        } finally {
-            out.close();
-        }
-    }
-
-    private static void createUncompressedZip(ByteArrayOutputStream bytesOut) throws IOException {
-        ZipOutputStream out = new ZipOutputStream(bytesOut);
-        try {
-            long[] crcs = {0x205fbff3, 0x906fae57L, 0x2c235131};
-            int i;
-
-            for (i = 0; i < 3; i++) {
-                byte[] input = makeSampleFile(i);
-                ZipEntry newEntry = new ZipEntry("file-" + i);
-
-                if (i != 1)
-                    newEntry.setComment("this is file " + i);
-                newEntry.setMethod(ZipEntry.STORED);
-                newEntry.setSize(128 * 1024);
-                newEntry.setCrc(crcs[i]);
-                out.putNextEntry(newEntry);
-                out.write(input, 0, input.length);
-                out.closeEntry();
-            }
-
-            out.setComment("This is a lovely, but uncompressed, archive!");
-        } finally {
-            out.close();
-        }
-    }
-
-    private static void scanZip(ByteArrayInputStream bytesIn) throws IOException {
-        ZipInputStream in = new ZipInputStream(bytesIn);
-        try {
-            int i;
-
-            for (i = 0; i < 3; i++) {
-                ZipEntry entry = in.getNextEntry();
-                ByteArrayOutputStream contents = new ByteArrayOutputStream();
-                byte[] buf = new byte[4096];
-                int len, totalLen = 0;
-
-                while ((len = in.read(buf)) > 0) {
-                    contents.write(buf, 0, len);
-                    totalLen += len;
-                }
-
-                assertEquals(128 * 1024, totalLen);
-
-//                System.out.println("ZipStreamTest: name='" + entry.getName()
-//                        + "', zero=" + contents.toByteArray()[0]
-//                        + ", tfs=" + contents.toByteArray()[257]
-//                        + ", crc=" + Long.toHexString(entry.getCrc()));
-            }
-
-            assertNull("should only be three entries", in.getNextEntry());
-        } finally {
-            in.close();
-        }
-    }
-}
-
diff --git a/tests/HwAccelerationTest/.classpath b/tests/HwAccelerationTest/.classpath
new file mode 100644
index 0000000..609aa00
--- /dev/null
+++ b/tests/HwAccelerationTest/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="gen"/>
+	<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/tests/HwAccelerationTest/.gitignore b/tests/HwAccelerationTest/.gitignore
new file mode 100644
index 0000000..f178f17
--- /dev/null
+++ b/tests/HwAccelerationTest/.gitignore
@@ -0,0 +1,3 @@
+bin
+gen
+local.properties
\ No newline at end of file
diff --git a/tests/HwAccelerationTest/.project b/tests/HwAccelerationTest/.project
new file mode 100644
index 0000000..7c04d3c
--- /dev/null
+++ b/tests/HwAccelerationTest/.project
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>HwAccelerationTest</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ResourceManagerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.PreCompilerBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>com.android.ide.eclipse.adt.ApkBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.android.ide.eclipse.adt.AndroidNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/tests/HwAccelerationTest/AndroidManifest.xml b/tests/HwAccelerationTest/AndroidManifest.xml
index 7fa71a9..c60613c 100644
--- a/tests/HwAccelerationTest/AndroidManifest.xml
+++ b/tests/HwAccelerationTest/AndroidManifest.xml
@@ -17,7 +17,8 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.android.test.hwui">
 
-    <uses-permission android:name="android.permission.INTERNET" />    
+    <uses-permission android:name="android.permission.INTERNET" />
+    <uses-sdk android:minSdkVersion="Froyo" />
     
     <application
         android:label="HwUi"
diff --git a/tests/HwAccelerationTest/default.properties b/tests/HwAccelerationTest/default.properties
new file mode 100644
index 0000000..5a8ea50
--- /dev/null
+++ b/tests/HwAccelerationTest/default.properties
@@ -0,0 +1,11 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-Froyo
diff --git a/tests/HwAccelerationTest/res/layout/advanced_blend.xml b/tests/HwAccelerationTest/res/layout/advanced_blend.xml
new file mode 100644
index 0000000..6efdd73
--- /dev/null
+++ b/tests/HwAccelerationTest/res/layout/advanced_blend.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.android.test.hwui.AdvancedBlendActivity.ShadersView
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent">
+</com.android.test.hwui.AdvancedBlendActivity.ShadersView>
diff --git a/tests/HwAccelerationTest/res/layout/advanced_gradient.xml b/tests/HwAccelerationTest/res/layout/advanced_gradient.xml
new file mode 100644
index 0000000..dd937f9
--- /dev/null
+++ b/tests/HwAccelerationTest/res/layout/advanced_gradient.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<com.android.test.hwui.AdvancedGradientsActivity.GradientsView
+  xmlns:android="http://schemas.android.com/apk/res/android"
+  android:layout_width="fill_parent"
+  android:layout_height="fill_parent">
+</com.android.test.hwui.AdvancedGradientsActivity.GradientsView>
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java
index 5baa20c..a83005b 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedBlendActivity.java
@@ -41,7 +41,7 @@
         setContentView(new ShadersView(this));
     }
 
-    static class ShadersView extends View {
+    public static class ShadersView extends View {
         private BitmapShader mScaledShader;
         private int mTexWidth;
         private int mTexHeight;
@@ -57,7 +57,7 @@
         private ComposeShader mCompose6Shader;
         private BitmapShader mScaled2Shader;
 
-        ShadersView(Context c) {
+        public ShadersView(Context c) {
             super(c);
 
             Bitmap texture = BitmapFactory.decodeResource(c.getResources(), R.drawable.sunset1);
@@ -71,7 +71,7 @@
             Matrix m2 = new Matrix();
             m2.setScale(0.5f, 0.5f);
             mScaledShader.setLocalMatrix(m2);
-            
+
             mScaled2Shader = new BitmapShader(texture, Shader.TileMode.MIRROR,
                     Shader.TileMode.MIRROR);
             Matrix m3 = new Matrix();
@@ -80,7 +80,7 @@
 
             mHorGradient = new LinearGradient(0.0f, 0.0f, mDrawWidth, 0.0f,
                     Color.BLACK, Color.WHITE, Shader.TileMode.CLAMP);
-            
+
             mComposeShader = new ComposeShader(mScaledShader, mHorGradient,
                     PorterDuff.Mode.DARKEN);
             mCompose2Shader = new ComposeShader(mScaledShader, mHorGradient,
@@ -107,7 +107,7 @@
 
             mPaint.setShader(mComposeShader);
             canvas.drawRect(0.0f, 0.0f, mDrawWidth, mDrawHeight, mPaint);
-            
+
             canvas.translate(0.0f, 40.0f + mDrawHeight);
             mPaint.setShader(mCompose2Shader);
             canvas.drawRect(0.0f, 0.0f, mDrawWidth, mDrawHeight, mPaint);
@@ -117,10 +117,10 @@
             canvas.drawRect(0.0f, 0.0f, mDrawWidth, mDrawHeight, mPaint);
 
             canvas.restore();
-            
+
             canvas.save();
             canvas.translate(40.0f + mDrawWidth + 40.0f, 40.0f);
-            
+
             mPaint.setShader(mCompose4Shader);
             canvas.drawRect(0.0f, 0.0f, mDrawWidth, mDrawHeight, mPaint);
 
@@ -131,7 +131,7 @@
             canvas.translate(0.0f, 40.0f + mDrawHeight);
             mPaint.setShader(mCompose6Shader);
             canvas.drawRect(0.0f, 0.0f, mDrawWidth, mDrawHeight, mPaint);
-            
+
             canvas.restore();
         }
     }
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedGradientsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedGradientsActivity.java
index 27974e7..b0b54eb 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedGradientsActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/AdvancedGradientsActivity.java
@@ -36,7 +36,7 @@
         setContentView(new GradientsView(this));
     }
 
-    static class GradientsView extends View {
+    public static class GradientsView extends View {
         private final Paint mPaint;
         private final SweepGradient mSweepGradient;
         private final RadialGradient mRadialGradient;
@@ -44,7 +44,7 @@
         private final Matrix mMatrix2;
         private final Matrix mMatrix3;
 
-        GradientsView(Context c) {
+        public GradientsView(Context c) {
             super(c);
 
             mSweepGradient = new SweepGradient(0.0f, 0.0f, 0xff000000, 0xffffffff);
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
index 8fa626b..f8422f4 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/GradientsActivity.java
@@ -51,15 +51,12 @@
         final SeekBar rotateView = new SeekBar(this);
         rotateView.setMax(360);
         rotateView.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
-            @Override
             public void onStopTrackingTouch(SeekBar seekBar) {
             }
 
-            @Override
             public void onStartTrackingTouch(SeekBar seekBar) {
             }
 
-            @Override
             public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
                 gradientView.setRotationY((float) progress);
                 radialGradientView.setRotationX((float) progress);
@@ -67,7 +64,7 @@
                 bitmapView.setRotationX((float) progress);
             }
         });
-        
+
         layout.addView(shadersView);
         layout.addView(gradientView, new FrameLayout.LayoutParams(
                 200, 200, Gravity.CENTER));
@@ -90,7 +87,7 @@
 
         setContentView(layout);
     }
-    
+
     static class BitmapView extends View {
         private final Paint mPaint;
 
@@ -116,7 +113,7 @@
             canvas.drawRect(0.0f, 0.0f, getWidth(), getHeight(), mPaint);
         }
     }
-    
+
     static class GradientView extends View {
         private final Paint mPaint;
 
@@ -166,14 +163,14 @@
             canvas.drawRect(0.0f, 0.0f, getWidth(), getHeight(), mPaint);
         }
     }
-    
+
     static class SweepGradientView extends View {
         private final Paint mPaint;
 
         SweepGradientView(Context c) {
             super(c);
 
-            SweepGradient gradient = new SweepGradient(100.0f, 100.0f, 0xff000000, 0xffffffff);                
+            SweepGradient gradient = new SweepGradient(100.0f, 100.0f, 0xff000000, 0xffffffff);
             mPaint = new Paint();
             mPaint.setShader(gradient);
         }
@@ -190,7 +187,7 @@
             canvas.drawRect(0.0f, 0.0f, getWidth(), getHeight(), mPaint);
         }
     }
-        
+
     static class ShadersView extends View {
         private final Paint mPaint;
         private final float mDrawWidth;
@@ -232,12 +229,12 @@
 
             top += 40.0f + mDrawHeight;
             bottom += 40.0f + mDrawHeight;
-            
+
             mMatrix.setScale(1, mDrawHeight);
             mMatrix.postTranslate(left, top);
             mGradient.setLocalMatrix(mMatrix);
             canvas.drawRect(left, top, right, top + mDrawHeight, mPaint);
-            
+
             left += 40.0f + mDrawWidth;
             right += 40.0f + mDrawWidth;
             top -= 40.0f + mDrawHeight;
@@ -251,13 +248,13 @@
 
             top += 40.0f + mDrawHeight;
             bottom += 40.0f + mDrawHeight;
-            
+
             mMatrix.setScale(1, mDrawWidth);
             mMatrix.postRotate(-90);
             mMatrix.postTranslate(left, top);
             mGradient.setLocalMatrix(mMatrix);
             canvas.drawRect(left, top, left + mDrawWidth, bottom, mPaint);
-           
+
             canvas.restore();
         }
     }
diff --git a/tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java b/tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java
index 773d390..f40b89d 100644
--- a/tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java
+++ b/tests/HwAccelerationTest/src/com/android/test/hwui/TextGammaActivity.java
@@ -43,9 +43,8 @@
         ));
 
         setContentView(layout);
-        
+
         layout.post(new Runnable() {
-            @Override
             public void run() {
                 Bitmap b = Bitmap.createBitmap(gamma.getWidth(), gamma.getHeight(),
                         Bitmap.Config.ARGB_8888);
@@ -88,7 +87,7 @@
 
             final LinearLayout layout = new LinearLayout(this);
             layout.setOrientation(LinearLayout.VERTICAL);
-        
+
             final GammaTextView gamma = new GammaTextView(this);
             final LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
                     LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT
diff --git a/tools/aapt/Command.cpp b/tools/aapt/Command.cpp
index 16fa95a..8ac7590 100644
--- a/tools/aapt/Command.cpp
+++ b/tools/aapt/Command.cpp
@@ -907,10 +907,10 @@
                                     error.string());
                                 goto bail;
                         }
-                    } else if (tag == "uses-gl-texture") {
+                    } else if (tag == "supports-gl-texture") {
                         String8 name = getAttribute(tree, NAME_ATTR, &error);
                         if (name != "" && error == "") {
-                            printf("uses-gl-texture:'%s'\n", name.string());
+                            printf("supports-gl-texture:'%s'\n", name.string());
                         } else {
                             fprintf(stderr, "ERROR getting 'android:name' attribute: %s\n",
                                     error.string());
diff --git a/tools/layoutlib/bridge/.classpath b/tools/layoutlib/bridge/.classpath
index 7204ace..2102eb1 100644
--- a/tools/layoutlib/bridge/.classpath
+++ b/tools/layoutlib/bridge/.classpath
@@ -6,7 +6,7 @@
 	<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
 	<classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/layoutlib_api/layoutlib_api-prebuilt.jar"/>
 	<classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/kxml2/kxml2-2.3.0.jar" sourcepath="/ANDROID_PLAT_SRC/dalvik/libcore/xml/src/main/java"/>
-	<classpathentry kind="var" path="ANDROID_PLAT_OUT_FRAMEWORK/ninepatch.jar" sourcepath="/ANDROID_PLAT_SRC/development/tools/ninepatch/src"/>
 	<classpathentry kind="var" path="ANDROID_PLAT_SRC/out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar" sourcepath="/ANDROID_PLAT_SRC/frameworks/base"/>
+	<classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/ninepatch/ninepatch-prebuilt.jar"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/tools/layoutlib/bridge/Android.mk b/tools/layoutlib/bridge/Android.mk
index b7a602a..9b7bc5f 100644
--- a/tools/layoutlib/bridge/Android.mk
+++ b/tools/layoutlib/bridge/Android.mk
@@ -21,7 +21,7 @@
 LOCAL_JAVA_LIBRARIES := \
 	kxml2-2.3.0 \
 	layoutlib_api-prebuilt \
-	ninepatch
+	ninepatch-prebuilt
 
 LOCAL_STATIC_JAVA_LIBRARIES := temp_layoutlib
 
diff --git a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java
index cd62baf..626f878 100644
--- a/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java
+++ b/tools/layoutlib/bridge/src/android/graphics/BitmapFactory.java
@@ -351,6 +351,7 @@
                 If the exception happened on open, bm will be null.
                 If it happened on close, bm is still valid.
             */
+            Bridge.getLog().error(null, e);
         } finally {
             try {
                 if (is != null) is.close();
diff --git a/tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java
index 042d557..bc4ccd2 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Gradient_Delegate.java
@@ -119,20 +119,23 @@
                             pos = 0.f;
                             break;
                         case REPEAT:
-                            // remove the integer part to stay in the [0,1] range
-                            // careful: this is a negative value, so use ceil instead of floor
-                            pos = pos - (float)Math.ceil(pos);
+                            // remove the integer part to stay in the [0,1] range.
+                            // we also need to invert the value from [-1,0] to [0, 1]
+                            pos = pos - (float)Math.floor(pos);
                             break;
                         case MIRROR:
+                            // this is the same as the positive side, just make the value positive
+                            // first.
+                            pos = Math.abs(pos);
+
                             // get the integer and the decimal part
-                            // careful: this is a negative value, so use ceil instead of floor
-                            int intPart = (int)Math.ceil(pos);
+                            int intPart = (int)Math.floor(pos);
                             pos = pos - intPart;
-                            // 0  -> -1 : mirrored order
-                            // -1 -> -2: normal order
+                            // 0 -> 1 : normal order
+                            // 1 -> 2: mirrored
                             // etc..
-                            // this means if the intpart is even we invert
-                            if ((intPart % 2) == 0) {
+                            // this means if the intpart is odd we invert
+                            if ((intPart % 2) == 1) {
                                 pos = 1.f - pos;
                             }
                             break;
diff --git a/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java
index 7573dc1..862b4544 100644
--- a/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/LinearGradient_Delegate.java
@@ -16,11 +16,14 @@
 
 package android.graphics;
 
+import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 
 import android.graphics.Shader.TileMode;
 
 import java.awt.Paint;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
 
 /**
  * Delegate implementing the native methods of android.graphics.LinearGradient
@@ -115,7 +118,7 @@
      * {@link java.awt.GradientPaint} only supports 2 points and does not support Android's tile
      * modes.
      */
-    private static class LinearGradientPaint extends GradientPaint {
+    private class LinearGradientPaint extends GradientPaint {
 
         private final float mX0;
         private final float mY0;
@@ -126,11 +129,11 @@
         public LinearGradientPaint(float x0, float y0, float x1, float y1, int colors[],
                 float positions[], TileMode tile) {
             super(colors, positions, tile);
-                mX0 = x0;
-                mY0 = y0;
-                mDx = x1 - x0;
-                mDy = y1 - y0;
-                mDSize2 = mDx * mDx + mDy * mDy;
+            mX0 = x0;
+            mY0 = y0;
+            mDx = x1 - x0;
+            mDy = y1 - y0;
+            mDSize2 = mDx * mDx + mDy * mDy;
         }
 
         public java.awt.PaintContext createContext(
@@ -140,16 +143,37 @@
                 java.awt.geom.AffineTransform  xform,
                 java.awt.RenderingHints        hints) {
             precomputeGradientColors();
-            return new LinearGradientPaintContext(colorModel);
+
+            AffineTransform canvasMatrix;
+            try {
+                canvasMatrix = xform.createInverse();
+            } catch (NoninvertibleTransformException e) {
+                Bridge.getLog().error(null, "Unable to inverse matrix in LinearGradient", e);
+                canvasMatrix = new AffineTransform();
+            }
+
+            AffineTransform localMatrix = getLocalMatrix();
+            try {
+                localMatrix = localMatrix.createInverse();
+            } catch (NoninvertibleTransformException e) {
+                Bridge.getLog().error(null, "Unable to inverse matrix in LinearGradient", e);
+                localMatrix = new AffineTransform();
+            }
+
+            return new LinearGradientPaintContext(canvasMatrix, localMatrix, colorModel);
         }
 
         private class LinearGradientPaintContext implements java.awt.PaintContext {
 
+            private final AffineTransform mCanvasMatrix;
+            private final AffineTransform mLocalMatrix;
             private final java.awt.image.ColorModel mColorModel;
 
-            public LinearGradientPaintContext(java.awt.image.ColorModel colorModel) {
+            public LinearGradientPaintContext(AffineTransform canvasMatrix,
+                    AffineTransform localMatrix, java.awt.image.ColorModel colorModel) {
+                mCanvasMatrix = canvasMatrix;
+                mLocalMatrix = localMatrix;
                 mColorModel = colorModel;
-                // FIXME: so far all this is always the same rect gotten in getRaster with an identity matrix?
             }
 
             public void dispose() {
@@ -165,31 +189,22 @@
 
                 int[] data = new int[w*h];
 
-                if (mDx == 0) { // vertical gradient
-                    // compute first column and copy to all other columns
-                    int index = 0;
-                    for (int iy = 0 ; iy < h ; iy++) {
-                        int color = getColor(iy + y, mY0, mDy);
-                        for (int ix = 0 ; ix < w ; ix++) {
-                            data[index++] = color;
-                        }
-                    }
-                } else if (mDy == 0) { // horizontal
-                    // compute first line in a tmp array and copy to all lines
-                    int[] line = new int[w];
+                int index = 0;
+                float[] pt1 = new float[2];
+                float[] pt2 = new float[2];
+                for (int iy = 0 ; iy < h ; iy++) {
                     for (int ix = 0 ; ix < w ; ix++) {
-                        line[ix] = getColor(ix + x, mX0, mDx);
-                    }
+                        // handle the canvas transform
+                        pt1[0] = x + ix;
+                        pt1[1] = y + iy;
+                        mCanvasMatrix.transform(pt1, 0, pt2, 0, 1);
 
-                    for (int iy = 0 ; iy < h ; iy++) {
-                        System.arraycopy(line, 0, data, iy*w, line.length);
-                    }
-                } else {
-                    int index = 0;
-                    for (int iy = 0 ; iy < h ; iy++) {
-                        for (int ix = 0 ; ix < w ; ix++) {
-                            data[index++] = getColor(ix + x, iy + y);
-                        }
+                        // handle the local matrix.
+                        pt1[0] = pt2[0];
+                        pt1[1] = pt2[1];
+                        mLocalMatrix.transform(pt1, 0, pt2, 0, 1);
+
+                        data[index++] = getColor(pt2[0], pt2[1]);
                     }
                 }
 
@@ -199,13 +214,6 @@
             }
         }
 
-        /** Returns a color for the easy vertical/horizontal mode */
-        private int getColor(float absPos, float refPos, float refSize) {
-            float pos = (absPos - refPos) / refSize;
-
-            return getGradientColor(pos);
-        }
-
         /**
          * Returns a color for an arbitrary point.
          */
diff --git a/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
index b2333f6..6b43544 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java
@@ -471,7 +471,7 @@
             return false;
         }
 
-        d.preTransform(getRotate(degrees, px, py));
+        d.postTransform(getRotate(degrees, px, py));
         return true;
     }
 
@@ -869,7 +869,7 @@
              tmpDest = new float[dstIndex + pointCount * 2];
          }
 
-         for (int i = 0 ; i < pointCount ; i++) {
+         for (int i = 0 ; i < pointCount * 2 ; i += 2) {
              // just in case we are doing in place, we better put this in temp vars
              float x = mValues[0] * src[i + srcIndex] +
                        mValues[1] * src[i + srcIndex + 1] +
diff --git a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
index a6c6dfd..95663ec 100644
--- a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java
@@ -167,7 +167,7 @@
 
        try {
            chunkObject.draw(bitmap_delegate.getImage(), graphics,
-                   left, top, right - left, bottom - top);
+                   left, top, right - left, bottom - top, destDensity, srcDensity);
        } finally {
            if (paint_delegate != null) {
                graphics.dispose();
diff --git a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java
index c36ce53..eebf378 100644
--- a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java
@@ -16,11 +16,14 @@
 
 package android.graphics;
 
+import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 
 import android.graphics.Shader.TileMode;
 
 import java.awt.Paint;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
 
 /**
  * Delegate implementing the native methods of android.graphics.RadialGradient
@@ -105,18 +108,17 @@
     private RadialGradient_Delegate(float x, float y, float radius, int colors[], float positions[],
             TileMode tile) {
         super(colors, positions);
-
         mJavaPaint = new RadialGradientPaint(x, y, radius, mColors, mPositions, tile);
     }
 
-    private static class RadialGradientPaint extends GradientPaint {
+    private class RadialGradientPaint extends GradientPaint {
 
         private final float mX;
         private final float mY;
         private final float mRadius;
 
-        public RadialGradientPaint(float x, float y, float radius, int[] colors, float[] positions,
-                TileMode mode) {
+        public RadialGradientPaint(float x, float y, float radius,
+                int[] colors, float[] positions, TileMode mode) {
             super(colors, positions, mode);
             mX = x;
             mY = y;
@@ -130,14 +132,36 @@
                 java.awt.geom.AffineTransform xform,
                 java.awt.RenderingHints       hints) {
             precomputeGradientColors();
-            return new RadialGradientPaintContext(colorModel);
+
+            AffineTransform canvasMatrix;
+            try {
+                canvasMatrix = xform.createInverse();
+            } catch (NoninvertibleTransformException e) {
+                Bridge.getLog().error(null, "Unable to inverse matrix in RadialGradient", e);
+                canvasMatrix = new AffineTransform();
+            }
+
+            AffineTransform localMatrix = getLocalMatrix();
+            try {
+                localMatrix = localMatrix.createInverse();
+            } catch (NoninvertibleTransformException e) {
+                Bridge.getLog().error(null, "Unable to inverse matrix in RadialGradient", e);
+                localMatrix = new AffineTransform();
+            }
+
+            return new RadialGradientPaintContext(canvasMatrix, localMatrix, colorModel);
         }
 
         private class RadialGradientPaintContext implements java.awt.PaintContext {
 
+            private final AffineTransform mCanvasMatrix;
+            private final AffineTransform mLocalMatrix;
             private final java.awt.image.ColorModel mColorModel;
 
-            public RadialGradientPaintContext(java.awt.image.ColorModel colorModel) {
+            public RadialGradientPaintContext(AffineTransform canvasMatrix,
+                    AffineTransform localMatrix, java.awt.image.ColorModel colorModel) {
+                mCanvasMatrix = canvasMatrix;
+                mLocalMatrix = localMatrix;
                 mColorModel = colorModel;
             }
 
@@ -157,10 +181,22 @@
                 // compute distance from each point to the center, and figure out the distance from
                 // it.
                 int index = 0;
+                float[] pt1 = new float[2];
+                float[] pt2 = new float[2];
                 for (int iy = 0 ; iy < h ; iy++) {
                     for (int ix = 0 ; ix < w ; ix++) {
-                        float _x = x + ix - mX;
-                        float _y = y + iy - mY;
+                        // handle the canvas transform
+                        pt1[0] = x + ix;
+                        pt1[1] = y + iy;
+                        mCanvasMatrix.transform(pt1, 0, pt2, 0, 1);
+
+                        // handle the local matrix
+                        pt1[0] = pt2[0] - mX;
+                        pt1[1] = pt2[1] - mY;
+                        mLocalMatrix.transform(pt1, 0, pt2, 0, 1);
+
+                        float _x = pt2[0];
+                        float _y = pt2[1];
                         float distance = (float) Math.sqrt(_x * _x + _y * _y);
 
                         data[index++] = getGradientColor(distance / mRadius);
diff --git a/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java
index 646ac80..7bf1443 100644
--- a/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/Shader_Delegate.java
@@ -18,6 +18,8 @@
 
 import com.android.layoutlib.bridge.impl.DelegateManager;
 
+import java.awt.geom.AffineTransform;
+
 /**
  * Delegate implementing the native methods of android.graphics.Shader
  *
@@ -109,4 +111,19 @@
 
     // ---- Private delegate/helper methods ----
 
+    protected AffineTransform getLocalMatrix() {
+        Matrix_Delegate localMatrixDelegate = null;
+        if (mLocalMatrix > 0) {
+            localMatrixDelegate = Matrix_Delegate.getDelegate(mLocalMatrix);
+            if (localMatrixDelegate == null) {
+                assert false;
+                return new AffineTransform();
+            }
+
+            return localMatrixDelegate.getAffineTransform();
+        }
+
+        return new AffineTransform();
+    }
+
 }
diff --git a/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java
index 358c3c7..97c3cfd 100644
--- a/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/graphics/SweepGradient_Delegate.java
@@ -16,9 +16,12 @@
 
 package android.graphics;
 
+import com.android.layoutlib.bridge.Bridge;
 import com.android.layoutlib.bridge.impl.DelegateManager;
 
 import java.awt.Paint;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.NoninvertibleTransformException;
 
 /**
  * Delegate implementing the native methods of android.graphics.SweepGradient
@@ -90,16 +93,16 @@
     private SweepGradient_Delegate(float cx, float cy,
                          int colors[], float positions[]) {
         super(colors, positions);
-
         mJavaPaint = new SweepGradientPaint(cx, cy, mColors, mPositions);
     }
 
-    private static class SweepGradientPaint extends GradientPaint {
+    private class SweepGradientPaint extends GradientPaint {
 
         private final float mCx;
         private final float mCy;
 
-        public SweepGradientPaint(float cx, float cy, int[] colors, float[] positions) {
+        public SweepGradientPaint(float cx, float cy, int[] colors,
+                float[] positions) {
             super(colors, positions, null /*tileMode*/);
             mCx = cx;
             mCy = cy;
@@ -112,14 +115,36 @@
                 java.awt.geom.AffineTransform xform,
                 java.awt.RenderingHints       hints) {
             precomputeGradientColors();
-            return new SweepGradientPaintContext(colorModel);
+
+            AffineTransform canvasMatrix;
+            try {
+                canvasMatrix = xform.createInverse();
+            } catch (NoninvertibleTransformException e) {
+                Bridge.getLog().error(null, "Unable to inverse matrix in SweepGradient", e);
+                canvasMatrix = new AffineTransform();
+            }
+
+            AffineTransform localMatrix = getLocalMatrix();
+            try {
+                localMatrix = localMatrix.createInverse();
+            } catch (NoninvertibleTransformException e) {
+                Bridge.getLog().error(null, "Unable to inverse matrix in SweepGradient", e);
+                localMatrix = new AffineTransform();
+            }
+
+            return new SweepGradientPaintContext(canvasMatrix, localMatrix, colorModel);
         }
 
         private class SweepGradientPaintContext implements java.awt.PaintContext {
 
+            private final AffineTransform mCanvasMatrix;
+            private final AffineTransform mLocalMatrix;
             private final java.awt.image.ColorModel mColorModel;
 
-            public SweepGradientPaintContext(java.awt.image.ColorModel colorModel) {
+            public SweepGradientPaintContext(AffineTransform canvasMatrix,
+                    AffineTransform localMatrix, java.awt.image.ColorModel colorModel) {
+                mCanvasMatrix = canvasMatrix;
+                mLocalMatrix = localMatrix;
                 mColorModel = colorModel;
             }
 
@@ -139,10 +164,23 @@
                 // compute angle from each point to the center, and figure out the distance from
                 // it.
                 int index = 0;
+                float[] pt1 = new float[2];
+                float[] pt2 = new float[2];
                 for (int iy = 0 ; iy < h ; iy++) {
                     for (int ix = 0 ; ix < w ; ix++) {
-                        float dx = x + ix - mCx;
-                        float dy = y + iy - mCy;
+                        // handle the canvas transform
+                        pt1[0] = x + ix;
+                        pt1[1] = y + iy;
+                        mCanvasMatrix.transform(pt1, 0, pt2, 0, 1);
+
+                        // handle the local matrix
+                        pt1[0] = pt2[0] - mCx;
+                        pt1[1] = pt2[1] - mCy;
+                        mLocalMatrix.transform(pt1, 0, pt2, 0, 1);
+
+                        float dx = pt2[0];
+                        float dy = pt2[1];
+
                         float angle;
                         if (dx == 0) {
                             angle = (float) (dy < 0 ? 3 * Math.PI / 2 : Math.PI / 2);
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java
index 6146cd4..24cf380 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/LayoutSceneImpl.java
@@ -152,6 +152,8 @@
             return result;
         }
 
+        Bridge.setLog(mParams.getLog());
+
         // setup the display Metrics.
         DisplayMetrics metrics = new DisplayMetrics();
         metrics.densityDpi = mParams.getDensity();
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
index 13f0f4a7..f03931f 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java
@@ -48,7 +48,7 @@
 import java.util.regex.Pattern;
 
 /**
- * Helper class to provide various convertion method used in handling android resources.
+ * Helper class to provide various conversion method used in handling android resources.
  */
 public final class ResourceHelper {
 
@@ -133,7 +133,8 @@
                 // if either chunk or bitmap is null, then we reload the 9-patch file.
                 if (chunk == null || bitmap == null) {
                     try {
-                        NinePatch ninePatch = NinePatch.load(file.toURL(), false /* convert */);
+                        NinePatch ninePatch = NinePatch.load(file.toURI().toURL(),
+                                false /* convert */);
                         if (ninePatch != null) {
                             if (chunk == null) {
                                 chunk = ninePatch.getChunk();
@@ -161,6 +162,7 @@
                         // URL is wrong, we'll return null below
                     } catch (IOException e) {
                         // failed to read the file, we'll return null below.
+                        Bridge.getLog().error(null, e);
                     }
                 }
 
@@ -176,7 +178,7 @@
 
             return null;
         } else if (lowerCaseValue.endsWith(".xml")) {
-            // create a blockparser for the file
+            // create a block parser for the file
             File f = new File(stringValue);
             if (f.isFile()) {
                 try {
@@ -220,7 +222,7 @@
                     return new BitmapDrawable(context.getResources(), bitmap);
                 } catch (IOException e) {
                     // we'll return null below
-                    // TODO: log the error.
+                    Bridge.getLog().error(null, e);
                 }
             } else {
                 // attempt to get a color from the value
@@ -229,7 +231,8 @@
                     return new ColorDrawable(color);
                 } catch (NumberFormatException e) {
                     // we'll return null below.
-                    // TODO: log the error
+                    Bridge.getLog().error(null,
+                            "failed to convert " + stringValue + " into a drawable");
                 }
             }
         }