Merge "doc change: miscellaneous small fixes." into froyo
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 417f764..707404b 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -50,6 +50,8 @@
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/com/android/internal/backup)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/app)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/content)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/FrameworkTest_intermediates/)
+
 
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/api/current.xml b/api/current.xml
index 34a0e00..0d42c2c 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -38684,6 +38684,17 @@
  visibility="public"
 >
 </field>
+<field name="CATEGORY_CAR_MODE"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;android.intent.category.CAR_MODE&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="CATEGORY_DEFAULT"
  type="java.lang.String"
  transient="false"
@@ -82509,163 +82520,151 @@
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="quality" type="android.media.CamcorderProfile.Quality">
+<parameter name="quality" type="int">
 </parameter>
 </method>
-<method name="getMmsRecordingDurationInSeconds"
- return="int"
- abstract="false"
- native="false"
- synchronized="false"
+<field name="QUALITY_HIGH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
  static="true"
  final="true"
  deprecated="not deprecated"
  visibility="public"
 >
-</method>
-<field name="mAudioBitRate"
+</field>
+<field name="QUALITY_LOW"
  type="int"
  transient="false"
  volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="mAudioChannels"
- type="int"
- transient="false"
- volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="mAudioCodec"
- type="int"
- transient="false"
- volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="mAudioSampleRate"
- type="int"
- transient="false"
- volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="mFileFormat"
- type="int"
- transient="false"
- volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="mQuality"
- type="android.media.CamcorderProfile.Quality"
- transient="false"
- volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="mVideoBitRate"
- type="int"
- transient="false"
- volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="mVideoCodec"
- type="int"
- transient="false"
- volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="mVideoFrameHeight"
- type="int"
- transient="false"
- volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="mVideoFrameRate"
- type="int"
- transient="false"
- volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-<field name="mVideoFrameWidth"
- type="int"
- transient="false"
- volatile="false"
- static="false"
- final="true"
- deprecated="not deprecated"
- visibility="public"
->
-</field>
-</class>
-<class name="CamcorderProfile.Quality"
- extends="java.lang.Enum"
- abstract="false"
+ value="0"
  static="true"
  final="true"
  deprecated="not deprecated"
  visibility="public"
 >
-<method name="valueOf"
- return="android.media.CamcorderProfile.Quality"
- abstract="false"
- native="false"
- synchronized="false"
- static="true"
+</field>
+<field name="audioBitRate"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
  final="false"
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="name" type="java.lang.String">
-</parameter>
-</method>
-<method name="values"
- return="android.media.CamcorderProfile.Quality[]"
- abstract="false"
- native="false"
- synchronized="false"
- static="true"
- final="true"
+</field>
+<field name="audioChannels"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
  deprecated="not deprecated"
  visibility="public"
 >
-</method>
+</field>
+<field name="audioCodec"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="audioSampleRate"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="duration"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="fileFormat"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="quality"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="videoBitRate"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="videoCodec"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="videoFrameHeight"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="videoFrameRate"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="videoFrameWidth"
+ type="int"
+ transient="false"
+ volatile="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 </class>
 <class name="CameraProfile"
  extends="java.lang.Object"
@@ -82683,8 +82682,8 @@
  visibility="public"
 >
 </constructor>
-<method name="getImageEncodingQualityLevels"
- return="int[]"
+<method name="getJpegEncodingQualityParameter"
+ return="int"
  abstract="false"
  native="false"
  synchronized="false"
@@ -82693,7 +82692,42 @@
  deprecated="not deprecated"
  visibility="public"
 >
+<parameter name="quality" type="int">
+</parameter>
 </method>
+<field name="QUALITY_HIGH"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="2"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="QUALITY_LOW"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="0"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="QUALITY_MEDIUM"
+ type="int"
+ transient="false"
+ volatile="false"
+ value="1"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 </class>
 <class name="ExifInterface"
  extends="java.lang.Object"
@@ -84608,6 +84642,19 @@
 <parameter name="sv" type="android.view.Surface">
 </parameter>
 </method>
+<method name="setProfile"
+ return="void"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+<parameter name="profile" type="android.media.CamcorderProfile">
+</parameter>
+</method>
 <method name="setVideoEncoder"
  return="void"
  abstract="false"
@@ -138885,6 +138932,28 @@
 <parameter name="filename" type="java.lang.String">
 </parameter>
 </method>
+<method name="areDefaultsEnforced"
+ return="boolean"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
+<method name="getDefaultEngine"
+ return="java.lang.String"
+ abstract="false"
+ native="false"
+ synchronized="false"
+ static="false"
+ final="false"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</method>
 <method name="getLanguage"
  return="java.util.Locale"
  abstract="false"
@@ -139301,6 +139370,28 @@
  visibility="public"
 >
 </field>
+<field name="EXTRA_AVAILABLE_VOICES"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;availableVoices&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
+<field name="EXTRA_CHECK_VOICE_DATA_FOR"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;checkVoiceDataFor&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="EXTRA_TTS_DATA_INSTALLED"
  type="java.lang.String"
  transient="false"
@@ -139312,6 +139403,17 @@
  visibility="public"
 >
 </field>
+<field name="EXTRA_UNAVAILABLE_VOICES"
+ type="java.lang.String"
+ transient="false"
+ volatile="false"
+ value="&quot;unavailableVoices&quot;"
+ static="true"
+ final="true"
+ deprecated="not deprecated"
+ visibility="public"
+>
+</field>
 <field name="EXTRA_VOICE_DATA_FILES"
  type="java.lang.String"
  transient="false"
diff --git a/cmds/stagefright/stagefright.cpp b/cmds/stagefright/stagefright.cpp
index 55bb581..fec9e1a 100644
--- a/cmds/stagefright/stagefright.cpp
+++ b/cmds/stagefright/stagefright.cpp
@@ -158,6 +158,7 @@
     MediaSource::ReadOptions options;
 
     int64_t sumDecodeUs = 0;
+    int64_t totalBytes = 0;
 
     while (numIterationsLeft-- > 0) {
         long numFrames = 0;
@@ -188,6 +189,7 @@
             }
 
             sumDecodeUs += delayDecodeUs;
+            totalBytes += buffer->range_length();
 
             buffer->release();
             buffer = NULL;
@@ -216,11 +218,20 @@
     printf("\n");
 
     int64_t delay = getNowUs() - startTime;
