Merge "Allow sniffers to return a packet of opaque data that the corresponding extractor can take advantage of to not duplicate work already done sniffing. The mp3 extractor takes advantage of this now." into gingerbread
diff --git a/core/jni/AndroidRuntime.cpp b/core/jni/AndroidRuntime.cpp
index 407d2e7..62a4495 100644
--- a/core/jni/AndroidRuntime.cpp
+++ b/core/jni/AndroidRuntime.cpp
@@ -506,7 +506,7 @@
 static void readLocale(char* language, char* region)
 {
     char propLang[PROPERTY_VALUE_MAX], propRegn[PROPERTY_VALUE_MAX];
-    
+
     property_get("persist.sys.language", propLang, "");
     property_get("persist.sys.country", propRegn, "");
     if (*propLang == 0 && *propRegn == 0) {
@@ -710,6 +710,33 @@
         LOGW("dalvik.vm.gc.overwritefree should be 'true' or 'false'");
     }
 
+    /* enable heap verification before each gc */
+    property_get("dalvik.vm.gc.preverify", propBuf, "false");
+    if (strcmp(propBuf, "true") == 0) {
+        opt.optionString = "-Xgc:preverify";
+        mOptions.add(opt);
+    } else if (strcmp(propBuf, "false") != 0) {
+        LOGW("dalvik.vm.gc.preverify should be 'true' or 'false'");
+    }
+
+    /* enable heap verification after each gc */
+    property_get("dalvik.vm.gc.postverify", propBuf, "false");
+    if (strcmp(propBuf, "true") == 0) {
+        opt.optionString = "-Xgc:postverify";
+        mOptions.add(opt);
+    } else if (strcmp(propBuf, "false") != 0) {
+        LOGW("dalvik.vm.gc.postverify should be 'true' or 'false'");
+    }
+
+    /* enable card table verification for partial gc */
+    property_get("dalvik.vm.gc.verifycardtable", propBuf, "false");
+    if (strcmp(propBuf, "true") == 0) {
+        opt.optionString = "-Xgc:verifycardtable";
+        mOptions.add(opt);
+    } else if (strcmp(propBuf, "false") != 0) {
+        LOGW("dalvik.vm.gc.verifycardtable should be 'true' or 'false'");
+    }
+
     /* enable debugging; set suspend=y to pause during VM init */
 #ifdef HAVE_ANDROID_OS
     /* use android ADB transport */
@@ -757,16 +784,6 @@
     }
 
 #if defined(WITH_JIT)
-    /* Minimal profile threshold to trigger JIT compilation */
-    char jitThresholdBuf[sizeof("-Xjitthreshold:") + PROPERTY_VALUE_MAX];
-    property_get("dalvik.vm.jit.threshold", propBuf, "");
-    if (strlen(propBuf) > 0) {
-        strcpy(jitThresholdBuf, "-Xjitthreshold:");
-        strcat(jitThresholdBuf, propBuf);
-        opt.optionString = jitThresholdBuf;
-        mOptions.add(opt);
-    }
-
     /* Force interpreter-only mode for selected opcodes. Eg "1-0a,3c,f1-ff" */
     char jitOpBuf[sizeof("-Xjitop:") + PROPERTY_VALUE_MAX];
     property_get("dalvik.vm.jit.op", propBuf, "");
@@ -777,16 +794,6 @@
         mOptions.add(opt);
     }
 
-    /*
-     * Reverse the polarity of dalvik.vm.jit.op and force interpreter-only
-     * for non-selected opcodes.
-     */
-    property_get("dalvik.vm.jit.includeop", propBuf, "");
-    if (strlen(propBuf) > 0) {
-        opt.optionString = "-Xincludeselectedop";
-        mOptions.add(opt);
-    }
-
     /* Force interpreter-only mode for selected methods */
     char jitMethodBuf[sizeof("-Xjitmethod:") + PROPERTY_VALUE_MAX];
     property_get("dalvik.vm.jit.method", propBuf, "");
@@ -796,37 +803,6 @@
         opt.optionString = jitMethodBuf;
         mOptions.add(opt);
     }
