diff options
author | Joe Onorato <joeo@google.com> | 2010-04-19 10:24:23 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-04-19 10:24:23 -0700 |
commit | 9ecd07d636f75d5775b59c9a87ddc342b7a361d0 (patch) | |
tree | c727e6bed60418a266f41aaa1dc5fef0cd91d299 /src/com | |
parent | 495f2892288504f4ab87e62957b3f71144dd73c2 (diff) | |
parent | 2ff10b3b0137d258569ce5471808842e88696133 (diff) | |
download | android_packages_apps_Trebuchet-9ecd07d636f75d5775b59c9a87ddc342b7a361d0.tar.gz android_packages_apps_Trebuchet-9ecd07d636f75d5775b59c9a87ddc342b7a361d0.tar.bz2 android_packages_apps_Trebuchet-9ecd07d636f75d5775b59c9a87ddc342b7a361d0.zip |
Merge "More Launcher performance improvements." into froyo
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/launcher2/LauncherModel.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/com/android/launcher2/LauncherModel.java b/src/com/android/launcher2/LauncherModel.java index 9766831bb..7a56bcd7b 100644 --- a/src/com/android/launcher2/LauncherModel.java +++ b/src/com/android/launcher2/LauncherModel.java @@ -62,7 +62,7 @@ public class LauncherModel extends BroadcastReceiver { static final boolean DEBUG_LOADERS = false; static final String TAG = "Launcher.Model"; - final int ALL_APPS_LOAD_DELAY = 150; // ms + private int mAllAppsLoadDelay; // milliseconds between batches private final LauncherApplication mApp; private final Object mLock = new Object(); @@ -98,6 +98,8 @@ public class LauncherModel extends BroadcastReceiver { mDefaultIcon = Utilities.createIconBitmap( app.getPackageManager().getDefaultActivityIcon(), app); + + mAllAppsLoadDelay = app.getResources().getInteger(R.integer.config_allAppsBatchLoadDelay); } public Bitmap getFallbackIcon() { @@ -581,7 +583,7 @@ public class LauncherModel extends BroadcastReceiver { // Whew! Hard work done. synchronized (mLock) { if (mIsLaunching) { - android.os.Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT); + android.os.Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND); } } @@ -1055,9 +1057,6 @@ public class LauncherModel extends BroadcastReceiver { mAllAppsList.add(new ApplicationInfo(apps.get(i), mIconCache)); i++; } - // re-sort before binding this batch to the grid - Collections.sort(mAllAppsList.data, APP_NAME_COMPARATOR); - Collections.sort(mAllAppsList.added, APP_NAME_COMPARATOR); if (DEBUG_LOADERS) { Log.d(TAG, "batch of " + batchSize + " icons processed in " + (SystemClock.uptimeMillis()-t2) + "ms"); @@ -1066,16 +1065,17 @@ public class LauncherModel extends BroadcastReceiver { mHandler.post(bindAllAppsTask); - if (ALL_APPS_LOAD_DELAY > 0) { + if (mAllAppsLoadDelay > 0 && i < N) { try { - Thread.sleep(ALL_APPS_LOAD_DELAY); + Thread.sleep(mAllAppsLoadDelay); } catch (InterruptedException exc) { } } } if (DEBUG_LOADERS) { Log.d(TAG, "cached all " + N + " apps in " - + (SystemClock.uptimeMillis()-t) + "ms"); + + (SystemClock.uptimeMillis()-t) + "ms" + + (mAllAppsLoadDelay > 0 ? " (including delay)" : "")); } } |