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

Commit 5249ffc9 authored by Andrei Onea's avatar Andrei Onea
Browse files

Add non-logging method to PlatformCompat

Allow checking the state of a changeid without reporting it.

Test: boots
Bug: 163352654
Change-Id: I9b99ad9f19e42bec88b96d80b2eb2df2031feb33
Merged-In: I9b99ad9f19e42bec88b96d80b2eb2df2031feb33
parent 3a76c4c9
Loading
Loading
Loading
Loading
+14 −8
Original line number Diff line number Diff line
@@ -107,17 +107,23 @@ public class PlatformCompat extends IPlatformCompat.Stub {
    }

    /**
     * Internal version of the above method. Does not perform costly permission check.
     * Internal version of the above method, without logging. Does not perform costly permission
     * check.
     * TODO(b/167551701): Remove this method and add 'loggability' as a changeid property.
     */
    public boolean isChangeEnabledInternal(long changeId, ApplicationInfo appInfo) {
        if (mCompatConfig.isChangeEnabled(changeId, appInfo)) {
            reportChange(changeId, appInfo.uid,
                    ChangeReporter.STATE_ENABLED);
            return true;
    public boolean isChangeEnabledInternalNoLogging(long changeId, ApplicationInfo appInfo) {
        return mCompatConfig.isChangeEnabled(changeId, appInfo);
    }

    /**
     * Internal version of {@link #isChangeEnabled(long, ApplicationInfo)}. Does not perform costly
     * permission check.
     */
    public boolean isChangeEnabledInternal(long changeId, ApplicationInfo appInfo) {
        boolean value = isChangeEnabledInternalNoLogging(changeId, appInfo);
        reportChange(changeId, appInfo.uid,
                ChangeReporter.STATE_DISABLED);
        return false;
                value ? ChangeReporter.STATE_ENABLED : ChangeReporter.STATE_DISABLED);
        return value;
    }

    @Override
+2 −1
Original line number Diff line number Diff line
@@ -290,7 +290,8 @@ public class AppsFilter {

        private void updateEnabledState(@NonNull AndroidPackage pkg) {
            // TODO(b/135203078): Do not use toAppInfo
            final boolean enabled = mInjector.getCompatibility().isChangeEnabledInternal(
            // TODO(b/167551701): Make changeId non-logging
            final boolean enabled = mInjector.getCompatibility().isChangeEnabledInternalNoLogging(
                    PackageManager.FILTER_APPLICATION_QUERY, pkg.toAppInfoWithoutState());
            if (enabled) {
                mDisabledPackages.remove(pkg.getPackageName());