-    printf("avg. %.2f fps\n", n * 1E6 / delay);
-    printf("avg. time to decode one buffer %.2f usecs\n",
-           (double)sumDecodeUs / n);
+    if (!strncasecmp("video/", mime, 6)) {
+        printf("avg. %.2f fps\n", n * 1E6 / delay);
 
-    printf("decoded a total of %d frame(s).\n", n);
+        printf("avg. time to decode one buffer %.2f usecs\n",
+               (double)sumDecodeUs / n);
+
+        printf("decoded a total of %d frame(s).\n", n);
+    } else if (!strncasecmp("audio/", mime, 6)) {
+        // Frame count makes less sense for audio, as the output buffer
+        // sizes may be different across decoders.
+        printf("avg. %.2f KB/sec\n", totalBytes / 1024 * 1E6 / delay);
+
+        printf("decoded a total of %lld bytes\n", totalBytes);
+    }
 }
 
 static void usage(const char *me) {
diff --git a/common/tests/src/com/android/common/OperationSchedulerTest.java b/common/tests/src/com/android/common/OperationSchedulerTest.java
index f728eea..866d1a8 100644
--- a/common/tests/src/com/android/common/OperationSchedulerTest.java
+++ b/common/tests/src/com/android/common/OperationSchedulerTest.java
@@ -18,8 +18,11 @@
 
 import android.content.SharedPreferences;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
 
 public class OperationSchedulerTest extends AndroidTestCase {
+    @MediumTest
     public void testScheduler() throws Exception {
         String name = "OperationSchedulerTest.testScheduler";
         SharedPreferences storage = getContext().getSharedPreferences(name, 0);
@@ -112,6 +115,7 @@
         assertTrue(afterSuccess + 1000000 >= scheduler.getNextTimeMillis(options));
     }
 
+    @SmallTest
     public void testParseOptions() throws Exception {
          OperationScheduler.Options options = new OperationScheduler.Options();
          assertEquals(
@@ -132,6 +136,7 @@
                  OperationScheduler.parseOptions("", options).toString());
     }
 
+    @SmallTest
     public void testMoratoriumWithHttpDate() throws Exception {
         String name = "OperationSchedulerTest.testMoratoriumWithHttpDate";
         SharedPreferences storage = getContext().getSharedPreferences(name, 0);
diff --git a/core/java/android/accounts/AccountManager.java b/core/java/android/accounts/AccountManager.java
index 15c8856..b0adaec 100644
--- a/core/java/android/accounts/AccountManager.java
+++ b/core/java/android/accounts/AccountManager.java
@@ -539,14 +539,15 @@
      * {@link android.Manifest.permission#MANAGE_ACCOUNTS} or
      * {@link android.Manifest.permission#USE_CREDENTIALS}
      *
-     * @param accountType The account type of the auth token to invalidate
-     * @param authToken The auth token to invalidate
+     * @param accountType The account type of the auth token to invalidate, must not be null
+     * @param authToken The auth token to invalidate, may be null
      */
     public void invalidateAuthToken(final String accountType, final String authToken) {
         if (accountType == null) throw new IllegalArgumentException("accountType is null");
-        if (authToken == null) throw new IllegalArgumentException("authToken is null");
         try {
-            mService.invalidateAuthToken(accountType, authToken);
+            if (authToken != null) {
+                mService.invalidateAuthToken(accountType, authToken);
+            }
         } catch (RemoteException e) {
             // won't ever happen
             throw new RuntimeException(e);
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 0ebe3ac..9d217ec 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -795,7 +795,9 @@
             SearchableInfo searchable = mSearchable;
             try {
                 if (searchable.getVoiceSearchLaunchWebSearch()) {
-                    getContext().startActivity(mVoiceWebSearchIntent);
+                    Intent webSearchIntent = createVoiceWebSearchIntent(mVoiceWebSearchIntent,
+                            searchable);
+                    getContext().startActivity(webSearchIntent);
                 } else if (searchable.getVoiceSearchLaunchRecognizer()) {
                     Intent appSearchIntent = createVoiceAppSearchIntent(mVoiceAppSearchIntent,
                             searchable);
@@ -811,6 +813,17 @@
     };
     
     /**
+     * Create and return an Intent that can launch the voice search activity for web search.
+     */
+    private Intent createVoiceWebSearchIntent(Intent baseIntent, SearchableInfo searchable) {
+        Intent voiceIntent = new Intent(baseIntent);
+        ComponentName searchActivity = searchable.getSearchActivity();
+        voiceIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
+                searchActivity == null ? null : searchActivity.flattenToShortString());
+        return voiceIntent;
+    }
+    
+    /**
      * Create and return an Intent that can launch the voice search activity, perform a specific
      * voice transcription, and forward the results to the searchable activity.
      * 
@@ -865,7 +878,7 @@
         voiceIntent.putExtra(RecognizerIntent.EXTRA_LANGUAGE, language);
         voiceIntent.putExtra(RecognizerIntent.EXTRA_MAX_RESULTS, maxResults);
         voiceIntent.putExtra(RecognizerIntent.EXTRA_CALLING_PACKAGE,
-                searchActivity == null ? null : searchActivity.toShortString());
+                searchActivity == null ? null : searchActivity.flattenToShortString());
         
         // Add the values that configure forwarding the results
         voiceIntent.putExtra(RecognizerIntent.EXTRA_RESULTS_PENDINGINTENT, pending);
diff --git a/core/java/android/content/Intent.java b/core/java/android/content/Intent.java
index fd5591d..13494f8 100644
--- a/core/java/android/content/Intent.java
+++ b/core/java/android/content/Intent.java
@@ -533,6 +533,7 @@
  *     <li> {@link #CATEGORY_TEST}
  *     <li> {@link #CATEGORY_CAR_DOCK}
  *     <li> {@link #CATEGORY_DESK_DOCK}
+ *     <li> {@link #CATEGORY_CAR_MODE}
  * </ul>
  *
  * <h3>Standard Extra Data</h3>
@@ -2023,6 +2024,12 @@
     @SdkConstant(SdkConstantType.INTENT_CATEGORY)
     public static final String CATEGORY_DESK_DOCK = "android.intent.category.DESK_DOCK";
 
+    /**
+     * Used to indicate that the activity can be used in a car environment.
+     */
+    @SdkConstant(SdkConstantType.INTENT_CATEGORY)
+    public static final String CATEGORY_CAR_MODE = "android.intent.category.CAR_MODE";
+
     // ---------------------------------------------------------------------
     // ---------------------------------------------------------------------
     // Standard extra data keys.
@@ -2118,7 +2125,7 @@
      * number to call in a {@link android.content.Intent#ACTION_CALL}.
      */
     public static final String EXTRA_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER";
-    
+
     /**
      * Used as an int extra field in {@link android.content.Intent#ACTION_UID_REMOVED}
      * intents to supply the uid the package had been assigned.  Also an optional
diff --git a/core/java/android/os/INetworkManagementService.aidl b/core/java/android/os/INetworkManagementService.aidl
index e970e7e..da8c5d2 100644
--- a/core/java/android/os/INetworkManagementService.aidl
+++ b/core/java/android/os/INetworkManagementService.aidl
@@ -179,4 +179,36 @@
      * Set Access Point config
      */
     void setAccessPoint(in WifiConfiguration wifiConfig, String wlanIface, String softapIface);
+
+    /**
+     * Read number of bytes sent over an interface
+     */
+    long getInterfaceTxCounter(String iface);
+
+    /**
+     * Read number of bytes received over an interface
+     */
+    long getInterfaceRxCounter(String iface);
+
+    /**
+     * Configures RX bandwidth throttling on an interface
+     */
+    void setInterfaceRxThrottle(String iface, int kbps);
+
+    /**
+     * Configures TX bandwidth throttling on an interface
+     */
+    void setInterfaceTxThrottle(String iface, int kbps);
+
+    /**
+     * Returns the currently configured RX throttle values
+     * for the specified interface
+     */
+    int getInterfaceRxThrottle(String iface);
+
+    /**
+     * Returns the currently configured TX throttle values
+     * for the specified interface
+     */
+    int getInterfaceTxThrottle(String iface);
 }
diff --git a/core/java/android/pim/vcard/VCardEntry.java b/core/java/android/pim/vcard/VCardEntry.java
index e40a7ba..1327770 100644
--- a/core/java/android/pim/vcard/VCardEntry.java
+++ b/core/java/android/pim/vcard/VCardEntry.java
@@ -62,7 +62,7 @@
     private final static int DEFAULT_ORGANIZATION_TYPE = Organization.TYPE_WORK;
 
     private static final String ACCOUNT_TYPE_GOOGLE = "com.google";
-    private static final String GOOGLE_MY_CONTACTS_GROUP = "My Contacts";
+    private static final String GOOGLE_MY_CONTACTS_GROUP = "System Group: My Contacts";
 
     private static final Map<String, Integer> sImMap = new HashMap<String, Integer>();
 
diff --git a/core/java/android/speech/tts/ITts.aidl b/core/java/android/speech/tts/ITts.aidl
index 2fd3672..c1051c4 100755
--- a/core/java/android/speech/tts/ITts.aidl
+++ b/core/java/android/speech/tts/ITts.aidl
@@ -43,7 +43,7 @@
 

     String[] getLanguage();

 

-    int isLanguageAvailable(in String language, in String country, in String variant);

+    int isLanguageAvailable(in String language, in String country, in String variant, in String[] params);

 

     int setLanguage(in String callingApp, in String language, in String country, in String variant);

 

diff --git a/core/java/android/speech/tts/TextToSpeech.java b/core/java/android/speech/tts/TextToSpeech.java
index eeb42c42..26c167e 100755
--- a/core/java/android/speech/tts/TextToSpeech.java
+++ b/core/java/android/speech/tts/TextToSpeech.java
@@ -261,7 +261,6 @@
          * the TextToSpeech engine returns an ArrayList<String> of all the available voices.
          * The format of each voice is: lang-COUNTRY-variant where COUNTRY and variant are
          * optional (ie, "eng" or "eng-USA" or "eng-USA-FEMALE").
-         * {@hide}
          */
         public static final String EXTRA_AVAILABLE_VOICES = "availableVoices";
         /**
@@ -269,7 +268,6 @@
          * the TextToSpeech engine returns an ArrayList<String> of all the unavailable voices.
          * The format of each voice is: lang-COUNTRY-variant where COUNTRY and variant are
          * optional (ie, "eng" or "eng-USA" or "eng-USA-FEMALE").
-         * {@hide}
          */
         public static final String EXTRA_UNAVAILABLE_VOICES = "unavailableVoices";
         /**
@@ -278,7 +276,6 @@
          * check for by sending an ArrayList<String> of the voices that are of interest.
          * The format of each voice is: lang-COUNTRY-variant where COUNTRY and variant are
          * optional (ie, "eng" or "eng-USA" or "eng-USA-FEMALE").
-         * {@hide}
          */
         public static final String EXTRA_CHECK_VOICE_DATA_FOR = "checkVoiceDataFor";
 
@@ -315,6 +312,10 @@
          */
         public static final String KEY_PARAM_ENGINE = "engine";
         /**
+         * {@hide}
+         */
+        public static final String KEY_PARAM_PITCH = "pitch";
+        /**
          * Parameter key to specify the audio stream type to be used when speaking text
          * or playing back a file.
          * @see TextToSpeech#speak(String, int, HashMap)
@@ -365,7 +366,12 @@
         /**
          * {@hide}
          */
-        protected static final int NB_CACHED_PARAMS = 7;
+        protected static final int PARAM_POSITION_PITCH = 14;
+
+        /**
+         * {@hide}
+         */
+        protected static final int NB_CACHED_PARAMS = 8;
     }
 
     /**
@@ -409,9 +415,10 @@
         mCachedParams[Engine.PARAM_POSITION_STREAM] = Engine.KEY_PARAM_STREAM;
         mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID] = Engine.KEY_PARAM_UTTERANCE_ID;
         mCachedParams[Engine.PARAM_POSITION_ENGINE] = Engine.KEY_PARAM_ENGINE;
+        mCachedParams[Engine.PARAM_POSITION_PITCH] = Engine.KEY_PARAM_PITCH;
 
-        // Leave all defaults that are shown in Settings uninitialized so that
-        // the values set in Settings will take effect if the application does
+        // Leave all defaults that are shown in Settings uninitialized/at the default
+        // so that the values set in Settings will take effect if the application does
         // not try to change these settings itself.
         mCachedParams[Engine.PARAM_POSITION_RATE + 1] = "";
         mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1] = "";
@@ -421,6 +428,7 @@
                 String.valueOf(Engine.DEFAULT_STREAM);
         mCachedParams[Engine.PARAM_POSITION_UTTERANCE_ID + 1] = "";
         mCachedParams[Engine.PARAM_POSITION_ENGINE + 1] = "";
+        mCachedParams[Engine.PARAM_POSITION_PITCH + 1] = "100";
 
         initTts();
     }
@@ -435,6 +443,9 @@
                 synchronized(mStartLock) {
                     mITts = ITts.Stub.asInterface(service);
                     mStarted = true;
+                    // Cache the default engine and current language
+                    setEngineByPackageName(getDefaultEngine());
+                    setLanguage(getLanguage());
                     if (mInitListener != null) {
                         // TODO manage failures and missing resources
                         mInitListener.onInit(SUCCESS);
@@ -1008,15 +1019,13 @@
                 return result;
             }
             try {
+                // the pitch is not set here, instead it is cached so it will be associated
+                // with all upcoming utterances.
                 if (pitch > 0) {
-                    result = mITts.setPitch(mPackageName, (int)(pitch*100));
+                    int p = (int)(pitch*100);
+                    mCachedParams[Engine.PARAM_POSITION_PITCH + 1] = String.valueOf(p);
+                    result = SUCCESS;
                 }
-            } catch (RemoteException e) {
-                // TTS died; restart it.
-                Log.e("TextToSpeech.java - setPitch", "RemoteException");
-                e.printStackTrace();
-                mStarted = false;
-                initTts();
             } catch (NullPointerException e) {
                 // TTS died; restart it.
                 Log.e("TextToSpeech.java - setPitch", "NullPointerException");
@@ -1057,16 +1066,27 @@
                 return result;
             }
             try {
-                mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1] = loc.getISO3Language();
-                mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1] = loc.getISO3Country();
-                mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] = loc.getVariant();
-                // the language is not set here, instead it is cached so it will be associated
-                // with all upcoming utterances. But we still need to report the language support,
-                // which is achieved by calling isLanguageAvailable()
-                result = mITts.isLanguageAvailable(
-                        mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1],
-                        mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1],
-                        mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] );
+                String language = loc.getISO3Language();
+                String country = loc.getISO3Country();
+                String variant = loc.getVariant();
+                // Check if the language, country, variant are available, and cache
+                // the available parts.
+                // Note that the language is not actually set here, instead it is cached so it
+                // will be associated with all upcoming utterances.
+                result = mITts.isLanguageAvailable(language, country, variant, mCachedParams);
+                if (result >= LANG_AVAILABLE){
+                    mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1] = language;
+                    if (result >= LANG_COUNTRY_AVAILABLE){
+                        mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1] = country;
+                    } else {
+                        mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1] = "";
+                    }
+                    if (result >= LANG_COUNTRY_VAR_AVAILABLE){
+                        mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] = variant;
+                    } else {
+                        mCachedParams[Engine.PARAM_POSITION_VARIANT + 1] = "";
+                    }
+                }
             } catch (RemoteException e) {
                 // TTS died; restart it.
                 Log.e("TextToSpeech.java - setLanguage", "RemoteException");
@@ -1104,11 +1124,18 @@
                 return null;
             }
             try {
-                String[] locStrings = mITts.getLanguage();
-                if ((locStrings != null) && (locStrings.length == 3)) {
-                    return new Locale(locStrings[0], locStrings[1], locStrings[2]);
+                // Only do a call to the native synth if there is nothing in the cached params
+                if (mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1].length() < 1){
+                    String[] locStrings = mITts.getLanguage();
+                    if ((locStrings != null) && (locStrings.length == 3)) {
+                        return new Locale(locStrings[0], locStrings[1], locStrings[2]);
+                    } else {
+                        return null;
+                    }
                 } else {
-                    return null;
+                    return new Locale(mCachedParams[Engine.PARAM_POSITION_LANGUAGE + 1],
+                            mCachedParams[Engine.PARAM_POSITION_COUNTRY + 1],
+                            mCachedParams[Engine.PARAM_POSITION_VARIANT + 1]);
                 }
             } catch (RemoteException e) {
                 // TTS died; restart it.
@@ -1151,7 +1178,7 @@
             }
             try {
                 result = mITts.isLanguageAvailable(loc.getISO3Language(),
-                        loc.getISO3Country(), loc.getVariant());
+                        loc.getISO3Country(), loc.getVariant(), mCachedParams);
             } catch (RemoteException e) {
                 // TTS died; restart it.
                 Log.e("TextToSpeech.java - isLanguageAvailable", "RemoteException");
@@ -1345,8 +1372,6 @@
      * Gets the packagename of the default speech synthesis engine.
      *
      * @return Packagename of the TTS engine that the user has chosen as their default.
-     *
-     * @hide
      */
     public String getDefaultEngine() {
         synchronized (mStartLock) {
@@ -1386,8 +1411,6 @@
      * Text-To-Speech settings set by applications.
      *
      * @return Whether or not defaults are enforced.
-     *
-     * @hide
      */
     public boolean areDefaultsEnforced() {
         synchronized (mStartLock) {
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 006aff8..eca583f 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -3457,11 +3457,11 @@
      * The base LayoutParams class just describes how big the view wants to be
      * for both width and height. For each dimension, it can specify one of:
      * <ul>
-     * <li> an exact number
-     * <li>MATCH_PARENT, which means the view wants to be as big as its parent
-     * (minus padding)
+     * <li>FILL_PARENT (renamed MATCH_PARENT in API Level 8 and higher), which
+     * means that the view wants to be as big as its parent (minus padding)
      * <li> WRAP_CONTENT, which means that the view wants to be just big enough
      * to enclose its content (plus padding)
+     * <li> an exact number
      * </ul>
      * There are subclasses of LayoutParams for different subclasses of
      * ViewGroup. For example, AbsoluteLayout has its own subclass of
@@ -3472,8 +3472,10 @@
      */
     public static class LayoutParams {
         /**
-         * This value has the same meaning as {@link #MATCH_PARENT} but has
-         * been deprecated.
+         * Special value for the height or width requested by a View.
+         * FILL_PARENT means that the view wants to be as big as its parent,
+         * minus the parent's padding, if any. This value is deprecated
+         * starting in API Level 8 and replaced by {@link #MATCH_PARENT}.
          */
         @SuppressWarnings({"UnusedDeclaration"})
         @Deprecated
@@ -3482,7 +3484,7 @@
         /**
          * Special value for the height or width requested by a View.
          * MATCH_PARENT means that the view wants to be as big as its parent,
-         * minus the parent's padding, if any.
+         * minus the parent's padding, if any. Introduced in API Level 8.
          */
         public static final int MATCH_PARENT = -1;
 
@@ -3494,8 +3496,9 @@
         public static final int WRAP_CONTENT = -2;
 
         /**
-         * Information about how wide the view wants to be. Can be an exact
-         * size, or one of the constants MATCH_PARENT or WRAP_CONTENT.
+         * Information about how wide the view wants to be. Can be one of the
+         * constants FILL_PARENT (replaced by MATCH_PARENT ,
+         * in API Level 8) or WRAP_CONTENT. or an exact size.
          */
         @ViewDebug.ExportedProperty(mapping = {
             @ViewDebug.IntToString(from = MATCH_PARENT, to = "MATCH_PARENT"),
@@ -3504,8 +3507,9 @@
         public int width;
 
         /**
-         * Information about how tall the view wants to be. Can be an exact
-         * size, or one of the constants MATCH_PARENT or WRAP_CONTENT.
+         * Information about how tall the view wants to be. Can be one of the
+         * constants FILL_PARENT (replaced by MATCH_PARENT ,
+         * in API Level 8) or WRAP_CONTENT. or an exact size.
          */
         @ViewDebug.ExportedProperty(mapping = {
             @ViewDebug.IntToString(from = MATCH_PARENT, to = "MATCH_PARENT"),
@@ -3525,9 +3529,11 @@
          *
          * <ul>
          *   <li><code>layout_width</code>: the width, either an exact value,
-         *   {@link #WRAP_CONTENT} or {@link #MATCH_PARENT}</li>
+         *   {@link #WRAP_CONTENT}, or {@link #FILL_PARENT} (replaced by
+         *   {@link #MATCH_PARENT} in API Level 8)</li>
          *   <li><code>layout_height</code>: the height, either an exact value,
-         *   {@link #WRAP_CONTENT} or {@link #MATCH_PARENT}</li>
+         *   {@link #WRAP_CONTENT}, or {@link #FILL_PARENT} (replaced by
+         *   {@link #MATCH_PARENT} in API Level 8)</li>
          * </ul>
          *
          * @param c the application environment
@@ -3546,10 +3552,12 @@
          * Creates a new set of layout parameters with the specified width
          * and height.
          *
-         * @param width the width, either {@link #MATCH_PARENT},
-         *        {@link #WRAP_CONTENT} or a fixed size in pixels
-         * @param height the height, either {@link #MATCH_PARENT},
-         *        {@link #WRAP_CONTENT} or a fixed size in pixels
+         * @param width the width, either {@link #WRAP_CONTENT},
+         *        {@link #FILL_PARENT} (replaced by {@link #MATCH_PARENT} in
+         *        API Level 8), or a fixed size in pixels
+         * @param height the height, either {@link #WRAP_CONTENT},
+         *        {@link #FILL_PARENT} (replaced by {@link #MATCH_PARENT} in
+         *        API Level 8), or a fixed size in pixels
          */
         public LayoutParams(int width, int height) {
             this.width = width;
diff --git a/core/java/android/webkit/BrowserFrame.java b/core/java/android/webkit/BrowserFrame.java
index beac0b8..219a469 100644
--- a/core/java/android/webkit/BrowserFrame.java
+++ b/core/java/android/webkit/BrowserFrame.java
@@ -188,7 +188,7 @@
         // Create a global JWebCoreJavaBridge to handle timers and
         // cookies in the WebCore thread.
         if (sJavaBridge == null) {
-            sJavaBridge = new JWebCoreJavaBridge(appContext);
+            sJavaBridge = new JWebCoreJavaBridge();
             // set WebCore native cache size
             ActivityManager am = (ActivityManager) context
                     .getSystemService(Context.ACTIVITY_SERVICE);
diff --git a/core/java/android/webkit/CookieManager.java b/core/java/android/webkit/CookieManager.java
index 74a648e..758a152 100644
--- a/core/java/android/webkit/CookieManager.java
+++ b/core/java/android/webkit/CookieManager.java
@@ -693,8 +693,17 @@
      */
     private String[] getHostAndPath(WebAddress uri) {
         if (uri.mHost != null && uri.mPath != null) {
+
+            /*
+             * The domain (i.e. host) portion of the cookie is supposed to be
+             * case-insensitive. We will consistently return the domain in lower
+             * case, which allows us to do the more efficient equals comparison
+             * instead of equalIgnoreCase.
+             *
+             * See: http://www.ieft.org/rfc/rfc2965.txt (Section 3.3.3)
+             */
             String[] ret = new String[2];
-            ret[0] = uri.mHost;
+            ret[0] = uri.mHost.toLowerCase();
             ret[1] = uri.mPath;
 
             int index = ret[0].indexOf(PERIOD);
@@ -728,6 +737,7 @@
             if (index != -1) {
                 ret[1] = ret[1].substring(0, index);
             }
+
             return ret;
         } else
             return null;
diff --git a/core/java/android/webkit/JWebCoreJavaBridge.java b/core/java/android/webkit/JWebCoreJavaBridge.java
index 9dc7079..e766693 100644
--- a/core/java/android/webkit/JWebCoreJavaBridge.java
+++ b/core/java/android/webkit/JWebCoreJavaBridge.java
@@ -16,7 +16,6 @@
 
 package android.webkit;
 
-import android.content.Context;
 import android.os.Handler;
 import android.os.Message;
 import android.util.Log;
@@ -43,7 +42,9 @@
     private boolean mTimerPaused;
     private boolean mHasDeferredTimers;
 
-    private Context mContext;
+    // keep track of the main WebView attached to the current window so that we
+    // can get the proper Context.
+    private WebView mCurrentMainWebView;
 
     /* package */
     static final int REFRESH_PLUGINS = 100;
@@ -52,8 +53,7 @@
      * Construct a new JWebCoreJavaBridge to interface with
      * WebCore timers and cookies.
      */
-    public JWebCoreJavaBridge(Context context) {
-        mContext = context;
+    public JWebCoreJavaBridge() {
         nativeConstructor();
     }
 
@@ -62,6 +62,22 @@
         nativeFinalize();
     }
 
+    synchronized void setActiveWebView(WebView webview) {
+        if (mCurrentMainWebView != null) {
+            // it is possible if there is a sub-WebView. Do nothing.
+            return;
+        }
+        mCurrentMainWebView = webview;
+    }
+
+    synchronized void removeActiveWebView(WebView webview) {
+        if (mCurrentMainWebView != webview) {
+            // it is possible if there is a sub-WebView. Do nothing.
+            return;
+        }
+        mCurrentMainWebView = null;
+    }
+
     /**
      * Call native timer callbacks.
      */
@@ -238,9 +254,17 @@
         return CertTool.getKeyStrengthList();
     }
 
-    private String getSignedPublicKey(int index, String challenge, String url) {
-        // generateKeyPair expects organizations which we don't have. Ignore url.
-        return CertTool.getSignedPublicKey(mContext, index, challenge);
+    synchronized private String getSignedPublicKey(int index, String challenge,
+            String url) {
+        if (mCurrentMainWebView != null) {
+            // generateKeyPair expects organizations which we don't have. Ignore
+            // url.
+            return CertTool.getSignedPublicKey(
+                    mCurrentMainWebView.getContext(), index, challenge);
+        } else {
+            Log.e(LOGTAG, "There is no active WebView for getSignedPublicKey");
+            return "";
+        }
     }
 
     private native void nativeConstructor();
diff --git a/core/java/android/webkit/LoadListener.java b/core/java/android/webkit/LoadListener.java
index 1dfadde..1130e95 100644
--- a/core/java/android/webkit/LoadListener.java
+++ b/core/java/android/webkit/LoadListener.java
@@ -474,6 +474,7 @@
                         WebViewWorker.MSG_CREATE_CACHE, data).sendToTarget();
             }
             WebViewWorker.CacheEncoding ce = new WebViewWorker.CacheEncoding();
+            ce.mEncoding = mEncoding;
             WebViewWorker.getHandler().obtainMessage(
                     WebViewWorker.MSG_UPDATE_CACHE_ENCODING, ce).sendToTarget();
         }
diff --git a/core/java/android/webkit/WebView.java b/core/java/android/webkit/WebView.java
index 9acfda5..0eb5177 100644
--- a/core/java/android/webkit/WebView.java
+++ b/core/java/android/webkit/WebView.java
@@ -2066,7 +2066,7 @@
                 mScrollX = pinLocX(mScrollX);
                 mScrollY = pinLocY(mScrollY);
                 if (oldX != mScrollX || oldY != mScrollY) {
-                    sendOurVisibleRect();
+                    onScrollChanged(mScrollX, mScrollY, oldX, oldY);
                 }
                 if (!mScroller.isFinished()) {
                     // We are in the middle of a scroll.  Repin the final scroll
@@ -2130,9 +2130,12 @@
                 mScrollX = pinLocX(Math.round(sx));
                 mScrollY = pinLocY(Math.round(sy));
 
+                if (oldX != mScrollX || oldY != mScrollY) {
+                    onScrollChanged(mScrollX, mScrollY, oldX, oldY);
+                }
+
                 // update webkit
                 sendViewSizeZoom();
-                sendOurVisibleRect();
             }
         }
     }
@@ -2634,9 +2637,7 @@
             mScrollY = mScroller.getCurrY();
             postInvalidate();  // So we draw again
             if (oldX != mScrollX || oldY != mScrollY) {
-                // As onScrollChanged() is not called, sendOurVisibleRect()
-                // needs to be called explicitly.
-                sendOurVisibleRect();
+                onScrollChanged(mScrollX, mScrollY, oldX, oldY);
             }
         } else {
             super.computeScroll();
@@ -3347,8 +3348,10 @@
                 mUserScroll = false;
                 mWebViewCore.sendMessage(EventHub.SYNC_SCROLL, oldScrollX,
                         oldScrollY);
+                onScrollChanged(mScrollX, mScrollY, oldScrollX, oldScrollY);
+            } else {
+                sendOurVisibleRect();
             }
-            sendOurVisibleRect();
         }
     }
 
@@ -3916,13 +3919,14 @@
     @Override
     protected void onAttachedToWindow() {
         super.onAttachedToWindow();
-        if (hasWindowFocus()) onWindowFocusChanged(true);
+        if (hasWindowFocus()) setActive(true);
     }
 
     @Override
     protected void onDetachedFromWindow() {
         clearTextEntry(false);
         dismissZoomControl();
+        if (hasWindowFocus()) setActive(false);
         super.onDetachedFromWindow();
     }
 
@@ -3949,11 +3953,8 @@
     public void onGlobalFocusChanged(View oldFocus, View newFocus) {
     }
 
-    // To avoid drawing the cursor ring, and remove the TextView when our window
-    // loses focus.
-    @Override
-    public void onWindowFocusChanged(boolean hasWindowFocus) {
-        if (hasWindowFocus) {
+    private void setActive(boolean active) {
+        if (active) {
             if (hasFocus()) {
                 // If our window regained focus, and we have focus, then begin
                 // drawing the cursor ring
@@ -3973,7 +3974,8 @@
                 // false for the first parameter
             }
         } else {
-            if (getSettings().getBuiltInZoomControls() && !getZoomButtonsController().isVisible()) {
+            if (getSettings().getBuiltInZoomControls()
+                    && !getZoomButtonsController().isVisible()) {
                 /*
                  * The zoom controls come in their own window, so our window
                  * loses focus. Our policy is to not draw the cursor ring if
@@ -3994,6 +3996,18 @@
             setFocusControllerInactive();
         }
         invalidate();
+    }
+
+    // To avoid drawing the cursor ring, and remove the TextView when our window
+    // loses focus.
+    @Override
+    public void onWindowFocusChanged(boolean hasWindowFocus) {
+        setActive(hasWindowFocus);
+        if (hasWindowFocus) {
+            BrowserFrame.sJavaBridge.setActiveWebView(this);
+        } else {
+            BrowserFrame.sJavaBridge.removeActiveWebView(this);
+        }
         super.onWindowFocusChanged(hasWindowFocus);
     }
 
diff --git a/core/java/android/widget/AbsListView.java b/core/java/android/widget/AbsListView.java
index 66461a7..4aae05e 100644
--- a/core/java/android/widget/AbsListView.java
+++ b/core/java/android/widget/AbsListView.java
@@ -2059,12 +2059,6 @@
                     deltaY -= mMotionCorrection;
                     int incrementalDeltaY = mLastY != Integer.MIN_VALUE ? y - mLastY : deltaY;
                     
-                    int motionViewPrevTop = 0;
-                    View motionView = this.getChildAt(mMotionPosition - mFirstPosition);
-                    if (motionView != null) {
-                        motionViewPrevTop = motionView.getTop();
-                    }
-                    
                     // No need to do all this work if we're not going to move anyway
                     boolean atEdge = false;
                     if (incrementalDeltaY != 0) {
@@ -2072,14 +2066,19 @@
                     }
 
                     // Check to see if we have bumped into the scroll limit
-                    motionView = this.getChildAt(mMotionPosition - mFirstPosition);
-                    if (motionView != null) {
-                        // Check if the top of the motion view is where it is
-                        // supposed to be
-                        final int motionViewRealTop = motionView.getTop();
-                        if (atEdge) {
-                            invalidate();
+                    if (atEdge && getChildCount() > 0) {
+                        // Treat this like we're starting a new scroll from the current
+                        // position. This will let the user start scrolling back into
+                        // content immediately rather than needing to scroll back to the
+                        // point where they hit the limit first.
+                        int motionPosition = findMotionRow(y);
+                        if (motionPosition >= 0) {
+                            final View motionView = getChildAt(motionPosition - mFirstPosition);
+                            mMotionViewOriginalTop = motionView.getTop();
                         }
+                        mMotionY = y;
+                        mMotionPosition = motionPosition;
+                        invalidate();
                     }
                     mLastY = y;
                 }
diff --git a/core/java/com/android/internal/app/ShutdownThread.java b/core/java/com/android/internal/app/ShutdownThread.java
index 51cd0f8..83614a8 100644
--- a/core/java/com/android/internal/app/ShutdownThread.java
+++ b/core/java/com/android/internal/app/ShutdownThread.java
@@ -33,6 +33,7 @@
 import android.os.RemoteException;
 import android.os.ServiceManager;
 import android.os.SystemClock;
+import android.os.Vibrator;
 import android.os.storage.IMountService;
 import android.os.storage.IMountShutdownObserver;
 
@@ -48,6 +49,9 @@
     // maximum time we wait for the shutdown broadcast before going on.
     private static final int MAX_BROADCAST_TIME = 10*1000;
     private static final int MAX_SHUTDOWN_WAIT_TIME = 20*1000;
+
+    // length of vibration before shutting down
+    private static final int SHUTDOWN_VIBRATE_MS = 500;
     
     // state tracking
     private static Object sIsStartedGuard = new Object();
@@ -324,6 +328,15 @@
             } catch (Exception e) {
                 Log.e(TAG, "Reboot failed, will attempt shutdown instead", e);
             }
+        } else if (SHUTDOWN_VIBRATE_MS > 0) {
+            // vibrate before shutting down
+            Vibrator vibrator = new Vibrator();
+            vibrator.vibrate(SHUTDOWN_VIBRATE_MS);
+            // vibrator is asynchronous so we need to wait to avoid shutting down too soon.
+            try {
+                Thread.sleep(SHUTDOWN_VIBRATE_MS);
+            } catch (InterruptedException e) {
+            }
         }
 
         // Shutdown power
diff --git a/core/java/com/android/internal/os/BatteryStatsImpl.java b/core/java/com/android/internal/os/BatteryStatsImpl.java
index 24275ec..833c01b 100644
--- a/core/java/com/android/internal/os/BatteryStatsImpl.java
+++ b/core/java/com/android/internal/os/BatteryStatsImpl.java
@@ -895,9 +895,15 @@
 
                 String[] nameStringArray = mProcWakelocksName;
                 long[] wlData = mProcWakelocksData;
+                // Stomp out any bad characters since this is from a circular buffer
+                // A corruption is seen sometimes that results in the vm crashing
+                // This should prevent crashes and the line will probably fail to parse
+                for (int j = startIndex; j < endIndex; j++) {
+                    if ((wlBuffer[j] & 0x80) != 0) wlBuffer[j] = (byte) '?';
+                }
                 boolean parsed = Process.parseProcLine(wlBuffer, startIndex, endIndex,
                         PROC_WAKELOCKS_FORMAT, nameStringArray, wlData, null);
-                
+
                 name = nameStringArray[0];
                 count = (int) wlData[1];
                 // convert nanoseconds to microseconds with rounding.
diff --git a/core/java/com/android/internal/view/menu/MenuDialogHelper.java b/core/java/com/android/internal/view/menu/MenuDialogHelper.java
index 70f040a..d7438d6 100644
--- a/core/java/com/android/internal/view/menu/MenuDialogHelper.java
+++ b/core/java/com/android/internal/view/menu/MenuDialogHelper.java
@@ -101,11 +101,19 @@
                         }
                     }
                 }
-            } else if (event.getAction() == KeyEvent.ACTION_UP
-                    && event.isTracking() && !event.isCanceled()) {
-                mMenu.close(true);
-                dialog.dismiss();
-                return true;
+            } else if (event.getAction() == KeyEvent.ACTION_UP && !event.isCanceled()) {
+                Window win = mDialog.getWindow();
+                if (win != null) {
+                    View decor = win.getDecorView();
+                    if (decor != null) {
+                        KeyEvent.DispatcherState ds = decor.getKeyDispatcherState();
+                        if (ds != null && ds.isTracking(event)) {
+                            mMenu.close(true);
+                            dialog.dismiss();
+                            return true;
+                        }
+                    }
+                }
             }
         }
 
diff --git a/core/java/com/android/internal/widget/LockPatternView.java b/core/java/com/android/internal/widget/LockPatternView.java
index 6adce6d..007e7b9 100644
--- a/core/java/com/android/internal/widget/LockPatternView.java
+++ b/core/java/com/android/internal/widget/LockPatternView.java
@@ -21,6 +21,7 @@
 
 import android.content.Context;
 import android.content.res.Resources;
+import android.content.res.TypedArray;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Canvas;
@@ -50,6 +51,11 @@
  * "correct" states.
  */
 public class LockPatternView extends View {
+    // Aspect to use when rendering this view
+    private static final int ASPECT_SQUARE = 0; // View will be the minimum of width/height
+    private static final int ASPECT_LOCK_WIDTH = 1; // Fixed width; height will be minimum of (w,h)
+    private static final int ASPECT_LOCK_HEIGHT = 2; // Fixed height; width will be minimum of (w,h)
+
     // Vibrator pattern for creating a tactile bump
     private static final long[] DEFAULT_VIBE_PATTERN = {0, 1, 40, 41};
 
@@ -116,12 +122,14 @@
 
     private int mBitmapWidth;
     private int mBitmapHeight;
-   
+
 
     private Vibrator vibe; // Vibrator for creating tactile feedback
 
     private long[] mVibePattern;
 
+    private int mAspect;
+
     /**
      * Represents a cell in the 3 X 3 matrix of the unlock pattern view.
      */
@@ -237,6 +245,20 @@
         super(context, attrs);
         vibe = new Vibrator();
 
+        TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.LockPatternView);
+
+        final String aspect = a.getString(R.styleable.LockPatternView_aspect);
+
+        if ("square".equals(aspect)) {
+            mAspect = ASPECT_SQUARE;
+        } else if ("lock_width".equals(aspect)) {
+            mAspect = ASPECT_LOCK_WIDTH;
+        } else if ("lock_height".equals(aspect)) {
+            mAspect = ASPECT_LOCK_HEIGHT;
+        } else {
+            mAspect = ASPECT_SQUARE;
+        }
+
         setClickable(true);
 
         mPathPaint.setAntiAlias(true);
@@ -425,8 +447,22 @@
     protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
         final int width = MeasureSpec.getSize(widthMeasureSpec);
         final int height = MeasureSpec.getSize(heightMeasureSpec);
-        final int squareSide = Math.min(width, height);
-        setMeasuredDimension(squareSide, squareSide);
+        int viewWidth = width;
+        int viewHeight = height;
+        switch (mAspect) {
+            case ASPECT_SQUARE:
+                viewWidth = viewHeight = Math.min(width, height);
+                break;
+            case ASPECT_LOCK_WIDTH:
+                viewWidth = width;
+                viewHeight = Math.min(width, height);
+                break;
+            case ASPECT_LOCK_HEIGHT:
+                viewWidth = Math.min(width, height);
+                viewHeight = height;
+                break;
+        }
+        setMeasuredDimension(viewWidth, viewHeight);
     }
 
     /**
@@ -890,17 +926,17 @@
         Matrix matrix = new Matrix();
         final int cellWidth = mBitmapCircleDefault.getWidth();
         final int cellHeight = mBitmapCircleDefault.getHeight();
-        
+
         // the up arrow bitmap is at 12:00, so find the rotation from x axis and add 90 degrees.
         final float theta = (float) Math.atan2(
                 (double) (endRow - startRow), (double) (endColumn - startColumn));
-        final float angle = (float) Math.toDegrees(theta) + 90.0f; 
-        
+        final float angle = (float) Math.toDegrees(theta) + 90.0f;
+
         // compose matrix
         matrix.setTranslate(leftX + offsetX, topY + offsetY); // transform to cell position
         matrix.preRotate(angle, cellWidth / 2.0f, cellHeight / 2.0f);  // rotate about cell center
         matrix.preTranslate((cellWidth - arrow.getWidth()) / 2.0f, 0.0f); // translate to 12:00 pos
-        canvas.drawBitmap(arrow, matrix, mPaint); 
+        canvas.drawBitmap(arrow, matrix, mPaint);
     }
 
     /**
@@ -1004,7 +1040,7 @@
             mInStealthMode = (Boolean) in.readValue(null);
             mTactileFeedbackEnabled = (Boolean) in.readValue(null);
         }
-        
+
         public String getSerializedPattern() {
             return mSerializedPattern;
         }
diff --git a/core/res/res/layout/keyguard_screen_unlock_portrait.xml b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
index 97c4ae9..8dacfaf 100644
--- a/core/res/res/layout/keyguard_screen_unlock_portrait.xml
+++ b/core/res/res/layout/keyguard_screen_unlock_portrait.xml
@@ -154,6 +154,7 @@
         android:layout_height="0dip"
         android:layout_weight="1"
         android:layout_marginTop="2dip"
+        android:aspect="@string/lock_pattern_view_aspect"
          />
 
     <!-- footer -->
diff --git a/core/res/res/values-port-mdpi/donottranslate.xml b/core/res/res/values-port-mdpi/donottranslate.xml
new file mode 100644
index 0000000..b4581fe
--- /dev/null
+++ b/core/res/res/values-port-mdpi/donottranslate.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/* //device/apps/common/assets/res/any/strings.xml
+**
+** Copyright 2009, The Android Open Source Project
+**
+** Licensed under the Apache License, Version 2.0 (the "License");
+** you may not use this file except in compliance with the License.
+** You may obtain a copy of the License at
+**
+**     http://www.apache.org/licenses/LICENSE-2.0
+**
+** Unless required by applicable law or agreed to in writing, software
+** distributed under the License is distributed on an "AS IS" BASIS,
+** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+** See the License for the specific language governing permissions and
+** limitations under the License.
+*/
+-->
+<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
+    <!-- @hide DO NOT TRANSLATE. There isn't enough room on mdpi devices, allow height to vary -->
+    <string name="lock_pattern_view_aspect">lock_width</string>
+</resources>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index 24808ec..6d6c47f 100644
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -1396,9 +1396,12 @@
              be a dimension (such as "12dip") for a constant width or one of
              the special constants. -->
         <attr name="layout_width" format="dimension">
-            <!-- <strong>Deprecated.</strong> Use {@code match_parent} instead. -->
+            <!-- The view should be as big as its parent (minus padding).
+                 This constant is deprecated starting from API Level 8 and
+                 is replaced by {@code match_parent}. -->
             <enum name="fill_parent" value="-1" />
-            <!-- The view should be as big as its parent (minus padding). -->
+            <!-- The view should be as big as its parent (minus padding).
+                 Introduced in API Level 8. -->
             <enum name="match_parent" value="-1" />
             <!-- The view should be only big enough to enclose its content (plus padding). -->
             <enum name="wrap_content" value="-2" />
@@ -1409,9 +1412,12 @@
              be a dimension (such as "12dip") for a constant height or one of
              the special constants. -->
         <attr name="layout_height" format="dimension">
-            <!-- <strong>Deprecated.</strong> Use {@code match_parent} instead. -->
+            <!-- The view should be as big as its parent (minus padding).
+                 This constant is deprecated starting from API Level 8 and
+                 is replaced by {@code match_parent}. -->
             <enum name="fill_parent" value="-1" />
-            <!-- The view should be as big as its parent (minus padding). -->
+            <!-- The view should be as big as its parent (minus padding).
+                 Introduced in API Level 8. -->
             <enum name="match_parent" value="-1" />
             <!-- The view should be only big enough to enclose its content (plus padding). -->
             <enum name="wrap_content" value="-2" />
@@ -2128,27 +2134,35 @@
              is used. -->
         <attr name="dropDownAnchor" format="reference" />
         <!-- Specifies the basic width of the dropdown. Its value may
-             be a dimension (such as "12dip") for a constant width, match_parent
-             to match the width of the screen, or wrap_content to match the width
-             of the anchored view. -->
+             be a dimension (such as "12dip") for a constant width,
+             fill_parent or match_parent to match the width of the 
+             screen, or wrap_content to match the width of
+             the anchored view. -->
         <attr name="dropDownWidth" format="dimension">
-            <!-- <strong>Deprecated.</strong> Use {@code match_parent} instead. -->
+            <!-- The dropdown should fill the width of the screen.
+                 This constant is deprecated starting from API Level 8 and
+                 is replaced by {@code match_parent}. -->
             <enum name="fill_parent" value="-1" />
-            <!-- The dropdown should fit the width of the screen. -->
+            <!-- The dropdown should fit the width of the screen.
+                 Introduced in API Level 8. -->
             <enum name="match_parent" value="-1" />
             <!-- The dropdown should fit the width of its anchor. -->
             <enum name="wrap_content" value="-2" />
         </attr>
-        <!-- Specifies the basic width of the dropdown. Its value may
-             be a dimension (such as "12dip") for a constant width, match_parent
-             to fill the width of the screen, or wrap_content to match the height of
+        <!-- Specifies the basic height of the dropdown. Its value may
+             be a dimension (such as "12dip") for a constant height,
+             fill_parent or match_parent to fill the height of the
+             screen, or wrap_content to match the height of
              the content of the drop down. -->
         <attr name="dropDownHeight" format="dimension">
-            <!-- <strong>Deprecated.</strong> Use {@code match_parent} instead. -->
+            <!-- The dropdown should fit the height of the screen.
+                 This constant is deprecated starting from API Level 8 and
+                 is replaced by {@code match_parent}. -->
             <enum name="fill_parent" value="-1" />
-            <!-- The dropdown should fill the width of the screen. -->
+            <!-- The dropdown should fit the height of the screen.
+                 Introduced in API Level 8. -->
             <enum name="match_parent" value="-1" />
-            <!-- The dropdown should fit the width of its anchor. -->
+            <!-- The dropdown should fit the height of the content. -->
             <enum name="wrap_content" value="-2" />
         </attr>
         <attr name="inputType" />
@@ -3609,7 +3623,18 @@
         <!-- Use "horizontal" for a row, "vertical" for a column.  The default is horizontal. -->
         <attr name="orientation" />
     </declare-styleable>
-    
+
+    <!-- =============================== -->
+    <!-- LockPatternView class attributes -->
+    <!-- =============================== -->
+    <eat-comment />
+
+    <declare-styleable name="LockPatternView">
+        <!-- Aspect to use when drawing LockPatternView. Choices are "square"(default), "lock_width"
+             or "lock_height" -->
+        <attr name="aspect" format="string" />
+    </declare-styleable>
+
     <!-- Use <code>recognition-service</code> as the root tag of the XML resource that
          describes a {@link android.speech.RecognitionService}, which is reference from
          its {@link android.speech.RecognitionService#SERVICE_META_DATA} meta-data entry.
diff --git a/core/res/res/values/donottranslate.xml b/core/res/res/values/donottranslate.xml
index 78d4d36d..d6d5dbb 100644
--- a/core/res/res/values/donottranslate.xml
+++ b/core/res/res/values/donottranslate.xml
@@ -22,4 +22,6 @@
     <string name="default_text_encoding">Latin-1</string>
     <!-- @hide DO NOT TRANSLATE. Workaround for resource race condition in lockscreen. -->
     <bool name="lockscreen_isPortrait">true</bool>
+    <!-- @hide DO NOT TRANSLATE. Control aspect ratio of lock pattern -->
+    <string name="lock_pattern_view_aspect">square</string>
 </resources>
diff --git a/core/tests/coretests/Android.mk b/core/tests/coretests/Android.mk
index b0e2843..c067b80 100644
--- a/core/tests/coretests/Android.mk
+++ b/core/tests/coretests/Android.mk
@@ -7,6 +7,8 @@
 # Include all test java files.
 LOCAL_SRC_FILES := \
 	$(call all-java-files-under, src) \
+	$(call all-java-files-under, DisabledTestApp/src) \
+	$(call all-java-files-under, EnabledTestApp/src) \
 	src/android/os/IAidlTest.aidl
 
 LOCAL_STATIC_JAVA_LIBRARIES += android-common
@@ -18,3 +20,4 @@
 
 include $(BUILD_PACKAGE)
 
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/core/tests/coretests/AndroidManifest.xml b/core/tests/coretests/AndroidManifest.xml
index 9972a8c..30855d1 100644
--- a/core/tests/coretests/AndroidManifest.xml
+++ b/core/tests/coretests/AndroidManifest.xml
@@ -16,7 +16,8 @@
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           android:installLocation="internalOnly"
-          package="com.android.frameworks.coretests">
+          package="com.android.frameworks.coretests"
+          android:sharedUserId="com.android.uid.test">
 
     <permission android:name="com.android.frameworks.coretests.permission.TEST_GRANTED"
         android:protectionLevel="normal"
diff --git a/tests/AndroidTests/DisabledTestApp/Android.mk b/core/tests/coretests/DisabledTestApp/Android.mk
similarity index 100%
rename from tests/AndroidTests/DisabledTestApp/Android.mk
rename to core/tests/coretests/DisabledTestApp/Android.mk
diff --git a/core/tests/coretests/DisabledTestApp/AndroidManifest.xml b/core/tests/coretests/DisabledTestApp/AndroidManifest.xml
new file mode 100644
index 0000000..5bd840f
--- /dev/null
+++ b/core/tests/coretests/DisabledTestApp/AndroidManifest.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+        package="com.android.frameworks.coretests.disabled_app"
+        android:sharedUserId="com.android.uid.test">
+
+    <application enabled="false">
+
+        <!-- Used to test package component enabling and disabling -->
+        <activity android:name=".DisabledActivity" android:enabled="false" >
+        </activity>
+        <activity android:name=".EnabledActivity" >
+        </activity>
+    </application>
+</manifest>
diff --git a/tests/AndroidTests/DisabledTestApp/src/com/android/unit_tests/disabled_app/EnabledActivity.java b/core/tests/coretests/DisabledTestApp/src/com/android/frameworks/coretests/disabled_app/EnabledActivity.java
similarity index 92%
copy from tests/AndroidTests/DisabledTestApp/src/com/android/unit_tests/disabled_app/EnabledActivity.java
copy to core/tests/coretests/DisabledTestApp/src/com/android/frameworks/coretests/disabled_app/EnabledActivity.java
index 4e4dc85..e676231 100644
--- a/tests/AndroidTests/DisabledTestApp/src/com/android/unit_tests/disabled_app/EnabledActivity.java
+++ b/core/tests/coretests/DisabledTestApp/src/com/android/frameworks/coretests/disabled_app/EnabledActivity.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests.disabled_app;
+package com.android.frameworks.coretests.disabled_app;
 
 import android.app.Activity;
 
diff --git a/tests/AndroidTests/EnabledTestApp/Android.mk b/core/tests/coretests/EnabledTestApp/Android.mk
similarity index 100%
rename from tests/AndroidTests/EnabledTestApp/Android.mk
rename to core/tests/coretests/EnabledTestApp/Android.mk
diff --git a/core/tests/coretests/EnabledTestApp/AndroidManifest.xml b/core/tests/coretests/EnabledTestApp/AndroidManifest.xml
new file mode 100644
index 0000000..72d933a
--- /dev/null
+++ b/core/tests/coretests/EnabledTestApp/AndroidManifest.xml
@@ -0,0 +1,52 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+        package="com.android.frameworks.coretests.enabled_app"
+        android:sharedUserId="com.android.uid.test">
+
+    <application>
+
+        <!-- Used to test package component enabling and disabling -->
+        <activity android:name=".DisabledActivity" android:enabled="false" >
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="com.android.frameworks.coretests.enabled_app.TEST_CATEGORY" />
+            </intent-filter>
+        </activity>
+        <service android:name=".DisabledService" android:enabled="false" >
+        </service>
+        <receiver android:name=".DisabledReceiver" android:enabled="false" >
+            <intent-filter>
+                <action android:name="android.intent.action.ENABLED_APP_DISABLED_RECEIVER" />
+            </intent-filter>
+        </receiver>
+        <provider android:name=".DisabledProvider" android:enabled="false"
+                  android:authorities="com.android.frameworks.coretests.enabled_app.DisabledProvider"
+                  android:process=":disabled.provider.process" />
+        <activity android:name=".EnabledActivity" >
+        </activity>
+        <service android:name=".EnabledService" android:enabled="true" >
+        </service>
+        <receiver android:name=".EnabledReceiver" >
+            <intent-filter>
+                <action android:name="android.intent.action.ENABLED_APP_ENABLED_RECEIVER" />
+            </intent-filter>
+        </receiver>
+        <provider android:name=".EnabledProvider"
+                  android:authorities="com.android.frameworks.coretests.enabled_app.EnabledProvider"
+                  android:process=":enabled.provider.process" />
+    </application>
+</manifest>
diff --git a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledActivity.java b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/DisabledActivity.java
similarity index 92%
rename from tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledActivity.java
rename to core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/DisabledActivity.java
index 0ab0416..325adfe 100644
--- a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledActivity.java
+++ b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/DisabledActivity.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests.enabled_app;
+package com.android.frameworks.coretests.enabled_app;
 
 import android.app.Activity;
 
diff --git a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledProvider.java b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/DisabledProvider.java
similarity index 96%
rename from tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledProvider.java
rename to core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/DisabledProvider.java
index 06527f9..26781c4 100644
--- a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledProvider.java
+++ b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/DisabledProvider.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests.enabled_app;
+package com.android.frameworks.coretests.enabled_app;
 
 import android.content.ContentProvider;
 import android.content.ContentValues;
diff --git a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledReceiver.java b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/DisabledReceiver.java
similarity index 93%
rename from tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledReceiver.java
rename to core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/DisabledReceiver.java
index c27b87e..b06d2ce 100644
--- a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledReceiver.java
+++ b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/DisabledReceiver.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests.enabled_app;
+package com.android.frameworks.coretests.enabled_app;
 
 import android.content.BroadcastReceiver;
 import android.content.Context;
diff --git a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledService.java b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/DisabledService.java
similarity index 93%
rename from tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledService.java
rename to core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/DisabledService.java
index ed8d0b9..ac66ae5 100644
--- a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/DisabledService.java
+++ b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/DisabledService.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests.enabled_app;
+package com.android.frameworks.coretests.enabled_app;
 
 import android.app.Service;
 import android.os.IBinder;
diff --git a/tests/AndroidTests/DisabledTestApp/src/com/android/unit_tests/disabled_app/EnabledActivity.java b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/EnabledActivity.java
similarity index 92%
rename from tests/AndroidTests/DisabledTestApp/src/com/android/unit_tests/disabled_app/EnabledActivity.java
rename to core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/EnabledActivity.java
index 4e4dc85..1b0ac6d 100644
--- a/tests/AndroidTests/DisabledTestApp/src/com/android/unit_tests/disabled_app/EnabledActivity.java
+++ b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/EnabledActivity.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests.disabled_app;
+package com.android.frameworks.coretests.enabled_app;
 
 import android.app.Activity;
 
diff --git a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledProvider.java b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/EnabledProvider.java
similarity index 96%
rename from tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledProvider.java
rename to core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/EnabledProvider.java
index 764937f..8da70b4 100644
--- a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledProvider.java
+++ b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/EnabledProvider.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests.enabled_app;
+package com.android.frameworks.coretests.enabled_app;
 
 import android.content.ContentProvider;
 import android.content.ContentValues;
diff --git a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledReceiver.java b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/EnabledReceiver.java
similarity index 93%
rename from tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledReceiver.java
rename to core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/EnabledReceiver.java
index 707448f..6cee98d 100644
--- a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledReceiver.java
+++ b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/EnabledReceiver.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests.enabled_app;
+package com.android.frameworks.coretests.enabled_app;
 
 import android.content.BroadcastReceiver;
 import android.content.Context;
diff --git a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledService.java b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/EnabledService.java
similarity index 93%
rename from tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledService.java
rename to core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/EnabledService.java
index 81a80b3..7d05db0 100644
--- a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledService.java
+++ b/core/tests/coretests/EnabledTestApp/src/com/android/frameworks/coretests/enabled_app/EnabledService.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests.enabled_app;
+package com.android.frameworks.coretests.enabled_app;
 
 import android.app.Service;
 import android.os.IBinder;
diff --git a/tests/AndroidTests/apks/install_use_perm_good/Android.mk b/core/tests/coretests/apks/install_decl_perm/Android.mk
similarity index 72%
rename from tests/AndroidTests/apks/install_use_perm_good/Android.mk
rename to core/tests/coretests/apks/install_decl_perm/Android.mk
index a25a03c..c38e981 100644
--- a/tests/AndroidTests/apks/install_use_perm_good/Android.mk
+++ b/core/tests/coretests/apks/install_decl_perm/Android.mk
@@ -5,7 +5,7 @@
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
-LOCAL_PACKAGE_NAME := AndroidTests_install_use_perm_good
+LOCAL_PACKAGE_NAME := FrameworkCoreTests_install_decl_perm
 
 include $(BUILD_PACKAGE)
 
diff --git a/core/tests/coretests/apks/install_decl_perm/AndroidManifest.xml b/core/tests/coretests/apks/install_decl_perm/AndroidManifest.xml
new file mode 100644
index 0000000..9a1f0ff
--- /dev/null
+++ b/core/tests/coretests/apks/install_decl_perm/AndroidManifest.xml
@@ -0,0 +1,36 @@
+<?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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+        package="com.android.frameworks.coretests.install_decl_perm">
+
+    <permission android:name="com.android.frameworks.coretests.NORMAL"
+        android:permissionGroup="android.permission-group.COST_MONEY"
+        android:protectionLevel="normal"
+        android:label="test normal perm" />
+        
+    <permission android:name="com.android.frameworks.coretests.DANGEROUS"
+        android:permissionGroup="android.permission-group.COST_MONEY"
+        android:protectionLevel="dangerous"
+        android:label="test dangerous perm" />
+        
+    <permission android:name="com.android.frameworks.coretests.SIGNATURE"
+        android:permissionGroup="android.permission-group.COST_MONEY"
+        android:protectionLevel="signature"
+        android:label="test signature perm" />
+        
+    <application android:hasCode="false">
+    </application>
+</manifest>
diff --git a/tests/AndroidTests/apks/install_decl_perm/res/values/strings.xml b/core/tests/coretests/apks/install_decl_perm/res/values/strings.xml
similarity index 100%
rename from tests/AndroidTests/apks/install_decl_perm/res/values/strings.xml
rename to core/tests/coretests/apks/install_decl_perm/res/values/strings.xml
diff --git a/tests/AndroidTests/apks/install_use_perm_good/Android.mk b/core/tests/coretests/apks/install_use_perm_good/Android.mk
similarity index 71%
copy from tests/AndroidTests/apks/install_use_perm_good/Android.mk
copy to core/tests/coretests/apks/install_use_perm_good/Android.mk
index a25a03c..1a07fc8 100644
--- a/tests/AndroidTests/apks/install_use_perm_good/Android.mk
+++ b/core/tests/coretests/apks/install_use_perm_good/Android.mk
@@ -5,7 +5,7 @@
 
 LOCAL_SRC_FILES := $(call all-subdir-java-files)
 
-LOCAL_PACKAGE_NAME := AndroidTests_install_use_perm_good
+LOCAL_PACKAGE_NAME := FrameworkCoreTests_install_use_perm_good
 
 include $(BUILD_PACKAGE)
 
diff --git a/core/tests/coretests/apks/install_use_perm_good/AndroidManifest.xml b/core/tests/coretests/apks/install_use_perm_good/AndroidManifest.xml
new file mode 100644
index 0000000..dadce7d
--- /dev/null
+++ b/core/tests/coretests/apks/install_use_perm_good/AndroidManifest.xml
@@ -0,0 +1,25 @@
+<?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.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+        package="com.android.frameworks.coretests.install_use_perm_good">
+
+    <uses-permission android:name="com.android.frameworks.coretests.NORMAL" />
+    <uses-permission android:name="com.android.frameworks.coretests.DANGEROUS" />
+    <uses-permission android:name="com.android.frameworks.coretests.SIGNATURE" />
+        
+    <application android:hasCode="false">
+    </application>
+</manifest>
diff --git a/tests/AndroidTests/apks/install_use_perm_good/res/values/strings.xml b/core/tests/coretests/apks/install_use_perm_good/res/values/strings.xml
similarity index 100%
rename from tests/AndroidTests/apks/install_use_perm_good/res/values/strings.xml
rename to core/tests/coretests/apks/install_use_perm_good/res/values/strings.xml
diff --git a/tests/AndroidTests/res/raw/alt_ip_only.crt b/core/tests/coretests/res/raw/alt_ip_only.crt
similarity index 100%
rename from tests/AndroidTests/res/raw/alt_ip_only.crt
rename to core/tests/coretests/res/raw/alt_ip_only.crt
diff --git a/tests/AndroidTests/res/raw/subject_alt_only.crt b/core/tests/coretests/res/raw/subject_alt_only.crt
similarity index 100%
rename from tests/AndroidTests/res/raw/subject_alt_only.crt
rename to core/tests/coretests/res/raw/subject_alt_only.crt
diff --git a/tests/AndroidTests/res/raw/subject_only.crt b/core/tests/coretests/res/raw/subject_only.crt
similarity index 100%
rename from tests/AndroidTests/res/raw/subject_only.crt
rename to core/tests/coretests/res/raw/subject_only.crt
diff --git a/tests/AndroidTests/res/raw/subject_with_alt_names.crt b/core/tests/coretests/res/raw/subject_with_alt_names.crt
similarity index 100%
rename from tests/AndroidTests/res/raw/subject_with_alt_names.crt
rename to core/tests/coretests/res/raw/subject_with_alt_names.crt
diff --git a/tests/AndroidTests/res/raw/subject_with_wild_alt_name.crt b/core/tests/coretests/res/raw/subject_with_wild_alt_name.crt
similarity index 100%
rename from tests/AndroidTests/res/raw/subject_with_wild_alt_name.crt
rename to core/tests/coretests/res/raw/subject_with_wild_alt_name.crt
diff --git a/tests/AndroidTests/res/raw/wild_alt_name_only.crt b/core/tests/coretests/res/raw/wild_alt_name_only.crt
similarity index 100%
rename from tests/AndroidTests/res/raw/wild_alt_name_only.crt
rename to core/tests/coretests/res/raw/wild_alt_name_only.crt
diff --git a/tests/AndroidTests/src/com/android/unit_tests/BrickDeniedTest.java b/core/tests/coretests/src/android/content/BrickDeniedTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/BrickDeniedTest.java
rename to core/tests/coretests/src/android/content/BrickDeniedTest.java
index 0f2b23b..c7d0b7a 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/BrickDeniedTest.java
+++ b/core/tests/coretests/src/android/content/BrickDeniedTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.content;
 
 import android.content.Intent;
 import android.test.AndroidTestCase;
diff --git a/tests/CoreTests/android/content/SyncQueueTest.java b/core/tests/coretests/src/android/content/SyncQueueTest.java
similarity index 100%
rename from tests/CoreTests/android/content/SyncQueueTest.java
rename to core/tests/coretests/src/android/content/SyncQueueTest.java
diff --git a/tests/AndroidTests/src/com/android/unit_tests/AppCacheTest.java b/core/tests/coretests/src/android/content/pm/AppCacheTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/AppCacheTest.java
rename to core/tests/coretests/src/android/content/pm/AppCacheTest.java
index fa7b9ff..dbb10b1 100755
--- a/tests/AndroidTests/src/com/android/unit_tests/AppCacheTest.java
+++ b/core/tests/coretests/src/android/content/pm/AppCacheTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.content.pm;
 
 import java.io.File;
 import java.io.FileInputStream;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/ComponentTest.java b/core/tests/coretests/src/android/content/pm/ComponentTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/ComponentTest.java
rename to core/tests/coretests/src/android/content/pm/ComponentTest.java
index 08fe742..ebfbd68 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/ComponentTest.java
+++ b/core/tests/coretests/src/android/content/pm/ComponentTest.java
@@ -14,16 +14,16 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.content.pm;
 
-import com.android.unit_tests.enabled_app.DisabledActivity;
-import com.android.unit_tests.enabled_app.DisabledProvider;
-import com.android.unit_tests.enabled_app.DisabledReceiver;
-import com.android.unit_tests.enabled_app.DisabledService;
-import com.android.unit_tests.enabled_app.EnabledActivity;
-import com.android.unit_tests.enabled_app.EnabledProvider;
-import com.android.unit_tests.enabled_app.EnabledReceiver;
-import com.android.unit_tests.enabled_app.EnabledService;
+import com.android.frameworks.coretests.enabled_app.DisabledActivity;
+import com.android.frameworks.coretests.enabled_app.DisabledProvider;
+import com.android.frameworks.coretests.enabled_app.DisabledReceiver;
+import com.android.frameworks.coretests.enabled_app.DisabledService;
+import com.android.frameworks.coretests.enabled_app.EnabledActivity;
+import com.android.frameworks.coretests.enabled_app.EnabledProvider;
+import com.android.frameworks.coretests.enabled_app.EnabledReceiver;
+import com.android.frameworks.coretests.enabled_app.EnabledService;
 
 import android.content.ComponentName;
 import android.content.Intent;
@@ -65,9 +65,9 @@
     private Intent mDisabledAppEnabledActivityIntent;
 
     private static final String ENABLED_PACKAGENAME =
-            "com.android.unit_tests.enabled_app";
+            "com.android.frameworks.coretests.enabled_app";
     private static final String DISABLED_PACKAGENAME =
-            "com.android.unit_tests.disabled_app";
+            "com.android.frameworks.coretests.disabled_app";
     private static final String DISABLED_ACTIVITY_CLASSNAME =
             DisabledActivity.class.getName();
     private static final ComponentName DISABLED_ACTIVITY_COMPONENTNAME =
@@ -103,11 +103,11 @@
             new ComponentName(ENABLED_PACKAGENAME, ENABLED_PROVIDER_CLASSNAME);
     private static final String ENABLED_PROVIDER_NAME = EnabledProvider.class.getName();
     private static final String DISABLED_APP_ENABLED_ACTIVITY_CLASSNAME =
-            com.android.unit_tests.disabled_app.EnabledActivity.class.getName();
+            com.android.frameworks.coretests.disabled_app.EnabledActivity.class.getName();
     private static final ComponentName DISABLED_APP_ENABLED_ACTIVITY_COMPONENTNAME =
             new ComponentName(DISABLED_PACKAGENAME, DISABLED_APP_ENABLED_ACTIVITY_CLASSNAME);
     private static final String TEST_CATEGORY =
-            "com.android.unit_tests.enabled_app.TEST_CATEGORY";
+            "com.android.frameworks.coretests.enabled_app.TEST_CATEGORY";
 
     @Override
     protected void setUp() throws Exception {
diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index aec82afe..c699c10 100755
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -1946,42 +1946,42 @@
     static final String BASE_PERMISSIONS_DEFINED[] = new String[] {
         PERM_PACKAGE, "com.android.unit_tests.install_decl_perm",
         PERM_DEFINED,
-        "com.android.unit_tests.NORMAL",
-        "com.android.unit_tests.DANGEROUS",
-        "com.android.unit_tests.SIGNATURE",
+        "com.android.frameworks.coretests.NORMAL",
+        "com.android.frameworks.coretests.DANGEROUS",
+        "com.android.frameworks.coretests.SIGNATURE",
     };
     
     static final String BASE_PERMISSIONS_UNDEFINED[] = new String[] {
-        PERM_PACKAGE, "com.android.unit_tests.install_decl_perm",
+        PERM_PACKAGE, "com.android.frameworks.coretests.install_decl_perm",
         PERM_UNDEFINED,
-        "com.android.unit_tests.NORMAL",
-        "com.android.unit_tests.DANGEROUS",
-        "com.android.unit_tests.SIGNATURE",
+        "com.android.frameworks.coretests.NORMAL",
+        "com.android.frameworks.coretests.DANGEROUS",
+        "com.android.frameworks.coretests.SIGNATURE",
     };
     
     static final String BASE_PERMISSIONS_USED[] = new String[] {
-        PERM_PACKAGE, "com.android.unit_tests.install_use_perm_good",
+        PERM_PACKAGE, "com.android.frameworks.coretests.install_use_perm_good",
         PERM_USED,
-        "com.android.unit_tests.NORMAL",
-        "com.android.unit_tests.DANGEROUS",
-        "com.android.unit_tests.SIGNATURE",
+        "com.android.frameworks.coretests.NORMAL",
+        "com.android.frameworks.coretests.DANGEROUS",
+        "com.android.frameworks.coretests.SIGNATURE",
     };
     
     static final String BASE_PERMISSIONS_NOTUSED[] = new String[] {
-        PERM_PACKAGE, "com.android.unit_tests.install_use_perm_good",
+        PERM_PACKAGE, "com.android.frameworks.coretests.install_use_perm_good",
         PERM_NOTUSED,
-        "com.android.unit_tests.NORMAL",
-        "com.android.unit_tests.DANGEROUS",
-        "com.android.unit_tests.SIGNATURE",
+        "com.android.frameworks.coretests.NORMAL",
+        "com.android.frameworks.coretests.DANGEROUS",
+        "com.android.frameworks.coretests.SIGNATURE",
     };
     
     static final String BASE_PERMISSIONS_SIGUSED[] = new String[] {
-        PERM_PACKAGE, "com.android.unit_tests.install_use_perm_good",
+        PERM_PACKAGE, "com.android.frameworks.coretests.install_use_perm_good",
         PERM_USED,
-        "com.android.unit_tests.SIGNATURE",
+        "com.android.frameworks.coretests.SIGNATURE",
         PERM_NOTUSED,
-        "com.android.unit_tests.NORMAL",
-        "com.android.unit_tests.DANGEROUS",
+        "com.android.frameworks.coretests.NORMAL",
+        "com.android.frameworks.coretests.DANGEROUS",
     };
     
     /*
diff --git a/tests/AndroidTests/src/com/android/unit_tests/NewDatabasePerformanceTestSuite.java b/core/tests/coretests/src/android/database/NewDatabasePerformanceTestSuite.java
similarity index 96%
rename from tests/AndroidTests/src/com/android/unit_tests/NewDatabasePerformanceTestSuite.java
rename to core/tests/coretests/src/android/database/NewDatabasePerformanceTestSuite.java
index 3462f97..31cf515 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/NewDatabasePerformanceTestSuite.java
+++ b/core/tests/coretests/src/android/database/NewDatabasePerformanceTestSuite.java
@@ -14,12 +14,9 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
-import android.test.FrameworkTests;
-import android.test.suitebuilder.TestSuiteBuilder;
+package android.database;
 
 import junit.framework.TestSuite;
-import junit.framework.TestCase;
 
 public class NewDatabasePerformanceTestSuite extends TestSuite {
     public static TestSuite suite() {
diff --git a/tests/AndroidTests/src/com/android/unit_tests/NewDatabasePerformanceTests.java b/core/tests/coretests/src/android/database/NewDatabasePerformanceTests.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/NewDatabasePerformanceTests.java
rename to core/tests/coretests/src/android/database/NewDatabasePerformanceTests.java
index 8644fbb..0dca90b 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/NewDatabasePerformanceTests.java
+++ b/core/tests/coretests/src/android/database/NewDatabasePerformanceTests.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.database;
 
 import android.content.ContentValues;
 import android.database.sqlite.SQLiteDatabase;
diff --git a/core/tests/coretests/src/android/text/HtmlTest.java b/core/tests/coretests/src/android/text/HtmlTest.java
index a79b93e..c07d212 100644
--- a/core/tests/coretests/src/android/text/HtmlTest.java
+++ b/core/tests/coretests/src/android/text/HtmlTest.java
@@ -16,14 +16,25 @@
 
 package android.text;
 
-import android.test.InstrumentationTestCase;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.text.Html;
-import android.text.Spanned;
-import android.text.style.StyleSpan;
+import android.content.res.ColorStateList;
+import android.content.res.Resources;
 import android.graphics.Typeface;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.text.style.ForegroundColorSpan;
+import android.text.style.QuoteSpan;
+import android.text.style.StrikethroughSpan;
+import android.text.style.StyleSpan;
+import android.text.style.SubscriptSpan;
+import android.text.style.SuperscriptSpan;
+import android.text.style.TextAppearanceSpan;
+import android.text.style.TypefaceSpan;
+import android.text.style.URLSpan;
+import android.text.style.UnderlineSpan;
 
-public class HtmlTest extends InstrumentationTestCase {
+import junit.framework.TestCase;
+
+public class HtmlTest extends TestCase {
 
     @MediumTest
     public void testSingleTagOnWhileString() {
@@ -63,4 +74,175 @@
         String spanned = Html.fromHtml("&copy; &gt; &lt").toString();
         assertEquals("\u00a9 > <", spanned);
     }
+    
+    @MediumTest
+    public void testColor() throws Exception {
+        Spanned s;
+        ForegroundColorSpan[] colors;
+
+        s = Html.fromHtml("<font color=\"#00FF00\">something</font>");
+        colors = s.getSpans(0, s.length(), ForegroundColorSpan.class);
+        assertEquals(1, colors.length);
+        assertEquals(0xFF00FF00, colors[0].getForegroundColor());
+
+        s = Html.fromHtml("<font color=\"navy\">something</font>");
+        colors = s.getSpans(0, s.length(), ForegroundColorSpan.class);
+        assertEquals(1, colors.length);
+        assertEquals(0xFF000080, colors[0].getForegroundColor());
+
+        s = Html.fromHtml("<font color=\"gibberish\">something</font>");
+        colors = s.getSpans(0, s.length(), ForegroundColorSpan.class);
+        assertEquals(0, colors.length);
+    }
+
+    @MediumTest
+    public void testResourceColor() throws Exception {
+        ColorStateList c =
+                Resources.getSystem().getColorStateList(android.R.color.primary_text_dark);
+        Spanned s;
+        TextAppearanceSpan[] colors;
+
+        s = Html.fromHtml("<font color=\"@android:color/primary_text_dark\">something</font>");
+        colors = s.getSpans(0, s.length(), TextAppearanceSpan.class);
+        assertEquals(1, colors.length);
+        assertEquals(c.toString(), colors[0].getTextColor().toString());
+
+        s = Html.fromHtml("<font color=\"@android:primary_text_dark\">something</font>");
+        colors = s.getSpans(0, s.length(), TextAppearanceSpan.class);
+        assertEquals(1, colors.length);
+        assertEquals(c.toString(), colors[0].getTextColor().toString());
+
+        s = Html.fromHtml("<font color=\"@color/primary_text_dark\">something</font>");
+        colors = s.getSpans(0, s.length(), TextAppearanceSpan.class);
+        assertEquals(1, colors.length);
+        assertEquals(c.toString(), colors[0].getTextColor().toString());
+
+        s = Html.fromHtml("<font color=\"@primary_text_dark\">something</font>");
+        colors = s.getSpans(0, s.length(), TextAppearanceSpan.class);
+        assertEquals(1, colors.length);
+        assertEquals(c.toString(), colors[0].getTextColor().toString());
+
+        s = Html.fromHtml("<font color=\"@" + android.R.color.primary_text_dark
+                + "\">something</font>");
+        colors = s.getSpans(0, s.length(), TextAppearanceSpan.class);
+        assertEquals(1, colors.length);
+        assertEquals(c.toString(), colors[0].getTextColor().toString());
+
+        s = Html.fromHtml("<font color=\"gibberish\">something</font>");
+        colors = s.getSpans(0, s.length(), TextAppearanceSpan.class);
+        assertEquals(colors.length, 0);
+    }
+
+    @SmallTest
+    public void testParagraphs() throws Exception {
+        SpannableString s;
+
+        s = new SpannableString("Hello world");
+        assertEquals(Html.toHtml(s), "<p>Hello world</p>\n");
+
+        s = new SpannableString("Hello world\nor something");
+        assertEquals(Html.toHtml(s), "<p>Hello world<br>\nor something</p>\n");
+
+        s = new SpannableString("Hello world\n\nor something");
+        assertEquals(Html.toHtml(s), "<p>Hello world</p>\n<p>or something</p>\n");
+
+        s = new SpannableString("Hello world\n\n\nor something");
+        assertEquals(Html.toHtml(s), "<p>Hello world<br></p>\n<p>or something</p>\n");
+
+        assertEquals("foo\nbar", Html.fromHtml("foo<br>bar").toString());
+        assertEquals("foo\nbar", Html.fromHtml("foo<br>\nbar").toString());
+        assertEquals("foo\nbar", Html.fromHtml("foo<br>\n \nbar").toString());
+    }
+
+    @SmallTest
+    public void testBlockquote() throws Exception {
+        SpannableString s;
+
+        s = new SpannableString("Hello world");
+        s.setSpan(new QuoteSpan(), 0, s.length(), Spannable.SPAN_PARAGRAPH);
+        assertEquals(Html.toHtml(s), "<blockquote><p>Hello world</p>\n</blockquote>\n");
+
+        s = new SpannableString("Hello\n\nworld");
+        s.setSpan(new QuoteSpan(), 0, 7, Spannable.SPAN_PARAGRAPH);
+        assertEquals(Html.toHtml(s), "<blockquote><p>Hello</p>\n</blockquote>\n<p>world</p>\n");
+    }
+
+    @SmallTest
+    public void testEntities() throws Exception {
+        SpannableString s;
+
+        s = new SpannableString("Hello <&> world");
+        assertEquals(Html.toHtml(s), "<p>Hello &lt;&amp;&gt; world</p>\n");
+
+        s = new SpannableString("Hello \u03D5 world");
+        assertEquals(Html.toHtml(s), "<p>Hello &#981; world</p>\n");
+
+        s = new SpannableString("Hello  world");
+        assertEquals(Html.toHtml(s), "<p>Hello&nbsp; world</p>\n");
+    }
+
+    @SmallTest
+    public void testMarkup() throws Exception {
+        SpannableString s;
+
+        s = new SpannableString("Hello bold world");
+        s.setSpan(new StyleSpan(Typeface.BOLD), 6, s.length() - 6,
+                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
+        assertEquals(Html.toHtml(s), "<p>Hello <b>bold</b> world</p>\n");
+
+        s = new SpannableString("Hello italic world");
+        s.setSpan(new StyleSpan(Typeface.ITALIC), 6, s.length() - 6,
+                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
+        assertEquals(Html.toHtml(s), "<p>Hello <i>italic</i> world</p>\n");
+
+        s = new SpannableString("Hello monospace world");
+        s.setSpan(new TypefaceSpan("monospace"), 6, s.length() - 6,
+                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
+        assertEquals(Html.toHtml(s), "<p>Hello <tt>monospace</tt> world</p>\n");
+
+        s = new SpannableString("Hello superscript world");
+        s.setSpan(new SuperscriptSpan(), 6, s.length() - 6,
+                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
+        assertEquals(Html.toHtml(s), "<p>Hello <sup>superscript</sup> world</p>\n");
+
+        s = new SpannableString("Hello subscript world");
+        s.setSpan(new SubscriptSpan(), 6, s.length() - 6,
+                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
+        assertEquals(Html.toHtml(s), "<p>Hello <sub>subscript</sub> world</p>\n");
+
+        s = new SpannableString("Hello underline world");
+        s.setSpan(new UnderlineSpan(), 6, s.length() - 6,
+                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
+        assertEquals(Html.toHtml(s), "<p>Hello <u>underline</u> world</p>\n");
+
+        s = new SpannableString("Hello struck world");
+        s.setSpan(new StrikethroughSpan(), 6, s.length() - 6,
+                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
+        assertEquals(Html.toHtml(s), "<p>Hello <strike>struck</strike> world</p>\n");
+
+        s = new SpannableString("Hello linky world");
+        s.setSpan(new URLSpan("http://www.google.com"), 6, s.length() - 6,
+                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
+        assertEquals(Html.toHtml(s),
+                     "<p>Hello <a href=\"http://www.google.com\">linky</a> world</p>\n");
+    }
+
+    @SmallTest
+    public void testImg() throws Exception {
+        Spanned s;
+
+        s = Html.fromHtml("yes<img src=\"http://example.com/foo.gif\">no");
+
+        assertEquals("<p>yes<img src=\"http://example.com/foo.gif\">no</p>\n",
+                     Html.toHtml(s));
+    }
+
+    @SmallTest
+    public void testUtf8() throws Exception {
+        Spanned s;
+
+        s = Html.fromHtml("<p>\u0124\u00eb\u0142\u0142o, world!</p>");
+        assertEquals("<p>&#292;&#235;&#322;&#322;o, world!</p>\n", Html.toHtml(s));
+    }
+
 }
diff --git a/tests/AndroidTests/src/com/android/unit_tests/LinkifyTest.java b/core/tests/coretests/src/android/text/util/LinkifyTest.java
similarity index 91%
rename from tests/AndroidTests/src/com/android/unit_tests/LinkifyTest.java
rename to core/tests/coretests/src/android/text/util/LinkifyTest.java
index 83e0758..99c6501 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/LinkifyTest.java
+++ b/core/tests/coretests/src/android/text/util/LinkifyTest.java
@@ -14,16 +14,14 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.text.util;
 
 import android.test.AndroidTestCase;
 import android.test.suitebuilder.annotation.MediumTest;
 import android.test.suitebuilder.annotation.SmallTest;
-import android.text.*;
-import android.text.method.*;
-import android.text.style.*;
-import android.text.util.*;
-import android.widget.*;
+import android.text.method.LinkMovementMethod;
+import android.text.util.Linkify;
+import android.widget.TextView;
 
 /**
  * LinkifyTest tests {@link Linkify}.
diff --git a/tests/AndroidTests/src/com/android/unit_tests/PatternsTest.java b/core/tests/coretests/src/android/util/PatternsTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/PatternsTest.java
rename to core/tests/coretests/src/android/util/PatternsTest.java
index 0edcd6d..957c593 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/PatternsTest.java
+++ b/core/tests/coretests/src/android/util/PatternsTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.android.unit_tests;
+package android.util;
 
 import android.test.suitebuilder.annotation.SmallTest;
 import android.util.Patterns;
diff --git a/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java
index ad99ee8..dfb10fb 100644
--- a/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java
+++ b/core/tests/coretests/src/android/widget/expandablelistview/ExpandableListTester.java
@@ -28,11 +28,11 @@
 import junit.framework.Assert;
 
 public class ExpandableListTester {
-    private ExpandableListView mExpandableListView;
-    private ExpandableListAdapter mAdapter;
-    private ListUtil mListUtil;
+    private final ExpandableListView mExpandableListView;
+    private final ExpandableListAdapter mAdapter;
+    private final ListUtil mListUtil;
 
-    private ActivityInstrumentationTestCase2<? extends ExpandableListScenario>
+    private final ActivityInstrumentationTestCase2<? extends ExpandableListScenario>
         mActivityInstrumentation;
 
     Instrumentation mInstrumentation;
@@ -76,6 +76,8 @@
             View headerChild = mExpandableListView.getChildAt(index
                     - mExpandableListView.getFirstVisiblePosition());
             mExpandableListView.showContextMenuForChild(headerChild);
+            mInstrumentation.waitForIdleSync();
+            Assert.assertNull(menuListener.getErrorMessage(), menuListener.getErrorMessage());
             index++;
         }
 
@@ -92,6 +94,8 @@
             View groupChild = mExpandableListView.getChildAt(index
                     - mExpandableListView.getFirstVisiblePosition());
             mExpandableListView.showContextMenuForChild(groupChild);
+            mInstrumentation.waitForIdleSync();
+            Assert.assertNull(menuListener.getErrorMessage(), menuListener.getErrorMessage());
             index++;
 
             final int childrenCount = mAdapter.getChildrenCount(groupIndex);
@@ -102,6 +106,8 @@
                 View child = mExpandableListView.getChildAt(index
                         - mExpandableListView.getFirstVisiblePosition());
                 mExpandableListView.showContextMenuForChild(child);
+                mInstrumentation.waitForIdleSync();
+                Assert.assertNull(menuListener.getErrorMessage(), menuListener.getErrorMessage());
                 index++;
             }
         }
@@ -115,6 +121,8 @@
             View footerChild = mExpandableListView.getChildAt(index
                     - mExpandableListView.getFirstVisiblePosition());
             mExpandableListView.showContextMenuForChild(footerChild);
+            mInstrumentation.waitForIdleSync();
+            Assert.assertNull(menuListener.getErrorMessage(), menuListener.getErrorMessage());
             index++;
         }
 
diff --git a/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java b/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java
index b482005..2dbdff8 100644
--- a/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java
+++ b/core/tests/coretests/src/android/widget/expandablelistview/PositionTesterContextMenuListener.java
@@ -23,8 +23,6 @@
 import android.widget.ExpandableListView;
 import android.widget.AdapterView.AdapterContextMenuInfo;
 
-import junit.framework.Assert;
-
 public class PositionTesterContextMenuListener implements OnCreateContextMenuListener {
 
     private int groupPosition, childPosition;
@@ -33,6 +31,9 @@
     private static final int ADAPTER_TYPE = -1;
     private int testType; // as returned by getPackedPositionType
 
+    // Will be set to null by each call to onCreateContextMenu, unless an error occurred. 
+    private String errorMessage;
+
     public void expectGroupContextMenu(int groupPosition) {
         this.groupPosition = groupPosition;
         testType = ExpandableListView.PACKED_POSITION_TYPE_GROUP;
@@ -50,30 +51,61 @@
     }
 
     public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
+        errorMessage = null;
         if (testType == ADAPTER_TYPE) {
-            Assert.assertTrue("MenuInfo is not an AdapterContextMenuInfo",
-                    menuInfo instanceof AdapterContextMenuInfo);
+            if (!isTrue("MenuInfo is not an AdapterContextMenuInfo",
+                    menuInfo instanceof AdapterContextMenuInfo)) {
+                return;
+            }
             AdapterContextMenuInfo adapterContextMenuInfo = (AdapterContextMenuInfo) menuInfo;
-            Assert.assertEquals("Wrong flat position",
-                    groupPosition,
-                    adapterContextMenuInfo.position);
+            if (!areEqual("Wrong flat position", groupPosition, adapterContextMenuInfo.position)) {
+                return;
+            }
         } else {
-            Assert.assertTrue("MenuInfo is not an ExpandableListContextMenuInfo",
-                    menuInfo instanceof ExpandableListView.ExpandableListContextMenuInfo);
+            if (!isTrue("MenuInfo is not an ExpandableListContextMenuInfo",
+                    menuInfo instanceof ExpandableListView.ExpandableListContextMenuInfo)) {
+                return;
+            }
             ExpandableListView.ExpandableListContextMenuInfo elvMenuInfo =
                 (ExpandableListView.ExpandableListContextMenuInfo) menuInfo;
             long packedPosition = elvMenuInfo.packedPosition;
 
             int packedPositionType = ExpandableListView.getPackedPositionType(packedPosition);
-            Assert.assertEquals("Wrong packed position type", testType, packedPositionType);
+            if (!areEqual("Wrong packed position type", testType, packedPositionType)) {
+                return;
+            }
 
             int packedPositionGroup = ExpandableListView.getPackedPositionGroup(packedPosition);
-            Assert.assertEquals("Wrong group position", groupPosition, packedPositionGroup);
+            if (!areEqual("Wrong group position", groupPosition, packedPositionGroup)) {
+                return;
+            }
 
             if (testType == ExpandableListView.PACKED_POSITION_TYPE_CHILD) {
-                int packedPosChild = ExpandableListView.getPackedPositionChild(packedPosition);
-                Assert.assertEquals("Wrong child position", childPosition, packedPosChild);
+                int packedPositionChild = ExpandableListView.getPackedPositionChild(packedPosition);
+                if (!areEqual("Wrong child position", childPosition, packedPositionChild)) {
+                    return;
+                }
             }
         }
     }
+
+    private boolean areEqual(String message, int expected, int actual) {
+        if (expected != actual) {
+            errorMessage = String.format(message + " (%d vs %d", expected, actual);
+            return false;
+        }
+        return true;
+    }
+
+    private boolean isTrue(String message, boolean value) {
+        if (!value) {
+            errorMessage = message;
+            return false;
+        }
+        return true;
+    }
+
+    public String getErrorMessage() {
+        return errorMessage;
+    }
 }
diff --git a/tests/AndroidTests/src/com/android/unit_tests/DNParserTest.java b/core/tests/coretests/src/com/android/internal/net/DNParserTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/DNParserTest.java
rename to core/tests/coretests/src/com/android/internal/net/DNParserTest.java
index 61d0b42..9b490a3 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/DNParserTest.java
+++ b/core/tests/coretests/src/com/android/internal/net/DNParserTest.java
@@ -13,7 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.android.unit_tests;
+package com.android.internal.net;
 
 import com.android.internal.net.DNParser;
 
diff --git a/tests/AndroidTests/src/com/android/unit_tests/DomainNameValidatorTest.java b/core/tests/coretests/src/com/android/internal/net/DomainNameValidatorTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/DomainNameValidatorTest.java
rename to core/tests/coretests/src/com/android/internal/net/DomainNameValidatorTest.java
index 1754dbe..f0d581e 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/DomainNameValidatorTest.java
+++ b/core/tests/coretests/src/com/android/internal/net/DomainNameValidatorTest.java
@@ -13,9 +13,11 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
-package com.android.unit_tests;
+package com.android.internal.net;
 
 import com.android.internal.net.DomainNameValidator;
+import com.android.frameworks.coretests.R;
+import com.android.frameworks.coretests.R.raw;
 
 import android.test.AndroidTestCase;
 
diff --git a/tests/AndroidTests/src/com/android/unit_tests/internal/util/HanziToPinyinTest.java b/core/tests/coretests/src/com/android/internal/util/HanziToPinyinTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/internal/util/HanziToPinyinTest.java
rename to core/tests/coretests/src/com/android/internal/util/HanziToPinyinTest.java
index 71a8ea7..36dee70 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/internal/util/HanziToPinyinTest.java
+++ b/core/tests/coretests/src/com/android/internal/util/HanziToPinyinTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests.internal.util;
+package com.android.internal.util;
 
 import java.text.Collator;
 import java.util.Arrays;
diff --git a/docs/html/guide/topics/ui/declaring-layout.jd b/docs/html/guide/topics/ui/declaring-layout.jd
index f114895..5c12db9 100644
--- a/docs/html/guide/topics/ui/declaring-layout.jd
+++ b/docs/html/guide/topics/ui/declaring-layout.jd
@@ -200,15 +200,29 @@
 values. Each child element must define LayoutParams that are appropriate for its parent, 
 though it may also define different LayoutParams for its own children. </p>
 
-<p>All view groups include a width and height (<code>layout_width</code> and <code>layout_height</code>), 
-and each view is required to define them. 
-Many LayoutParams also include optional margins and
-borders. You can specify width and height with exact measurements, though you probably won't want
-to do this often. More often, you will tell your view to size itself either to
-the dimensions required by its content, or to become as big as its parent view group
-will allow (with the <var>wrap_content</var> and <var>fill_parent</var> values, respectively).
-The accepted measurement types are defined in the 
-<a href="{@docRoot}guide/topics/resources/available-resources.html#dimension">Available Resources</a> document.</p>
+<p>All view groups include a width and height (<code>layout_width</code> and
+<code>layout_height</code>), and each view is required to define them. Many
+LayoutParams also include optional margins and borders. <p>
+
+<p>You can specify width and height with exact measurements, though you probably
+won't want to do this often. More often, you will use one of these constants to
+set the width or height: </p>
+
+<ul>
+  <li><var>wrap_content</var> tells your view to size itself to the dimensions
+required by its content</li>
+  <li><var>fill_parent</var> (renamed <var>match_parent</var> in API Level 8)
+tells your view to become as big as its parent view group will allow.</li>
+</ul>
+
+<p>In general, specifying a layout width and height using absolute units such as
+pixels is not recommended. Instead, using relative measurements such as
+density-independent pixel units (<var>dp</var>), <var>wrap_content</var>, or
+<var>fill_parent</var>, is a better approach, because it helps ensure that
+your application will display properly across a variety of device screen sizes.
+The accepted measurement types are defined in the
+<a href="{@docRoot}guide/topics/resources/available-resources.html#dimension">
+Available Resources</a> document.</p>
 
 
 <h2 id="Position">Layout Position</h2>
diff --git a/tests/CoreTests/android/res/color/color1.xml b/graphics/tests/graphicstests/res/color/color1.xml
similarity index 100%
rename from tests/CoreTests/android/res/color/color1.xml
rename to graphics/tests/graphicstests/res/color/color1.xml
diff --git a/tests/CoreTests/android/res/color/color_no_default.xml b/graphics/tests/graphicstests/res/color/color_no_default.xml
similarity index 100%
rename from tests/CoreTests/android/res/color/color_no_default.xml
rename to graphics/tests/graphicstests/res/color/color_no_default.xml
diff --git a/tests/CoreTests/android/res/values/colors.xml b/graphics/tests/graphicstests/res/values/colors.xml
similarity index 100%
rename from tests/CoreTests/android/res/values/colors.xml
rename to graphics/tests/graphicstests/res/values/colors.xml
diff --git a/tests/CoreTests/android/graphics/ColorStateListTest.java b/graphics/tests/graphicstests/src/android/graphics/ColorStateListTest.java
similarity index 97%
rename from tests/CoreTests/android/graphics/ColorStateListTest.java
rename to graphics/tests/graphicstests/src/android/graphics/ColorStateListTest.java
index 68c2fc1..eb1025c 100644
--- a/tests/CoreTests/android/graphics/ColorStateListTest.java
+++ b/graphics/tests/graphicstests/src/android/graphics/ColorStateListTest.java
@@ -16,10 +16,11 @@
 
 package android.graphics;
 
+import com.android.frameworks.graphicstests.R;
+
 import android.content.res.Resources;
 import android.content.res.ColorStateList;
 import android.test.AndroidTestCase;
-import android.core.R;
 import android.test.suitebuilder.annotation.SmallTest;
 
 /**
diff --git a/tests/CoreTests/android/graphics/drawable/StateListDrawableTest.java b/graphics/tests/graphicstests/src/android/graphics/drawable/StateListDrawableTest.java
similarity index 100%
rename from tests/CoreTests/android/graphics/drawable/StateListDrawableTest.java
rename to graphics/tests/graphicstests/src/android/graphics/drawable/StateListDrawableTest.java
diff --git a/tests/CoreTests/android/view/MockView.java b/graphics/tests/graphicstests/src/android/view/MockView.java
similarity index 100%
rename from tests/CoreTests/android/view/MockView.java
rename to graphics/tests/graphicstests/src/android/view/MockView.java
diff --git a/include/media/MediaProfiles.h b/include/media/MediaProfiles.h
index eb96d20..a4eea2a 100644
--- a/include/media/MediaProfiles.h
+++ b/include/media/MediaProfiles.h
@@ -24,8 +24,8 @@
 namespace android {
 
 enum camcorder_quality {
-    CAMCORDER_QUALITY_HIGH = 0,
-    CAMCORDER_QUALITY_LOW  = 1
+    CAMCORDER_QUALITY_LOW  = 0,
+    CAMCORDER_QUALITY_HIGH = 1
 };
 
 enum video_decoder {
diff --git a/include/media/stagefright/OMXCodec.h b/include/media/stagefright/OMXCodec.h
index d58c711..1d76a1a 100644
--- a/include/media/stagefright/OMXCodec.h
+++ b/include/media/stagefright/OMXCodec.h
@@ -87,16 +87,17 @@
     };
 
     enum Quirks {
-        kNeedsFlushBeforeDisable             = 1,
-        kWantsNALFragments                   = 2,
-        kRequiresLoadedToIdleAfterAllocation = 4,
-        kRequiresAllocateBufferOnInputPorts  = 8,
-        kRequiresFlushCompleteEmulation      = 16,
-        kRequiresAllocateBufferOnOutputPorts = 32,
-        kRequiresFlushBeforeShutdown         = 64,
-        kDefersOutputBufferAllocation        = 128,
-        kDecoderLiesAboutNumberOfChannels    = 256,
-        kInputBufferSizesAreBogus            = 512,
+        kNeedsFlushBeforeDisable              = 1,
+        kWantsNALFragments                    = 2,
+        kRequiresLoadedToIdleAfterAllocation  = 4,
+        kRequiresAllocateBufferOnInputPorts   = 8,
+        kRequiresFlushCompleteEmulation       = 16,
+        kRequiresAllocateBufferOnOutputPorts  = 32,
+        kRequiresFlushBeforeShutdown          = 64,
+        kDefersOutputBufferAllocation         = 128,
+        kDecoderLiesAboutNumberOfChannels     = 256,
+        kInputBufferSizesAreBogus             = 512,
+        kSupportsMultipleFramesPerInputBuffer = 1024,
     };
 
     struct BufferInfo {
@@ -137,6 +138,8 @@
     bool mOutputPortSettingsHaveChanged;
     int64_t mSeekTimeUs;
 
+    MediaBuffer *mLeftOverBuffer;
+
     Mutex mLock;
     Condition mAsyncCompletion;
 
diff --git a/media/java/android/media/AudioManager.java b/media/java/android/media/AudioManager.java
index 47a1ec3..47e2da2 100644
--- a/media/java/android/media/AudioManager.java
+++ b/media/java/android/media/AudioManager.java
@@ -1437,6 +1437,11 @@
      */
     public int requestAudioFocus(OnAudioFocusChangeListener l, int streamType, int durationHint) {
         int status = AUDIOFOCUS_REQUEST_FAILED;
+        if ((durationHint < AUDIOFOCUS_GAIN) || (durationHint > AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK))
+        {
+            Log.e(TAG, "Invalid duration hint, audio focus request denied");
+            return status;
+        }
         registerAudioFocusListener(l);
         //TODO protect request by permission check?
         IAudioService service = getService();
diff --git a/media/java/android/media/AudioService.java b/media/java/android/media/AudioService.java
index 74e6157..2b7683a 100644
--- a/media/java/android/media/AudioService.java
+++ b/media/java/android/media/AudioService.java
@@ -2063,6 +2063,9 @@
                 }
             }
 
+            // focus requester might already be somewhere below in the stack, remove it
+            removeFocusStackEntry(clientId, false);
+
             // push focus requester at the top of the audio focus stack
             mFocusStack.push(new FocusStackEntry(mainStreamType, focusChangeHint, false, fd, cb,
                     clientId));
@@ -2215,7 +2218,7 @@
 
     /** see AudioManager.unregisterMediaButtonEventReceiver(ComponentName eventReceiver) */
     public void unregisterMediaButtonEventReceiver(ComponentName eventReceiver) {
-        Log.i(TAG, "  Remote Control   registerMediaButtonEventReceiver() for " + eventReceiver);
+        Log.i(TAG, "  Remote Control   unregisterMediaButtonEventReceiver() for " + eventReceiver);
 
         synchronized(mRCStack) {
             removeMediaButtonReceiver(eventReceiver);
diff --git a/media/java/android/media/CamcorderProfile.java b/media/java/android/media/CamcorderProfile.java
index 09ac0ac..64d6460 100644
--- a/media/java/android/media/CamcorderProfile.java
+++ b/media/java/android/media/CamcorderProfile.java
@@ -19,17 +19,19 @@
 /**
  * The CamcorderProfile class is used to retrieve the
  * predefined camcorder profile settings for camcorder applications.
+ * These settings are read-only.
+ *
  * The compressed output from a recording session with a given
  * CamcorderProfile contains two tracks: one for auido and one for video.
  *
  * <p>Each profile specifies the following set of parameters:
  * <ul>
- * <li> The file output format, @see android.media.MediaRecorder.OutputFormat
- * <li> Video codec format, @see android.media.MediaRecorder.VideoEncoder
+ * <li> The file output format
+ * <li> Video codec format
  * <li> Video bit rate in bits per second
  * <li> Video frame rate in frames per second
  * <li> Video frame width and height,
- * <li> Audio codec format, @see android.media.MediaRecorder.AudioEncoder
+ * <li> Audio codec format
  * <li> Audio bit rate in bits per second,
  * <li> Audio sample rate
  * <li> Number of audio channels for recording.
@@ -37,98 +39,95 @@
  */
 public class CamcorderProfile
 {
-    private final int mDuration;  // Recording duration in seconds
-
     /**
-     * The Quality class represents the quality level of each CamcorderProfile.
+     * The output from camcorder recording sessions can have different quality levels.
      *
-     * The output from recording sessions with high quality level usually may have
-     * larger output bit rate, better video and/or audio recording quality, and
-     * laerger video frame resolution and higher audio sampling rate, etc, than those
-     * with low quality level.
+     * Currently, we define two quality levels: high quality and low quality.
+     * A camcorder recording session with high quality level usually has higher output bit
+     * rate, better video and/or audio recording quality, larger video frame
+     * resolution and higher audio sampling rate, etc, than those with low quality
+     * level.
+     *
+     * Do not change these values/ordinals without updating their counterpart
+     * in include/media/MediaProfiles.h!
      */
-    public enum Quality {
-       /* Do not change these values/ordinals without updating their counterpart
-        * in include/media/MediaProfiles.h!
-        */
-        HIGH,
-        LOW
-    };
+    public static final int QUALITY_LOW  = 0;
+    public static final int QUALITY_HIGH = 1;
 
     /**
-     * Returns the recording duration in seconds for LOW quality CamcorderProfile
-     * used by the MMS application.
+     * Default recording duration in seconds before the session is terminated.
+     * This is useful for applications like MMS has limited file size requirement.
      */
-    public static final int getMmsRecordingDurationInSeconds() {
-        return get(Quality.LOW).mDuration;
-    }
+    public int duration;
 
     /**
      * The quality level of the camcorder profile
-     * @see android.media.CamcorderProfile.Quality
      */
-    public final Quality mQuality;
+    public int quality;
 
     /**
      * The file output format of the camcorder profile
      * @see android.media.MediaRecorder.OutputFormat
      */
-    public final int mFileFormat;
+    public int fileFormat;
 
     /**
      * The video encoder being used for the video track
      * @see android.media.MediaRecorder.VideoEncoder
      */
-    public final int mVideoCodec;
+    public int videoCodec;
 
     /**
      * The target video output bit rate in bits per second
      */
-    public final int mVideoBitRate;
+    public int videoBitRate;
 
     /**
      * The target video frame rate in frames per second
      */
-    public final int mVideoFrameRate;
+    public int videoFrameRate;
 
     /**
      * The target video frame width in pixels
      */
-    public final int mVideoFrameWidth;
+    public int videoFrameWidth;
 
     /**
      * The target video frame height in pixels
      */
-    public final int mVideoFrameHeight;
+    public int videoFrameHeight;
 
     /**
      * The audio encoder being used for the audio track.
      * @see android.media.MediaRecorder.AudioEncoder
      */
-    public final int mAudioCodec;
+    public int audioCodec;
 
     /**
      * The target audio output bit rate in bits per second
      */
-    public final int mAudioBitRate;
+    public int audioBitRate;
 
     /**
      * The audio sampling rate used for the audio track
      */
-    public final int mAudioSampleRate;
+    public int audioSampleRate;
 
     /**
      * The number of audio channels used for the audio track
      */
-    public final int mAudioChannels;
+    public int audioChannels;
 
     /**
-     * Returns the camcorder profile for the given quality.
+     * Returns the camcorder profile for the given quality level.
      * @param quality the target quality level for the camcorder profile
-     * @see android.media.CamcorderProfile.Quality
      */
-    public static CamcorderProfile get(Quality quality) {
-        return native_get_camcorder_profile(quality.ordinal());
+    public static CamcorderProfile get(int quality) {
+        if (quality < QUALITY_LOW || quality > QUALITY_HIGH) {
+            String errMessage = "Unsupported quality level: " + quality;
+            throw new IllegalArgumentException(errMessage);
+        }
+        return native_get_camcorder_profile(quality);
     }
 
     static {
@@ -150,18 +149,18 @@
                              int audioSampleRate,
                              int audioChannels) {
 
-        mDuration         = duration;
-        mQuality          = Quality.values()[quality];
-        mFileFormat       = fileFormat;
-        mVideoCodec       = videoCodec;
-        mVideoBitRate     = videoBitRate;
-        mVideoFrameRate   = videoFrameRate;
-        mVideoFrameWidth  = videoWidth;
-        mVideoFrameHeight = videoHeight;
-        mAudioCodec       = audioCodec;
-        mAudioBitRate     = audioBitRate;
-        mAudioSampleRate  = audioSampleRate;
-        mAudioChannels    = audioChannels;
+        this.duration         = duration;
+        this.quality          = quality;
+        this.fileFormat       = fileFormat;
+        this.videoCodec       = videoCodec;
+        this.videoBitRate     = videoBitRate;
+        this.videoFrameRate   = videoFrameRate;
+        this.videoFrameWidth  = videoWidth;
+        this.videoFrameHeight = videoHeight;
+        this.audioCodec       = audioCodec;
+        this.audioBitRate     = audioBitRate;
+        this.audioSampleRate  = audioSampleRate;
+        this.audioChannels    = audioChannels;
     }
 
     // Methods implemented by JNI
diff --git a/media/java/android/media/CameraProfile.java b/media/java/android/media/CameraProfile.java
index f1616cc..f8d3935 100644
--- a/media/java/android/media/CameraProfile.java
+++ b/media/java/android/media/CameraProfile.java
@@ -16,6 +16,8 @@
 
 package android.media;
 
+import java.util.Arrays;
+
 /**
  * The CameraProfile class is used to retrieve the pre-defined still image
  * capture (jpeg) quality levels (0-100) used for low, medium, and high
@@ -25,23 +27,52 @@
 public class CameraProfile
 {
     /**
-     * Returns a list of the pre-defined still image capture (jpeg) quality levels
-     * used for low, medium and high quality settings in the Camera application.
+     * Define three quality levels for JPEG image encoding.
      */
-    public static int[] getImageEncodingQualityLevels() {
-        int nLevels = native_get_num_image_encoding_quality_levels();
-        if (nLevels == 0) return null;
+    /*
+     * Don't change the values for these constants unless getImageEncodingQualityLevels()
+     * method is also changed accordingly.
+     */
+    public static final int QUALITY_LOW    = 0;
+    public static final int QUALITY_MEDIUM = 1;
+    public static final int QUALITY_HIGH   = 2;
 
-        int[] levels = new int[nLevels];
-        for (int i = 0; i < nLevels; ++i) {
-            levels[i] = native_get_image_encoding_quality_level(i);
+    /*
+     * Cache the Jpeg encoding quality parameters
+     */
+    private static final int[] sJpegEncodingQualityParameters;
+
+    /**
+     * Returns a pre-defined still image capture (jpeg) quality level
+     * used for the given quality level in the Camera application.
+     *
+     * @param quality The target quality level
+     */
+    public static int getJpegEncodingQualityParameter(int quality) {
+        if (quality < QUALITY_LOW || quality > QUALITY_HIGH) {
+            throw new IllegalArgumentException("Unsupported quality level: " + quality);
         }
-        return levels;
+        return sJpegEncodingQualityParameters[quality];
     }
 
     static {
         System.loadLibrary("media_jni");
         native_init();
+        sJpegEncodingQualityParameters = getImageEncodingQualityLevels();
+    }
+
+    private static int[] getImageEncodingQualityLevels() {
+        int nLevels = native_get_num_image_encoding_quality_levels();
+        if (nLevels != QUALITY_HIGH + 1) {
+            throw new RuntimeException("Unexpected Jpeg encoding quality levels " + nLevels);
+        }
+
+        int[] levels = new int[nLevels];
+        for (int i = 0; i < nLevels; ++i) {
+            levels[i] = native_get_image_encoding_quality_level(i);
+        }
+        Arrays.sort(levels);  // Lower quality level ALWAYS comes before higher one
+        return levels;
     }
 
     // Methods implemented by JNI
diff --git a/media/java/android/media/MediaRecorder.java b/media/java/android/media/MediaRecorder.java
index 5988d34..47a8cfc 100644
--- a/media/java/android/media/MediaRecorder.java
+++ b/media/java/android/media/MediaRecorder.java
@@ -16,6 +16,7 @@
 
 package android.media;
 
+import android.media.CamcorderProfile;
 import android.hardware.Camera;
 import android.os.Handler;
 import android.os.Looper;
@@ -259,6 +260,25 @@
             throws IllegalStateException;
 
     /**
+     * Uses the settings from a CamcorderProfile object for recording. This method should
+     * be called after the video AND audio sources are set, and before setOutputFile().
+     *
+     * @param profile the CamcorderProfile to use
+     * @see android.media.CamcorderProfile
+     */
+    public void setProfile(CamcorderProfile profile) {
+        setOutputFormat(profile.fileFormat);
+        setVideoFrameRate(profile.videoFrameRate);
+        setVideoSize(profile.videoFrameWidth, profile.videoFrameHeight);
+        setVideoEncodingBitRate(profile.videoBitRate);
+        setAudioEncodingBitRate(profile.audioBitRate);
+        setAudioChannels(profile.audioChannels);
+        setAudioSamplingRate(profile.audioSampleRate);
+        setVideoEncoder(profile.videoCodec);
+        setAudioEncoder(profile.audioCodec);
+    }
+
+    /**
      * Sets the format of the output file produced during recording. Call this
      * after setAudioSource()/setVideoSource() but before prepare().
      *
diff --git a/media/jni/android_media_MediaMetadataRetriever.cpp b/media/jni/android_media_MediaMetadataRetriever.cpp
index 3e9ba33..efea802 100644
--- a/media/jni/android_media_MediaMetadataRetriever.cpp
+++ b/media/jni/android_media_MediaMetadataRetriever.cpp
@@ -76,7 +76,6 @@
 static void android_media_MediaMetadataRetriever_setDataSource(JNIEnv *env, jobject thiz, jstring path)
 {
     LOGV("setDataSource");
-    Mutex::Autolock lock(sLock);
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     if (retriever == 0) {
         jniThrowException(env, "java/lang/IllegalStateException", "No retriever available");
@@ -105,7 +104,6 @@
 static void android_media_MediaMetadataRetriever_setDataSourceFD(JNIEnv *env, jobject thiz, jobject fileDescriptor, jlong offset, jlong length)
 {
     LOGV("setDataSource");
-    Mutex::Autolock lock(sLock);
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     if (retriever == 0) {
         jniThrowException(env, "java/lang/IllegalStateException", "No retriever available");
@@ -135,7 +133,6 @@
 static void android_media_MediaMetadataRetriever_setMode(JNIEnv *env, jobject thiz, jint mode)
 {
     LOGV("setMode");
-    Mutex::Autolock lock(sLock);
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     if (retriever == 0) {
         jniThrowException(env, "java/lang/IllegalStateException", "No retriever available");
@@ -147,7 +144,6 @@
 static int android_media_MediaMetadataRetriever_getMode(JNIEnv *env, jobject thiz)
 {
     LOGV("getMode");
-    Mutex::Autolock lock(sLock);
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     if (retriever == 0) {
         jniThrowException(env, "java/lang/IllegalStateException", "No retriever available");
@@ -161,7 +157,6 @@
 static jobject android_media_MediaMetadataRetriever_captureFrame(JNIEnv *env, jobject thiz)
 {
     LOGV("captureFrame");
-    Mutex::Autolock lock(sLock);
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     if (retriever == 0) {
         jniThrowException(env, "java/lang/IllegalStateException", "No retriever available");
@@ -202,7 +197,6 @@
 static jbyteArray android_media_MediaMetadataRetriever_extractAlbumArt(JNIEnv *env, jobject thiz)
 {
     LOGV("extractAlbumArt");
-    Mutex::Autolock lock(sLock);
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     if (retriever == 0) {
         jniThrowException(env, "java/lang/IllegalStateException", "No retriever available");
@@ -238,7 +232,6 @@
 static jobject android_media_MediaMetadataRetriever_extractMetadata(JNIEnv *env, jobject thiz, jint keyCode)
 {
     LOGV("extractMetadata");
-    Mutex::Autolock lock(sLock);
     MediaMetadataRetriever* retriever = getRetriever(env, thiz);
     if (retriever == 0) {
         jniThrowException(env, "java/lang/IllegalStateException", "No retriever available");
diff --git a/media/libmedia/mediametadataretriever.cpp b/media/libmedia/mediametadataretriever.cpp
index d34a8ed..e2712ba 100644
--- a/media/libmedia/mediametadataretriever.cpp
+++ b/media/libmedia/mediametadataretriever.cpp
@@ -95,6 +95,7 @@
 status_t MediaMetadataRetriever::setDataSource(const char* srcUrl)
 {
     LOGV("setDataSource");
+    Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
         LOGE("retriever is not initialized");
         return INVALID_OPERATION;
@@ -110,6 +111,7 @@
 status_t MediaMetadataRetriever::setDataSource(int fd, int64_t offset, int64_t length)
 {
     LOGV("setDataSource(%d, %lld, %lld)", fd, offset, length);
+    Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
         LOGE("retriever is not initialized");
         return INVALID_OPERATION;
@@ -124,6 +126,7 @@
 status_t MediaMetadataRetriever::setMode(int mode)
 {
     LOGV("setMode(%d)", mode);
+    Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
         LOGE("retriever is not initialized");
         return INVALID_OPERATION;
@@ -134,6 +137,7 @@
 status_t MediaMetadataRetriever::getMode(int* mode)
 {
     LOGV("getMode");
+    Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
         LOGE("retriever is not initialized");
         return INVALID_OPERATION;
@@ -144,6 +148,7 @@
 sp<IMemory> MediaMetadataRetriever::captureFrame()
 {
     LOGV("captureFrame");
+    Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
         LOGE("retriever is not initialized");
         return NULL;
@@ -154,6 +159,7 @@
 const char* MediaMetadataRetriever::extractMetadata(int keyCode)
 {
     LOGV("extractMetadata(%d)", keyCode);
+    Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
         LOGE("retriever is not initialized");
         return NULL;
@@ -164,6 +170,7 @@
 sp<IMemory> MediaMetadataRetriever::extractAlbumArt()
 {
     LOGV("extractAlbumArt");
+    Mutex::Autolock _l(mLock);
     if (mRetriever == 0) {
         LOGE("retriever is not initialized");
         return NULL;
diff --git a/media/libstagefright/MPEG4Extractor.cpp b/media/libstagefright/MPEG4Extractor.cpp
index f50451d..bd3925a 100644
--- a/media/libstagefright/MPEG4Extractor.cpp
+++ b/media/libstagefright/MPEG4Extractor.cpp
@@ -1626,7 +1626,7 @@
     if (!memcmp(header, "ftyp3gp", 7) || !memcmp(header, "ftypmp42", 8)
         || !memcmp(header, "ftypisom", 8) || !memcmp(header, "ftypM4V ", 8)
         || !memcmp(header, "ftypM4A ", 8) || !memcmp(header, "ftypf4v ", 8)
-        || !memcmp(header, "ftypkddi", 8)) {
+        || !memcmp(header, "ftypkddi", 8) || !memcmp(header, "ftypM4VP", 8)) {
         *mimeType = MEDIA_MIMETYPE_CONTAINER_MPEG4;
         *confidence = 0.1;
 
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp
index 20d9540..2346639 100644
--- a/media/libstagefright/OMXCodec.cpp
+++ b/media/libstagefright/OMXCodec.cpp
@@ -103,6 +103,7 @@
     { MEDIA_MIMETYPE_AUDIO_MPEG, "OMX.TI.MP3.decode" },
     { MEDIA_MIMETYPE_AUDIO_MPEG, "MP3Decoder" },
 //    { MEDIA_MIMETYPE_AUDIO_MPEG, "OMX.PV.mp3dec" },
+//    { MEDIA_MIMETYPE_AUDIO_AMR_NB, "OMX.TI.AMR.decode" },
     { MEDIA_MIMETYPE_AUDIO_AMR_NB, "AMRNBDecoder" },
 //    { MEDIA_MIMETYPE_AUDIO_AMR_NB, "OMX.PV.amrdec" },
     { MEDIA_MIMETYPE_AUDIO_AMR_WB, "OMX.TI.WBAMR.decode" },
@@ -284,6 +285,7 @@
     if (!strcmp(componentName, "OMX.TI.AAC.decode")) {
         quirks |= kNeedsFlushBeforeDisable;
         quirks |= kRequiresFlushCompleteEmulation;
+        quirks |= kSupportsMultipleFramesPerInputBuffer;
     }
     if (!strncmp(componentName, "OMX.qcom.video.encoder.", 23)) {
         quirks |= kRequiresLoadedToIdleAfterAllocation;
@@ -533,7 +535,28 @@
                 return err;
             }
         }
+    } else if (!strncasecmp(mMIME, "audio/", 6)) {
+        if ((mQuirks & kSupportsMultipleFramesPerInputBuffer)
+            && !strcmp(mComponentName, "OMX.TI.AAC.decode")) {
+            OMX_PARAM_PORTDEFINITIONTYPE def;
+            InitOMXParams(&def);
+            def.nPortIndex = kPortIndexInput;
+
+            status_t err = mOMX->getParameter(
+                    mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
+            CHECK_EQ(err, OK);
+
+            const size_t kMinBufferSize = 100 * 1024;
+            if (def.nBufferSize < kMinBufferSize) {
+                def.nBufferSize = kMinBufferSize;
+            }
+
+            err = mOMX->setParameter(
+                    mNode, OMX_IndexParamPortDefinition, &def, sizeof(def));
+            CHECK_EQ(err, OK);
+        }
     }
+
     if (!strcasecmp(mMIME, MEDIA_MIMETYPE_IMAGE_JPEG)
         && !strcmp(mComponentName, "OMX.TI.JPEG.decode")) {
         OMX_COLOR_FORMATTYPE format =
@@ -1049,7 +1072,8 @@
       mSignalledEOS(false),
       mNoMoreOutputData(false),
       mOutputPortSettingsHaveChanged(false),
-      mSeekTimeUs(-1) {
+      mSeekTimeUs(-1),
+      mLeftOverBuffer(NULL) {
     mPortStatus[kPortIndexInput] = ENABLED;
     mPortStatus[kPortIndexOutput] = ENABLED;
 
@@ -1938,66 +1962,104 @@
         return;
     }
 
-    MediaBuffer *srcBuffer;
     status_t err;
-    if (mSeekTimeUs >= 0) {
-        MediaSource::ReadOptions options;
-        options.setSeekTo(mSeekTimeUs);
 
-        mSeekTimeUs = -1;
-        mBufferFilled.signal();
+    bool signalEOS = false;
+    int64_t timestampUs = 0;
 
-        err = mSource->read(&srcBuffer, &options);
-    } else {
-        err = mSource->read(&srcBuffer);
+    size_t offset = 0;
+    int32_t n = 0;
+    for (;;) {
+        MediaBuffer *srcBuffer;
+        if (mSeekTimeUs >= 0) {
+            if (mLeftOverBuffer) {
+                mLeftOverBuffer->release();
+                mLeftOverBuffer = NULL;
+            }
+
+            MediaSource::ReadOptions options;
+            options.setSeekTo(mSeekTimeUs);
+
+            mSeekTimeUs = -1;
+            mBufferFilled.signal();
+
+            err = mSource->read(&srcBuffer, &options);
+        } else if (mLeftOverBuffer) {
+            srcBuffer = mLeftOverBuffer;
+            mLeftOverBuffer = NULL;
+
+            err = OK;
+        } else {
+            err = mSource->read(&srcBuffer);
+        }
+
+        if (err != OK) {
+            signalEOS = true;
+            mFinalStatus = err;
+            mSignalledEOS = true;
+            break;
+        }
+
+        size_t remainingBytes = info->mSize - offset;
+
+        if (srcBuffer->range_length() > remainingBytes) {
+            if (offset == 0) {
+                CODEC_LOGE(
+                     "Codec's input buffers are too small to accomodate "
+                     "buffer read from source (info->mSize = %d, srcLength = %d)",
+                     info->mSize, srcBuffer->range_length());
+
+                srcBuffer->release();
+                srcBuffer = NULL;
+
+                setState(ERROR);
+                return;
+            }
+
+            mLeftOverBuffer = srcBuffer;
+            break;
+        }
+
+        memcpy((uint8_t *)info->mData + offset,
+               (const uint8_t *)srcBuffer->data() + srcBuffer->range_offset(),
+               srcBuffer->range_length());
+
+        if (offset == 0) {
+            CHECK(srcBuffer->meta_data()->findInt64(kKeyTime, &timestampUs));
+            CHECK(timestampUs >= 0);
+        }
+
+        offset += srcBuffer->range_length();
+
+        srcBuffer->release();
+        srcBuffer = NULL;
+
+        ++n;
+
+        if (!(mQuirks & kSupportsMultipleFramesPerInputBuffer)) {
+            break;
+        }
+    }
+
+    if (n > 1) {
+        LOGV("coalesced %d frames into one input buffer", n);
     }
 
     OMX_U32 flags = OMX_BUFFERFLAG_ENDOFFRAME;
-    OMX_TICKS timestampUs = 0;
-    size_t srcLength = 0;
 
-    if (err != OK) {
-        CODEC_LOGV("signalling end of input stream.");
+    if (signalEOS) {
         flags |= OMX_BUFFERFLAG_EOS;
-
-        mFinalStatus = err;
-        mSignalledEOS = true;
     } else {
         mNoMoreOutputData = false;
-
-        srcLength = srcBuffer->range_length();
-
-        if (info->mSize < srcLength) {
-            CODEC_LOGE(
-                 "Codec's input buffers are too small to accomodate "
-                 "buffer read from source (info->mSize = %d, srcLength = %d)",
-                 info->mSize, srcLength);
-
-            srcBuffer->release();
-            srcBuffer = NULL;
-
-            setState(ERROR);
-            return;
-        }
-        memcpy(info->mData,
-               (const uint8_t *)srcBuffer->data() + srcBuffer->range_offset(),
-               srcLength);
-
-        if (srcBuffer->meta_data()->findInt64(kKeyTime, &timestampUs)) {
-            CODEC_LOGV("Calling emptyBuffer on buffer %p (length %d), "
-                       "timestamp %lld us (%.2f secs)",
-                       info->mBuffer, srcLength,
-                       timestampUs, timestampUs / 1E6);
-        }
     }
 
-    if (srcBuffer != NULL) {
-        srcBuffer->release();
-        srcBuffer = NULL;
-    }
+    CODEC_LOGV("Calling emptyBuffer on buffer %p (length %d), "
+               "timestamp %lld us (%.2f secs)",
+               info->mBuffer, offset,
+               timestampUs, timestampUs / 1E6);
 
     err = mOMX->emptyBuffer(
-            mNode, info->mBuffer, 0, srcLength,
+            mNode, info->mBuffer, 0, offset,
             flags, timestampUs);
 
     if (err != OK) {
@@ -2352,6 +2414,11 @@
         }
     }
 
+    if (mLeftOverBuffer) {
+        mLeftOverBuffer->release();
+        mLeftOverBuffer = NULL;
+    }
+
     mSource->stop();
 
     CODEC_LOGV("stopped");
diff --git a/media/libstagefright/codecs/amrnb/dec/src/dec_amr.cpp b/media/libstagefright/codecs/amrnb/dec/src/dec_amr.cpp
index 9190aea..be15475 100644
--- a/media/libstagefright/codecs/amrnb/dec/src/dec_amr.cpp
+++ b/media/libstagefright/codecs/amrnb/dec/src/dec_amr.cpp
@@ -1634,7 +1634,7 @@
             {
                 if (st->old_T0 < PIT_MAX)
                 {                               /* Graceful pitch */
-                    st->old_T0 += 1;            /* degradation    */
+                    st->old_T0 += 0;            /* degradation    */
                 }
                 T0 = st->old_T0;
                 T0_frac = 0;
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
index 2a4e9a0..3e33951 100755
--- a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/MediaFrameworkTestRunner.java
@@ -24,7 +24,7 @@
 import com.android.mediaframeworktest.functional.MediaRecorderTest;
 import com.android.mediaframeworktest.functional.SimTonesTest;
 import com.android.mediaframeworktest.functional.MediaPlayerInvokeTest;
-
+import com.android.mediaframeworktest.functional.MediaAudioManagerTest;
 import junit.framework.TestSuite;
 
 import android.test.InstrumentationTestRunner;
@@ -54,6 +54,7 @@
         suite.addTestSuite(MediaAudioTrackTest.class);
         suite.addTestSuite(MediaMimeTest.class);
         suite.addTestSuite(MediaPlayerInvokeTest.class);
+        suite.addTestSuite(MediaAudioManagerTest.class);
         return suite;
     }
 
diff --git a/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioManagerTest.java b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioManagerTest.java
new file mode 100644
index 0000000..644444a
--- /dev/null
+++ b/media/tests/MediaFrameworkTest/src/com/android/mediaframeworktest/functional/MediaAudioManagerTest.java
@@ -0,0 +1,70 @@
+ /*
+  * Copyright (C) 2010 The Android Open Source Project
+  *
+  * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+  * use this file except in compliance with the License. You may obtain a copy of
+  * the License at
+  *
+  * http://www.apache.org/licenses/LICENSE-2.0
+  *
+  * Unless required by applicable law or agreed to in writing, software
+  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+  * License for the specific language governing permissions and limitations under
+  * the License.
+  */
+
+package com.android.mediaframeworktest.functional;
+
+import com.android.mediaframeworktest.MediaFrameworkTest;
+import android.content.Context;
+import android.media.AudioManager;
+import android.test.ActivityInstrumentationTestCase2;
+import android.test.suitebuilder.annotation.MediumTest;
+
+/**
+ * Junit / Instrumentation test case for the media AudioManager api
+ */
+
+public class MediaAudioManagerTest extends ActivityInstrumentationTestCase2<MediaFrameworkTest> {
+
+    private String TAG = "MediaAudioManagerTest";
+    private AudioManager mAudioManager;
+    private int[] ringtoneMode = {AudioManager.RINGER_MODE_NORMAL,
+             AudioManager.RINGER_MODE_SILENT, AudioManager.RINGER_MODE_VIBRATE};
+
+    public MediaAudioManagerTest() {
+        super("com.android.mediaframeworktest", MediaFrameworkTest.class);
+    }
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mAudioManager = (AudioManager) getActivity().getSystemService(Context.AUDIO_SERVICE);
+     }
+
+     @Override
+     protected void tearDown() throws Exception {
+         super.tearDown();
+     }
+
+     public boolean validateSetRingTone(int i) {
+         int getRingtone = mAudioManager.getRingerMode();
+         if (i != getRingtone)
+             return false;
+         else
+             return true;
+     }
+
+     // Test case 1: Simple test case to validate the set ringtone mode
+     @MediumTest
+     public void testSetRingtoneMode() throws Exception {
+         boolean result = false;
+
+         for (int i = 0; i < ringtoneMode.length; i++) {
+             mAudioManager.setRingerMode(ringtoneMode[i]);
+             result = validateSetRingTone(ringtoneMode[i]);
+             assertTrue("SetRingtoneMode : " + ringtoneMode[i], result);
+         }
+     }
+ }
\ No newline at end of file
diff --git a/packages/TtsService/src/android/tts/TtsService.java b/packages/TtsService/src/android/tts/TtsService.java
index 530ca57..c977ba3 100755
--- a/packages/TtsService/src/android/tts/TtsService.java
+++ b/packages/TtsService/src/android/tts/TtsService.java
@@ -321,6 +321,10 @@
                 TextToSpeech.Engine.DEFAULT_RATE);
     }
 
+    private int getDefaultPitch() {
+        // Pitch is not user settable; the default pitch is always 100.
+        return 100;
+    }
 
     private String getDefaultLanguage() {
         String defaultLang = android.provider.Settings.Secure.getString(mResolver,
@@ -786,6 +790,7 @@
                     String variant = "";
                     String speechRate = "";
                     String engine = "";
+                    String pitch = "";
                     if (speechItem.mParams != null){
                         for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){
                             String param = speechItem.mParams.get(i);
@@ -809,6 +814,8 @@
                                     }
                                 } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_ENGINE)) {
                                     engine = speechItem.mParams.get(i + 1);
+                                } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_PITCH)) {
+                                    pitch = speechItem.mParams.get(i + 1);
                                 }
                             }
                         }
@@ -831,6 +838,11 @@
                         } else {
                             setSpeechRate("", getDefaultRate());
                         }
+                        if (pitch.length() > 0){
+                            setPitch("", Integer.parseInt(pitch));
+                        } else {
+                            setPitch("", getDefaultPitch());
+                        }
                         try {
                             sNativeSynth.speak(speechItem.mText, streamType);
                         } catch (NullPointerException e) {
@@ -885,6 +897,7 @@
                     String variant = "";
                     String speechRate = "";
                     String engine = "";
+                    String pitch = "";
                     if (speechItem.mParams != null){
                         for (int i = 0; i < speechItem.mParams.size() - 1; i = i + 2){
                             String param = speechItem.mParams.get(i);
@@ -901,6 +914,8 @@
                                     utteranceId = speechItem.mParams.get(i+1);
                                 } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_ENGINE)) {
                                     engine = speechItem.mParams.get(i + 1);
+                                } else if (param.equals(TextToSpeech.Engine.KEY_PARAM_PITCH)) {
+                                    pitch = speechItem.mParams.get(i + 1);
                                 }
                             }
                         }
@@ -923,6 +938,11 @@
                         } else {
                             setSpeechRate("", getDefaultRate());
                         }
+                        if (pitch.length() > 0){
+                            setPitch("", Integer.parseInt(pitch));
+                        } else {
+                            setPitch("", getDefaultPitch());
+                        }
                         try {
                             sNativeSynth.synthesizeToFile(speechItem.mText, speechItem.mFilename);
                         } catch (NullPointerException e) {
@@ -1377,7 +1397,17 @@
          *      TTS_LANG_COUNTRY_AVAILABLE, TTS_LANG_COUNTRY_VAR_AVAILABLE as defined in
          *      android.speech.tts.TextToSpeech.
          */
-        public int isLanguageAvailable(String lang, String country, String variant) {
+        public int isLanguageAvailable(String lang, String country, String variant,
+                String[] params) {
+            for (int i = 0; i < params.length - 1; i = i + 2){
+                String param = params[i];
+                if (param != null) {
+                    if (param.equals(TextToSpeech.Engine.KEY_PARAM_ENGINE)) {
+                        mSelf.setEngine(params[i + 1]);
+                        break;
+                    }
+                }
+            }
             return mSelf.isLanguageAvailable(lang, country, variant);
         }
 
diff --git a/services/java/com/android/server/NetworkManagementService.java b/services/java/com/android/server/NetworkManagementService.java
index 072fc1b..b7f6175 100644
--- a/services/java/com/android/server/NetworkManagementService.java
+++ b/services/java/com/android/server/NetworkManagementService.java
@@ -65,6 +65,10 @@
         public static final int InterfaceGetCfgResult     = 213;
         public static final int SoftapStatusResult        = 214;
         public static final int UsbRNDISStatusResult      = 215;
+        public static final int InterfaceRxCounterResult  = 216;
+        public static final int InterfaceTxCounterResult  = 217;
+        public static final int InterfaceRxThrottleResult = 218;
+        public static final int InterfaceTxThrottleResult = 219;
 
         public static final int InterfaceChange           = 600;
     }
@@ -524,4 +528,89 @@
             mConnector.doCommand(str);
         }
     }
+
+    private long getInterfaceCounter(String iface, boolean rx) {
+        mContext.enforceCallingOrSelfPermission(
+                android.Manifest.permission.ACCESS_NETWORK_STATE, "NetworkManagementService");
+        try {
+            String rsp = mConnector.doCommand(
+                    String.format("interface read%scounter %s", (rx ? "rx" : "tx"), iface)).get(0);
+            String []tok = rsp.split(" ");
+            int code;
+            try {
+                code = Integer.parseInt(tok[0]);
+            } catch (NumberFormatException nfe) {
+                Slog.e(TAG, String.format("Error parsing code %s", tok[0]));
+                return -1;
+            }
+            if ((rx && code != NetdResponseCode.InterfaceRxCounterResult) || (
+                    !rx && code != NetdResponseCode.InterfaceTxCounterResult)) {
+                Slog.e(TAG, String.format("Unexpected response code %d", code));
+                return -1;
+            }
+            return Long.parseLong(tok[1]);
+        } catch (Exception e) {
+            Slog.e(TAG, String.format(
+                    "Failed to read interface %s counters", (rx ? "rx" : "tx")), e);
+        }
+        return -1;
+    }
+
+    public long getInterfaceRxCounter(String iface) {
+        return getInterfaceCounter(iface, true);
+    }
+
+    public long getInterfaceTxCounter(String iface) {
+        return getInterfaceCounter(iface, false);
+    }
+
+    private void setInterfaceThrottle(String iface, boolean rx, int kbps) {
+        mContext.enforceCallingOrSelfPermission(
+                android.Manifest.permission.CHANGE_NETWORK_STATE, "NetworkManagementService");
+        mConnector.doCommand(String.format(
+                "interface setthrottle %s %s %d", iface, (rx ? "rx" : "tx"), kbps));
+    }
+
+    public void setInterfaceRxThrottle(String iface, int kbps) {
+        setInterfaceThrottle(iface, true, kbps);
+    }
+
+    public void setInterfaceTxThrottle(String iface, int kbps) {
+        setInterfaceThrottle(iface, false, kbps);
+    }
+
+    private int getInterfaceThrottle(String iface, boolean rx) {
+        mContext.enforceCallingOrSelfPermission(
+                android.Manifest.permission.ACCESS_NETWORK_STATE, "NetworkManagementService");
+        try {
+            String rsp = mConnector.doCommand(
+                    String.format("interface getthrottle %s %s", iface,(rx ? "rx" : "tx"))).get(0);
+            String []tok = rsp.split(" ");
+            int code;
+            try {
+                code = Integer.parseInt(tok[0]);
+            } catch (NumberFormatException nfe) {
+                Slog.e(TAG, String.format("Error parsing code %s", tok[0]));
+                return -1;
+            }
+            if ((rx && code != NetdResponseCode.InterfaceRxThrottleResult) || (
+                    !rx && code != NetdResponseCode.InterfaceTxThrottleResult)) {
+                Slog.e(TAG, String.format("Unexpected response code %d", code));
+                return -1;
+            }
+            return Integer.parseInt(tok[1]);
+        } catch (Exception e) {
+            Slog.e(TAG, String.format(
+                    "Failed to read interface %s throttle value", (rx ? "rx" : "tx")), e);
+        }
+        return -1;
+    }
+
+    public int getInterfaceRxThrottle(String iface) {
+        return getInterfaceThrottle(iface, true);
+    }
+
+    public int getInterfaceTxThrottle(String iface) {
+        return getInterfaceThrottle(iface, false);
+    }
 }
diff --git a/services/java/com/android/server/PackageManagerService.java b/services/java/com/android/server/PackageManagerService.java
index ef1738b..b95bae4 100644
--- a/services/java/com/android/server/PackageManagerService.java
+++ b/services/java/com/android/server/PackageManagerService.java
@@ -2681,7 +2681,13 @@
                 Slog.w(TAG, "Apk not found for dexopt: " + path);
                 ret = -1;
             } catch (IOException e) {
-                Slog.w(TAG, "Exception reading apk: " + path, e);
+                Slog.w(TAG, "IOException reading apk: " + path, e);
+                ret = -1;
+            } catch (dalvik.system.StaleDexCacheError e) {
+                Slog.w(TAG, "StaleDexCacheError when reading apk: " + path, e);
+                ret = -1;
+            } catch (Exception e) {
+                Slog.w(TAG, "Exception when doing dexopt : ", e);
                 ret = -1;
             }
             if (ret < 0) {
diff --git a/services/java/com/android/server/UiModeManagerService.java b/services/java/com/android/server/UiModeManagerService.java
index 1850b9a..d6a42f6 100644
--- a/services/java/com/android/server/UiModeManagerService.java
+++ b/services/java/com/android/server/UiModeManagerService.java
@@ -383,7 +383,7 @@
     }
 
     final void updateConfigurationLocked(boolean sendIt) {
-        int uiMode = 0;
+        int uiMode = Configuration.UI_MODE_TYPE_NORMAL;
         if (mCarModeEnabled) {
             uiMode = Configuration.UI_MODE_TYPE_CAR;
         } else if (mDockState == Intent.EXTRA_DOCK_STATE_DESK) {
@@ -399,8 +399,15 @@
             }
         } else {
             // Disabling the car mode clears the night mode.
-            uiMode = Configuration.UI_MODE_TYPE_NORMAL |
-                    Configuration.UI_MODE_NIGHT_NO;
+            uiMode = (uiMode & ~Configuration.UI_MODE_NIGHT_MASK) | Configuration.UI_MODE_NIGHT_NO;
+        }
+
+        if (LOG) {
+            Slog.d(TAG, 
+                "updateConfigurationLocked: mDockState=" + mDockState 
+                + "; mCarMode=" + mCarModeEnabled
+                + "; mNightMode=" + mNightMode
+                + "; uiMode=" + uiMode);
         }
 
         mCurUiMode = uiMode;
diff --git a/services/java/com/android/server/WifiService.java b/services/java/com/android/server/WifiService.java
index 99cacdf..3bfb4c6 100644
--- a/services/java/com/android/server/WifiService.java
+++ b/services/java/com/android/server/WifiService.java
@@ -263,10 +263,13 @@
     /**
      * Check if Wi-Fi needs to be enabled and start
      * if needed
+     *
+     * This function is used only at boot time
      */
     public void startWifi() {
         /* Start if Wi-Fi is enabled or the saved state indicates Wi-Fi was on */
-        boolean wifiEnabled = getPersistedWifiEnabled() || testAndClearWifiSavedState();
+        boolean wifiEnabled = !isAirplaneModeOn()
+                && (getPersistedWifiEnabled() || testAndClearWifiSavedState());
         Slog.i(TAG, "WifiService starting up with Wi-Fi " +
                 (wifiEnabled ? "enabled" : "disabled"));
         setWifiEnabled(wifiEnabled);
diff --git a/tests/AndroidTests/Android.mk b/tests/AndroidTests/Android.mk
deleted file mode 100644
index c22547f..0000000
--- a/tests/AndroidTests/Android.mk
+++ /dev/null
@@ -1,21 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_JAVA_LIBRARIES := framework-tests android.test.runner services
-
-# Resource unit tests use a private locale
-LOCAL_AAPT_FLAGS = -c xx_YY -c cs -c 160dpi -c 32dpi -c 240dpi
-
-LOCAL_SRC_FILES := \
-	$(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := AndroidTests
-LOCAL_CERTIFICATE := platform
-
-include $(BUILD_PACKAGE)
-
-LOCAL_STORED_PATH:= $(LOCAL_PATH)
-include $(call all-makefiles-under,$(LOCAL_STORED_PATH))
-include $(call all-makefiles-under,$(LOCAL_STORED_PATH)/apks)
diff --git a/tests/AndroidTests/AndroidManifest.xml b/tests/AndroidTests/AndroidManifest.xml
deleted file mode 100644
index 1f0bf4d..0000000
--- a/tests/AndroidTests/AndroidManifest.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-        package="com.android.unit_tests"
-        android:sharedUserId="com.android.uid.test">
-
-    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
-    <uses-permission android:name="android.permission.BROADCAST_STICKY" />
-    <uses-permission android:name="android.permission.CLEAR_APP_CACHE" />
-    <uses-permission android:name="android.permission.CLEAR_APP_USER_DATA" />
-    <uses-permission android:name="android.permission.DELETE_CACHE_FILES" />
-    <uses-permission android:name="android.permission.GET_PACKAGE_SIZE" />
-    <uses-permission android:name="android.permission.WAKE_LOCK" />
-    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
-    <uses-permission android:name="android.permission.INSTALL_PACKAGES" />
-    <uses-permission android:name="android.permission.DELETE_PACKAGES" />
-    <uses-permission android:name="android.permission.MOVE_PACKAGE" />
-    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
-    <uses-permission android:name="android.permission.ASEC_ACCESS" />
-    <uses-permission android:name="android.permission.ASEC_CREATE" />
-    <uses-permission android:name="android.permission.ASEC_DESTROY" />
-    <uses-permission android:name="android.permission.ASEC_MOUNT_UNMOUNT" />
-    <uses-permission android:name="android.permission.ASEC_RENAME" />
-    <uses-permission android:name="android.permission.SHUTDOWN" />
-    <uses-permission android:name="com.android.unit_tests.permission.TEST_GRANTED" />
-    <uses-permission android:name="com.google.android.googleapps.permission.ACCESS_GOOGLE_PASSWORD" />
-    <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH" />
-    <uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH.ALL_SERVICES" />
-
-    <!-- InstrumentationTestRunner for AndroidTests -->
-    <instrumentation android:name="android.test.InstrumentationTestRunner"
-                     android:targetPackage="com.android.unit_tests"
-                     android:label="Tests for AndroidTests (unit tests collection)"/>
-
-    <application>
-        <uses-library android:name="android.test.runner" />
-        <activity android:name="AndroidPerformanceTests" android:label="Android Performance Tests">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.UNIT_TEST" />
-            </intent-filter>
-        </activity>
-
-    </application>
-</manifest>
diff --git a/tests/AndroidTests/DisabledTestApp/AndroidManifest.xml b/tests/AndroidTests/DisabledTestApp/AndroidManifest.xml
deleted file mode 100644
index 4d6843e..0000000
--- a/tests/AndroidTests/DisabledTestApp/AndroidManifest.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-        package="com.android.unit_tests.disabled_app"
-        android:sharedUserId="com.android.uid.test">
-
-    <application enabled="false">
-
-        <!-- Used to test package component enabling and disabling -->
-        <activity android:name=".DisabledActivity" android:enabled="false" >
-        </activity>
-        <activity android:name=".EnabledActivity" >
-        </activity>
-    </application>
-</manifest>
diff --git a/tests/AndroidTests/EnabledTestApp/AndroidManifest.xml b/tests/AndroidTests/EnabledTestApp/AndroidManifest.xml
deleted file mode 100644
index ad610f1..0000000
--- a/tests/AndroidTests/EnabledTestApp/AndroidManifest.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-        package="com.android.unit_tests.enabled_app"
-        android:sharedUserId="com.android.uid.test">
-
-    <application>
-
-        <!-- Used to test package component enabling and disabling -->
-        <activity android:name=".DisabledActivity" android:enabled="false" >
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="com.android.unit_tests.enabled_app.TEST_CATEGORY" />
-            </intent-filter>
-        </activity>
-        <service android:name=".DisabledService" android:enabled="false" >
-        </service>
-        <receiver android:name=".DisabledReceiver" android:enabled="false" >
-            <intent-filter>
-                <action android:name="android.intent.action.ENABLED_APP_DISABLED_RECEIVER" />
-            </intent-filter>
-        </receiver>
-        <provider android:name=".DisabledProvider" android:enabled="false"
-                  android:authorities="com.android.unit_tests.enabled_app.DisabledProvider"
-                  android:process=":disabled.provider.process" />
-        <activity android:name=".EnabledActivity" >
-        </activity>
-        <service android:name=".EnabledService" android:enabled="true" >
-        </service>
-        <receiver android:name=".EnabledReceiver" >
-            <intent-filter>
-                <action android:name="android.intent.action.ENABLED_APP_ENABLED_RECEIVER" />
-            </intent-filter>
-        </receiver>
-        <provider android:name=".EnabledProvider"
-                  android:authorities="com.android.unit_tests.enabled_app.EnabledProvider"
-                  android:process=":enabled.provider.process" />
-    </application>
-</manifest>
diff --git a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledActivity.java b/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledActivity.java
deleted file mode 100644
index cfac3ec..0000000
--- a/tests/AndroidTests/EnabledTestApp/src/com/android/unit_tests/enabled_app/EnabledActivity.java
+++ /dev/null
@@ -1,27 +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 com.android.unit_tests.enabled_app;
-
-import android.app.Activity;
-
-/**
- * Empty Activity for testing
- */
-
-public class EnabledActivity extends Activity {
-
-}
diff --git a/tests/AndroidTests/MODULE_LICENSE_APACHE2 b/tests/AndroidTests/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/tests/AndroidTests/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/tests/AndroidTests/NOTICE b/tests/AndroidTests/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/tests/AndroidTests/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
-   Copyright (c) 2005-2008, The Android Open Source Project
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
diff --git a/tests/AndroidTests/apks/install_decl_perm/Android.mk b/tests/AndroidTests/apks/install_decl_perm/Android.mk
deleted file mode 100644
index 9dcf9a0..0000000
--- a/tests/AndroidTests/apks/install_decl_perm/Android.mk
+++ /dev/null
@@ -1,11 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_PACKAGE_NAME := AndroidTests_install_decl_perm
-
-include $(BUILD_PACKAGE)
-
diff --git a/tests/AndroidTests/apks/install_decl_perm/AndroidManifest.xml b/tests/AndroidTests/apks/install_decl_perm/AndroidManifest.xml
deleted file mode 100644
index 4387500..0000000
--- a/tests/AndroidTests/apks/install_decl_perm/AndroidManifest.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-        package="com.android.unit_tests.install_decl_perm">
-
-    <permission android:name="com.android.unit_tests.NORMAL"
-        android:permissionGroup="android.permission-group.COST_MONEY"
-        android:protectionLevel="normal"
-        android:label="test normal perm" />
-        
-    <permission android:name="com.android.unit_tests.DANGEROUS"
-        android:permissionGroup="android.permission-group.COST_MONEY"
-        android:protectionLevel="dangerous"
-        android:label="test dangerous perm" />
-        
-    <permission android:name="com.android.unit_tests.SIGNATURE"
-        android:permissionGroup="android.permission-group.COST_MONEY"
-        android:protectionLevel="signature"
-        android:label="test signature perm" />
-        
-    <application android:hasCode="false">
-    </application>
-</manifest>
diff --git a/tests/AndroidTests/apks/install_use_perm_good/AndroidManifest.xml b/tests/AndroidTests/apks/install_use_perm_good/AndroidManifest.xml
deleted file mode 100644
index 6dd3e71..0000000
--- a/tests/AndroidTests/apks/install_use_perm_good/AndroidManifest.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-        package="com.android.unit_tests.install_use_perm_good">
-
-    <uses-permission android:name="com.android.unit_tests.NORMAL" />
-    <uses-permission android:name="com.android.unit_tests.DANGEROUS" />
-    <uses-permission android:name="com.android.unit_tests.SIGNATURE" />
-        
-    <application android:hasCode="false">
-    </application>
-</manifest>
diff --git a/tests/AndroidTests/res/values-12key-63x57/configVarying.xml b/tests/AndroidTests/res/values-12key-63x57/configVarying.xml
deleted file mode 100644
index 50b3765..0000000
--- a/tests/AndroidTests/res/values-12key-63x57/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple 12key 63x57</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag 12key 63x57</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-12key-dpad/configVarying.xml b/tests/AndroidTests/res/values-12key-dpad/configVarying.xml
deleted file mode 100644
index 83eb080..0000000
--- a/tests/AndroidTests/res/values-12key-dpad/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple 12key dpad</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag 12key dpad</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-12key/configVarying.xml b/tests/AndroidTests/res/values-12key/configVarying.xml
deleted file mode 100644
index e11340c..0000000
--- a/tests/AndroidTests/res/values-12key/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple 12key</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag 12key</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-240dpi/configVarying.xml b/tests/AndroidTests/res/values-240dpi/configVarying.xml
deleted file mode 100644
index 9f32f8d..0000000
--- a/tests/AndroidTests/res/values-240dpi/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple 240dpi</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag 240dpi</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-32dpi-keysexposed/configVarying.xml b/tests/AndroidTests/res/values-32dpi-keysexposed/configVarying.xml
deleted file mode 100644
index cd7f8da..0000000
--- a/tests/AndroidTests/res/values-32dpi-keysexposed/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple 32dpi keysexposed</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag 32dpi keysexposed</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-32dpi-stylus/configVarying.xml b/tests/AndroidTests/res/values-32dpi-stylus/configVarying.xml
deleted file mode 100644
index 63fcdc8..0000000
--- a/tests/AndroidTests/res/values-32dpi-stylus/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple 32dpi stylus</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag 32dpi stylus</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-32dpi/configVarying.xml b/tests/AndroidTests/res/values-32dpi/configVarying.xml
deleted file mode 100644
index f903f0f..0000000
--- a/tests/AndroidTests/res/values-32dpi/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple 32dpi</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag 32dpi</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-480x320/configVarying.xml b/tests/AndroidTests/res/values-480x320/configVarying.xml
deleted file mode 100644
index d4305fc..0000000
--- a/tests/AndroidTests/res/values-480x320/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple 480x320</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag 480x320</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-640x400/configVarying.xml b/tests/AndroidTests/res/values-640x400/configVarying.xml
deleted file mode 100644
index 30332c0..0000000
--- a/tests/AndroidTests/res/values-640x400/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple 640x400</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag 640x400</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-cs/strings.xml b/tests/AndroidTests/res/values-cs/strings.xml
deleted file mode 100644
index bd402c7..0000000
--- a/tests/AndroidTests/res/values-cs/strings.xml
+++ /dev/null
@@ -1,25 +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.
--->
-
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
- 
-    <plurals name="plurals_test">
-        <item quantity="one">A Czech dog</item>
-        <item quantity="few">Few Czech dogs</item>
-        <item quantity="other">Some Czech dogs</item>
-    </plurals>
-</resources>
-
diff --git a/tests/AndroidTests/res/values-dpad-63x57/configVarying.xml b/tests/AndroidTests/res/values-dpad-63x57/configVarying.xml
deleted file mode 100644
index 8383e9e..0000000
--- a/tests/AndroidTests/res/values-dpad-63x57/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple dpad 63x57</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag dpad 63x57</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-dpad/configVarying.xml b/tests/AndroidTests/res/values-dpad/configVarying.xml
deleted file mode 100644
index c8d5767..0000000
--- a/tests/AndroidTests/res/values-dpad/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple dpad</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag dpad</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-fr-rFR/configVarying.xml b/tests/AndroidTests/res/values-fr-rFR/configVarying.xml
deleted file mode 100644
index 5ecac7c..0000000
--- a/tests/AndroidTests/res/values-fr-rFR/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple fr FR</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag fr FR</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-fr/configVarying.xml b/tests/AndroidTests/res/values-fr/configVarying.xml
deleted file mode 100644
index 8413b5a..0000000
--- a/tests/AndroidTests/res/values-fr/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple fr</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag fr</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-keysexposed-12key/configVarying.xml b/tests/AndroidTests/res/values-keysexposed-12key/configVarying.xml
deleted file mode 100644
index 2a2b8d9..0000000
--- a/tests/AndroidTests/res/values-keysexposed-12key/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple keysexposed 12key</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag keysexposed 12key</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-keysexposed-dpad/configVarying.xml b/tests/AndroidTests/res/values-keysexposed-dpad/configVarying.xml
deleted file mode 100644
index f279eb0..0000000
--- a/tests/AndroidTests/res/values-keysexposed-dpad/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple keysexposed dpad</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag keysexposed dpad</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-keysexposed/configVarying.xml b/tests/AndroidTests/res/values-keysexposed/configVarying.xml
deleted file mode 100644
index 2380e7e..0000000
--- a/tests/AndroidTests/res/values-keysexposed/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple keysexposed</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag keysexposed</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-land/configVarying.xml b/tests/AndroidTests/res/values-land/configVarying.xml
deleted file mode 100644
index 7d3d7e8..0000000
--- a/tests/AndroidTests/res/values-land/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple landscape</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag landscape</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-mcc110-xx/configVarying.xml b/tests/AndroidTests/res/values-mcc110-xx/configVarying.xml
deleted file mode 100644
index 82e2435..0000000
--- a/tests/AndroidTests/res/values-mcc110-xx/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple mcc110 xx</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag mcc110 xx</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-mcc111-mnc222/configVarying.xml b/tests/AndroidTests/res/values-mcc111-mnc222/configVarying.xml
deleted file mode 100644
index 84c31c6..0000000
--- a/tests/AndroidTests/res/values-mcc111-mnc222/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple mcc111 mnc222</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag mcc111 mnc222</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-mcc111-xx-rYY/configVarying.xml b/tests/AndroidTests/res/values-mcc111-xx-rYY/configVarying.xml
deleted file mode 100644
index 3aa1ba0..0000000
--- a/tests/AndroidTests/res/values-mcc111-xx-rYY/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple mcc111 xx-rYY</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag mcc111 xx-rYY</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-mcc111-xx/configVarying.xml b/tests/AndroidTests/res/values-mcc111-xx/configVarying.xml
deleted file mode 100644
index 09bd817..0000000
--- a/tests/AndroidTests/res/values-mcc111-xx/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple mcc111 xx</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag mcc111 xx</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-mcc111/configVarying.xml b/tests/AndroidTests/res/values-mcc111/configVarying.xml
deleted file mode 100644
index b516194..0000000
--- a/tests/AndroidTests/res/values-mcc111/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple mcc111</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag mcc111</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-mcc112/configVarying.xml b/tests/AndroidTests/res/values-mcc112/configVarying.xml
deleted file mode 100644
index 9c05d77..0000000
--- a/tests/AndroidTests/res/values-mcc112/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple mcc112</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag mcc112</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-mnc220-xx/configVarying.xml b/tests/AndroidTests/res/values-mnc220-xx/configVarying.xml
deleted file mode 100644
index fbc7888..0000000
--- a/tests/AndroidTests/res/values-mnc220-xx/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple mnc220 xx</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag mnc220 xx</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-mnc222-32dpi/configVarying.xml b/tests/AndroidTests/res/values-mnc222-32dpi/configVarying.xml
deleted file mode 100644
index 03bea33..0000000
--- a/tests/AndroidTests/res/values-mnc222-32dpi/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple mnc222 32dpi</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag mnc222 32dpi</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-mnc222-square/configVarying.xml b/tests/AndroidTests/res/values-mnc222-square/configVarying.xml
deleted file mode 100644
index 952c595..0000000
--- a/tests/AndroidTests/res/values-mnc222-square/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple mnc222 square</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag mnc222 square</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-mnc222-xx/configVarying.xml b/tests/AndroidTests/res/values-mnc222-xx/configVarying.xml
deleted file mode 100644
index c1cafbc..0000000
--- a/tests/AndroidTests/res/values-mnc222-xx/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple mnc222 xx</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag mnc222 xx</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-mnc222/configVarying.xml b/tests/AndroidTests/res/values-mnc222/configVarying.xml
deleted file mode 100644
index a37b7ef..0000000
--- a/tests/AndroidTests/res/values-mnc222/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple mnc222</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag mnc222</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-mnc223/configVarying.xml b/tests/AndroidTests/res/values-mnc223/configVarying.xml
deleted file mode 100644
index 8936cbc..0000000
--- a/tests/AndroidTests/res/values-mnc223/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple mnc223</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag mnc223</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-nokeys/configVarying.xml b/tests/AndroidTests/res/values-nokeys/configVarying.xml
deleted file mode 100644
index 71f7e0b..0000000
--- a/tests/AndroidTests/res/values-nokeys/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple nokeys</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag nokeys</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-nonav/configVarying.xml b/tests/AndroidTests/res/values-nonav/configVarying.xml
deleted file mode 100644
index 1254920..0000000
--- a/tests/AndroidTests/res/values-nonav/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple nonav</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag nonav</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-notouch/configVarying.xml b/tests/AndroidTests/res/values-notouch/configVarying.xml
deleted file mode 100644
index f919f87..0000000
--- a/tests/AndroidTests/res/values-notouch/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple notouch</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag notouch</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-square-32dpi/configVarying.xml b/tests/AndroidTests/res/values-square-32dpi/configVarying.xml
deleted file mode 100644
index 41a69cd..0000000
--- a/tests/AndroidTests/res/values-square-32dpi/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple square 32dpi</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag square 32dpi</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-square-stylus/configVarying.xml b/tests/AndroidTests/res/values-square-stylus/configVarying.xml
deleted file mode 100644
index de7892e..0000000
--- a/tests/AndroidTests/res/values-square-stylus/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple square stylus</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag square stylus</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-square/configVarying.xml b/tests/AndroidTests/res/values-square/configVarying.xml
deleted file mode 100644
index ba3a036..0000000
--- a/tests/AndroidTests/res/values-square/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple square</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag square</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-stylus-12key/configVarying.xml b/tests/AndroidTests/res/values-stylus-12key/configVarying.xml
deleted file mode 100644
index d79f079..0000000
--- a/tests/AndroidTests/res/values-stylus-12key/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple stylus 12key</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag stylus 12key</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-stylus-keysexposed/configVarying.xml b/tests/AndroidTests/res/values-stylus-keysexposed/configVarying.xml
deleted file mode 100644
index ff4e766..0000000
--- a/tests/AndroidTests/res/values-stylus-keysexposed/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple stylus keysexposed</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag stylus keysexposed</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-stylus/configVarying.xml b/tests/AndroidTests/res/values-stylus/configVarying.xml
deleted file mode 100644
index 83936a7..0000000
--- a/tests/AndroidTests/res/values-stylus/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple stylus</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag stylus</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-wheel/configVarying.xml b/tests/AndroidTests/res/values-wheel/configVarying.xml
deleted file mode 100644
index 6164855..0000000
--- a/tests/AndroidTests/res/values-wheel/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple wheel</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag wheel</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-xx-32dpi/configVarying.xml b/tests/AndroidTests/res/values-xx-32dpi/configVarying.xml
deleted file mode 100644
index 4cc162c..0000000
--- a/tests/AndroidTests/res/values-xx-32dpi/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple xx 32dpi</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag xx 32dpi</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-xx-rYY/configVarying.xml b/tests/AndroidTests/res/values-xx-rYY/configVarying.xml
deleted file mode 100644
index 2d2a9a1..0000000
--- a/tests/AndroidTests/res/values-xx-rYY/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple xx-rYY</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag xx-rYY</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-xx-square/configVarying.xml b/tests/AndroidTests/res/values-xx-square/configVarying.xml
deleted file mode 100644
index 807feec..0000000
--- a/tests/AndroidTests/res/values-xx-square/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple xx square</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag xx square</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values-xx/configVarying.xml b/tests/AndroidTests/res/values-xx/configVarying.xml
deleted file mode 100644
index fef2737..0000000
--- a/tests/AndroidTests/res/values-xx/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple xx</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag xx</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values/arrays.xml b/tests/AndroidTests/res/values/arrays.xml
deleted file mode 100644
index 20ab407..0000000
--- a/tests/AndroidTests/res/values/arrays.xml
+++ /dev/null
@@ -1,42 +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.
--->
-
-<resources>
-    <item type="integer" name="reference" format="integer">101</item>
-    
-    <!--
-    <array name="generic">
-        <item>zero</item>
-        <item>1</item>
-        <item>@string/reference</item>
-    </array>
-    <array name="genericStrings" format="string">
-        <item>zero</item>
-        <item>1</item>
-        <item>@string/reference</item>
-    </array>
-    -->
-    <string-array name="strings">
-        <item>zero</item>
-        <item>1</item>
-        <item>@string/reference</item>
-    </string-array>
-    <integer-array name="integers">
-        <item>0</item>
-        <item>1</item>
-        <item>@integer/reference</item>
-    </integer-array>
-</resources>
diff --git a/tests/AndroidTests/res/values/attrs.xml b/tests/AndroidTests/res/values/attrs.xml
deleted file mode 100644
index d3a31ca..0000000
--- a/tests/AndroidTests/res/values/attrs.xml
+++ /dev/null
@@ -1,44 +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.
--->
-
-<resources>
-    <attr name="testEnum">
-        <enum name="val1" value="1" />
-        <enum name="val2" value="2" />
-        <enum name="val10" value="10" />
-    </attr>
-
-    <attr name="testFlags">
-        <flag name="bit1" value="0x1" />
-        <flag name="bit2" value="0x2" />
-        <flag name="bit31" value="0x40000000" />
-    </attr>
-
-    <attr name="testString" format="string" />
-    
-    <declare-styleable name="EnumStyle">
-        <attr name="testEnum" />
-    </declare-styleable>
-
-    <declare-styleable name="FlagStyle">
-        <attr name="testFlags" />
-    </declare-styleable>
-    
-    <declare-styleable name="TestConfig">
-        <attr name="testString" />
-    </declare-styleable>
-</resources>
-
diff --git a/tests/AndroidTests/res/values/bools.xml b/tests/AndroidTests/res/values/bools.xml
deleted file mode 100644
index ffa8955..0000000
--- a/tests/AndroidTests/res/values/bools.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-
-<resources>
-	<bool name="trueRes">true</bool>
-	<bool name="falseRes">false</bool>
-</resources>
diff --git a/tests/AndroidTests/res/values/configVarying.xml b/tests/AndroidTests/res/values/configVarying.xml
deleted file mode 100644
index 3b3e4a4..0000000
--- a/tests/AndroidTests/res/values/configVarying.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<resources>
-    <item type="configVarying" name="simple">simple default</item>
-    <bag type="configVarying" name="bag">
-        <item name="testString">bag default</item>
-    </bag>
-</resources>
diff --git a/tests/AndroidTests/res/values/dimens.xml b/tests/AndroidTests/res/values/dimens.xml
deleted file mode 100644
index 72d1010..0000000
--- a/tests/AndroidTests/res/values/dimens.xml
+++ /dev/null
@@ -1,42 +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.
--->
-
-<resources>
-    <item name="frac100perc" type="dimen" format="fraction">100%</item>
-    <item name="frac1perc" type="dimen" format="fraction">1%</item>
-    <item name="fracp1perc" type="dimen" format="fraction">.1%</item>
-    <item name="fracp01perc" type="dimen" format="fraction">.01%</item>
-    <item name="frac0perc" type="dimen" format="fraction">0%</item>
-    <item name="frac1p1perc" type="dimen" format="fraction">1.1%</item>
-    <item name="frac100p1perc" type="dimen" format="fraction">100.1%</item>
-    <item name="frac25510perc" type="dimen" format="fraction">25510%</item>
-    <item name="frac25610perc" type="dimen" format="fraction">25610%</item>
-    <item name="frac6553510perc" type="dimen" format="fraction">6553510%</item>
-    <item name="frac6553610perc" type="dimen" format="fraction">6553610%</item>
-
-    <item name="frac100pperc" type="dimen" format="fraction">100%p</item>
-    <item name="frac1pperc" type="dimen" format="fraction">1%p</item>
-    <item name="fracp1pperc" type="dimen" format="fraction">.1%p</item>
-    <item name="fracp01pperc" type="dimen" format="fraction">.01%p</item>
-    <item name="frac0pperc" type="dimen" format="fraction">0%p</item>
-    <item name="frac1p1pperc" type="dimen" format="fraction">1.1%p</item>
-    <item name="frac100p1pperc" type="dimen" format="fraction">100.1%p</item>
-    <item name="frac25510pperc" type="dimen" format="fraction">25510%p</item>
-    <item name="frac25610pperc" type="dimen" format="fraction">25610%p</item>
-    <item name="frac6553510pperc" type="dimen" format="fraction">6553510%p</item>
-    <item name="frac6553610pperc" type="dimen" format="fraction">6553610%p</item> 
-</resources>
-
diff --git a/tests/AndroidTests/res/values/strings.xml b/tests/AndroidTests/res/values/strings.xml
deleted file mode 100644
index e8b150a..0000000
--- a/tests/AndroidTests/res/values/strings.xml
+++ /dev/null
@@ -1,38 +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" BASI
-     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-     See the License for the specific language governing permissions and
-     limitations under the License.
--->
-
-<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
-
-    <string name="coerceIntegerToString">100</string>
-    <string name="coerceBooleanToString">true</string>
-    <string name="coerceColorToString">#fff</string>
-    <string name="coerceFloatToString">100.0</string>
-    <string name="coerceDimensionToString">100px</string>
-    <string name="coerceFractionToString">100<xliff:g id="percent">%</xliff:g></string>
-
-    <string name="formattedStringNone">Format[]</string>
-    <string name="formattedStringOne">Format[<xliff:g id="format">%d</xliff:g>]</string>
-    <string name="formattedStringTwo">Format[<xliff:g id="format">%3$d,%2$s</xliff:g>]</string>
-    
-    <string name="reference">here</string>
-    
-    <plurals name="plurals_test">
-        <item quantity="one">A dog</item>
-        <item quantity="other">Some dogs</item>
-    </plurals>
-    
-<!--    <string name="layout_six_text_text">F</string> -->
-</resources>
diff --git a/tests/AndroidTests/res/values/styles.xml b/tests/AndroidTests/res/values/styles.xml
deleted file mode 100644
index 6c60e21..0000000
--- a/tests/AndroidTests/res/values/styles.xml
+++ /dev/null
@@ -1,46 +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.
--->
-
-<resources>
-    <style name="TestEnum1">
-        <item name="testEnum">val1</item>
-    </style>
-    <style name="TestEnum2">
-        <item name="testEnum">val2</item>
-    </style>
-    <style name="TestEnum10">
-        <item name="testEnum">val10</item>
-    </style>
-
-    <style name="TestFlag1">
-        <item name="testFlags">bit1</item>
-    </style>
-    <style name="TestFlag2">
-        <item name="testFlags">bit2</item>
-    </style>
-    <style name="TestFlag31">
-        <item name="testFlags">bit31</item>
-    </style>
-    <style name="TestFlag1And2">
-        <item name="testFlags">bit1|bit2</item>
-    </style>
-    <style name="TestFlag1And2And31">
-        <item name="testFlags">bit1|bit2|bit31</item>
-    </style>
-    
-    <style name="TestEnum1.EmptyInherit">
-    </style>
-</resources>
diff --git a/tests/AndroidTests/run_test.sh b/tests/AndroidTests/run_test.sh
deleted file mode 100755
index bc06b7e..0000000
--- a/tests/AndroidTests/run_test.sh
+++ /dev/null
@@ -1,4 +0,0 @@
-framework=/system/framework
-bpath=$framework/core.jar:$framework/ext.jar:$framework/framework.jar:$framework/android.test.runner.jar
-adb shell exec dalvikvm  -Xbootclasspath:$bpath -cp /system/app/AndroidTests.apk:/data/app/com.android.unit_tests.apk:/data/app/AndroidTests.apk \
-      com.android.internal.util.WithFramework junit.textui.TestRunner $*
diff --git a/tests/AndroidTests/src/com/android/unit_tests/HtmlTest.java b/tests/AndroidTests/src/com/android/unit_tests/HtmlTest.java
deleted file mode 100644
index 027730f..0000000
--- a/tests/AndroidTests/src/com/android/unit_tests/HtmlTest.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.unit_tests;
-
-import android.content.res.ColorStateList;
-import android.content.res.Resources;
-import android.graphics.Typeface;
-import android.test.suitebuilder.annotation.MediumTest;
-import android.test.suitebuilder.annotation.SmallTest;
-import android.text.Html;
-import android.text.Spannable;
-import android.text.SpannableString;
-import android.text.Spanned;
-import android.text.style.ForegroundColorSpan;
-import android.text.style.QuoteSpan;
-import android.text.style.StrikethroughSpan;
-import android.text.style.StyleSpan;
-import android.text.style.SubscriptSpan;
-import android.text.style.SuperscriptSpan;
-import android.text.style.TextAppearanceSpan;
-import android.text.style.TypefaceSpan;
-import android.text.style.URLSpan;
-import android.text.style.UnderlineSpan;
-
-import junit.framework.TestCase;
-
-/**
- * HtmlTest tests the Spanned-to-HTML converter
- */
-public class HtmlTest extends TestCase {
-    @MediumTest
-    public void testColor() throws Exception {
-        Spanned s;
-        ForegroundColorSpan[] colors;
-
-        s = Html.fromHtml("<font color=\"#00FF00\">something</font>");
-        colors = s.getSpans(0, s.length(), ForegroundColorSpan.class);
-        assertEquals(1, colors.length);
-        assertEquals(0xFF00FF00, colors[0].getForegroundColor());
-
-        s = Html.fromHtml("<font color=\"navy\">something</font>");
-        colors = s.getSpans(0, s.length(), ForegroundColorSpan.class);
-        assertEquals(1, colors.length);
-        assertEquals(0xFF000080, colors[0].getForegroundColor());
-
-        s = Html.fromHtml("<font color=\"gibberish\">something</font>");
-        colors = s.getSpans(0, s.length(), ForegroundColorSpan.class);
-        assertEquals(0, colors.length);
-    }
-
-    @MediumTest
-    public void testResourceColor() throws Exception {
-        ColorStateList c =
-                Resources.getSystem().getColorStateList(android.R.color.primary_text_dark);
-        Spanned s;
-        TextAppearanceSpan[] colors;
-
-        s = Html.fromHtml("<font color=\"@android:color/primary_text_dark\">something</font>");
-        colors = s.getSpans(0, s.length(), TextAppearanceSpan.class);
-        assertEquals(1, colors.length);
-        assertEquals(c.toString(), colors[0].getTextColor().toString());
-
-        s = Html.fromHtml("<font color=\"@android:primary_text_dark\">something</font>");
-        colors = s.getSpans(0, s.length(), TextAppearanceSpan.class);
-        assertEquals(1, colors.length);
-        assertEquals(c.toString(), colors[0].getTextColor().toString());
-
-        s = Html.fromHtml("<font color=\"@color/primary_text_dark\">something</font>");
-        colors = s.getSpans(0, s.length(), TextAppearanceSpan.class);
-        assertEquals(1, colors.length);
-        assertEquals(c.toString(), colors[0].getTextColor().toString());
-
-        s = Html.fromHtml("<font color=\"@primary_text_dark\">something</font>");
-        colors = s.getSpans(0, s.length(), TextAppearanceSpan.class);
-        assertEquals(1, colors.length);
-        assertEquals(c.toString(), colors[0].getTextColor().toString());
-
-        s = Html.fromHtml("<font color=\"@" + android.R.color.primary_text_dark
-                + "\">something</font>");
-        colors = s.getSpans(0, s.length(), TextAppearanceSpan.class);
-        assertEquals(1, colors.length);
-        assertEquals(c.toString(), colors[0].getTextColor().toString());
-
-        s = Html.fromHtml("<font color=\"gibberish\">something</font>");
-        colors = s.getSpans(0, s.length(), TextAppearanceSpan.class);
-        assertEquals(colors.length, 0);
-    }
-
-    @SmallTest
-    public void testParagraphs() throws Exception {
-        SpannableString s;
-
-        s = new SpannableString("Hello world");
-        assertEquals(Html.toHtml(s), "<p>Hello world</p>\n");
-
-        s = new SpannableString("Hello world\nor something");
-        assertEquals(Html.toHtml(s), "<p>Hello world<br>\nor something</p>\n");
-
-        s = new SpannableString("Hello world\n\nor something");
-        assertEquals(Html.toHtml(s), "<p>Hello world</p>\n<p>or something</p>\n");
-
-        s = new SpannableString("Hello world\n\n\nor something");
-        assertEquals(Html.toHtml(s), "<p>Hello world<br></p>\n<p>or something</p>\n");
-
-        assertEquals("foo\nbar", Html.fromHtml("foo<br>bar").toString());
-        assertEquals("foo\nbar", Html.fromHtml("foo<br>\nbar").toString());
-        assertEquals("foo\nbar", Html.fromHtml("foo<br>\n \nbar").toString());
-    }
-
-    @SmallTest
-    public void testBlockquote() throws Exception {
-        SpannableString s;
-
-        s = new SpannableString("Hello world");
-        s.setSpan(new QuoteSpan(), 0, s.length(), Spannable.SPAN_PARAGRAPH);
-        assertEquals(Html.toHtml(s), "<blockquote><p>Hello world</p>\n</blockquote>\n");
-
-        s = new SpannableString("Hello\n\nworld");
-        s.setSpan(new QuoteSpan(), 0, 7, Spannable.SPAN_PARAGRAPH);
-        assertEquals(Html.toHtml(s), "<blockquote><p>Hello</p>\n</blockquote>\n<p>world</p>\n");
-    }
-
-    @SmallTest
-    public void testEntities() throws Exception {
-        SpannableString s;
-
-        s = new SpannableString("Hello <&> world");
-        assertEquals(Html.toHtml(s), "<p>Hello &lt;&amp;&gt; world</p>\n");
-
-        s = new SpannableString("Hello \u03D5 world");
-        assertEquals(Html.toHtml(s), "<p>Hello &#981; world</p>\n");
-
-        s = new SpannableString("Hello  world");
-        assertEquals(Html.toHtml(s), "<p>Hello&nbsp; world</p>\n");
-    }
-
-    @SmallTest
-    public void testMarkup() throws Exception {
-        SpannableString s;
-
-        s = new SpannableString("Hello bold world");
-        s.setSpan(new StyleSpan(Typeface.BOLD), 6, s.length() - 6,
-                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
-        assertEquals(Html.toHtml(s), "<p>Hello <b>bold</b> world</p>\n");
-
-        s = new SpannableString("Hello italic world");
-        s.setSpan(new StyleSpan(Typeface.ITALIC), 6, s.length() - 6,
-                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
-        assertEquals(Html.toHtml(s), "<p>Hello <i>italic</i> world</p>\n");
-
-        s = new SpannableString("Hello monospace world");
-        s.setSpan(new TypefaceSpan("monospace"), 6, s.length() - 6,
-                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
-        assertEquals(Html.toHtml(s), "<p>Hello <tt>monospace</tt> world</p>\n");
-
-        s = new SpannableString("Hello superscript world");
-        s.setSpan(new SuperscriptSpan(), 6, s.length() - 6,
-                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
-        assertEquals(Html.toHtml(s), "<p>Hello <sup>superscript</sup> world</p>\n");
-
-        s = new SpannableString("Hello subscript world");
-        s.setSpan(new SubscriptSpan(), 6, s.length() - 6,
-                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
-        assertEquals(Html.toHtml(s), "<p>Hello <sub>subscript</sub> world</p>\n");
-
-        s = new SpannableString("Hello underline world");
-        s.setSpan(new UnderlineSpan(), 6, s.length() - 6,
-                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
-        assertEquals(Html.toHtml(s), "<p>Hello <u>underline</u> world</p>\n");
-
-        s = new SpannableString("Hello struck world");
-        s.setSpan(new StrikethroughSpan(), 6, s.length() - 6,
-                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
-        assertEquals(Html.toHtml(s), "<p>Hello <strike>struck</strike> world</p>\n");
-
-        s = new SpannableString("Hello linky world");
-        s.setSpan(new URLSpan("http://www.google.com"), 6, s.length() - 6,
-                  Spannable.SPAN_EXCLUSIVE_INCLUSIVE);
-        assertEquals(Html.toHtml(s),
-                     "<p>Hello <a href=\"http://www.google.com\">linky</a> world</p>\n");
-    }
-
-    @SmallTest
-    public void testImg() throws Exception {
-        Spanned s;
-
-        s = Html.fromHtml("yes<img src=\"http://example.com/foo.gif\">no");
-
-        assertEquals("<p>yes<img src=\"http://example.com/foo.gif\">no</p>\n",
-                     Html.toHtml(s));
-    }
-
-    @SmallTest
-    public void testUtf8() throws Exception {
-        Spanned s;
-
-        s = Html.fromHtml("<p>\u0124\u00eb\u0142\u0142o, world!</p>");
-        assertEquals("<p>&#292;&#235;&#322;&#322;o, world!</p>\n", Html.toHtml(s));
-    }
-}
diff --git a/tests/AndroidTests/src/com/android/unit_tests/AndroidPerformanceTests.java b/tests/CoreTests/android/core/AndroidPerformanceTests.java
similarity index 96%
rename from tests/AndroidTests/src/com/android/unit_tests/AndroidPerformanceTests.java
rename to tests/CoreTests/android/core/AndroidPerformanceTests.java
index 795fe2b..e604d59 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/AndroidPerformanceTests.java
+++ b/tests/CoreTests/android/core/AndroidPerformanceTests.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import android.test.TestListActivity;
 
diff --git a/tests/AndroidTests/src/com/android/unit_tests/ArrayListTest.java b/tests/CoreTests/android/core/ArrayListPerformanceTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/ArrayListTest.java
rename to tests/CoreTests/android/core/ArrayListPerformanceTest.java
index 81e6efd..6130e83 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/ArrayListTest.java
+++ b/tests/CoreTests/android/core/ArrayListPerformanceTest.java
@@ -14,12 +14,12 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import java.util.ArrayList;
 import android.test.PerformanceTestBase;
 
-public class ArrayListTest extends PerformanceTestBase {
+public class ArrayListPerformanceTest extends PerformanceTestBase {
 
     private ArrayList<Integer> mList;
 
diff --git a/tests/AndroidTests/src/com/android/unit_tests/HashMapTest.java b/tests/CoreTests/android/core/HashMapPerformanceTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/HashMapTest.java
rename to tests/CoreTests/android/core/HashMapPerformanceTest.java
index b4d15c9..82727bb 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/HashMapTest.java
+++ b/tests/CoreTests/android/core/HashMapPerformanceTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import java.util.Collection;
 import java.util.HashMap;
@@ -23,7 +23,7 @@
 import android.test.PerformanceTestBase;
 import android.test.PerformanceTestCase;
 
-public class HashMapTest extends PerformanceTestBase {
+public class HashMapPerformanceTest extends PerformanceTestBase {
     public static final int ITERATIONS = 1000;
     public HashMap mMap;
     public String[] mKeys;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/HashSetTest.java b/tests/CoreTests/android/core/HashSetTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/HashSetTest.java
rename to tests/CoreTests/android/core/HashSetTest.java
index 80d3d8d..09a711f 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/HashSetTest.java
+++ b/tests/CoreTests/android/core/HashSetTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import android.test.PerformanceTestBase;
 import android.test.PerformanceTestCase;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/HashtableTest.java b/tests/CoreTests/android/core/HashtableTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/HashtableTest.java
rename to tests/CoreTests/android/core/HashtableTest.java
index 42bec11..6160f57 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/HashtableTest.java
+++ b/tests/CoreTests/android/core/HashtableTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import android.test.PerformanceTestBase;
 import android.test.PerformanceTestCase;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/HeapTest.java b/tests/CoreTests/android/core/HeapTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/HeapTest.java
rename to tests/CoreTests/android/core/HeapTest.java
index f6ae6f6..6116f5e 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/HeapTest.java
+++ b/tests/CoreTests/android/core/HeapTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import android.test.suitebuilder.annotation.LargeTest;
 import android.test.suitebuilder.annotation.MediumTest;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/InstanceofTest.java b/tests/CoreTests/android/core/InstanceofTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/InstanceofTest.java
rename to tests/CoreTests/android/core/InstanceofTest.java
index 1f82df8..b35ef6b 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/InstanceofTest.java
+++ b/tests/CoreTests/android/core/InstanceofTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import junit.framework.TestCase;
 import android.test.suitebuilder.annotation.MediumTest;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/JavaPerformanceTests.java b/tests/CoreTests/android/core/JavaPerformanceTests.java
similarity index 80%
rename from tests/AndroidTests/src/com/android/unit_tests/JavaPerformanceTests.java
rename to tests/CoreTests/android/core/JavaPerformanceTests.java
index e778d53..fbe70cc 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/JavaPerformanceTests.java
+++ b/tests/CoreTests/android/core/JavaPerformanceTests.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 /**
  * 
@@ -24,15 +24,15 @@
     public static String[] children() {
         return new String[] {
                 StringTest.class.getName(),
-                HashMapTest.class.getName(),
-                ArrayListTest.class.getName(),
-                TreeMapTest.class.getName(),
+                HashMapPerformanceTest.class.getName(),
+                ArrayListPerformanceTest.class.getName(),
+                TreeMapPerformanceTest.class.getName(),
                 TreeSetTest.class.getName(),
                 HashSetTest.class.getName(),
                 HashtableTest.class.getName(),
                 VectorTest.class.getName(),
                 LinkedListTest.class.getName(),
-                MathTest.class.getName(),
+                MathPerformanceTest.class.getName(),
         };
     }
 }
diff --git a/tests/AndroidTests/src/com/android/unit_tests/JniLibTest.java b/tests/CoreTests/android/core/JniLibTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/JniLibTest.java
rename to tests/CoreTests/android/core/JniLibTest.java
index 6b740ba..d476072 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/JniLibTest.java
+++ b/tests/CoreTests/android/core/JniLibTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import android.test.suitebuilder.annotation.Suppress;
 import android.util.Log;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/LinkedListTest.java b/tests/CoreTests/android/core/LinkedListTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/LinkedListTest.java
rename to tests/CoreTests/android/core/LinkedListTest.java
index ca470cd..8b237fd 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/LinkedListTest.java
+++ b/tests/CoreTests/android/core/LinkedListTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import android.test.PerformanceTestBase;
 import android.test.PerformanceTestCase;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/MathTest.java b/tests/CoreTests/android/core/MathPerformanceTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/MathTest.java
rename to tests/CoreTests/android/core/MathPerformanceTest.java
index caf2d20..b1eb500 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/MathTest.java
+++ b/tests/CoreTests/android/core/MathPerformanceTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import android.test.PerformanceTestBase;
 import android.test.PerformanceTestCase;
@@ -25,7 +25,7 @@
  * 
  */
 
-public class MathTest extends PerformanceTestBase {
+public class MathPerformanceTest extends PerformanceTestBase {
     public static final int ITERATIONS = 1000;
     public static final double sDouble1 = -2450.50;
     public static final double sDouble2 = -500;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/MonitorTest.java b/tests/CoreTests/android/core/MonitorTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/MonitorTest.java
rename to tests/CoreTests/android/core/MonitorTest.java
index b5c6d87..73c33db 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/MonitorTest.java
+++ b/tests/CoreTests/android/core/MonitorTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import junit.framework.TestCase;
 import android.test.suitebuilder.annotation.MediumTest;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/PerformanceTests.java b/tests/CoreTests/android/core/PerformanceTests.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/PerformanceTests.java
rename to tests/CoreTests/android/core/PerformanceTests.java
index 9e54540..faf46e6 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/PerformanceTests.java
+++ b/tests/CoreTests/android/core/PerformanceTests.java
@@ -14,13 +14,12 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
-import android.os.Debug;
-import junit.framework.Assert;
+import org.apache.harmony.dalvik.NativeTestTarget;
+
 import android.test.PerformanceTestBase;
 import android.test.PerformanceTestCase;
-import org.apache.harmony.dalvik.NativeTestTarget;
 
 import java.util.ArrayList;
 import java.util.HashMap;
@@ -28,6 +27,8 @@
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import junit.framework.Assert;
+
 public class PerformanceTests {
     public static String[] children() {
         return new String[] {
diff --git a/tests/AndroidTests/src/com/android/unit_tests/SerializationTest.java b/tests/CoreTests/android/core/SerializationTest.java
similarity index 97%
rename from tests/AndroidTests/src/com/android/unit_tests/SerializationTest.java
rename to tests/CoreTests/android/core/SerializationTest.java
index 4b64144..9644d03 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/SerializationTest.java
+++ b/tests/CoreTests/android/core/SerializationTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import junit.framework.TestCase;
 
diff --git a/tests/AndroidTests/src/com/android/unit_tests/StringTest.java b/tests/CoreTests/android/core/StringTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/StringTest.java
rename to tests/CoreTests/android/core/StringTest.java
index dc40a0a..128531c 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/StringTest.java
+++ b/tests/CoreTests/android/core/StringTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import java.util.Locale;
 
diff --git a/tests/AndroidTests/src/com/android/unit_tests/TestHttpClient.java b/tests/CoreTests/android/core/TestHttpClient.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/TestHttpClient.java
rename to tests/CoreTests/android/core/TestHttpClient.java
index 9b5e655..c657f1e 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/TestHttpClient.java
+++ b/tests/CoreTests/android/core/TestHttpClient.java
@@ -29,7 +29,7 @@
  *
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import java.io.IOException;
 
diff --git a/tests/AndroidTests/src/com/android/unit_tests/TreeMapTest.java b/tests/CoreTests/android/core/TreeMapPerformanceTest.java
similarity index 98%
rename from tests/AndroidTests/src/com/android/unit_tests/TreeMapTest.java
rename to tests/CoreTests/android/core/TreeMapPerformanceTest.java
index d77a819..3a210f4 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/TreeMapTest.java
+++ b/tests/CoreTests/android/core/TreeMapPerformanceTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import android.test.PerformanceTestBase;
 import android.test.PerformanceTestCase;
@@ -28,7 +28,7 @@
  * Implements basic performance test functionality for java.util.TreeMap
  */
 
-public class TreeMapTest extends PerformanceTestBase {
+public class TreeMapPerformanceTest extends PerformanceTestBase {
     public static final int ITERATIONS = 1000;
     public static TreeMap<String, Integer> sMap;
     public static String[] sKeys;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/TreeSetTest.java b/tests/CoreTests/android/core/TreeSetTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/TreeSetTest.java
rename to tests/CoreTests/android/core/TreeSetTest.java
index 60dfe9a..a6a3309 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/TreeSetTest.java
+++ b/tests/CoreTests/android/core/TreeSetTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import android.test.PerformanceTestBase;
 import android.test.PerformanceTestCase;
diff --git a/tests/AndroidTests/src/com/android/unit_tests/VectorTest.java b/tests/CoreTests/android/core/VectorTest.java
similarity index 99%
rename from tests/AndroidTests/src/com/android/unit_tests/VectorTest.java
rename to tests/CoreTests/android/core/VectorTest.java
index 22f9771..b4c84fd 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/VectorTest.java
+++ b/tests/CoreTests/android/core/VectorTest.java
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package com.android.unit_tests;
+package android.core;
 
 import android.test.PerformanceTestBase;
 import android.test.PerformanceTestCase;
diff --git a/tests/FrameworkTest/Android.mk b/tests/FrameworkTest/Android.mk
deleted file mode 100644
index 61cdbfa..0000000
--- a/tests/FrameworkTest/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_MODULE_TAGS := tests
-
-# Only compile source java files in this apk.
-LOCAL_SRC_FILES := $(call all-java-files-under, src)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
-LOCAL_PACKAGE_NAME := FrameworkTest
-
-include $(BUILD_PACKAGE)
-# Use the following include to make our test apk.
-include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/tests/FrameworkTest/AndroidManifest.xml b/tests/FrameworkTest/AndroidManifest.xml
deleted file mode 100644
index 4db8952..0000000
--- a/tests/FrameworkTest/AndroidManifest.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- 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.
--->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.frameworktest">
-
-    <uses-permission android:name="android.permission.READ_CONTACTS" />
-    <uses-permission android:name="android.permission.HARDWARE_TEST" />
-    <uses-permission android:name="android.permission.WRITE_SETTINGS" />
-    <uses-permission android:name="android.permission.ACCESSIBILITY_EVENT_VIEW_TYPES" />
-    <uses-permission android:name="android.permission.ACCESSIBILITY_EVENT_TRANSITION_TYPES" />
-    <uses-permission android:name="android.permission.ACCESSIBILITY_EVENT_NOTIFICATION_TYPES" />
-
-    <application android:theme="@style/Theme">
-        <uses-library android:name="android.test.runner" />
-
-        <activity android:name=".FrameworkTestApplication" android:label="FrameworkTestApplication">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".performance.InvalidateCycle" android:label="InvalidateCycle">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
-            </intent-filter>
-        </activity>
-
-        <activity android:name=".settings.RingtonePickerActivityLauncher" android:label="RingtonePickerActivityLauncher">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" />
-            </intent-filter>
-        </activity>
-        
-
-    </application>
-
-</manifest>
diff --git a/tests/FrameworkTest/README b/tests/FrameworkTest/README
deleted file mode 100644
index d6d0042..0000000
--- a/tests/FrameworkTest/README
+++ /dev/null
@@ -1,8 +0,0 @@
-FrameworkTestApplication should hold snippets of functionality that are
-helpful for testing the UI framework code, but not appropriate for
-sample code.  For instance, a layout contrived to exercise an edge case
-of scrolling behavior.
-
-InstrumentationTestCases should be added under tests and added to the
-list of tests in FrameworkInstrumentationTestRunner.
-
diff --git a/tests/FrameworkTest/res/values/styles.xml b/tests/FrameworkTest/res/values/styles.xml
deleted file mode 100644
index 7a90197..0000000
--- a/tests/FrameworkTest/res/values/styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<resources>
-    <style name="Theme" parent="android:Theme">
-        <item name="android:windowAnimationStyle">@style/Animation</item>
-    </style>
-
-    <style name="Animation">
-        <item name="android:activityOpenEnterAnimation">@null</item>
-        <item name="android:activityOpenExitAnimation">@null</item>
-        <item name="android:activityCloseEnterAnimation">@null</item>
-        <item name="android:activityCloseExitAnimation">@null</item>
-        <item name="android:taskOpenEnterAnimation">@null</item>
-        <item name="android:taskOpenExitAnimation">@null</item>
-        <item name="android:taskCloseEnterAnimation">@null</item>
-        <item name="android:taskCloseExitAnimation">@null</item>
-        <item name="android:taskToFrontEnterAnimation">@null</item>
-        <item name="android:taskToFrontExitAnimation">@null</item>
-        <item name="android:taskToBackEnterAnimation">@null</item>
-        <item name="android:taskToBackExitAnimation">@null</item>
-    </style>
-</resources>
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java b/tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java
deleted file mode 100644
index c57b9973..0000000
--- a/tests/FrameworkTest/src/com/android/frameworktest/FrameworkTestApplication.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.frameworktest;
-
-import android.app.LauncherActivity;
-import android.content.Intent;
-
-/**
- * Holds little snippets of functionality used as code under test for
- * instrumentation tests of framework code.
- */
-public class FrameworkTestApplication extends LauncherActivity {
-
-    protected Intent getTargetIntent() {
-        // TODO: partition into categories by label like the sample code app
-        Intent targetIntent = new Intent(Intent.ACTION_MAIN, null);
-        targetIntent.addCategory(Intent.CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST);
-        targetIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        return targetIntent;
-    }
-}
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java b/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java
deleted file mode 100644
index 22bb46f..0000000
--- a/tests/FrameworkTest/src/com/android/frameworktest/performance/InvalidateCycle.java
+++ /dev/null
@@ -1,65 +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 com.android.frameworktest.performance;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.os.Debug;
-import android.os.Handler;
-import android.view.View;
-import android.view.ViewGroup;
-import android.content.Context;
-import android.graphics.Canvas;
-
-public class InvalidateCycle extends Activity {
-    private boolean mStartProfiling;
-    private InvalidateCycle.AutoInvalidateView mView;
-
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        mView = new AutoInvalidateView(this);
-        mView.setLayoutParams(new ViewGroup.LayoutParams(16, 16));
-        setContentView(mView);
-
-        new Handler().postDelayed(new Runnable() {
-            public void run() {
-                mStartProfiling = true;
-                android.util.Log.d("Performance", "Profiling started");
-                Debug.startMethodTracing("invalidateCycle");
-                mView.invalidate();
-            }
-        }, 15000);
-    }
-
-    private class AutoInvalidateView extends View {
-        private boolean mFirstDraw;
-
-        public AutoInvalidateView(Context context) {
-            super(context);
-        }
-
-        protected void onDraw(Canvas canvas) {
-            if (mStartProfiling && !mFirstDraw) {
-                Debug.stopMethodTracing();
-                android.util.Log.d("Performance", "Profiling ended");
-                mFirstDraw = true;
-            }
-            canvas.drawColor(0xFFFF0000);            
-        }
-    }
-}
diff --git a/tests/FrameworkTest/src/com/android/frameworktest/settings/RingtonePickerActivityLauncher.java b/tests/FrameworkTest/src/com/android/frameworktest/settings/RingtonePickerActivityLauncher.java
deleted file mode 100644
index 19113da..0000000
--- a/tests/FrameworkTest/src/com/android/frameworktest/settings/RingtonePickerActivityLauncher.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.frameworktest.settings;
-
-import com.android.internal.app.RingtonePickerActivity;
-
-import android.app.Activity;
-import android.content.Intent;
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.os.Bundle;
-
-/**
- * Activity that will launch the RingtonePickerActivity as a subactivity, and
- * waits for its result.
- */
-public class RingtonePickerActivityLauncher extends Activity {
-
-    private static final String TAG = "RingtonePickerActivityLauncher";
-    
-    public boolean resultReceived = false;
-    
-    public int resultCode;
-    public Intent result;
-
-    public Uri pickedUri;
-    
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        
-        setContentView(android.R.layout.simple_list_item_1);
-    }
-
-    /**
-     * Launches the {@link RingtonePickerActivity} and blocks until it returns.
-     * 
-     * @param showDefault {@link RingtonePickerActivity#EXTRA_SHOW_DEFAULT}
-     * @param existingUri {@link RingtonePickerActivity#EXTRA_EXISTING_URI}
-     * @param filterColumns {@link RingtonePickerActivity#EXTRA_RINGTONE_COLUMNS}
-     */
-    public void launchRingtonePickerActivity(boolean showDefault, Uri existingUri,
-            int types) {
-        Intent intent = new Intent(RingtoneManager.ACTION_RINGTONE_PICKER);
-        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, showDefault);
-        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, existingUri);
-        intent.putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, types);
-        startActivityForResult(intent, 0);
-    }
-
-    @Override
-    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
-        super.onActivityResult(requestCode, resultCode, data);
-       
-        resultReceived = true;
-
-        this.resultCode = resultCode;
-        this.result = data;
-        
-        if (data != null) {
-            this.pickedUri = data.getParcelableExtra(RingtoneManager.EXTRA_RINGTONE_PICKED_URI);
-        }
-    }
-    
-}
diff --git a/tests/FrameworkTest/tests/Android.mk b/tests/FrameworkTest/tests/Android.mk
deleted file mode 100644
index 5c54684..0000000
--- a/tests/FrameworkTest/tests/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-# We only want this apk build for tests.
-LOCAL_MODULE_TAGS := tests
-
-# Include all test java files.
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-
-LOCAL_JAVA_LIBRARIES := android.test.runner
-
-LOCAL_PACKAGE_NAME := FrameworkTestTests
-
-LOCAL_INSTRUMENTATION_FOR := FrameworkTest
-
-include $(BUILD_PACKAGE)
-
diff --git a/tests/FrameworkTest/tests/AndroidManifest.xml b/tests/FrameworkTest/tests/AndroidManifest.xml
deleted file mode 100644
index 65aaebb..0000000
--- a/tests/FrameworkTest/tests/AndroidManifest.xml
+++ /dev/null
@@ -1,34 +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.
--->
-
-<!-- package name must be unique so suffix with "tests" so package loader doesn't ignore us -->
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.frameworktest.tests">
-
-    <application>
-        <uses-library android:name="android.test.runner" />
-    </application>
-
-    <!--
-    This declares that this app uses the instrumentation test runner targeting
-    the package of com.android.frameworktest.  To run the tests use the command:
-    "adb shell am instrument -w com.android.frameworktest.tests/android.test.InstrumentationTestRunner"
-    -->
-    <instrumentation android:name="android.test.InstrumentationTestRunner"
-                     android:targetPackage="com.android.frameworktest"
-                     android:label="framework tests"/>
-
-</manifest>
diff --git a/tests/FrameworkTest/tests/src/com/android/frameworktest/settings/RingtonePickerActivityTest.java b/tests/FrameworkTest/tests/src/com/android/frameworktest/settings/RingtonePickerActivityTest.java
deleted file mode 100644
index 42888ff..0000000
--- a/tests/FrameworkTest/tests/src/com/android/frameworktest/settings/RingtonePickerActivityTest.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * Copyright (C) 2007 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.frameworktest.settings;
-
-import com.android.frameworktest.settings.RingtonePickerActivityLauncher;
-
-import android.app.Instrumentation;
-import android.database.Cursor;
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.provider.MediaStore;
-import android.test.ActivityInstrumentationTestCase;
-import android.test.suitebuilder.annotation.Suppress;
-import android.view.KeyEvent;
-
-/**
- * Tests the RingtonePickerActivity.
- * <p>
- * There is a launcher for launching the RingtonePickerActivity (RPA) since the RPA needs
- * to be a subactivity.  We don't have a reference to the actual RPA.
- * <p>
- * This relies heavily on keypresses getting to the right widget.  It depends on:
- * <li> Less than NUM_RINGTONES_AND_SOME ringtones on the system
- * <li> Pressing arrow-down a ton will eventually end up on the 'Cancel' button
- * <li> From the 'Cancel' button, pressing arrow-left will end up on 'OK' button
- */
-@Suppress
-public class RingtonePickerActivityTest extends ActivityInstrumentationTestCase<RingtonePickerActivityLauncher> {
-
-    private static final int NUM_RINGTONES_AND_SOME = 20;
-    private RingtonePickerActivityLauncher mActivity;
-    private Instrumentation mInstrumentation;
-    
-    public RingtonePickerActivityTest() {
-        super("com.android.frameworktest", RingtonePickerActivityLauncher.class);
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        
-        mActivity = getActivity();
-        mInstrumentation = getInstrumentation();
-        assertNotNull(mActivity);
-        assertFalse(mActivity.resultReceived);
-        assertNotNull(mInstrumentation);
-    }
-    
-    public void testDefault() {
-        mActivity.launchRingtonePickerActivity(true, null, RingtoneManager.TYPE_ALL);
-        mInstrumentation.waitForIdleSync();
-        
-        // Go to top
-        goTo(true);
-        // Select default ringtone 
-        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
-        // Go to bottom/cancel button
-        goTo(false);
-        // Select OK button
-        sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER);
-        
-        mInstrumentation.waitForIdleSync();
-        
-        assertTrue(mActivity.resultReceived);
-        assertNotNull(mActivity.result);
-        assertTrue(RingtoneManager.isDefault(mActivity.pickedUri));
-    }
-    
-    public void testFirst() {
-        mActivity.launchRingtonePickerActivity(true, null, RingtoneManager.TYPE_ALL);
-        mInstrumentation.waitForIdleSync();
-        
-        // Go to top
-        goTo(true);
-        // Select first (non-default) ringtone 
-        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN, KeyEvent.KEYCODE_DPAD_CENTER);
-        // Go to bottom/cancel button
-        goTo(false);
-        // Select OK button
-        sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER);
-        
-        mInstrumentation.waitForIdleSync();
-        
-        assertTrue(mActivity.resultReceived);
-        assertNotNull(mActivity.result);
-        assertNotNull(mActivity.pickedUri);
-        assertFalse(RingtoneManager.isDefault(mActivity.pickedUri));
-    }
-
-    public void testExisting() {
-        // We need to get an existing ringtone first, so launch it, pick first,
-        // and keep that URI
-        testFirst();
-        Uri firstUri = mActivity.pickedUri;
-        
-        mActivity.launchRingtonePickerActivity(true, firstUri, RingtoneManager.TYPE_ALL);
-        mInstrumentation.waitForIdleSync();
-
-        //// Hit cancel:
-        
-        // Go to bottom
-        goTo(false);
-        // Select Cancel button
-        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
-        
-        mInstrumentation.waitForIdleSync();
-        
-        assertTrue(mActivity.resultReceived);
-        assertEquals(mActivity.pickedUri, firstUri);
-    }
-    
-    public void testExistingButDifferent() {
-        // We need to get an existing ringtone first, so launch it, pick first,
-        // and keep that URI
-        testFirst();
-        Uri firstUri = mActivity.pickedUri;
-        
-        mActivity.launchRingtonePickerActivity(true, firstUri, RingtoneManager.TYPE_ALL);
-        mInstrumentation.waitForIdleSync();
-
-        //// Pick second:
-        
-        // Go to top
-        goTo(true);
-        // Select second (non-default) ringtone 
-        sendKeys(KeyEvent.KEYCODE_DPAD_DOWN, KeyEvent.KEYCODE_DPAD_DOWN,
-                KeyEvent.KEYCODE_DPAD_CENTER);
-        // Go to bottom/cancel button
-        goTo(false);
-        // Select OK button
-        sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER);
-        
-        mInstrumentation.waitForIdleSync();
-        
-        assertTrue(mActivity.resultReceived);
-        assertNotNull(mActivity.result);
-        assertTrue(!firstUri.equals(mActivity.pickedUri));
-    }
-    
-    public void testCancel() {
-        mActivity.launchRingtonePickerActivity(true, null, RingtoneManager.TYPE_ALL);
-        mInstrumentation.waitForIdleSync();
-        
-        // Go to bottom
-        goTo(false);
-        // Select Cancel button
-        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
-        
-        mInstrumentation.waitForIdleSync();
-        
-        assertTrue(mActivity.resultReceived);
-        assertNull(mActivity.result);
-    }
-
-    public void testNoDefault() {
-        mActivity.launchRingtonePickerActivity(false, null, RingtoneManager.TYPE_ALL);
-        mInstrumentation.waitForIdleSync();
-        
-        // Go to top
-        goTo(true);
-        // Select first (non-default) ringtone 
-        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
-        // Go to bottom/cancel button
-        goTo(false);
-        // Select OK button
-        sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER);
-        
-        mInstrumentation.waitForIdleSync();
-        
-        assertTrue(mActivity.resultReceived);
-        assertNotNull(mActivity.result);
-        assertNotNull(mActivity.pickedUri);
-        assertFalse(RingtoneManager.isDefault(mActivity.pickedUri));
-    }
-    
-    public void testNotifications() {
-        mActivity.launchRingtonePickerActivity(false, null, RingtoneManager.TYPE_NOTIFICATION);
-        mInstrumentation.waitForIdleSync();
-        
-        // Move to top of list
-        goTo(true);
-        // Select first ringtone in list
-        sendKeys(KeyEvent.KEYCODE_DPAD_CENTER);
-        // Move all the way down (will focus 'Cancel')
-        goTo(false);
-        // Move left and click (will click 'Ok')
-        sendKeys(KeyEvent.KEYCODE_DPAD_LEFT, KeyEvent.KEYCODE_DPAD_CENTER);
-
-        // Wait until main thread is idle
-        mInstrumentation.waitForIdleSync();
-
-        assertTrue(mActivity.resultReceived);
-        assertNotNull(mActivity.result);
-        assertNotNull(mActivity.pickedUri);
-        
-        // Get the path of the picked ringtone
-        Uri uri = mActivity.pickedUri;
-        Cursor c = mActivity.getContentResolver().query(uri, new String[] { "_data" },
-                null, null, null);
-        assertTrue("Query for selected ringtone URI does not have a result", c.moveToFirst());
-        String path = c.getString(0);
-        // Quick check to see if the ringtone is a notification
-        assertTrue("The path of the selected ringtone did not contain \"notification\"",
-                path.contains("notifications"));
-    }
-    
-    private void goTo(boolean top) {
-        // Get to the buttons at the bottom (top == false), or the top (top == true)
-        for (int i = 0; i < NUM_RINGTONES_AND_SOME; i++) {
-            sendKeys(top ? KeyEvent.KEYCODE_DPAD_UP : KeyEvent.KEYCODE_DPAD_DOWN);
-        }
-    }
-}