diff options
author | Joel Galenson <jgalenson@google.com> | 2019-03-27 13:30:15 -0700 |
---|---|---|
committer | Joel Galenson <jgalenson@google.com> | 2019-03-27 14:12:15 -0700 |
commit | 6165e8f56b4cbdddd38746a663a6ac3fa640fe1d (patch) | |
tree | 185fa65491b6179b7de344cbd7215603fc75c03b | |
parent | 965c73d4726fc9232a3543adacfdd6c7ba87642d (diff) | |
download | android_packages_apps_PackageInstaller-6165e8f56b4cbdddd38746a663a6ac3fa640fe1d.tar.gz android_packages_apps_PackageInstaller-6165e8f56b4cbdddd38746a663a6ac3fa640fe1d.tar.bz2 android_packages_apps_PackageInstaller-6165e8f56b4cbdddd38746a663a6ac3fa640fe1d.zip |
After filtering Permissions Hub by permission, make the back button return to the unfiltered view.
Previously, filtering by a permission group simply changed the filter
in the current fragment. Thus pressing the back button returned to
the previous screen instead of undoing the filter. This changes that
behavior.
Also update the string for removing the filter.
Fixes: 129415632
Test: Open Permissions Hub, filter by group, press back, see
Permissions Hub.
Test: Open filtered view, press "See all", press back, see filtered
view.
Test: Launch filtered view initially, press back, return to parent.
Change-Id: Id77b24bb30986ddbe8826297cd2d6187f1786a41
-rw-r--r-- | res/values/strings.xml | 2 | ||||
-rw-r--r-- | src/com/android/packageinstaller/permission/ui/handheld/PermissionUsageFragment.java | 22 |
2 files changed, 11 insertions, 13 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml index ddb318aa..70a3f283 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -344,7 +344,7 @@ <string name="app_permission_usage_filter_label">Filtered by: <xliff:g id="perm" example="Location">%1$s</xliff:g> </string> <!-- Label for the text that removes the filter by permission to view all usages [CHAR LIMIT=none] --> - <string name="app_permission_usage_remove_filter">Remove filter</string> + <string name="app_permission_usage_remove_filter">See all in Dashboard</string> <!-- Label for the title of the dialog allowing filtering by permissions [CHAR LIMIT=none] --> <string name="filter_by_title">Filter by</string> diff --git a/src/com/android/packageinstaller/permission/ui/handheld/PermissionUsageFragment.java b/src/com/android/packageinstaller/permission/ui/handheld/PermissionUsageFragment.java index bcf148e7..91bc5465 100644 --- a/src/com/android/packageinstaller/permission/ui/handheld/PermissionUsageFragment.java +++ b/src/com/android/packageinstaller/permission/ui/handheld/PermissionUsageFragment.java @@ -50,6 +50,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.StringRes; import androidx.fragment.app.DialogFragment; +import androidx.fragment.app.Fragment; import androidx.preference.PreferenceCategory; import androidx.preference.PreferenceScreen; @@ -200,6 +201,8 @@ public class PermissionUsageFragment extends SettingsWithLargeHeader implements setProgressBarVisible(true); } + hideHeader(); + reloadData(); } @@ -417,7 +420,6 @@ public class PermissionUsageFragment extends SettingsWithLargeHeader implements // Update header. if (mFilterGroup == null) { screen.addPreference(createBarChart(usages, timeFilterItem, context)); - hideHeader(); } else { AppPermissionGroup group = getGroup(mFilterGroup); if (group != null) { @@ -426,9 +428,7 @@ public class PermissionUsageFragment extends SettingsWithLargeHeader implements context.getString(R.string.app_permission_usage_filter_label, group.getLabel()), null); setSummary(context.getString(R.string.app_permission_usage_remove_filter), v -> { - mFilterGroup = null; - // We already loaded all data, so don't reload - updateUI(); + onPermissionGroupSelected(null); }); } } @@ -602,11 +602,7 @@ public class PermissionUsageFragment extends SettingsWithLargeHeader implements BarViewInfo barViewInfo = new BarViewInfo(icon, count, group.getLabel(), context.getResources().getQuantityString(R.plurals.permission_usage_bar_label, count, count), group.getLabel()); - barViewInfo.setClickListener(v -> { - mFilterGroup = group.getName(); - // We already loaded all data, so don't reload - updateUI(); - }); + barViewInfo.setClickListener(v -> onPermissionGroupSelected(group.getName())); builder.addBarViewInfo(barViewInfo); } @@ -873,9 +869,11 @@ public class PermissionUsageFragment extends SettingsWithLargeHeader implements * all entries. */ private void onPermissionGroupSelected(@Nullable String selectedGroup) { - mFilterGroup = selectedGroup; - // We already loaded all data, so don't reload - updateUI(); + Fragment frag = newInstance(selectedGroup, mFilterTimes.get(mFilterTimeIndex).getTime()); + getFragmentManager().beginTransaction() + .replace(android.R.id.content, frag) + .addToBackStack("PermissionUsage") + .commit(); } /** |