summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJon Miranda <jonmiranda@google.com>2017-08-23 12:13:24 -0700
committerJon Miranda <jonmiranda@google.com>2017-08-23 12:13:24 -0700
commitc56e3ff2ee03d1756ff70574421e497c5d2f0331 (patch)
tree21316960981dfb06f937b58756f4977d2805a396 /src
parent86ba394ad0792d31dc9b4400ea362942413251f3 (diff)
downloadandroid_packages_apps_Trebuchet-c56e3ff2ee03d1756ff70574421e497c5d2f0331.tar.gz
android_packages_apps_Trebuchet-c56e3ff2ee03d1756ff70574421e497c5d2f0331.tar.bz2
android_packages_apps_Trebuchet-c56e3ff2ee03d1756ff70574421e497c5d2f0331.zip
Show progress dialog when uninstalling an app in Launcher3Go.
This ensures that the uninstall activity will finish only after the task is completed. We initially assumed that this was always the case, but in Android Go the uninstall activity finishes before the uninstall is completed. Bug: 64033585 Change-Id: Ic5d8dd99e2fecd0c9cb24093ee66668b4b38cb1a
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/UninstallDropTarget.java30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/com/android/launcher3/UninstallDropTarget.java b/src/com/android/launcher3/UninstallDropTarget.java
index e15cf9f50..84d6a9b34 100644
--- a/src/com/android/launcher3/UninstallDropTarget.java
+++ b/src/com/android/launcher3/UninstallDropTarget.java
@@ -11,12 +11,17 @@ import android.os.Bundle;
import android.os.UserHandle;
import android.os.UserManager;
import android.util.AttributeSet;
+import android.util.Log;
import android.widget.Toast;
import com.android.launcher3.compat.LauncherAppsCompat;
+import java.net.URISyntaxException;
+
public class UninstallDropTarget extends ButtonDropTarget {
+ private static final String TAG = "UninstallDropTarget";
+
public UninstallDropTarget(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
@@ -99,25 +104,28 @@ public class UninstallDropTarget extends ButtonDropTarget {
final Launcher launcher, ItemInfo info, DropTargetResultCallback callback) {
final ComponentName cn = getUninstallTarget(launcher, info);
- final boolean isUninstallable;
+ boolean canUninstall;
if (cn == null) {
// System applications cannot be installed. For now, show a toast explaining that.
// We may give them the option of disabling apps this way.
Toast.makeText(launcher, R.string.uninstall_system_app_text, Toast.LENGTH_SHORT).show();
- isUninstallable = false;
+ canUninstall = false;
} else {
- Intent intent = new Intent(Intent.ACTION_DELETE,
- Uri.fromParts("package", cn.getPackageName(), cn.getClassName()))
- .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK
- | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
- intent.putExtra(Intent.EXTRA_USER, info.user);
- launcher.startActivity(intent);
- isUninstallable = true;
+ try {
+ Intent i = Intent.parseUri(launcher.getString(R.string.delete_package_intent), 0)
+ .setData(Uri.fromParts("package", cn.getPackageName(), cn.getClassName()))
+ .putExtra(Intent.EXTRA_USER, info.user);
+ launcher.startActivity(i);
+ canUninstall = true;
+ } catch (URISyntaxException e) {
+ Log.e(TAG, "Failed to parse intent to start uninstall activity for item=" + info);
+ canUninstall = false;
+ }
}
if (callback != null) {
- sendUninstallResult(launcher, isUninstallable, cn, info.user, callback);
+ sendUninstallResult(launcher, canUninstall, cn, info.user, callback);
}
- return isUninstallable;
+ return canUninstall;
}
/**