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

Commit db88af94 authored by Patrick Baumann's avatar Patrick Baumann Committed by Automerger Merge Worker
Browse files

Merge "Fixes shouldFilterApplication usages" into rvc-dev am: 80888dbb am:...

Merge "Fixes shouldFilterApplication usages" into rvc-dev am: 80888dbb am: 8908af89 am: 0138cfdc

Change-Id: I8f9f13ab986b4bd894f610e845f3e9883f934904
parents 51109d18 0138cfdc
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -2376,7 +2376,7 @@ public class PackageManagerService extends IPackageManager.Stub
        for (String packageName : packages) {
            PackageSetting setting = mSettings.mPackages.get(packageName);
            if (setting != null
                    && shouldFilterApplicationLocked(setting, callingUid, callingUserId)) {
                    && !shouldFilterApplicationLocked(setting, callingUid, callingUserId)) {
                notifyInstallObserver(packageName);
            }
        }
@@ -21007,11 +21007,15 @@ public class PackageManagerService extends IPackageManager.Stub
                false /* requireFullPermission */, false /* checkShell */, "get enabled");
        // reader
        synchronized (mLock) {
            try {
                if (shouldFilterApplicationLocked(
                        mSettings.getPackageLPr(packageName), callingUid, userId)) {
                return COMPONENT_ENABLED_STATE_DISABLED;
                    throw new PackageManager.NameNotFoundException(packageName);
                }
                return mSettings.getApplicationEnabledSettingLPr(packageName, userId);
            } catch (PackageManager.NameNotFoundException e) {
                throw new IllegalArgumentException("Unknown package: " + packageName);
            }
        }
    }
@@ -21023,12 +21027,16 @@ public class PackageManagerService extends IPackageManager.Stub
        mPermissionManager.enforceCrossUserPermission(callingUid, userId,
                false /*requireFullPermission*/, false /*checkShell*/, "getComponentEnabled");
        synchronized (mLock) {
            try {
                if (shouldFilterApplicationLocked(
                        mSettings.getPackageLPr(component.getPackageName()), callingUid,
                        component, TYPE_UNKNOWN, userId)) {
                return COMPONENT_ENABLED_STATE_DISABLED;
                    throw new PackageManager.NameNotFoundException(component.getPackageName());
                }
                return mSettings.getComponentEnabledSettingLPr(component, userId);
            } catch (PackageManager.NameNotFoundException e) {
                throw new IllegalArgumentException("Unknown component: " + component);
            }
        }
    }
+6 −4
Original line number Diff line number Diff line
@@ -4363,19 +4363,21 @@ public final class Settings {
        return pkg.installSource.isOrphaned;
    }

    int getApplicationEnabledSettingLPr(String packageName, int userId) {
    int getApplicationEnabledSettingLPr(String packageName, int userId)
            throws PackageManager.NameNotFoundException {
        final PackageSetting pkg = mPackages.get(packageName);
        if (pkg == null) {
            throw new IllegalArgumentException("Unknown package: " + packageName);
            throw new PackageManager.NameNotFoundException(packageName);
        }
        return pkg.getEnabled(userId);
    }

    int getComponentEnabledSettingLPr(ComponentName componentName, int userId) {
    int getComponentEnabledSettingLPr(ComponentName componentName, int userId)
            throws PackageManager.NameNotFoundException {
        final String packageName = componentName.getPackageName();
        final PackageSetting pkg = mPackages.get(packageName);
        if (pkg == null) {
            throw new IllegalArgumentException("Unknown component: " + componentName);
            throw new PackageManager.NameNotFoundException(componentName.getPackageName());
        }
        final String classNameStr = componentName.getClassName();
        return pkg.getCurrentEnabledStateLPr(classNameStr, userId);