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

Commit 77d23cb8 authored by Sam Mortimer's avatar Sam Mortimer Committed by Steve Kondik
Browse files

AppOps: only apply app type filters to summary screen

  *) If buildState() is called for a single package, do
     not apply hide user/system app filters.

  *) Fixes show detail display when called via
     long press in privacyguard and an AppOp hide
     filter is ticked.

Original feature commit:
http://review.cyanogenmod.org/#/c/51699/

Change-Id: If31d094fb989836ab6829daeefe820695032c0ed
parent 64e79e24
Loading
Loading
Loading
Loading
+18 −12
Original line number Diff line number Diff line
@@ -454,7 +454,7 @@ public class AppOpsState {
    }

    private AppEntry getAppEntry(final Context context, final HashMap<String, AppEntry> appEntries,
            final String packageName, ApplicationInfo appInfo) {
            final String packageName, ApplicationInfo appInfo, boolean applyFilters) {

        if (appInfo == null) {
            try {
@@ -467,6 +467,7 @@ public class AppOpsState {
            }
        }

        if (applyFilters) {
            // Hide user apps if needed
            if (!shouldShowUserApps() &&
                    (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 0) {
@@ -477,6 +478,7 @@ public class AppOpsState {
                    (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
                return null;
            }
        }

        AppEntry appEntry = appEntries.get(packageName);
        if (appEntry == null) {
@@ -515,6 +517,9 @@ public class AppOpsState {
            }
        }

        // Whether to apply hide user / system app filters
        final boolean applyFilters = (packageName == null);

        List<AppOpsManager.PackageOps> pkgs;
        if (packageName != null) {
            pkgs = mAppOps.getOpsForPackage(uid, packageName, tpl.ops);
@@ -525,7 +530,8 @@ public class AppOpsState {
        if (pkgs != null) {
            for (int i=0; i<pkgs.size(); i++) {
                AppOpsManager.PackageOps pkgOps = pkgs.get(i);
                AppEntry appEntry = getAppEntry(context, appEntries, pkgOps.getPackageName(), null);
                AppEntry appEntry = getAppEntry(context, appEntries, pkgOps.getPackageName(), null,
                        applyFilters);
                if (appEntry == null) {
                    continue;
                }
@@ -553,7 +559,7 @@ public class AppOpsState {
        for (int i=0; i<apps.size(); i++) {
            PackageInfo appInfo = apps.get(i);
            AppEntry appEntry = getAppEntry(context, appEntries, appInfo.packageName,
                    appInfo.applicationInfo);
                    appInfo.applicationInfo, applyFilters);
            if (appEntry == null) {
                continue;
            }