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

Commit dedcca44 authored by Svet Ganov's avatar Svet Ganov
Browse files

Fix missing case to update permission group subtitle

Permissions in some groups are individually controlled if
permission review mode is enabled. We were not properly
updating the subtitle of a group with individually controlled
permissions.

Also while at this fix a bug where we grnated an intividually
controller group if the user granted two permissions in the
group.

Test: manual

bug:33463159
bug:35622170

Change-Id: I0913531d69668ccf2c2fdd3cdf0d9e9a42e67dc0
parent 0c389b9d
Loading
Loading
Loading
Loading
+9 −4
Original line number Diff line number Diff line
@@ -316,20 +316,25 @@ public final class AllAppPermissionsFragment extends SettingsWithHeader {
                    // because another permission in the group is granted. This applies
                    // only to apps that support runtime permissions.
                    if (appPermissionGroup.doesSupportRuntimePermissions()) {
                        int grantedCount = 0;
                        String[] revokedPermissionsToFix = null;
                        final int permissionCount = appPermissionGroup.getPermissions().size();
                        for (int i = 0; i < permissionCount; i++) {
                            Permission current = appPermissionGroup.getPermissions().get(i);
                            if (!current.isGranted() && !current.isUserFixed()) {
                            if (!current.isGranted()) {
                                if (!current.isUserFixed()) {
                                    revokedPermissionsToFix = ArrayUtils.appendString(
                                            revokedPermissionsToFix, current.getName());
                                }
                            } else {
                                grantedCount++;
                            }
                        }
                        if (revokedPermissionsToFix != null) {
                            // If some permissions were not granted then they should be fixed.
                            appPermissionGroup.revokeRuntimePermissions(true,
                                    revokedPermissionsToFix);
                        } else {
                        } else if (appPermissionGroup.getPermissions().size() == grantedCount) {
                            // If all permissions are granted then they should not be fixed.
                            appPermissionGroup.grantRuntimePermissions(false);
                        }
+3 −2
Original line number Diff line number Diff line
@@ -321,11 +321,12 @@ public final class AppPermissionsFragment extends SettingsWithHeader
                        .setPositiveButton(R.string.grant_dialog_button_deny_anyway,
                                (DialogInterface dialog, int which) -> {
                            ((SwitchPreference) preference).setChecked(false);
                            if (preference instanceof MultiTargetSwitchPreference) {
                            group.revokeRuntimePermissions(false);
                            if (Utils.areGroupPermissionsIndividuallyControlled(getContext(),
                                    group.getName())) {
                                updateSummaryForIndividuallyControlledPermissionGroup(
                                        group, preference);
                            }
                            group.revokeRuntimePermissions(false);
                            if (!grantedByDefault) {
                                mHasConfirmedRevoke = true;
                            }