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

Commit 54c78252 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Change PermissionAppFragment's header for Location to "Allowed all the time""

parents af178253 592f30a3
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -472,6 +472,9 @@
    <!-- Header for granted permissions/apps [CHAR LIMIT=40] -->
    <string name="allowed_header">Allowed</string>

    <!-- Header for granted apps that can access the permission in the foreground and the background [CHAR LIMIT=40] -->
    <string name="allowed_always_header">Allowed all the time</string>

    <!-- Header for permissions/apps that are granted only when in the foreground [CHAR LIMIT=40] -->
    <string name="allowed_foreground_header">Allowed only while in use</string>

+8 −0
Original line number Diff line number Diff line
@@ -233,6 +233,7 @@ public final class PermissionAppsFragment extends SettingsWithLargeHeader implem

        mHasSystemApps = false;
        boolean menuOptionsInvalided = false;
        boolean hasPermissionWithBackgroundMode = false;

        ArrayList<PermissionApp> sortedApps = new ArrayList<>(permissionApps.getApps());
        sortedApps.sort((x, y) -> mCollator.compare(x.getLabel(), y.getLabel()));
@@ -241,6 +242,9 @@ public final class PermissionAppsFragment extends SettingsWithLargeHeader implem
            PermissionApp app = sortedApps.get(i);
            AppPermissionGroup group = app.getPermissionGroup();

            hasPermissionWithBackgroundMode =
                    hasPermissionWithBackgroundMode || group.hasPermissionWithBackgroundMode();

            if (!Utils.shouldShowPermission(getContext(), group)) {
                continue;
            }
@@ -342,6 +346,10 @@ public final class PermissionAppsFragment extends SettingsWithLargeHeader implem
                    grantedCount, mExtraScreen.getPreferenceCount()));
        }

        if (hasPermissionWithBackgroundMode) {
            allowed.setTitle(R.string.allowed_always_header);
        }

        if (allowed.getPreferenceCount() == 0) {
            Preference empty = new Preference(context);
            empty.setTitle(getString(R.string.no_apps_allowed));