summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2012-05-30 16:28:13 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2012-05-30 16:28:13 -0700
commitcb68fa5be7794b41e9079666efee4a4303707246 (patch)
tree78ecc82a7f57952979c0676b8d65611337bf0ff1
parentd30ac9b9d85dd43b11d5a7ff685f68db81c3fb35 (diff)
parent21a170b2e17621583f2800d5611459a0a939f560 (diff)
downloadandroid_packages_apps_Trebuchet-cb68fa5be7794b41e9079666efee4a4303707246.tar.gz
android_packages_apps_Trebuchet-cb68fa5be7794b41e9079666efee4a4303707246.tar.bz2
android_packages_apps_Trebuchet-cb68fa5be7794b41e9079666efee4a4303707246.zip
am 21a170b2: Fix for stuck widget (issue 6557954)
* commit '21a170b2e17621583f2800d5611459a0a939f560': Fix for stuck widget (issue 6557954)
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java34
1 files changed, 24 insertions, 10 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index eea0dbb51..71a4be2d5 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -299,8 +299,9 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
private Runnable mInflateWidgetRunnable = null;
private Runnable mBindWidgetRunnable = null;
static final int WIDGET_NO_CLEANUP_REQUIRED = -1;
- static final int WIDGET_BOUND = 0;
- static final int WIDGET_INFLATED = 1;
+ static final int WIDGET_PRELOAD_PENDING = 0;
+ static final int WIDGET_BOUND = 1;
+ static final int WIDGET_INFLATED = 2;
int mWidgetCleanupState = WIDGET_NO_CLEANUP_REQUIRED;
int mWidgetLoadingId = -1;
PendingAddWidgetInfo mCreateWidgetInfo = null;
@@ -654,6 +655,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
return;
}
+ mWidgetCleanupState = WIDGET_PRELOAD_PENDING;
mBindWidgetRunnable = new Runnable() {
@Override
public void run() {
@@ -716,17 +718,29 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// If the widget was not added, we may need to do further cleanup.
PendingAddWidgetInfo info = mCreateWidgetInfo;
mCreateWidgetInfo = null;
- // First step was to allocate a widget id, revert that.
- if ((mWidgetCleanupState == WIDGET_BOUND || mWidgetCleanupState == WIDGET_INFLATED) &&
- mWidgetLoadingId != -1) {
- Log.d(TAG, " 6557954 Cleaning up widget, delete widget id");
- mLauncher.getAppWidgetHost().deleteAppWidgetId(mWidgetLoadingId);
- }
- if (mWidgetCleanupState == WIDGET_BOUND) {
- // We never actually inflated the widget, so remove the callback to do so.
+
+ if (mWidgetCleanupState == WIDGET_PRELOAD_PENDING) {
+ Log.d(TAG, " 6557954 Cleaning up widget, remove preload callbacks");
+ // We never did any preloading, so just remove pending callbacks to do so
+ removeCallbacks(mBindWidgetRunnable);
+ removeCallbacks(mInflateWidgetRunnable);
+ } else if (mWidgetCleanupState == WIDGET_BOUND) {
+ // Delete the widget id which was allocated
+ if (mWidgetLoadingId != -1) {
+ Log.d(TAG, " 6557954 Cleaning up widget, delete widget id");
+ mLauncher.getAppWidgetHost().deleteAppWidgetId(mWidgetLoadingId);
+ }
+
+ // We never got around to inflating the widget, so remove the callback to do so.
Log.d(TAG, " 6557954 Cleaning up widget, remove callbacks");
removeCallbacks(mInflateWidgetRunnable);
} else if (mWidgetCleanupState == WIDGET_INFLATED) {
+ // Delete the widget id which was allocated
+ if (mWidgetLoadingId != -1) {
+ Log.d(TAG, " 6557954 Cleaning up widget, delete widget id");
+ mLauncher.getAppWidgetHost().deleteAppWidgetId(mWidgetLoadingId);
+ }
+
// The widget was inflated and added to the DragLayer -- remove it.
Log.d(TAG, " 6557954 Cleaning up widget, remove inflated widget from draglayer");
AppWidgetHostView widget = info.boundWidget;