send ACTION_UNINSTALL_STARTED before any work has started
This needs to be broadcast as soon as possible so the UI can change to lock out the user from doing conflicting actions. refs #1357
This commit is contained in:
parent
ab8f405dd2
commit
6c66697762
@ -63,8 +63,6 @@ public class DefaultInstaller extends Installer {
|
||||
|
||||
@Override
|
||||
protected void uninstallPackage() {
|
||||
sendBroadcastUninstall(Installer.ACTION_UNINSTALL_STARTED);
|
||||
|
||||
Intent uninstallIntent = new Intent(context, DefaultInstallerActivity.class);
|
||||
uninstallIntent.setAction(DefaultInstallerActivity.ACTION_UNINSTALL_PACKAGE);
|
||||
uninstallIntent.putExtra(Installer.EXTRA_APK, apk);
|
||||
|
@ -78,8 +78,6 @@ public class ExtensionInstaller extends Installer {
|
||||
|
||||
@Override
|
||||
protected void uninstallPackage() {
|
||||
sendBroadcastUninstall(Installer.ACTION_UNINSTALL_STARTED);
|
||||
|
||||
Intent uninstallIntent = new Intent(context, InstallExtensionDialogActivity.class);
|
||||
uninstallIntent.setAction(InstallExtensionDialogActivity.ACTION_UNINSTALL);
|
||||
|
||||
|
@ -68,8 +68,6 @@ public class FileInstaller extends Installer {
|
||||
|
||||
@Override
|
||||
protected void uninstallPackage() {
|
||||
sendBroadcastUninstall(Installer.ACTION_UNINSTALL_STARTED);
|
||||
|
||||
Intent uninstallIntent = new Intent(context, FileInstallerActivity.class);
|
||||
uninstallIntent.setAction(FileInstallerActivity.ACTION_UNINSTALL_FILE);
|
||||
uninstallIntent.putExtra(Installer.EXTRA_APK, apk);
|
||||
|
@ -200,6 +200,15 @@ public abstract class Installer {
|
||||
}
|
||||
|
||||
private void sendBroadcastUninstall(String action, PendingIntent pendingIntent, String errorMessage) {
|
||||
sendBroadcastUninstall(context, apk, action, pendingIntent, errorMessage);
|
||||
}
|
||||
|
||||
static void sendBroadcastUninstall(Context context, Apk apk, String action) {
|
||||
sendBroadcastUninstall(context, apk, action, null, null);
|
||||
}
|
||||
|
||||
private static void sendBroadcastUninstall(Context context, Apk apk, String action,
|
||||
PendingIntent pendingIntent, String errorMessage) {
|
||||
Uri uri = Uri.fromParts("package", apk.packageName, null);
|
||||
|
||||
Intent intent = new Intent(action);
|
||||
|
@ -142,6 +142,9 @@ public class InstallerService extends JobIntentService {
|
||||
*/
|
||||
public static void uninstall(Context context, @NonNull Apk apk) {
|
||||
Objects.requireNonNull(apk);
|
||||
|
||||
Installer.sendBroadcastUninstall(context, apk, Installer.ACTION_UNINSTALL_STARTED);
|
||||
|
||||
Intent intent = new Intent(context, InstallerService.class);
|
||||
intent.setAction(ACTION_UNINSTALL);
|
||||
intent.putExtra(Installer.EXTRA_APK, apk);
|
||||
|
@ -355,8 +355,6 @@ public class PrivilegedInstaller extends Installer {
|
||||
|
||||
@Override
|
||||
protected void uninstallPackage() {
|
||||
sendBroadcastUninstall(Installer.ACTION_UNINSTALL_STARTED);
|
||||
|
||||
ServiceConnection mServiceConnection = new ServiceConnection() {
|
||||
public void onServiceConnected(ComponentName name, IBinder service) {
|
||||
IPrivilegedService privService = IPrivilegedService.Stub.asInterface(service);
|
||||
|
Loading…
x
Reference in New Issue
Block a user