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

Commit 3c44cc54 authored by Svetoslav's avatar Svetoslav
Browse files

Display properly runtime permissions without a corresponding app op.

We added the GET_ACCOUNTS permission to the contacts group
but it does not have an app op. The UI code was written with
the assumption that all runtime permissions have an app op
and was not showing the contacts group if the only requested
permission from that group was GET_ACCOUNTS.

bug:23726958

Change-Id: Iad5493297901c3f1144f4d58a3dad3f022c593a1
parent f7fc0631
Loading
Loading
Loading
Loading
+3 −2
Original line number Original line Diff line number Diff line
@@ -275,8 +275,9 @@ public final class AppPermissionGroup implements Comparable<AppPermissionGroup>
                if (permission.isGranted()) {
                if (permission.isGranted()) {
                    return true;
                    return true;
                }
                }
            } else if (permission.isGranted() && permission.getAppOp()
            } else if (permission.isGranted() && ((permission.getAppOp()
                    != AppOpsManager.OP_NONE && permission.isAppOpAllowed()) {
                    != AppOpsManager.OP_NONE && permission.isAppOpAllowed())
                    || permission.getAppOp() == AppOpsManager.OP_NONE)) {
                return true;
                return true;
            }
            }
        }
        }
+0 −13
Original line number Original line Diff line number Diff line
@@ -84,13 +84,6 @@ public class Utils {
            return false;
            return false;
        }
        }


        // Yes this is possible. We have leftover permissions that
        // are not in the final groups and we want to get rid of,
        // therefore we do not have app ops for legacy support.
        if (!group.hasRuntimePermission() && !group.hasAppOpPermission()) {
            return false;
        }

        final boolean isPlatformPermission = group.getDeclaringPackage().equals(OS_PKG);
        final boolean isPlatformPermission = group.getDeclaringPackage().equals(OS_PKG);
        // Show legacy permissions only if the user chose that.
        // Show legacy permissions only if the user chose that.
        if (isPlatformPermission
        if (isPlatformPermission
@@ -108,12 +101,6 @@ public class Utils {
            return false;
            return false;
        }
        }


        // Yes this is possible. We have leftover permissions that
        // are not in the final groups and we want to get rid of,
        // therefore we do not have app ops for legacy support.
        if (!app.hasRuntimePermissions() && !app.hasAppOpPermissions()) {
            return false;
        }
        return true;
        return true;
    }
    }