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

Commit 40ed99ac authored by Patrick Baumann's avatar Patrick Baumann
Browse files

Debug mode to log and allow filtered apps

This is a simple change that just adds a debug flag useful for
identifying apps that need updating to avoid filtering logic.

Bug: 136675067
Test: N/A
Change-Id: I41dd8b9cfe2bf0c28b816166119e1c82f83705e9
parent af9c3feb
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -55,7 +55,14 @@ class AppsFilter {

    // Forces filtering logic to run for debug purposes.
    // STOPSHIP (b/136675067): should be false after development is complete
    private static final boolean DEBUG_FILTERING = true;
    private static final boolean DEBUG_RUN_WHEN_DISABLED = true;

    // Logs all filtering instead of enforcing
    private static final boolean DEBUG_ALLOW_ALL = false;

    @SuppressWarnings("ConstantExpression")
    private static final boolean DEBUG_LOGGING = false | DEBUG_RUN_WHEN_DISABLED | DEBUG_ALLOW_ALL;

    /**
     * This contains a list of packages that are implicitly queryable because another app explicitly
     * interacted with it. For example, if application A starts a service in application B,
@@ -278,7 +285,7 @@ class AppsFilter {
            return false;
        }
        final boolean featureEnabled = mConfigProvider.isEnabled();
        if (!featureEnabled && !DEBUG_FILTERING) {
        if (!featureEnabled && !DEBUG_RUN_WHEN_DISABLED) {
            return false;
        }
        if (callingSetting == null) {
@@ -328,9 +335,11 @@ class AppsFilter {
                        callingPkgSetting.pkg.packageName);
        switch (mode) {
            case AppOpsManager.MODE_DEFAULT:
                // if default, let's rely on remote feature toggle to determine whether to
                // actually filter
                return true;
                if (DEBUG_LOGGING) {
                    Slog.d(TAG, "filtered interaction: " + callingPkgSetting.name + " -> "
                            + targetPkgSetting.name + (DEBUG_ALLOW_ALL ? " ALLOWED" : ""));
                }
                return !DEBUG_ALLOW_ALL;
            case AppOpsManager.MODE_ALLOWED:
                // explicitly allowed to see all packages, don't filter
                return false;