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

Commit 1f09b8c0 authored by Fabrice Di Meglio's avatar Fabrice Di Meglio
Browse files

Add IntentFilter auto verification - part 8

- fix clearing of Intent Verification Status: now do it at the correct
time when the PackageSettings info is still there
- reduce writing of Settings

See bug #19628909

Change-Id: I9113333c330964249342108fa1ca7b8ec89c3322
parent 7d1a9d05
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -11743,6 +11743,7 @@ public class PackageManagerService extends IPackageManager.Stub {
        synchronized (mPackages) {
            if (deletedPs != null) {
                if ((flags&PackageManager.DELETE_KEEP_DATA) == 0) {
                    clearIntentFilterVerificationsLPw(deletedPs.name, UserHandle.USER_ALL);
                    if (outInfo != null) {
                        mSettings.mKeySetManagerService.removeAppKeySetDataLPw(packageName);
                        outInfo.removedAppId = mSettings.removePackageLPw(packageName);
@@ -11773,7 +11774,6 @@ public class PackageManagerService extends IPackageManager.Stub {
                        }
                    }
                    clearPackagePreferredActivitiesLPw(deletedPs.name, UserHandle.USER_ALL);
                    clearIntentFilterVerificationsLPw(deletedPs.name, UserHandle.USER_ALL);
                }
                // make sure to preserve per-user disabled state if this removal was just
                // a downgrade of a system app to the factory package
@@ -12635,15 +12635,18 @@ public class PackageManagerService extends IPackageManager.Stub {
    /** This method takes a specific user id as well as UserHandle.USER_ALL. */
    void clearIntentFilterVerificationsLPw(String packageName, int userId) {
        if (userId == UserHandle.USER_ALL) {
            mSettings.removeIntentFilterVerificationLPw(packageName, sUserManager.getUserIds());
            if (mSettings.removeIntentFilterVerificationLPw(packageName,
                    sUserManager.getUserIds())) {
                for (int oneUserId : sUserManager.getUserIds()) {
                    scheduleWritePackageRestrictionsLocked(oneUserId);
                }
            }
        } else {
            mSettings.removeIntentFilterVerificationLPw(packageName, userId);
            if (mSettings.removeIntentFilterVerificationLPw(packageName, userId)) {
                scheduleWritePackageRestrictionsLocked(userId);
            }
        }
    }
    @Override
    public void resetPreferredActivities(int userId) {
+7 −4
Original line number Diff line number Diff line
@@ -1067,19 +1067,22 @@ final class Settings {
        return result;
    }

    void removeIntentFilterVerificationLPw(String packageName, int userId) {
    boolean removeIntentFilterVerificationLPw(String packageName, int userId) {
        PackageSetting ps = mPackages.get(packageName);
        if (ps == null) {
            Slog.w(PackageManagerService.TAG, "No package known for name: " + packageName);
            return;
            return false;
        }
        ps.clearDomainVerificationStatusForUser(userId);
        return true;
    }

    void removeIntentFilterVerificationLPw(String packageName, int[] userIds) {
    boolean removeIntentFilterVerificationLPw(String packageName, int[] userIds) {
        boolean result = false;
        for (int userId : userIds) {
            removeIntentFilterVerificationLPw(packageName, userId);
            result |= removeIntentFilterVerificationLPw(packageName, userId);
        }
        return result;
    }

    boolean setDefaultBrowserPackageNameLPr(String packageName, int userId) {