Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3119a452 authored by Romain Guy's avatar Romain Guy Committed by The Android Open Source Project
Browse files

Automated import from //branches/master/...@141525,141525

parent eb785fa7
Loading
Loading
Loading
Loading
+17 −3
Original line number Diff line number Diff line
@@ -3900,14 +3900,26 @@ class PackageManagerService extends IPackageManager.Stub {
    private boolean deletePackageX(String packageName, boolean sendBroadCast,
                                   boolean deleteCodeAndResources, int flags) {
        PackageRemovedInfo info = new PackageRemovedInfo();
        boolean res = false;
        boolean res;

        synchronized (mInstallLock) {
            res = deletePackageLI(packageName, deleteCodeAndResources, flags, info);
        }
        
        if(res && sendBroadCast) {
            info.sendBroadcast(deleteCodeAndResources, false);
            boolean systemUpdate = info.isRemovedPackageSystemUpdate;
            info.sendBroadcast(deleteCodeAndResources, systemUpdate);

            // If the removed package was a system update, the old system packaged
            // was re-enabled; we need to broadcast this information
            if (systemUpdate) {
                Bundle extras = new Bundle(1);
                extras.putInt(Intent.EXTRA_UID, info.removedUid >= 0 ? info.removedUid : info.uid);
                extras.putBoolean(Intent.EXTRA_REPLACING, true);

                sendPackageBroadcast(Intent.ACTION_PACKAGE_ADDED, packageName, extras);
                sendPackageBroadcast(Intent.ACTION_PACKAGE_REPLACED, packageName, extras);
            }
        }
        return res;
    }
@@ -3916,6 +3928,7 @@ class PackageManagerService extends IPackageManager.Stub {
        String removedPackage;
        int uid = -1;
        int removedUid = -1;
        boolean isRemovedPackageSystemUpdate = false;

        void sendBroadcast(boolean fullRemove, boolean replacing) {
            Bundle extras = new Bundle(1);
@@ -4002,6 +4015,7 @@ class PackageManagerService extends IPackageManager.Stub {
            Log.i(TAG, "Deleting system pkg from data partition");
        }
        // Delete the updated package
        outInfo.isRemovedPackageSystemUpdate = true;
        boolean ret = deleteInstalledPackageLI(p, deleteCodeAndResources, flags, outInfo);
        if (!ret) {
            return false;