diff --git a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
index 7ced94f..82834b6 100755
--- a/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
+++ b/core/tests/coretests/src/android/content/pm/PackageManagerTests.java
@@ -33,6 +33,9 @@
 import android.content.res.Resources.NotFoundException;
 import android.net.Uri;
 import android.test.AndroidTestCase;
+import android.test.suitebuilder.annotation.SmallTest;
+import android.test.suitebuilder.annotation.MediumTest;
+import android.test.suitebuilder.annotation.LargeTest;
 import android.test.suitebuilder.annotation.Suppress;
 import android.util.DisplayMetrics;
 import android.util.Log;
@@ -275,7 +278,7 @@
                 (long)sdStats.getBlockSize();
         // TODO check for thesholds here
         return pkgLen <= sdSize;
-        
+
     }
     private boolean checkInt(long pkgLen) {
         StatFs intStats = new StatFs(Environment.getDataDirectory().getPath());
@@ -346,7 +349,7 @@
         }
         return INSTALL_LOC_ERR;
     }
-    
+
     private void assertInstall(PackageParser.Package pkg, int flags, int expInstallLocation) {
         try {
             String pkgName = pkg.packageName;
@@ -385,7 +388,7 @@
             failStr("failed with exception : " + e);
         }
     }
-    
+
     private void assertNotInstalled(String pkgName) {
         try {
             ApplicationInfo info = getPm().getApplicationInfo(pkgName, 0);
@@ -421,7 +424,7 @@
     static final String PERM_UNDEFINED = "undefined";
     static final String PERM_USED = "used";
     static final String PERM_NOTUSED = "notused";
-    
+
     private void assertPermissions(String[] cmds) {
         final PackageManager pm = getPm();
         String pkg = null;
@@ -572,14 +575,17 @@
         return ip;
     }
 
+    @MediumTest
     public void testInstallNormalInternal() {
         sampleInstallFromRawResource(0, true);
     }
 
+    @MediumTest
     public void testInstallFwdLockedInternal() {
         sampleInstallFromRawResource(PackageManager.INSTALL_FORWARD_LOCK, true);
     }
 
+    @MediumTest
     public void testInstallSdcard() {
         sampleInstallFromRawResource(PackageManager.INSTALL_EXTERNAL, true);
     }
@@ -669,27 +675,33 @@
         }
     }
 
+    @MediumTest
     public void testReplaceFailNormalInternal() {
         sampleReplaceFromRawResource(0);
     }
 
+    @MediumTest
     public void testReplaceFailFwdLockedInternal() {
         sampleReplaceFromRawResource(PackageManager.INSTALL_FORWARD_LOCK);
     }
 
+    @MediumTest
     public void testReplaceFailSdcard() {
         sampleReplaceFromRawResource(PackageManager.INSTALL_EXTERNAL);
     }
 
+    @MediumTest
     public void testReplaceNormalInternal() {
         sampleReplaceFromRawResource(PackageManager.INSTALL_REPLACE_EXISTING);
     }
 
+    @MediumTest
     public void testReplaceFwdLockedInternal() {
         sampleReplaceFromRawResource(PackageManager.INSTALL_REPLACE_EXISTING |
                 PackageManager.INSTALL_FORWARD_LOCK);
     }
 
+    @MediumTest
     public void testReplaceSdcard() {
         sampleReplaceFromRawResource(PackageManager.INSTALL_REPLACE_EXISTING |
                 PackageManager.INSTALL_EXTERNAL);
@@ -803,26 +815,32 @@
         }
     }
 
+    @MediumTest
     public void testDeleteNormalInternal() {
         deleteFromRawResource(0, 0);
     }
 
+    @MediumTest
     public void testDeleteFwdLockedInternal() {
         deleteFromRawResource(PackageManager.INSTALL_FORWARD_LOCK, 0);
     }
 
+    @MediumTest
     public void testDeleteSdcard() {
         deleteFromRawResource(PackageManager.INSTALL_EXTERNAL, 0);
     }
 
+    @MediumTest
     public void testDeleteNormalInternalRetainData() {
         deleteFromRawResource(0, PackageManager.DONT_DELETE_DATA);
     }
 
+    @MediumTest
     public void testDeleteFwdLockedInternalRetainData() {
         deleteFromRawResource(PackageManager.INSTALL_FORWARD_LOCK, PackageManager.DONT_DELETE_DATA);
     }
 
+    @MediumTest
     public void testDeleteSdcardRetainData() {
         deleteFromRawResource(PackageManager.INSTALL_EXTERNAL, PackageManager.DONT_DELETE_DATA);
     }
@@ -939,7 +957,7 @@
         } catch (RemoteException e) {
             failStr(e);
         }
-        
+
         StorageListener observer = new StorageListener();
         StorageManager sm = (StorageManager) mContext.getSystemService(Context.STORAGE_SERVICE);
         sm.registerListener(observer);
@@ -1054,26 +1072,31 @@
         } catch (NameNotFoundException e) {}
     }
 