-
-    /*
-     * Reverse the polarity of dalvik.vm.jit.method and force interpreter-only
-     * for non-selected methods.
-     */
-    property_get("dalvik.vm.jit.includemethod", propBuf, "");
-    if (strlen(propBuf) > 0) {
-        opt.optionString = "-Xincludeselectedmethod";
-        mOptions.add(opt);
-    }
-
-    /*
-     * Enable profile collection on JIT'ed code.
-     */
-    property_get("dalvik.vm.jit.profile", propBuf, "");
-    if (strlen(propBuf) > 0) {
-        opt.optionString = "-Xjitprofile";
-        mOptions.add(opt);
-    }
-
-    /*
-     * Disable optimizations by setting the corresponding bit to 1.
-     */
-    char jitOptBuf[sizeof("-Xjitdisableopt:") + PROPERTY_VALUE_MAX];
-    property_get("dalvik.vm.jit.disableopt", propBuf, "");
-    if (strlen(propBuf) > 0) {
-        strcpy(jitOptBuf, "-Xjitdisableopt:");
-        strcat(jitOptBuf, propBuf);
-        opt.optionString = jitOptBuf;
-        mOptions.add(opt);
-    }
 #endif
 
     if (executionMode == kEMIntPortable) {
diff --git a/media/libmedia/fixedfft.cpp b/media/libmedia/fixedfft.cpp
index 28eb05a..9cf05ba 100644
--- a/media/libmedia/fixedfft.cpp
+++ b/media/libmedia/fixedfft.cpp
@@ -26,7 +26,9 @@
 
 #include <stdio.h>
 #include <stdint.h>
+#ifdef __ARM_ARCH__
 #include <machine/cpu-features.h>
+#endif
 
 #define LOG_FFT_SIZE 10
 #define MAX_FFT_SIZE (1 << LOG_FFT_SIZE)
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 6f3c66d..03d7a02 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -196,12 +196,16 @@
     } else {
 slowpath:
         GGLSurface t;
-        status_t res = buffer->lock(&t, GRALLOC_USAGE_SW_READ_OFTEN);
-        LOGE_IF(res, "error %d (%s) locking buffer %p",
-                res, strerror(res), buffer.get());
-        if (res == NO_ERROR) {
-            mBufferManager.loadTexture(dirty, t);
-            buffer->unlock();
+        if (buffer->usage & GRALLOC_USAGE_SW_READ_MASK) {
+            status_t res = buffer->lock(&t, GRALLOC_USAGE_SW_READ_OFTEN);
+            LOGE_IF(res, "error %d (%s) locking buffer %p",
+                    res, strerror(res), buffer.get());
+            if (res == NO_ERROR) {
+                mBufferManager.loadTexture(dirty, t);
+                buffer->unlock();
+            }
+        } else {
+            // we can't do anything
         }
     }
 }
