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

Commit f9124eca authored by Benjamin Franz's avatar Benjamin Franz Committed by Android (Google) Code Review
Browse files

Merge "Flush package restriction changes for a user." into nyc-dev

parents 886ad069 bbb3ff2b
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -2024,6 +2024,15 @@ public class ApplicationPackageManager extends PackageManager {
        }
    }

    @Override
    public void flushPackageRestrictionsAsUser(int userId) {
        try {
            mPM.flushPackageRestrictionsAsUser(userId);
        } catch (RemoteException e) {
            throw e.rethrowFromSystemServer();
        }
    }

    @Override
    public boolean setApplicationHiddenSettingAsUser(String packageName, boolean hidden,
            UserHandle user) {
+5 −0
Original line number Diff line number Diff line
@@ -315,6 +315,11 @@ interface IPackageManager {
     */
    int getApplicationEnabledSetting(in String packageName, int userId);

    /**
     * As per {@link android.content.pm.PackageManager#flushPackageRestrictionsAsUser}.
     */
    void flushPackageRestrictionsAsUser(in int userId);

    /**
     * Set whether the given package should be considered stopped, making
     * it not visible to implicit intents that filter out stopped packages.
+10 −1
Original line number Diff line number Diff line
@@ -5225,7 +5225,6 @@ public abstract class PackageManager {
    public abstract void setComponentEnabledSetting(ComponentName componentName,
            int newState, int flags);


    /**
     * Return the enabled setting for a package component (activity,
     * receiver, service, provider).  This returns the last value set by
@@ -5282,6 +5281,16 @@ public abstract class PackageManager {
     */
    public abstract int getApplicationEnabledSetting(String packageName);

    /**
     * Flush the package restrictions for a given user to disk. This forces the package restrictions
     * like component and package enabled settings to be written to disk and avoids the delay that
     * is otherwise present when changing those settings.
     *
     * @param userId Ther userId of the user whose restrictions are to be flushed.
     * @hide
     */
    public abstract void flushPackageRestrictionsAsUser(int userId);

    /**
     * Puts the package in a hidden state, which is almost like an uninstalled state,
     * making the package unavailable, but it doesn't remove the data or the actual
+16 −0
Original line number Diff line number Diff line
@@ -16662,6 +16662,22 @@ Slog.v(TAG, ":: stepped forward, applying functor at tag " + parser.getName());
        }
    }
    @Override
    public void flushPackageRestrictionsAsUser(int userId) {
        if (!sUserManager.exists(userId)) {
            return;
        }
        enforceCrossUserPermission(Binder.getCallingUid(), userId, false /* requireFullPermission*/,
                false /* checkShell */, "flushPackageRestrictions");
        synchronized (mPackages) {
            mSettings.writePackageRestrictionsLPr(userId);
            mDirtyUsers.remove(userId);
            if (mDirtyUsers.isEmpty()) {
                mHandler.removeMessages(WRITE_PACKAGE_RESTRICTIONS);
            }
        }
    }
    private void sendPackageChangedBroadcast(String packageName,
            boolean killFlag, ArrayList<String> componentNames, int packageUid) {
        if (DEBUG_INSTALL)
+6 −0
Original line number Diff line number Diff line
@@ -758,6 +758,12 @@ public class MockPackageManager extends PackageManager {
        throw new UnsupportedOperationException();
    }

    /** @hide */
    @Override
    public void flushPackageRestrictionsAsUser(int userId) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void addPreferredActivity(IntentFilter filter,
            int match, ComponentName[] set, ComponentName activity) {
Loading