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
diff --git a/src/com/android/packageinstaller/permission/model/AppPermissionGroup.java b/src/com/android/packageinstaller/permission/model/AppPermissionGroup.java
index 9d65bcc..e54b702 100644
--- a/src/com/android/packageinstaller/permission/model/AppPermissionGroup.java
+++ b/src/com/android/packageinstaller/permission/model/AppPermissionGroup.java
@@ -275,8 +275,9 @@
                 if (permission.isGranted()) {
                     return true;
                 }
-            } else if (permission.isGranted() && permission.getAppOp()
-                    != AppOpsManager.OP_NONE && permission.isAppOpAllowed()) {
+            } else if (permission.isGranted() && ((permission.getAppOp()
+                    != AppOpsManager.OP_NONE && permission.isAppOpAllowed())
+                    || permission.getAppOp() == AppOpsManager.OP_NONE)) {
                 return true;
             }
         }
diff --git a/src/com/android/packageinstaller/permission/utils/Utils.java b/src/com/android/packageinstaller/permission/utils/Utils.java
index 7b9a2b6..2940a72 100644
--- a/src/com/android/packageinstaller/permission/utils/Utils.java
+++ b/src/com/android/packageinstaller/permission/utils/Utils.java
@@ -84,13 +84,6 @@
             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);
         // Show legacy permissions only if the user chose that.
         if (isPlatformPermission
@@ -108,12 +101,6 @@
             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;
     }