From 05e8dfde9dca86e4a9c5398d9cab193559948fd2 Mon Sep 17 00:00:00 2001 From: Antony Sargent Date: Fri, 10 Feb 2017 11:03:02 -0800 Subject: [PATCH] Add "Instant apps" filter to app listing Bug: 35098444 Test: automated testing of ManageApplications is hard (b/34768986), so testing is manual for now: install at least one instant app and then go to Settings->Apps&Notifications->Apps and see if the filter lets you see only instant apps. In Settings->Apps&Notifications->Apps, the list of filters before this CL is: All | Enabled | Disabled With this CL, the filter list becomes: All apps | Installed apps | Disabled apps | Instant apps Change-Id: I65ffbfd7db99f45fc0310c7239bdfc0522c65e3a --- res/values/strings.xml | 8 +++++--- .../applications/ManageApplications.java | 20 +++++++++++++------ 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 852e81d94f1..44a1c000271 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -3454,9 +3454,9 @@ Choose filter options - All + All apps - Disabled + Disabled apps Downloaded @@ -6884,7 +6884,9 @@ All apps - Enabled + Installed apps + + Instant apps Personal diff --git a/src/com/android/settings/applications/ManageApplications.java b/src/com/android/settings/applications/ManageApplications.java index d5f7f78c50d..2ca5feea681 100644 --- a/src/com/android/settings/applications/ManageApplications.java +++ b/src/com/android/settings/applications/ManageApplications.java @@ -136,12 +136,13 @@ public class ManageApplications extends InstrumentedPreferenceFragment public static final int FILTER_APPS_ALL = 2; public static final int FILTER_APPS_ENABLED = 3; public static final int FILTER_APPS_DISABLED = 4; - public static final int FILTER_APPS_BLOCKED = 5; - public static final int FILTER_APPS_PERSONAL = 6; - public static final int FILTER_APPS_WORK = 7; - public static final int FILTER_APPS_USAGE_ACCESS = 8; - public static final int FILTER_APPS_WITH_OVERLAY = 9; - public static final int FILTER_APPS_WRITE_SETTINGS = 10; + public static final int FILTER_APPS_INSTANT = 5; + public static final int FILTER_APPS_BLOCKED = 6; + public static final int FILTER_APPS_PERSONAL = 7; + public static final int FILTER_APPS_WORK = 8; + public static final int FILTER_APPS_USAGE_ACCESS = 9; + public static final int FILTER_APPS_WITH_OVERLAY = 10; + public static final int FILTER_APPS_WRITE_SETTINGS = 11; public static final int FILTER_APPS_INSTALL_SOURCES = 12; // Storage types. Used to determine what the extra item in the list of preferences is. @@ -155,6 +156,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment R.string.filter_all_apps, // All apps R.string.filter_enabled_apps, // Enabled R.string.filter_apps_disabled, // Disabled + R.string.filter_instant_apps, // Instant apps R.string.filter_notif_blocked_apps, // Blocked Notifications R.string.filter_personal_apps, // Personal R.string.filter_work_apps, // Work @@ -174,6 +176,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment ApplicationsState.FILTER_EVERYTHING, // All apps ApplicationsState.FILTER_ALL_ENABLED, // Enabled ApplicationsState.FILTER_DISABLED, // Disabled + ApplicationsState.FILTER_INSTANT, // Instant AppStateNotificationBridge.FILTER_APP_NOTIFICATION_BLOCKED, // Blocked Notifications ApplicationsState.FILTER_PERSONAL, // Personal ApplicationsState.FILTER_WORK, // Work @@ -691,6 +694,10 @@ public class ManageApplications extends InstrumentedPreferenceFragment mFilterAdapter.setFilterEnabled(FILTER_APPS_DISABLED, hasDisabledApps); } + public void setHasInstant(boolean haveInstantApps) { + mFilterAdapter.setFilterEnabled(FILTER_APPS_INSTANT, haveInstantApps); + } + static class FilterSpinnerAdapter extends ArrayAdapter { private final ManageApplications mManageApplications; @@ -1042,6 +1049,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment } mManageApplications.setHasDisabled(mState.haveDisabledApps()); + mManageApplications.setHasInstant(mState.haveInstantApps()); } private void rebuildSections() {