summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/DragController.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2014-10-13 11:33:11 -0700
committerSunny Goyal <sunnygoyal@google.com>2014-10-14 14:39:26 -0700
commit4390acea35aefae52bd3fe38f5fdbb7ea322afb0 (patch)
tree1939609e7bc96ac6a3c16c2acba20f9254af99ba /src/com/android/launcher3/DragController.java
parent76229a7ccca69e92700f7b5f9d54739ee67276be (diff)
downloadandroid_packages_apps_Trebuchet-4390acea35aefae52bd3fe38f5fdbb7ea322afb0.tar.gz
android_packages_apps_Trebuchet-4390acea35aefae52bd3fe38f5fdbb7ea322afb0.tar.bz2
android_packages_apps_Trebuchet-4390acea35aefae52bd3fe38f5fdbb7ea322afb0.zip
Updating ItemInfo objects in the worker thread
> Launcher was making non-trivial updates to ItemInfo objects on UI thread. These updates were getting skipped when the Activity gets destroyed (possibly due to onConfigurationChange) > Unregistering SessionCallback on application onTerminate, rather than activity onDestroy Bug: 17941096 Change-Id: Iad4a50871fe09470f26139b44a2e9886833032f1
Diffstat (limited to 'src/com/android/launcher3/DragController.java')
-rw-r--r--src/com/android/launcher3/DragController.java17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/com/android/launcher3/DragController.java b/src/com/android/launcher3/DragController.java
index 6d0a2be63..480dce999 100644
--- a/src/com/android/launcher3/DragController.java
+++ b/src/com/android/launcher3/DragController.java
@@ -26,10 +26,16 @@ import android.graphics.Rect;
import android.os.Handler;
import android.os.IBinder;
import android.util.Log;
-import android.view.*;
+import android.view.HapticFeedbackConstants;
+import android.view.KeyEvent;
+import android.view.MotionEvent;
+import android.view.VelocityTracker;
+import android.view.View;
+import android.view.ViewConfiguration;
import android.view.inputmethod.InputMethodManager;
import java.util.ArrayList;
+import java.util.HashSet;
/**
* Class for initiating a drag within a view or across multiple views.
@@ -318,18 +324,17 @@ public class DragController {
}
endDrag();
}
- public void onAppsRemoved(final ArrayList<String> packageNames, ArrayList<AppInfo> appInfos) {
+ public void onAppsRemoved(final ArrayList<String> packageNames, HashSet<ComponentName> cns) {
// Cancel the current drag if we are removing an app that we are dragging
if (mDragObject != null) {
Object rawDragInfo = mDragObject.dragInfo;
if (rawDragInfo instanceof ShortcutInfo) {
ShortcutInfo dragInfo = (ShortcutInfo) rawDragInfo;
- for (AppInfo info : appInfos) {
+ for (ComponentName componentName : cns) {
// Added null checks to prevent NPE we've seen in the wild
- if (dragInfo != null &&
- dragInfo.intent != null && info != null) {
+ if (dragInfo != null && dragInfo.intent != null) {
ComponentName cn = dragInfo.intent.getComponent();
- boolean isSameComponent = cn != null && (cn.equals(info.componentName) ||
+ boolean isSameComponent = cn != null && (cn.equals(componentName) ||
packageNames.contains(cn.getPackageName()));
if (isSameComponent) {
cancelDrag();