Launcher3: Use standard launcher method for uninstalling
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com> Signed-off-by: Mohammad Hasan Keramat J <ikeramat@protonmail.com> Change-Id: Ic3e40ce48c77438c26f248e5ac878a29bfa479d2
This commit is contained in:
parent
51344d13e3
commit
b88dc1592e
|
@ -7,6 +7,8 @@ import android.app.ActivityOptions;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Rect;
|
||||
import android.net.Uri;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.InflateException;
|
||||
import android.view.accessibility.AccessibilityNodeInfo;
|
||||
|
@ -30,6 +32,7 @@ import com.android.launcher3.views.ActivityContext;
|
|||
import com.android.launcher3.widget.WidgetsBottomSheet;
|
||||
import com.android.launcher3.customization.InfoBottomSheet;
|
||||
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
@ -273,11 +276,15 @@ public abstract class SystemShortcut<T extends Context & ActivityContext> extend
|
|||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String packageName = mItemInfo.getTargetComponent().getPackageName();
|
||||
Intent intent = new PackageManagerHelper(
|
||||
view.getContext()).getUninstallIntent(packageName);
|
||||
mTarget.startActivitySafely(view, intent, mItemInfo);
|
||||
AbstractFloatingView.closeAllOpenViews(mTarget);
|
||||
try {
|
||||
Intent intent = Intent.parseUri(view.getContext().getString(R.string.delete_package_intent), 0)
|
||||
.setData(Uri.fromParts("package", mItemInfo.getTargetComponent().getPackageName(),
|
||||
mItemInfo.getTargetComponent().getClassName())).putExtra(Intent.EXTRA_USER, mItemInfo.user);
|
||||
mTarget.startActivitySafely(view, intent, mItemInfo);
|
||||
AbstractFloatingView.closeAllOpenViews(mTarget);
|
||||
} catch (URISyntaxException e) {
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -197,12 +197,6 @@ public class PackageManagerHelper {
|
|||
.authority(mContext.getPackageName()).build());
|
||||
}
|
||||
|
||||
public Intent getUninstallIntent(String packageName) {
|
||||
return new Intent(Intent.ACTION_UNINSTALL_PACKAGE)
|
||||
.setData(Uri.parse("package:" + packageName))
|
||||
.putExtra(Intent.EXTRA_RETURN_RESULT, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new market search intent.
|
||||
*/
|
||||
|
|
Loading…
Reference in New Issue