+    @MediumTest
     public void testManifestInstallLocationInternal() {
         installFromRawResource("install.apk", R.raw.install_loc_internal,
                 0, true, false, -1, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
     }
 
+    @MediumTest
     public void testManifestInstallLocationSdcard() {
         installFromRawResource("install.apk", R.raw.install_loc_sdcard,
                 0, true, false, -1, PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL);
     }
 
+    @MediumTest
     public void testManifestInstallLocationAuto() {
         installFromRawResource("install.apk", R.raw.install_loc_auto,
                 0, true, false, -1, PackageInfo.INSTALL_LOCATION_AUTO);
     }
 
+    @MediumTest
     public void testManifestInstallLocationUnspecified() {
         installFromRawResource("install.apk", R.raw.install_loc_unspecified,
                 0, true, false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
     }
 
+    @MediumTest
     public void testManifestInstallLocationFwdLockedFlagSdcard() {
         installFromRawResource("install.apk", R.raw.install_loc_unspecified,
                 PackageManager.INSTALL_FORWARD_LOCK |
@@ -1082,6 +1105,7 @@
                 PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
     }
 
+    @MediumTest
     public void testManifestInstallLocationFwdLockedSdcard() {
         installFromRawResource("install.apk", R.raw.install_loc_sdcard,
                 PackageManager.INSTALL_FORWARD_LOCK, true, false,
@@ -1094,6 +1118,7 @@
      * the package via flag to install on sdcard. Make sure the new flag overrides
      * the old install location.
      */
+    @MediumTest
     public void testReplaceFlagInternalSdcard() {
         int iFlags = 0;
         int rFlags = PackageManager.INSTALL_EXTERNAL;
@@ -1115,6 +1140,7 @@
      * the package with no flags or manifest option and make sure the old
      * install location is retained.
      */
+    @MediumTest
     public void testReplaceFlagSdcardInternal() {
         int iFlags = PackageManager.INSTALL_EXTERNAL;
         int rFlags = 0;
@@ -1131,6 +1157,7 @@
         }
     }
 
+    @MediumTest
     public void testManifestInstallLocationReplaceInternalSdcard() {
         int iFlags = 0;
         int iApk = R.raw.install_loc_internal;
@@ -1153,6 +1180,7 @@
         }
     }
 
+    @MediumTest
     public void testManifestInstallLocationReplaceSdcardInternal() {
         int iFlags = 0;
         int iApk = R.raw.install_loc_sdcard;
@@ -1324,7 +1352,7 @@
      * PackageManager api to install first and then replace it
      * again.
      */
-    
+
     private void moveFromRawResource(String outFileName,
             int rawResId, int installFlags, int moveFlags, boolean cleanUp,
             boolean fail, int result) {
@@ -1374,6 +1402,7 @@
                 fail, result);
     }
 
+    @MediumTest
     public void testMoveAppInternalToExternal() {
         int installFlags = PackageManager.INSTALL_INTERNAL;
         int moveFlags = PackageManager.MOVE_EXTERNAL_MEDIA;
@@ -1382,6 +1411,7 @@
         sampleMoveFromRawResource(installFlags, moveFlags, fail, result);
     }
 
+    @MediumTest
     public void testMoveAppInternalToInternal() {
         int installFlags = PackageManager.INSTALL_INTERNAL;
         int moveFlags = PackageManager.MOVE_INTERNAL;
@@ -1390,6 +1420,7 @@
         sampleMoveFromRawResource(installFlags, moveFlags, fail, result);
     }
 
+    @MediumTest
     public void testMoveAppExternalToExternal() {
         int installFlags = PackageManager.INSTALL_EXTERNAL;
         int moveFlags = PackageManager.MOVE_EXTERNAL_MEDIA;
@@ -1397,6 +1428,7 @@
         int result = PackageManager.MOVE_FAILED_INVALID_LOCATION;
         sampleMoveFromRawResource(installFlags, moveFlags, fail, result);
     }
+    @MediumTest
     public void testMoveAppExternalToInternal() {
         int installFlags = PackageManager.INSTALL_EXTERNAL;
         int moveFlags = PackageManager.MOVE_INTERNAL;
@@ -1404,6 +1436,7 @@
         int result = PackageManager.MOVE_SUCCEEDED;
         sampleMoveFromRawResource(installFlags, moveFlags, fail, result);
     }
+    @MediumTest
     public void testMoveAppForwardLocked() {
         int installFlags = PackageManager.INSTALL_FORWARD_LOCK;
         int moveFlags = PackageManager.MOVE_EXTERNAL_MEDIA;
@@ -1411,12 +1444,13 @@
         int result = PackageManager.MOVE_FAILED_FORWARD_LOCKED;
         sampleMoveFromRawResource(installFlags, moveFlags, fail, result);
     }
+    //TODO: To be reenabled after investigation
     public void testMoveAppFailInternalToExternalDelete() {
         int installFlags = 0;
         int moveFlags = PackageManager.MOVE_EXTERNAL_MEDIA;
         boolean fail = true;
         final int result = PackageManager.MOVE_FAILED_DOESNT_EXIST;
-        
+
         int rawResId = R.raw.install;
         int origDefaultLoc = getDefaultInstallLoc();
         InstallParams ip = null;
@@ -1443,6 +1477,7 @@
      * Test that an install error code is returned when media is unmounted
      * and package installed on sdcard via package manager flag.
      */
+    @MediumTest
     public void testInstallSdcardUnmount() {
         boolean origState = getMediaState();
         try {
@@ -1464,10 +1499,11 @@
     }
 
     /*
-    * Unmount sdcard. Try installing an app with manifest option to install
-    * on sdcard. Make sure it gets installed on internal flash.
-    */
-   public void testInstallManifestSdcardUnmount() {
+     * Unmount sdcard. Try installing an app with manifest option to install
+     * on sdcard. Make sure it gets installed on internal flash.
+     */
+    @MediumTest
+    public void testInstallManifestSdcardUnmount() {
        boolean origState = getMediaState();
        try {
            // Unmount sdcard
@@ -1492,18 +1528,20 @@
     * I - internal, E - external, F - forward locked, Flag suffix absent if not using any option.
     * Manifest: ManifestI, ManifestE, ManifestA, Manifest suffix absent if not using any option.
     * Existing: Existing suffix absent if not existing.
-    * User: UserI, UserE, UserA, User suffix absent if not existing. 
-    * 
+    * User: UserI, UserE, UserA, User suffix absent if not existing.
+    *
     */
    /*
     * Install an app on internal flash
     */
+   @MediumTest
    public void testFlagI() {
        sampleInstallFromRawResource(PackageManager.INSTALL_INTERNAL, true);
    }
    /*
     * Install an app on sdcard.
     */
+   @MediumTest
    public void testFlagE() {
        sampleInstallFromRawResource(PackageManager.INSTALL_EXTERNAL, true);
    }
@@ -1511,12 +1549,14 @@
    /*
     * Install an app on sdcard.
     */
+   @MediumTest
    public void testFlagF() {
        sampleInstallFromRawResource(PackageManager.INSTALL_FORWARD_LOCK, true);
    }
    /*
     * Install an app with both internal and external flags set. should fail
     */
+   @MediumTest
    public void testFlagIE() {
        installFromRawResource("install.apk", R.raw.install,
                PackageManager.INSTALL_EXTERNAL | PackageManager.INSTALL_INTERNAL,
@@ -1528,6 +1568,7 @@
    /*
     * Install an app with both internal and external flags set. should fail
     */
+   @MediumTest
    public void testFlagIF() {
        sampleInstallFromRawResource(PackageManager.INSTALL_FORWARD_LOCK |
                PackageManager.INSTALL_INTERNAL, true);
@@ -1535,6 +1576,7 @@
    /*
     * Install an app with both internal and external flags set. should fail
     */
+   @MediumTest
    public void testFlagEF() {
        installFromRawResource("install.apk", R.raw.install,
                PackageManager.INSTALL_FORWARD_LOCK | PackageManager.INSTALL_EXTERNAL,
@@ -1545,6 +1587,7 @@
    /*
     * Install an app with both internal and external flags set. should fail
     */
+   @MediumTest
    public void testFlagIEF() {
        installFromRawResource("install.apk", R.raw.install,
                PackageManager.INSTALL_FORWARD_LOCK | PackageManager.INSTALL_INTERNAL |
@@ -1557,6 +1600,7 @@
     * Install an app with both internal and manifest option set.
     * should install on internal.
     */
+   @MediumTest
    public void testFlagIManifestI() {
        installFromRawResource("install.apk", R.raw.install_loc_internal,
                PackageManager.INSTALL_INTERNAL,
@@ -1568,6 +1612,7 @@
     * Install an app with both internal and manifest preference for
     * preferExternal. Should install on internal.
     */
+   @MediumTest
    public void testFlagIManifestE() {
        installFromRawResource("install.apk", R.raw.install_loc_sdcard,
                PackageManager.INSTALL_INTERNAL,
@@ -1579,6 +1624,7 @@
     * Install an app with both internal and manifest preference for
     * auto. should install internal.
     */
+   @MediumTest
    public void testFlagIManifestA() {
        installFromRawResource("install.apk", R.raw.install_loc_auto,
                PackageManager.INSTALL_INTERNAL,
@@ -1590,6 +1636,7 @@
     * Install an app with both external and manifest option set.
     * should install externally.
     */
+   @MediumTest
    public void testFlagEManifestI() {
        installFromRawResource("install.apk", R.raw.install_loc_internal,
                PackageManager.INSTALL_EXTERNAL,
@@ -1601,6 +1648,7 @@
     * Install an app with both external and manifest preference for
     * preferExternal. Should install externally.
     */
+   @MediumTest
    public void testFlagEManifestE() {
        installFromRawResource("install.apk", R.raw.install_loc_sdcard,
                PackageManager.INSTALL_EXTERNAL,
@@ -1612,6 +1660,7 @@
     * Install an app with both external and manifest preference for
     * auto. should install on external media.
     */
+   @MediumTest
    public void testFlagEManifestA() {
        installFromRawResource("install.apk", R.raw.install_loc_auto,
                PackageManager.INSTALL_EXTERNAL,
@@ -1623,6 +1672,7 @@
     * Install an app with fwd locked flag set and install location set to
     * internal. should install internally.
     */
+   @MediumTest
    public void testFlagFManifestI() {
        installFromRawResource("install.apk", R.raw.install_loc_internal,
                PackageManager.INSTALL_EXTERNAL,
@@ -1634,6 +1684,7 @@
     * Install an app with fwd locked flag set and install location set to
     * preferExternal. should install internally.
     */
+   @MediumTest
    public void testFlagFManifestE() {
        installFromRawResource("install.apk", R.raw.install_loc_sdcard,
                PackageManager.INSTALL_EXTERNAL,
@@ -1645,6 +1696,7 @@
     * Install an app with fwd locked flag set and install location set to
     * auto. should install internally.
     */
+   @MediumTest
    public void testFlagFManifestA() {
        installFromRawResource("install.apk", R.raw.install_loc_auto,
                PackageManager.INSTALL_EXTERNAL,
@@ -1657,8 +1709,9 @@
     * flag is explicitly set it should override current location. If manifest location
     * is set, that should over ride current location too. if not the existing install
     * location should be honoured.
-    * testFlagI/E/F/ExistingI/E - 
+    * testFlagI/E/F/ExistingI/E -
     */
+   @MediumTest
    public void testFlagIExistingI() {
        int iFlags = PackageManager.INSTALL_INTERNAL;
        int rFlags = PackageManager.INSTALL_INTERNAL | PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1675,6 +1728,7 @@
                false, -1,
                -1);
    }
+   @MediumTest
    public void testFlagIExistingE() {
        int iFlags = PackageManager.INSTALL_EXTERNAL;
        int rFlags = PackageManager.INSTALL_INTERNAL | PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1691,6 +1745,7 @@
                false, -1,
                -1);
    }
+   @MediumTest
    public void testFlagEExistingI() {
        int iFlags = PackageManager.INSTALL_INTERNAL;
        int rFlags = PackageManager.INSTALL_EXTERNAL | PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1707,6 +1762,7 @@
                false, -1,
                -1);
    }
+   @MediumTest
    public void testFlagEExistingE() {
        int iFlags = PackageManager.INSTALL_EXTERNAL;
        int rFlags = PackageManager.INSTALL_EXTERNAL | PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1723,6 +1779,7 @@
                false, -1,
                -1);
    }
+   @MediumTest
    public void testFlagFExistingI() {
        int iFlags = PackageManager.INSTALL_INTERNAL;
        int rFlags = PackageManager.INSTALL_FORWARD_LOCK | PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1739,6 +1796,7 @@
                false, -1,
                -1);
    }
+   @MediumTest
    public void testFlagFExistingE() {
        int iFlags = PackageManager.INSTALL_EXTERNAL;
        int rFlags = PackageManager.INSTALL_FORWARD_LOCK | PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1762,6 +1820,7 @@
     * public void testManifestI/E/A
     * TODO out of memory fall back behaviour.
     */
+   @MediumTest
    public void testManifestI() {
        installFromRawResource("install.apk", R.raw.install_loc_internal,
                0,
@@ -1769,6 +1828,7 @@
                false, -1,
                PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
    }
+   @MediumTest
    public void testManifestE() {
        installFromRawResource("install.apk", R.raw.install_loc_sdcard,
                0,
@@ -1776,6 +1836,7 @@
                false, -1,
                PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL);
    }
+   @MediumTest
    public void testManifestA() {
        installFromRawResource("install.apk", R.raw.install_loc_auto,
                0,
@@ -1788,8 +1849,9 @@
     * with install location attribute set to internalOnly, preferExternal and auto
     * for already existing apps. The manifest option should take precedence.
     * TODO add out of memory fall back behaviour.
-    * testManifestI/E/AExistingI/E 
+    * testManifestI/E/AExistingI/E
     */
+   @MediumTest
    public void testManifestIExistingI() {
        int iFlags = PackageManager.INSTALL_INTERNAL;
        int rFlags = PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1806,6 +1868,7 @@
                false, -1,
                PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
    }
+   @MediumTest
    public void testManifestIExistingE() {
        int iFlags = PackageManager.INSTALL_EXTERNAL;
        int rFlags = PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1822,6 +1885,7 @@
                false, -1,
                PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
    }
+   @MediumTest
    public void testManifestEExistingI() {
        int iFlags = PackageManager.INSTALL_INTERNAL;
        int rFlags = PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1838,6 +1902,7 @@
                false, -1,
                PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL);
    }
+   @MediumTest
    public void testManifestEExistingE() {
        int iFlags = PackageManager.INSTALL_EXTERNAL;
        int rFlags = PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1854,6 +1919,7 @@
                false, -1,
                PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL);
    }
+   @MediumTest
    public void testManifestAExistingI() {
        int iFlags = PackageManager.INSTALL_INTERNAL;
        int rFlags = PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1870,6 +1936,7 @@
                false, -1,
                PackageInfo.INSTALL_LOCATION_AUTO);
    }
+   @MediumTest
    public void testManifestAExistingE() {
        int iFlags = PackageManager.INSTALL_EXTERNAL;
        int rFlags = PackageManager.INSTALL_REPLACE_EXISTING;
@@ -1926,31 +1993,37 @@
            setInstallLoc(origSetting);
        }
    }
+   @MediumTest
    public void testExistingIUserI() {
        int userSetting = PackageHelper.APP_INSTALL_INTERNAL;
        int iFlags = PackageManager.INSTALL_INTERNAL;
        setExistingXUserX(userSetting, iFlags, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
    }
+   @MediumTest
    public void testExistingIUserE() {
        int userSetting = PackageHelper.APP_INSTALL_EXTERNAL;
        int iFlags = PackageManager.INSTALL_INTERNAL;
        setExistingXUserX(userSetting, iFlags, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
    }
+   @MediumTest
    public void testExistingIUserA() {
        int userSetting = PackageHelper.APP_INSTALL_AUTO;
        int iFlags = PackageManager.INSTALL_INTERNAL;
        setExistingXUserX(userSetting, iFlags, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
    }
+   @MediumTest
    public void testExistingEUserI() {
        int userSetting = PackageHelper.APP_INSTALL_INTERNAL;
        int iFlags = PackageManager.INSTALL_EXTERNAL;
        setExistingXUserX(userSetting, iFlags, PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL);
    }
+   @MediumTest
    public void testExistingEUserE() {
        int userSetting = PackageHelper.APP_INSTALL_EXTERNAL;
        int iFlags = PackageManager.INSTALL_EXTERNAL;
        setExistingXUserX(userSetting, iFlags, PackageInfo.INSTALL_LOCATION_PREFER_EXTERNAL);
    }
+   @MediumTest
    public void testExistingEUserA() {
        int userSetting = PackageHelper.APP_INSTALL_AUTO;
        int iFlags = PackageManager.INSTALL_EXTERNAL;
@@ -1959,12 +2032,12 @@
    /*
     * The following set of tests verify that the user setting defines
     * the install location.
-    * 
+    *
     */
    private boolean getUserSettingSetInstallLocation() {
        try {
            return Settings.System.getInt(mContext.getContentResolver(), Settings.Secure.SET_INSTALL_LOCATION) != 0;
-           
+
        } catch (SettingNotFoundException e1) {
        }
        return false;
@@ -1993,16 +2066,19 @@
            setInstallLoc(origSetting);
        }
    }
+   @MediumTest
    public void testUserI() {
        int userSetting = PackageHelper.APP_INSTALL_INTERNAL;
        int iloc = getExpectedInstallLocation(userSetting);
        setUserX(true, userSetting, iloc);
    }
+   @MediumTest
    public void testUserE() {
        int userSetting = PackageHelper.APP_INSTALL_EXTERNAL;
        int iloc = getExpectedInstallLocation(userSetting);
        setUserX(true, userSetting, iloc);
    }
+   @MediumTest
    public void testUserA() {
        int userSetting = PackageHelper.APP_INSTALL_AUTO;
        int iloc = getExpectedInstallLocation(userSetting);
@@ -2012,22 +2088,25 @@
     * The following set of tests turn on/off the basic
     * user setting for turning on install location.
     */
+   @MediumTest
    public void testUserPrefOffUserI() {
        int userSetting = PackageHelper.APP_INSTALL_INTERNAL;
        int iloc = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
        setUserX(false, userSetting, iloc);
    }
+   @MediumTest
    public void testUserPrefOffUserE() {
        int userSetting = PackageHelper.APP_INSTALL_EXTERNAL;
        int iloc = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
        setUserX(false, userSetting, iloc);
    }
+   @MediumTest
    public void testUserPrefOffA() {
        int userSetting = PackageHelper.APP_INSTALL_AUTO;
        int iloc = PackageInfo.INSTALL_LOCATION_UNSPECIFIED;
        setUserX(false, userSetting, iloc);
    }
-   
+
     static final String BASE_PERMISSIONS_DEFINED[] = new String[] {
         PERM_PACKAGE, "com.android.unit_tests.install_decl_perm",
         PERM_DEFINED,
@@ -2035,7 +2114,7 @@
         "com.android.frameworks.coretests.DANGEROUS",
         "com.android.frameworks.coretests.SIGNATURE",
     };
-    
+
     static final String BASE_PERMISSIONS_UNDEFINED[] = new String[] {
         PERM_PACKAGE, "com.android.frameworks.coretests.install_decl_perm",
         PERM_UNDEFINED,
@@ -2043,7 +2122,7 @@
         "com.android.frameworks.coretests.DANGEROUS",
         "com.android.frameworks.coretests.SIGNATURE",
     };
-    
+
     static final String BASE_PERMISSIONS_USED[] = new String[] {
         PERM_PACKAGE, "com.android.frameworks.coretests.install_use_perm_good",
         PERM_USED,
@@ -2051,7 +2130,7 @@
         "com.android.frameworks.coretests.DANGEROUS",
         "com.android.frameworks.coretests.SIGNATURE",
     };
-    
+
     static final String BASE_PERMISSIONS_NOTUSED[] = new String[] {
         PERM_PACKAGE, "com.android.frameworks.coretests.install_use_perm_good",
         PERM_NOTUSED,
@@ -2059,7 +2138,7 @@
         "com.android.frameworks.coretests.DANGEROUS",
         "com.android.frameworks.coretests.SIGNATURE",
     };
-    
+
     static final String BASE_PERMISSIONS_SIGUSED[] = new String[] {
         PERM_PACKAGE, "com.android.frameworks.coretests.install_use_perm_good",
         PERM_USED,
@@ -2068,16 +2147,17 @@
         "com.android.frameworks.coretests.NORMAL",
         "com.android.frameworks.coretests.DANGEROUS",
     };
-    
+
     /*
      * Ensure that permissions are properly declared.
      */
+    @LargeTest
     public void testInstallDeclaresPermissions() {
         InstallParams ip = null;
         InstallParams ip2 = null;
         try {
             // **: Upon installing a package, are its declared permissions published?
-           
+
             int iFlags = PackageManager.INSTALL_INTERNAL;
             int iApk = R.raw.install_decl_perm;
             ip = installFromRawResource("install.apk", iApk,
@@ -2085,9 +2165,9 @@
                     false, -1, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
             assertInstall(ip.pkg, iFlags, ip.pkg.installLocation);
             assertPermissions(BASE_PERMISSIONS_DEFINED);
-           
+
             // **: Upon installing package, are its permissions granted?
-           
+
             int i2Flags = PackageManager.INSTALL_INTERNAL;
             int i2Apk = R.raw.install_use_perm_good;
             ip2 = installFromRawResource("install2.apk", i2Apk,
@@ -2095,11 +2175,11 @@
                     false, -1, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
             assertInstall(ip2.pkg, i2Flags, ip2.pkg.installLocation);
             assertPermissions(BASE_PERMISSIONS_USED);
-            
+
             // **: Upon removing but not deleting, are permissions retained?
-           
+
             GenericReceiver receiver = new DeleteReceiver(ip.pkg.packageName);
-           
+
             try {
                 invokeDeletePackage(ip.pkg.packageName, PackageManager.DONT_DELETE_DATA, receiver);
             } catch (Exception e) {
@@ -2107,18 +2187,18 @@
             }
             assertPermissions(BASE_PERMISSIONS_DEFINED);
             assertPermissions(BASE_PERMISSIONS_USED);
-           
+
             // **: Upon re-installing, are permissions retained?
-           
+
             ip = installFromRawResource("install.apk", iApk,
                     iFlags | PackageManager.INSTALL_REPLACE_EXISTING, false,
                     false, -1, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
             assertInstall(ip.pkg, iFlags, ip.pkg.installLocation);
             assertPermissions(BASE_PERMISSIONS_DEFINED);
             assertPermissions(BASE_PERMISSIONS_USED);
-           
+
             // **: Upon deleting package, are all permissions removed?
-           
+
             try {
                 invokeDeletePackage(ip.pkg.packageName, 0, receiver);
                 ip = null;
@@ -2127,9 +2207,9 @@
             }
             assertPermissions(BASE_PERMISSIONS_UNDEFINED);
             assertPermissions(BASE_PERMISSIONS_NOTUSED);
-           
+
             // **: Delete package using permissions; nothing to check here.
-           
+
             GenericReceiver receiver2 = new DeleteReceiver(ip2.pkg.packageName);
             try {
                 invokeDeletePackage(ip2.pkg.packageName, 0, receiver);
@@ -2137,35 +2217,35 @@
             } catch (Exception e) {
                 failStr(e);
             }
-            
+
             // **: Re-install package using permissions; no permissions can be granted.
-           
+
             ip2 = installFromRawResource("install2.apk", i2Apk,
                     i2Flags, false,
                     false, -1, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
             assertInstall(ip2.pkg, i2Flags, ip2.pkg.installLocation);
             assertPermissions(BASE_PERMISSIONS_NOTUSED);
-           
+
             // **: Upon installing declaring package, are sig permissions granted
             // to other apps (but not other perms)?
-           
+
             ip = installFromRawResource("install.apk", iApk,
                     iFlags, false,
                     false, -1, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
             assertInstall(ip.pkg, iFlags, ip.pkg.installLocation);
             assertPermissions(BASE_PERMISSIONS_DEFINED);
             assertPermissions(BASE_PERMISSIONS_SIGUSED);
-           
+
             // **: Re-install package using permissions; are all permissions granted?
-            
+
             ip2 = installFromRawResource("install2.apk", i2Apk,
                     i2Flags | PackageManager.INSTALL_REPLACE_EXISTING, false,
                     false, -1, PackageInfo.INSTALL_LOCATION_INTERNAL_ONLY);
             assertInstall(ip2.pkg, i2Flags, ip2.pkg.installLocation);
             assertPermissions(BASE_PERMISSIONS_NOTUSED);
-           
+
             // **: Upon deleting package, are all permissions removed?
-            
+
             try {
                 invokeDeletePackage(ip.pkg.packageName, 0, receiver);
                 ip = null;
@@ -2174,16 +2254,16 @@
             }
             assertPermissions(BASE_PERMISSIONS_UNDEFINED);
             assertPermissions(BASE_PERMISSIONS_NOTUSED);
-            
+
             // **: Delete package using permissions; nothing to check here.
-            
+
             try {
                 invokeDeletePackage(ip2.pkg.packageName, 0, receiver);
                 ip2 = null;
             } catch (Exception e) {
                 failStr(e);
             }
-            
+
         } finally {
             if (ip2 != null) {
                 cleanUpInstall(ip2);
@@ -2197,6 +2277,7 @@
     /*
      * Ensure that permissions are properly declared.
      */
+    @MediumTest
     public void testInstallOnSdPermissionsUnmount() {
         InstallParams ip = null;
         boolean origMediaState = getMediaState();
@@ -2228,6 +2309,7 @@
      * Please note that this test is very closely tied to the framework's
      * naming convention for secure containers.
      */
+    @MediumTest
     public void testInstallSdcardStaleContainer() {
         boolean origMediaState = getMediaState();
         try {
@@ -2253,7 +2335,7 @@
             installFromRawResource(outFileName, rawResId,
                     PackageManager.INSTALL_EXTERNAL, true,
                     false, -1, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
-        } catch (Exception e) { 
+        } catch (Exception e) {
             failStr(e.getMessage());
         } finally {
             if (origMediaState) {
@@ -2266,7 +2348,7 @@
     }
     /*
      * The following series of tests are related to upgrading apps with
-     * different certificates. 
+     * different certificates.
      */
     private int APP1_UNSIGNED = R.raw.install_app1_unsigned;
     private int APP1_CERT1 = R.raw.install_app1_cert1;
@@ -2304,6 +2386,7 @@
      * Test that an app signed with two certificates can be upgraded by the
      * same app signed with two certificates.
      */
+    @MediumTest
     public void testReplaceMatchAllCerts() {
         replaceCerts(APP1_CERT1_CERT2, APP1_CERT1_CERT2, true, false, -1);
     }
@@ -2312,6 +2395,7 @@
      * Test that an app signed with two certificates cannot be upgraded
      * by an app signed with a different certificate.
      */
+    @MediumTest
     public void testReplaceMatchNoCerts1() {
         replaceCerts(APP1_CERT1_CERT2, APP1_CERT3, true, true,
                 PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES);
@@ -2320,6 +2404,7 @@
      * Test that an app signed with two certificates cannot be upgraded
      * by an app signed with a different certificate.
      */
+    @MediumTest
     public void testReplaceMatchNoCerts2() {
         replaceCerts(APP1_CERT1_CERT2, APP1_CERT3_CERT4, true, true,
                 PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES);
@@ -2328,6 +2413,7 @@
      * Test that an app signed with two certificates cannot be upgraded by
      * an app signed with a subset of initial certificates.
      */
+    @MediumTest
     public void testReplaceMatchSomeCerts1() {
         replaceCerts(APP1_CERT1_CERT2, APP1_CERT1, true, true,
                 PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES);
@@ -2336,6 +2422,7 @@
      * Test that an app signed with two certificates cannot be upgraded by
      * an app signed with the last certificate.
      */
+    @MediumTest
     public void testReplaceMatchSomeCerts2() {
         replaceCerts(APP1_CERT1_CERT2, APP1_CERT2, true, true,
                 PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES);
@@ -2344,6 +2431,7 @@
      * Test that an app signed with a certificate can be upgraded by app
      * signed with a superset of certificates.
      */
+    @MediumTest
     public void testReplaceMatchMoreCerts() {
         replaceCerts(APP1_CERT1, APP1_CERT1_CERT2, true, true,
                 PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES);
@@ -2353,6 +2441,7 @@
      * signed with a superset of certificates. Then verify that the an app
      * signed with the original set of certs cannot upgrade the new one.
      */
+    @MediumTest
     public void testReplaceMatchMoreCertsReplaceSomeCerts() {
         InstallParams ip = replaceCerts(APP1_CERT1, APP1_CERT1_CERT2, false, true,
                 PackageManager.INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES);
@@ -2376,31 +2465,37 @@
     private void checkSignatures(int apk1, int apk2, int expMatchResult) {
         checkSharedSignatures(apk1, apk2, true, false, -1, expMatchResult);
     }
+    @MediumTest
     public void testCheckSignaturesAllMatch() {
         int apk1 = APP1_CERT1_CERT2;
         int apk2 = APP2_CERT1_CERT2;
         checkSignatures(apk1, apk2, PackageManager.SIGNATURE_MATCH);
     }
+    @MediumTest
     public void testCheckSignaturesNoMatch() {
         int apk1 = APP1_CERT1;
         int apk2 = APP2_CERT2;
         checkSignatures(apk1, apk2, PackageManager.SIGNATURE_NO_MATCH);
     }
+    @MediumTest
     public void testCheckSignaturesSomeMatch1() {
         int apk1 = APP1_CERT1_CERT2;
         int apk2 = APP2_CERT1;
         checkSignatures(apk1, apk2, PackageManager.SIGNATURE_NO_MATCH);
     }
+    @MediumTest
     public void testCheckSignaturesSomeMatch2() {
         int apk1 = APP1_CERT1_CERT2;
         int apk2 = APP2_CERT2;
         checkSignatures(apk1, apk2, PackageManager.SIGNATURE_NO_MATCH);
     }
+    @MediumTest
     public void testCheckSignaturesMoreMatch() {
         int apk1 = APP1_CERT1;
         int apk2 = APP2_CERT1_CERT2;
         checkSignatures(apk1, apk2, PackageManager.SIGNATURE_NO_MATCH);
     }
+    @MediumTest
     public void testCheckSignaturesUnknown() {
         int apk1 = APP1_CERT1_CERT2;
         int apk2 = APP2_CERT1_CERT2;
@@ -2429,6 +2524,7 @@
             }
         }
     }
+    @MediumTest
     public void testInstallNoCertificates() {
         int apk1 = APP1_UNSIGNED;
         String apk1Name = "install1.apk";
@@ -2481,6 +2577,7 @@
             }
         }
     }
+    @MediumTest
     public void testCheckSignaturesSharedAllMatch() {
         int apk1 = SHARED1_CERT1_CERT2;
         int apk2 = SHARED2_CERT1_CERT2;
@@ -2489,6 +2586,7 @@
         int expMatchResult = PackageManager.SIGNATURE_MATCH;
         checkSharedSignatures(apk1, apk2, true, fail, retCode, expMatchResult);
     }
+    @MediumTest
     public void testCheckSignaturesSharedNoMatch() {
         int apk1 = SHARED1_CERT1;
         int apk2 = SHARED2_CERT2;
@@ -2500,6 +2598,7 @@
     /*
      * Test that an app signed with cert1 and cert2 cannot be replaced when signed with cert1 alone.
      */
+    @MediumTest
     public void testCheckSignaturesSharedSomeMatch1() {
         int apk1 = SHARED1_CERT1_CERT2;
         int apk2 = SHARED2_CERT1;
@@ -2511,6 +2610,7 @@
     /*
      * Test that an app signed with cert1 and cert2 cannot be replaced when signed with cert2 alone.
      */
+    @MediumTest
     public void testCheckSignaturesSharedSomeMatch2() {
         int apk1 = SHARED1_CERT1_CERT2;
         int apk2 = SHARED2_CERT2;
@@ -2519,6 +2619,7 @@
         int expMatchResult = -1;
         checkSharedSignatures(apk1, apk2, true, fail, retCode, expMatchResult);
     }
+    @MediumTest
     public void testCheckSignaturesSharedUnknown() {
         int apk1 = SHARED1_CERT1_CERT2;
         int apk2 = SHARED2_CERT1_CERT2;
@@ -2543,7 +2644,8 @@
             }
         }
     }
-    
+
+    @MediumTest
     public void testReplaceFirstSharedMatchAllCerts() {
         int apk1 = SHARED1_CERT1;
         int apk2 = SHARED2_CERT1;
@@ -2551,6 +2653,7 @@
         checkSignatures(apk1, apk2, PackageManager.SIGNATURE_MATCH);
         replaceCerts(apk1, rapk1, true, false, -1);
     }
+    @MediumTest
     public void testReplaceSecondSharedMatchAllCerts() {
         int apk1 = SHARED1_CERT1;
         int apk2 = SHARED2_CERT1;
@@ -2558,6 +2661,7 @@
         checkSignatures(apk1, apk2, PackageManager.SIGNATURE_MATCH);
         replaceCerts(apk2, rapk2, true, false, -1);
     }
+    @MediumTest
     public void testReplaceFirstSharedMatchSomeCerts() {
         int apk1 = SHARED1_CERT1_CERT2;
         int apk2 = SHARED2_CERT1_CERT2;
@@ -2568,6 +2672,7 @@
         installFromRawResource("install.apk", rapk1, PackageManager.INSTALL_REPLACE_EXISTING, true,
                 fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
     }
+    @MediumTest
     public void testReplaceSecondSharedMatchSomeCerts() {
         int apk1 = SHARED1_CERT1_CERT2;
         int apk2 = SHARED2_CERT1_CERT2;
@@ -2578,6 +2683,7 @@
         installFromRawResource("install.apk", rapk2, PackageManager.INSTALL_REPLACE_EXISTING, true,
                 fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
     }
+    @MediumTest
     public void testReplaceFirstSharedMatchNoCerts() {
         int apk1 = SHARED1_CERT1;
         int apk2 = SHARED2_CERT1;
@@ -2588,6 +2694,7 @@
         installFromRawResource("install.apk", rapk1, PackageManager.INSTALL_REPLACE_EXISTING, true,
                 fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
     }
+    @MediumTest
     public void testReplaceSecondSharedMatchNoCerts() {
         int apk1 = SHARED1_CERT1;
         int apk2 = SHARED2_CERT1;
@@ -2598,6 +2705,7 @@
         installFromRawResource("install.apk", rapk2, PackageManager.INSTALL_REPLACE_EXISTING, true,
                 fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
     }
+    @MediumTest
     public void testReplaceFirstSharedMatchMoreCerts() {
         int apk1 = SHARED1_CERT1;
         int apk2 = SHARED2_CERT1;
@@ -2608,6 +2716,7 @@
         installFromRawResource("install.apk", rapk1, PackageManager.INSTALL_REPLACE_EXISTING, true,
                 fail, retCode, PackageInfo.INSTALL_LOCATION_UNSPECIFIED);
     }
+    @MediumTest
     public void testReplaceSecondSharedMatchMoreCerts() {
         int apk1 = SHARED1_CERT1;
         int apk2 = SHARED2_CERT1;