diff --git a/tests/CoreTests/android/core/JavaPerformanceTests.java b/tests/CoreTests/android/core/JavaPerformanceTests.java
index fbe70cc..95075ea 100644
--- a/tests/CoreTests/android/core/JavaPerformanceTests.java
+++ b/tests/CoreTests/android/core/JavaPerformanceTests.java
@@ -23,7 +23,6 @@
 
     public static String[] children() {
         return new String[] {
-                StringTest.class.getName(),
                 HashMapPerformanceTest.class.getName(),
                 ArrayListPerformanceTest.class.getName(),
                 TreeMapPerformanceTest.class.getName(),
diff --git a/tests/CoreTests/android/core/StringTest.java b/tests/CoreTests/android/core/StringTest.java
deleted file mode 100644
index 128531c..0000000
--- a/tests/CoreTests/android/core/StringTest.java
+++ /dev/null
@@ -1,951 +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.util.Locale;
-
-import android.test.PerformanceTestBase;
-import android.test.PerformanceTestCase;
-
-public class StringTest extends PerformanceTestBase {
-    public static final int ITERATIONS = 1000;
-    public static final String STATIC_STRING_01 = "Hello Android";
-    public static final String STATIC_STRING_02 =
-            "Remember, today is the tomorrow you worried about yesterday";
-    public static final char[] STATIC_CHAR_ARRAY =
-            {'N', 'A', 'N', 'D', 'R', 'O', 'I', 'D'};
-    public static StringBuffer STATIC_SBUF = new StringBuffer(STATIC_STRING_02);
-
-    @Override
-    public int startPerformance(PerformanceTestCase.Intermediates intermediates) {
-        intermediates.setInternalIterations(ITERATIONS);
-        return 0;
-    }
-
-    /** Create an empty String object* */
-
-    public void testStringCreate() {
-        String rString;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = new String();
-            rString = new String();
-            rString = new String();
-            rString = new String();
-            rString = new String();
-            rString = new String();
-            rString = new String();
-            rString = new String();
-            rString = new String();
-            rString = new String();
-        }
-    }
-
-    /** Create an initialised String object* */
-
-    public void testStringCreate1() {
-        String rString, str = STATIC_STRING_01;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = new String(str);
-            rString = new String(str);
-            rString = new String(str);
-            rString = new String(str);
-            rString = new String(str);
-            rString = new String(str);
-            rString = new String(str);
-            rString = new String(str);
-            rString = new String(str);
-            rString = new String(str); // 10
-        }
-    }
-
-    /** equals() with for loop* */
-    public void testStringEquals() {
-        String mString = new String(STATIC_STRING_01);
-        String str = STATIC_STRING_01;
-        boolean result;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            result = mString.equals(str);
-            result = mString.equals(str);
-            result = mString.equals(str);
-            result = mString.equals(str);
-            result = mString.equals(str);
-            result = mString.equals(str);
-            result = mString.equals(str);
-            result = mString.equals(str);
-            result = mString.equals(str);
-            result = mString.equals(str);
-        }
-    }
-
-    /**
-     * ContentEquals- Comparing the content of a String with that of a String
-     * Buffer*
-     */
-
-    public void testStringContentEquals() {
-        StringBuffer sBuf = new StringBuffer(STATIC_STRING_01);
-        String str = STATIC_STRING_01;
-        boolean result;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            result = str.contentEquals(sBuf);
-            result = str.contentEquals(sBuf);
-            result = str.contentEquals(sBuf);
-            result = str.contentEquals(sBuf);
-            result = str.contentEquals(sBuf);
-            result = str.contentEquals(sBuf);
-            result = str.contentEquals(sBuf);
-            result = str.contentEquals(sBuf);
-            result = str.contentEquals(sBuf);
-            result = str.contentEquals(sBuf);
-        }
-    }
-
-    /** Compare string objects lexicographically using compareTo() with for loop* */
-
-    public void testStringCompareTo() {
-        String str1 = new String(STATIC_STRING_01);
-        String str2 = STATIC_STRING_01;
-        int result;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            result = str1.compareTo(str2);
-            result = str1.compareTo(str2);
-            result = str1.compareTo(str2);
-            result = str1.compareTo(str2);
-            result = str1.compareTo(str2);
-            result = str1.compareTo(str2);
-            result = str1.compareTo(str2);
-            result = str1.compareTo(str2);
-            result = str1.compareTo(str2);
-            result = str1.compareTo(str2);
-        }
-
-    }
-
-    /** Compare string objects using compareToIgnorecase() with for loop* */
-
-    public void testStringCompareToIgnoreCase() {
-        String mString = new String(STATIC_STRING_01);
-        String str2 = STATIC_STRING_01;
-        int result;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            result = mString.compareToIgnoreCase(str2);
-            result = mString.compareToIgnoreCase(str2);
-            result = mString.compareToIgnoreCase(str2);
-            result = mString.compareToIgnoreCase(str2);
-            result = mString.compareToIgnoreCase(str2);
-            result = mString.compareToIgnoreCase(str2);
-            result = mString.compareToIgnoreCase(str2);
-            result = mString.compareToIgnoreCase(str2);
-            result = mString.compareToIgnoreCase(str2);
-            result = mString.compareToIgnoreCase(str2);
-        }
-    }
-
-    /** startsWith * */
-
-    public void testStringstartsWith() {
-        boolean result;
-        String str1 = STATIC_STRING_02, str2 = "Rem";
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            result = str1.startsWith(str2);
-            result = str1.startsWith(str2);
-            result = str1.startsWith(str2);
-            result = str1.startsWith(str2);
-            result = str1.startsWith(str2);
-            result = str1.startsWith(str2);
-            result = str1.startsWith(str2);
-            result = str1.startsWith(str2);
-            result = str1.startsWith(str2);
-            result = str1.startsWith(str2);
-        }
-    }
-
-    /** startsWith(String seq, int begin) * */
-
-    public void testStringstartsWith1() {
-        String str1 = STATIC_STRING_02, str2 = "tom";
-        int pos = 10;
-        boolean result;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            result = str1.startsWith(str2, pos);
-            result = str1.startsWith(str2, pos);
-            result = str1.startsWith(str2, pos);
-            result = str1.startsWith(str2, pos);
-            result = str1.startsWith(str2, pos);
-            result = str1.startsWith(str2, pos);
-            result = str1.startsWith(str2, pos);
-            result = str1.startsWith(str2, pos);
-            result = str1.startsWith(str2, pos);
-            result = str1.startsWith(str2, pos);
-        }
-    }
-
-    /** endsWith * */
-
-    public void testStringendsWith() {
-        String str = STATIC_STRING_02, str1 = "day";
-        boolean result;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            result = str.endsWith(str1);
-            result = str.endsWith(str1);
-            result = str.endsWith(str1);
-            result = str.endsWith(str1);
-            result = str.endsWith(str1);
-            result = str.endsWith(str1);
-            result = str.endsWith(str1);
-            result = str.endsWith(str1);
-            result = str.endsWith(str1);
-            result = str.endsWith(str1);
-        }
-    }
-
-    /**
-     * indexOf to determine whether a string contains a substring
-     */
-    public void testStringindexOf() {
-        boolean result;
-        String str = STATIC_STRING_02, str1 = "tomo";
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            result = str.indexOf(str1) > 0;
-            result = str.indexOf(str1) > 0;
-            result = str.indexOf(str1) > 0;
-            result = str.indexOf(str1) > 0;
-            result = str.indexOf(str1) > 0;
-            result = str.indexOf(str1) > 0;
-            result = str.indexOf(str1) > 0;
-            result = str.indexOf(str1) > 0;
-            result = str.indexOf(str1) > 0;
-            result = str.indexOf(str1) > 0;
-        }
-    }
-
-    /** indexOf()* */
-
-    public void testStringindexOf1() {
-        int index;
-        String str = STATIC_STRING_02;
-        char c = 't';
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            index = str.indexOf(c);
-            index = str.indexOf(c);
-            index = str.indexOf(c);
-            index = str.indexOf(c);
-            index = str.indexOf(c);
-            index = str.indexOf(c);
-            index = str.indexOf(c);
-            index = str.indexOf(c);
-            index = str.indexOf(c);
-            index = str.indexOf(c);
-        }
-
-    }
-
-    /** indexOf(char c, int start)* */
-    public void testStringindexOf2() {
-        int index, pos = 12;
-        String str = STATIC_STRING_02, str1 = "tom";
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            index = str.indexOf(str1, pos);
-            index = str.indexOf(str1, pos);
-            index = str.indexOf(str1, pos);
-            index = str.indexOf(str1, pos);
-            index = str.indexOf(str1, pos);
-            index = str.indexOf(str1, pos);
-            index = str.indexOf(str1, pos);
-            index = str.indexOf(str1, pos);
-            index = str.indexOf(str1, pos);
-            index = str.indexOf(str1, pos);
-        }
-    }
-
-    /** lastIndexOf()* */
-
-    public void testStringlastIndexOf() {
-        int index;
-        char c = 't';
-        String str = STATIC_STRING_02;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            index = str.lastIndexOf(c);
-            index = str.lastIndexOf(c);
-            index = str.lastIndexOf(c);
-            index = str.lastIndexOf(c);
-            index = str.lastIndexOf(c);
-            index = str.lastIndexOf(c);
-            index = str.lastIndexOf(c);
-            index = str.lastIndexOf(c);
-            index = str.lastIndexOf(c);
-            index = str.lastIndexOf(c);
-        }
-    }
-
-    /** lastIndexOf()* */
-
-    public void testStringlastIndexOf1() {
-        int index, pos = 36;
-        String str = STATIC_STRING_02, str1 = "tom";
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            index = str.lastIndexOf(str1, pos);
-            index = str.lastIndexOf(str1, pos);
-            index = str.lastIndexOf(str1, pos);
-            index = str.lastIndexOf(str1, pos);
-            index = str.lastIndexOf(str1, pos);
-            index = str.lastIndexOf(str1, pos);
-            index = str.lastIndexOf(str1, pos);
-            index = str.lastIndexOf(str1, pos);
-            index = str.lastIndexOf(str1, pos);
-            index = str.lastIndexOf(str1, pos);
-        }
-    }
-
-    /**
-     * contains() to determine whether a string contains a substring
-     */
-
-    public void testStringcontains() {
-        boolean result;
-        String str = STATIC_STRING_02, str1 = "tomo";
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            result = str.contains(str1);
-            result = str.contains(str1);
-            result = str.contains(str1);
-            result = str.contains(str1);
-            result = str.contains(str1);
-            result = str.contains(str1);
-            result = str.contains(str1);
-            result = str.contains(str1);
-            result = str.contains(str1);
-            result = str.contains(str1);
-        }
-    }
-
-    /** substring(int start) */
-
-    public void testStringsubstring() {
-        String rString;
-        String str = STATIC_STRING_02;
-        int index = 10;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = str.substring(index);
-            rString = str.substring(index);
-            rString = str.substring(index);
-            rString = str.substring(index);
-            rString = str.substring(index);
-            rString = str.substring(index);
-            rString = str.substring(index);
-            rString = str.substring(index);
-            rString = str.substring(index);
-            rString = str.substring(index);
-        }
-    }
-
-    /** substring(int start, int end) in a for loop* */
-
-    public void testStringsubstring1() {
-        String rString;
-        String str = STATIC_STRING_02;
-        int start = 10, end = 48;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = str.substring(start, end);
-            rString = str.substring(start, end);
-            rString = str.substring(start, end);
-            rString = str.substring(start, end);
-            rString = str.substring(start, end);
-            rString = str.substring(start, end);
-            rString = str.substring(start, end);
-            rString = str.substring(start, end);
-            rString = str.substring(start, end);
-            rString = str.substring(start, end);
-        }
-    }
-
-    /**
-     * valueOf(char[] cArray) String representation of a character array
-     */
-    public void testStringvalueOf() {
-        String rString;
-        char[] cArray = STATIC_CHAR_ARRAY;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = String.valueOf(cArray);
-            rString = String.valueOf(cArray);
-            rString = String.valueOf(cArray);
-            rString = String.valueOf(cArray);
-            rString = String.valueOf(cArray);
-            rString = String.valueOf(cArray);
-            rString = String.valueOf(cArray);
-            rString = String.valueOf(cArray);
-            rString = String.valueOf(cArray);
-            rString = String.valueOf(cArray);
-        }
-    }
-
-    /** valueOf(char[] cArray, int offset, int count)* */
-
-    public void testStringvalueOf1() {
-        String rString;
-        char[] cArray = STATIC_CHAR_ARRAY;
-        int start = 1, end = 7;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = String.valueOf(cArray, start, end);
-            rString = String.valueOf(cArray, start, end);
-            rString = String.valueOf(cArray, start, end);
-            rString = String.valueOf(cArray, start, end);
-            rString = String.valueOf(cArray, start, end);
-            rString = String.valueOf(cArray, start, end);
-            rString = String.valueOf(cArray, start, end);
-            rString = String.valueOf(cArray, start, end);
-            rString = String.valueOf(cArray, start, end);
-            rString = String.valueOf(cArray, start, end);
-        }
-    }
-
-    /** Convert a string to a char Array* */
-
-    public void testStringtoCharArray() {
-        char[] cArray;
-        String str = STATIC_STRING_02;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            cArray = str.toCharArray();
-            cArray = str.toCharArray();
-            cArray = str.toCharArray();
-            cArray = str.toCharArray();
-            cArray = str.toCharArray();
-            cArray = str.toCharArray();
-            cArray = str.toCharArray();
-            cArray = str.toCharArray();
-            cArray = str.toCharArray();
-            cArray = str.toCharArray();
-        }
-    }
-
-    /** length()* */
-
-    public void testStringlength() {
-        int len;
-        String str = STATIC_STRING_02;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            len = str.length();
-            len = str.length();
-            len = str.length();
-            len = str.length();
-            len = str.length();
-            len = str.length();
-            len = str.length();
-            len = str.length();
-            len = str.length();
-            len = str.length();
-        }
-    }
-
-    /** hashcode()* */
-
-    public void testStringhashCode() {
-        int index;
-        String str = STATIC_STRING_02;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            index = str.hashCode();
-            index = str.hashCode();
-            index = str.hashCode();
-            index = str.hashCode();
-            index = str.hashCode();
-            index = str.hashCode();
-            index = str.hashCode();
-            index = str.hashCode();
-            index = str.hashCode();
-            index = str.hashCode();
-        }
-    }
-
-    /** replace()* */
-
-    public void testStringreplace() {
-        String rString;
-        String str = STATIC_STRING_02;
-        char c1 = ' ', c2 = ' ';
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = str.replace(c1, c2);
-            rString = str.replace(c1, c2);
-            rString = str.replace(c1, c2);
-            rString = str.replace(c1, c2);
-            rString = str.replace(c1, c2);
-            rString = str.replace(c1, c2);
-            rString = str.replace(c1, c2);
-            rString = str.replace(c1, c2);
-            rString = str.replace(c1, c2);
-            rString = str.replace(c1, c2);
-        }
-    }
-
-    public void testStringreplaceAll() {
-        String rString;
-        String str = STATIC_STRING_02, str1 = " ", str2 = "/";
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = str.replaceAll(str1, str2);
-            rString = str.replaceAll(str1, str2);
-            rString = str.replaceAll(str1, str2);
-            rString = str.replaceAll(str1, str2);
-            rString = str.replaceAll(str1, str2);
-            rString = str.replaceAll(str1, str2);
-            rString = str.replaceAll(str1, str2);
-            rString = str.replaceAll(str1, str2);
-            rString = str.replaceAll(str1, str2);
-            rString = str.replaceAll(str1, str2);
-        }
-    }
-
-    /** Convert a StringBuffer to a String* */
-
-    public void testStringtoString() {
-        StringBuffer sBuf = new StringBuffer(STATIC_STRING_02);
-
-        String rString;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = sBuf.toString();
-            rString = sBuf.toString();
-            rString = sBuf.toString();
-            rString = sBuf.toString();
-            rString = sBuf.toString();
-            rString = sBuf.toString();
-            rString = sBuf.toString();
-            rString = sBuf.toString();
-            rString = sBuf.toString();
-            rString = sBuf.toString();
-        }
-    }
-
-    /** Split a string into an array of strings* */
-
-    public void testStringsplit() {
-        String[] strings;
-        String str1 = STATIC_STRING_02, str = " ";
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            strings = str1.split(str);
-            strings = str1.split(str);
-            strings = str1.split(str);
-            strings = str1.split(str);
-            strings = str1.split(str);
-            strings = str1.split(str);
-            strings = str1.split(str);
-            strings = str1.split(str);
-            strings = str1.split(str);
-            strings = str1.split(str);
-
-        }
-    }
-
-    /** Split a string into an array of strings* */
-
-    public void testStringsplit1() {
-        String str = STATIC_STRING_02, str1 = " ";
-        String[] strings;
-        int pos = 8;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            strings = str.split(str1, pos);
-            strings = str.split(str1, pos);
-            strings = str.split(str1, pos);
-            strings = str.split(str1, pos);
-            strings = str.split(str1, pos);
-            strings = str.split(str1, pos);
-            strings = str.split(str1, pos);
-            strings = str.split(str1, pos);
-            strings = str.split(str1, pos);
-            strings = str.split(str1, pos);
-        }
-    }
-
-    public void testStringgetBytes() {
-        byte[] bytes;
-        String str = STATIC_STRING_02;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            bytes = str.getBytes();
-            bytes = str.getBytes();
-            bytes = str.getBytes();
-            bytes = str.getBytes();
-            bytes = str.getBytes();
-            bytes = str.getBytes();
-            bytes = str.getBytes();
-            bytes = str.getBytes();
-            bytes = str.getBytes();
-            bytes = str.getBytes();
-        }
-    }
-
-    /** copyValueOf(char[] data) * */
-
-    public void testStringcopyValueOf() {
-        String rString;
-        char[] cArray = STATIC_CHAR_ARRAY;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = String.copyValueOf(cArray);
-            rString = String.copyValueOf(cArray);
-            rString = String.copyValueOf(cArray);
-            rString = String.copyValueOf(cArray);
-            rString = String.copyValueOf(cArray);
-            rString = String.copyValueOf(cArray);
-            rString = String.copyValueOf(cArray);
-            rString = String.copyValueOf(cArray);
-            rString = String.copyValueOf(cArray);
-            rString = String.copyValueOf(cArray);
-        }
-    }
-
-    /** copyValueOf(char[] data, int index, int count)* */
-
-    public void testStringcopyValueOf1() {
-        String rString;
-        int start = 1, end = 7;
-        char[] cArray = STATIC_CHAR_ARRAY;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = String.copyValueOf(cArray, start, end);
-            rString = String.copyValueOf(cArray, start, end);
-            rString = String.copyValueOf(cArray, start, end);
-            rString = String.copyValueOf(cArray, start, end);
-            rString = String.copyValueOf(cArray, start, end);
-            rString = String.copyValueOf(cArray, start, end);
-            rString = String.copyValueOf(cArray, start, end);
-            rString = String.copyValueOf(cArray, start, end);
-            rString = String.copyValueOf(cArray, start, end);
-            rString = String.copyValueOf(cArray, start, end);
-        }
-    }
-
-    /** trim()* */
-
-    public void testStringtrim() {
-        String mString =
-                new String(
-                        "                            HELLO ANDROID                                                ");
-        String rString;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = mString.trim();
-            rString = mString.trim();
-            rString = mString.trim();
-            rString = mString.trim();
-            rString = mString.trim();
-            rString = mString.trim();
-            rString = mString.trim();
-            rString = mString.trim();
-            rString = mString.trim();
-            rString = mString.trim();
-        }
-    }
-
-    /** getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin)* */
-
-    public void testStringgetChars() {
-        char[] cArray = STATIC_CHAR_ARRAY;
-        String str = STATIC_STRING_01;
-        int value1 = 7, value2 = 12, value3 = 1;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            str.getChars(value1, value2, cArray, value3);
-            str.getChars(value1, value2, cArray, value3);
-            str.getChars(value1, value2, cArray, value3);
-            str.getChars(value1, value2, cArray, value3);
-            str.getChars(value1, value2, cArray, value3);
-            str.getChars(value1, value2, cArray, value3);
-            str.getChars(value1, value2, cArray, value3);
-            str.getChars(value1, value2, cArray, value3);
-            str.getChars(value1, value2, cArray, value3);
-            str.getChars(value1, value2, cArray, value3);
-        }
-    }
-
-    /** toUpperCase()* */
-
-    public void testStringtoUpperCase() {
-        String rString, str = STATIC_STRING_02;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = str.toUpperCase();
-            rString = str.toUpperCase();
-            rString = str.toUpperCase();
-            rString = str.toUpperCase();
-            rString = str.toUpperCase();
-            rString = str.toUpperCase();
-            rString = str.toUpperCase();
-            rString = str.toUpperCase();
-            rString = str.toUpperCase();
-            rString = str.toUpperCase();
-        }
-    }
-
-    /** toUpperCase() with locale* */
-
-    public void testStringtoUpperCase1() {
-        Locale locale = new Locale("tr");
-        String str = STATIC_STRING_02;
-        String rString;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = str.toUpperCase(locale);
-            rString = str.toUpperCase(locale);
-            rString = str.toUpperCase(locale);
-            rString = str.toUpperCase(locale);
-            rString = str.toUpperCase(locale);
-            rString = str.toUpperCase(locale);
-            rString = str.toUpperCase(locale);
-            rString = str.toUpperCase(locale);
-            rString = str.toUpperCase(locale);
-            rString = str.toUpperCase(locale);
-        }
-    }
-
-    /** toLowerCase* */
-
-    public void StringtoLowerCase() {
-        String rString, str = STATIC_STRING_02;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = str.toLowerCase();
-            rString = str.toLowerCase();
-            rString = str.toLowerCase();
-            rString = str.toLowerCase();
-            rString = str.toLowerCase();
-            rString = str.toLowerCase();
-            rString = str.toLowerCase();
-            rString = str.toLowerCase();
-            rString = str.toLowerCase();
-            rString = str.toLowerCase();
-        }
-    }
-
-    /** toLowerCase with locale* */
-
-    public void testStringtoLowerCase1() {
-        Locale locale = new Locale("tr");
-        String rString, str = STATIC_STRING_02;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = str.toLowerCase(locale);
-            rString = str.toLowerCase(locale);
-            rString = str.toLowerCase(locale);
-            rString = str.toLowerCase(locale);
-            rString = str.toLowerCase(locale);
-            rString = str.toLowerCase(locale);
-            rString = str.toLowerCase(locale);
-            rString = str.toLowerCase(locale);
-            rString = str.toLowerCase(locale);
-            rString = str.toLowerCase(locale);
-        }
-    }
-
-    /** charAt()* */
-
-    public void testStringcharAt() {
-        String str = STATIC_STRING_02;
-        int index, pos = 21;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            index = str.charAt(pos);
-            index = str.charAt(pos);
-            index = str.charAt(pos);
-            index = str.charAt(pos);
-            index = str.charAt(pos);
-            index = str.charAt(pos);
-            index = str.charAt(pos);
-            index = str.charAt(pos);
-            index = str.charAt(pos);
-            index = str.charAt(pos);
-        }
-    }
-
-    public void testStringConcat() {
-        String mString, str1 = STATIC_STRING_01, str2 = STATIC_STRING_02;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            mString = str1.concat(str2);
-            mString = str1.concat(str2);
-            mString = str1.concat(str2);
-            mString = str1.concat(str2);
-            mString = str1.concat(str2);
-            mString = str1.concat(str2);
-            mString = str1.concat(str2);
-            mString = str1.concat(str2);
-            mString = str1.concat(str2);
-            mString = str1.concat(str2);
-        }
-    }
-
-    public void testStringBufferAppend() {
-        StringBuffer sBuf = new StringBuffer(" ");
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            sBuf.append(i);
-            sBuf.append(i);
-            sBuf.append(i);
-            sBuf.append(i);
-            sBuf.append(i);
-            sBuf.append(i);
-            sBuf.append(i);
-            sBuf.append(i);
-            sBuf.append(i);
-            sBuf.append(i);
-        }
-    }
-
-    public void testStringBufferInsert() {
-        StringBuffer sBuf = new StringBuffer(" ");
-        int index = sBuf.length();
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            sBuf.insert(index, i);
-            sBuf.insert(index, i);
-            sBuf.insert(index, i);
-            sBuf.insert(index, i);
-            sBuf.insert(index, i);
-            sBuf.insert(index, i);
-            sBuf.insert(index, i);
-            sBuf.insert(index, i);
-            sBuf.insert(index, i);
-            sBuf.insert(index, i);
-        }
-    }
-
-    public void testStringBufferReverse() {
-        StringBuffer sBuf = STATIC_SBUF;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            sBuf.reverse();
-            sBuf.reverse();
-            sBuf.reverse();
-            sBuf.reverse();
-            sBuf.reverse();
-            sBuf.reverse();
-            sBuf.reverse();
-            sBuf.reverse();
-            sBuf.reverse();
-            sBuf.reverse();
-        }
-    }
-
-    public void testStringBufferSubstring() {
-        StringBuffer sBuf = STATIC_SBUF;
-        String rString;
-        int index = 0;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = sBuf.substring(index);
-            rString = sBuf.substring(index);
-            rString = sBuf.substring(index);
-            rString = sBuf.substring(index);
-            rString = sBuf.substring(index);
-            rString = sBuf.substring(index);
-            rString = sBuf.substring(index);
-            rString = sBuf.substring(index);
-            rString = sBuf.substring(index);
-            rString = sBuf.substring(index);
-        }
-    }
-
-    public void testStringBufferSubstring1() {
-        StringBuffer sBuf = STATIC_SBUF;
-        String rString;
-        int start = 5, end = 25;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            rString = sBuf.substring(start, end);
-            rString = sBuf.substring(start, end);
-            rString = sBuf.substring(start, end);
-            rString = sBuf.substring(start, end);
-            rString = sBuf.substring(start, end);
-            rString = sBuf.substring(start, end);
-            rString = sBuf.substring(start, end);
-            rString = sBuf.substring(start, end);
-            rString = sBuf.substring(start, end);
-            rString = sBuf.substring(start, end);
-        }
-    }
-
-    public void testStringBufferReplace() {
-        StringBuffer sBuf = STATIC_SBUF;
-        int start = 3, end = 6;
-        String str = "ind";
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            sBuf.replace(start, end, str);
-            sBuf.replace(start, end, str);
-            sBuf.replace(start, end, str);
-            sBuf.replace(start, end, str);
-            sBuf.replace(start, end, str);
-            sBuf.replace(start, end, str);
-            sBuf.replace(start, end, str);
-            sBuf.replace(start, end, str);
-            sBuf.replace(start, end, str);
-            sBuf.replace(start, end, str);
-        }
-    }
-
-    public void testStringBufferIndexOf() {
-        StringBuffer sBuf = STATIC_SBUF;
-        String str = "t";
-        int index;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            index = sBuf.indexOf(str);
-            index = sBuf.indexOf(str);
-            index = sBuf.indexOf(str);
-            index = sBuf.indexOf(str);
-            index = sBuf.indexOf(str);
-            index = sBuf.indexOf(str);
-            index = sBuf.indexOf(str);
-            index = sBuf.indexOf(str);
-            index = sBuf.indexOf(str);
-            index = sBuf.indexOf(str);
-        }
-    }
-
-    public void testStringBufferIndexOf1() {
-        StringBuffer sBuf = STATIC_SBUF;
-        String str = "tom";
-        int index, pos = 12;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            index = sBuf.indexOf(str, pos);
-            index = sBuf.indexOf(str, pos);
-            index = sBuf.indexOf(str, pos);
-            index = sBuf.indexOf(str, pos);
-            index = sBuf.indexOf(str, pos);
-            index = sBuf.indexOf(str, pos);
-            index = sBuf.indexOf(str, pos);
-            index = sBuf.indexOf(str, pos);
-            index = sBuf.indexOf(str, pos);
-            index = sBuf.indexOf(str, pos);
-        }
-
-    }
-
-    public void testStringBufferLastIndexOf() {
-        StringBuffer sBuf = STATIC_SBUF;
-        String str = "t";
-        int index;
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            index = sBuf.lastIndexOf(str);
-            index = sBuf.lastIndexOf(str);
-            index = sBuf.lastIndexOf(str);
-            index = sBuf.lastIndexOf(str);
-            index = sBuf.lastIndexOf(str);
-            index = sBuf.lastIndexOf(str);
-            index = sBuf.lastIndexOf(str);
-            index = sBuf.lastIndexOf(str);
-            index = sBuf.lastIndexOf(str);
-            index = sBuf.lastIndexOf(str);
-        }
-    }
-
-    public void testStringBufferLastIndexOf1() {
-        StringBuffer sBuf = STATIC_SBUF;
-        int index, pos = 36;
-        String str = "tom";
-        for (int i = ITERATIONS - 1; i >= 0; i--) {
-            index = sBuf.lastIndexOf(str, pos);
-            index = sBuf.lastIndexOf(str, pos);
-            index = sBuf.lastIndexOf(str, pos);
-            index = sBuf.lastIndexOf(str, pos);
-            index = sBuf.lastIndexOf(str, pos);
-            index = sBuf.lastIndexOf(str, pos);
-            index = sBuf.lastIndexOf(str, pos);
-            index = sBuf.lastIndexOf(str, pos);
-            index = sBuf.lastIndexOf(str, pos);
-            index = sBuf.lastIndexOf(str, pos);
-        }
-    }
-}
diff --git a/tools/aapt/Android.mk b/tools/aapt/Android.mk
index b339a2c..094b7db 100644
--- a/tools/aapt/Android.mk
+++ b/tools/aapt/Android.mk
@@ -41,7 +41,7 @@
 	libpng
 
 ifeq ($(HOST_OS),linux)
-LOCAL_LDLIBS += -lrt
+LOCAL_LDLIBS += -lrt -lpthread
 endif
 
 # Statically link libz for MinGW (Win SDK under Linux),
diff --git a/tools/localize/Android.mk b/tools/localize/Android.mk
index ab79f8d..f284e86 100644
--- a/tools/localize/Android.mk
+++ b/tools/localize/Android.mk
@@ -34,7 +34,7 @@
 	libcutils
     
 ifeq ($(HOST_OS),linux)
-LOCAL_LDLIBS += -lrt
+LOCAL_LDLIBS += -lrt -lpthread
 endif