summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMichael Jurka <mikejurka@google.com>2013-08-21 14:33:57 +0200
committerMichael Jurka <mikejurka@google.com>2013-08-21 15:11:00 +0200
commitf3007589e346df224d357b389069adfeb266545e (patch)
tree1e2082e41a9a64d8dad402365449cca32cc50ba6 /src
parentc8f83f46b68f783f627e4b4bd229f1281777b311 (diff)
downloadandroid_packages_apps_Trebuchet-f3007589e346df224d357b389069adfeb266545e.tar.gz
android_packages_apps_Trebuchet-f3007589e346df224d357b389069adfeb266545e.tar.bz2
android_packages_apps_Trebuchet-f3007589e346df224d357b389069adfeb266545e.zip
Add logging for Folder drag issues
Drags out of Folders are getting lost, adding debug code to see if the uninstall logic is causing that Also, fixing one potential cause of the issue Change-Id: I0b6a91268571c2a9394e0d6f19fb9d324b427b51
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/DeleteDropTarget.java49
-rw-r--r--src/com/android/launcher3/Folder.java1
-rw-r--r--src/com/android/launcher3/Launcher.java4
3 files changed, 24 insertions, 30 deletions
diff --git a/src/com/android/launcher3/DeleteDropTarget.java b/src/com/android/launcher3/DeleteDropTarget.java
index c98f761f2..01edb9eb6 100644
--- a/src/com/android/launcher3/DeleteDropTarget.java
+++ b/src/com/android/launcher3/DeleteDropTarget.java
@@ -253,7 +253,7 @@ public class DeleteDropTarget extends ButtonDropTarget {
return AppsCustomizePagedView.DISABLE_ALL_APPS && isWorkspaceOrFolderApplication(d);
}
- private void completeDrop(final DragObject d) {
+ private void completeDrop(DragObject d) {
ItemInfo item = (ItemInfo) d.dragInfo;
boolean wasWaitingForUninstall = mWaitingForUninstall;
mWaitingForUninstall = false;
@@ -264,11 +264,32 @@ public class DeleteDropTarget extends ButtonDropTarget {
} else if (AppsCustomizePagedView.DISABLE_ALL_APPS && isWorkspaceOrFolderApplication(d)) {
ShortcutInfo shortcut = (ShortcutInfo) item;
if (shortcut.intent != null && shortcut.intent.getComponent() != null) {
- ComponentName componentName = shortcut.intent.getComponent();
+ final ComponentName componentName = shortcut.intent.getComponent();
+ final DragSource dragSource = d.dragSource;
int flags = ApplicationInfo.initFlags(
ShortcutInfo.getPackageInfo(getContext(), componentName.getPackageName()));
mWaitingForUninstall =
mLauncher.startApplicationUninstallActivity(componentName, flags);
+ if (mWaitingForUninstall) {
+ final Runnable checkIfUninstallWasSuccess = new Runnable() {
+ @Override
+ public void run() {
+ mWaitingForUninstall = false;
+ String packageName = componentName.getPackageName();
+ List<ResolveInfo> activities =
+ AllAppsList.findActivitiesForPackage(getContext(), packageName);
+ boolean uninstallSuccessful = activities.size() == 0;
+ if (dragSource instanceof Folder) {
+ ((Folder) dragSource).
+ onUninstallActivityReturned(uninstallSuccessful);
+ } else if (dragSource instanceof Workspace) {
+ ((Workspace) dragSource).
+ onUninstallActivityReturned(uninstallSuccessful);
+ }
+ }
+ };
+ mLauncher.addOnResumeCallback(checkIfUninstallWasSuccess);
+ }
}
} else if (isWorkspaceOrFolderApplication(d)) {
LauncherModel.deleteItemFromDatabase(mLauncher, item);
@@ -301,30 +322,6 @@ public class DeleteDropTarget extends ButtonDropTarget {
((Workspace) d.dragSource).onUninstallActivityReturned(false);
}
}
- if (mWaitingForUninstall) {
- final Runnable checkIfUninstallWasSuccess = new Runnable() {
- @Override
- public void run() {
- mWaitingForUninstall = false;
- ShortcutInfo shortcut = (ShortcutInfo) d.dragInfo;
- if (shortcut.intent != null && shortcut.intent.getComponent() != null) {
- String packageName = shortcut.intent.getComponent().getPackageName();
- List<ResolveInfo> activities =
- AllAppsList.findActivitiesForPackage(getContext(), packageName);
- boolean uninstallSuccessful = activities.size() == 0;
- mLauncher.removeOnResumeCallback(this);
- if (d.dragSource instanceof Folder) {
- ((Folder) d.dragSource).
- onUninstallActivityReturned(uninstallSuccessful);
- } else if (d.dragSource instanceof Workspace) {
- ((Workspace) d.dragSource).
- onUninstallActivityReturned(uninstallSuccessful);
- }
- }
- }
- };
- mLauncher.addOnResumeCallback(checkIfUninstallWasSuccess);
- }
}
public void onDrop(DragObject d) {
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index f23e1bb39..d428abc2c 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -725,6 +725,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
public void onDropCompleted(final View target, final DragObject d,
final boolean isFlingToDelete, final boolean success) {
if (mDeferDropAfterUninstall) {
+ Log.d(TAG, "Deferred handling drop because waiting for uninstall.");
mDeferredAction = new Runnable() {
public void run() {
onDropCompleted(target, d, isFlingToDelete, success);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index a16a33e58..71054ffc5 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3457,10 +3457,6 @@ public class Launcher extends Activity
mOnResumeCallbacks.add(run);
}
- public void removeOnResumeCallback(Runnable run) {
- mOnResumeCallbacks.remove(run);
- }
-
/**
* If the activity is currently paused, signal that we need to re-run the loader
* in onResume.