summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/Utilities.java
diff options
context:
space:
mode:
authorHyunyoung Song <hyunyoungs@google.com>2015-05-21 13:04:53 -0700
committerHyunyoung Song <hyunyoungs@google.com>2015-05-21 13:04:53 -0700
commit2bd3d7d1cb5e4d8d826982d11b456739fed6b817 (patch)
tree4e0ecf47c9b3ced1116d896b3b9e8487792201fb /src/com/android/launcher3/Utilities.java
parent3e4d5f20ba9128fcbe77b220380129be773887b3 (diff)
downloadandroid_packages_apps_Trebuchet-2bd3d7d1cb5e4d8d826982d11b456739fed6b817.tar.gz
android_packages_apps_Trebuchet-2bd3d7d1cb5e4d8d826982d11b456739fed6b817.tar.bz2
android_packages_apps_Trebuchet-2bd3d7d1cb5e4d8d826982d11b456739fed6b817.zip
Load PackageItemInfo in background thread to prevent ANR
- Decoupled widget model from widget view, and placed the creation to LauncherModel. - As a result packagemanager operation, iconcache retrieval is all done inside LauncherModel on background thread b/21311085 b/21325319 Change-Id: I294698527db58b89f3da558090a367530c058776
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r--src/com/android/launcher3/Utilities.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java
index 6734fdc0d..1f8a6f2a5 100644
--- a/src/com/android/launcher3/Utilities.java
+++ b/src/com/android/launcher3/Utilities.java
@@ -44,6 +44,7 @@ import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.PaintDrawable;
import android.os.Build;
+import android.os.Process;
import android.util.Log;
import android.util.Pair;
import android.util.SparseArray;
@@ -57,6 +58,8 @@ import java.util.Comparator;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import junit.framework.Assert;
+
/**
* Various utilities shared amongst the Launcher's classes.
*/
@@ -641,4 +644,10 @@ public final class Utilities {
return (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) &&
(res.getConfiguration().getLayoutDirection() == View.LAYOUT_DIRECTION_RTL);
}
+
+ public static void assertWorkerThread() {
+ if (LauncherAppState.isDogfoodBuild()) {
+ Assert.assertTrue(LauncherModel.sWorkerThread.getThreadId() == Process.myTid());
+ }
+ }
}