[core] Fix uninstalling

This commit is contained in:
tehcneko 2021-03-07 15:48:21 +08:00
parent d3e87f3944
commit 83045a69a7
4 changed files with 6 additions and 4 deletions

View File

@ -173,6 +173,7 @@ public class ModulesActivity extends ListActivity implements ModuleUtil.ModuleLi
Toast.makeText(ModulesActivity.this, text, Toast.LENGTH_SHORT).show();
}
});
if (success) moduleUtil.reloadSingleModule(module.packageName);
}))
.setNegativeButton(android.R.string.cancel, null)
.show();

View File

@ -107,6 +107,9 @@ public final class ModuleUtil {
PackageInfo pkg;
try {
pkg = ConfigManager.getPackageInfo(packageName, PackageManager.GET_META_DATA);
if (pkg == null) {
throw new NameNotFoundException();
}
} catch (NameNotFoundException e) {
InstalledModule old = installedModules.remove(packageName);
if (old != null) {

View File

@ -221,7 +221,7 @@ public class PackageService {
public static boolean uninstallPackage(VersionedPackage versionedPackage) throws RemoteException, InterruptedException, InvocationTargetException, NoSuchMethodException, InstantiationException, IllegalAccessException {
CountDownLatch latch = new CountDownLatch(1);
final boolean[] result = {false};
pm.getPackageInstaller().uninstallExistingPackage(versionedPackage, "com.android.shell", new IntentSenderAdaptor() {
pm.getPackageInstaller().uninstall(versionedPackage, null, 0x00000002, new IntentSenderAdaptor() {
@Override
public void send(Intent intent) {
int status = intent.getIntExtra(PackageInstaller.EXTRA_STATUS, PackageInstaller.STATUS_FAILURE);

View File

@ -1,14 +1,12 @@
package android.content.pm;
import android.content.IntentSender;
import android.os.Binder;
import android.os.IBinder;
import android.os.IInterface;
public interface IPackageInstaller extends IInterface {
void uninstallExistingPackage(VersionedPackage versionedPackage, String callerPackageName,
IntentSender statusReceiver, int userId);
void uninstall(android.content.pm.VersionedPackage versionedPackage, java.lang.String callerPackageName, int flags, android.content.IntentSender statusReceiver, int userId) throws android.os.RemoteException;
abstract class Stub extends Binder implements IPackageInstaller {
public static IPackageInstaller asInterface(IBinder obj) {