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
This commit is contained in:
Antony Sargent
2017-02-10 11:03:02 -08:00
parent 011d78ae47
commit 05e8dfde9d
2 changed files with 19 additions and 9 deletions

View File

@@ -3454,9 +3454,9 @@
<string name="filter_dlg_title">Choose filter options</string>
<!-- Text for filter option in ManageApps screen to display all installed
applications -->
<string name="filter_apps_all">All</string>
<string name="filter_apps_all">All apps</string>
<!-- [CHAR LIMIT=NONE] Text for filter option in ManageApps screen to display disabled apps -->
<string name="filter_apps_disabled">Disabled</string>
<string name="filter_apps_disabled">Disabled apps</string>
<!-- Text for filter option in ManageApps screen to display third party
applications only -->
<string name="filter_apps_third_party">Downloaded</string>
@@ -6884,7 +6884,9 @@
<!-- Label for showing all apps in list [CHAR LIMIT=30] -->
<string name="filter_all_apps">All apps</string>
<!-- Label for showing enabled apps in list [CHAR LIMIT=30] -->
<string name="filter_enabled_apps">Enabled</string>
<string name="filter_enabled_apps">Installed apps</string>
<!-- Label for showing instant apps in list [CHAR LIMIT=30] -->
<string name="filter_instant_apps">Instant apps</string>
<!-- Label for showing personal apps in list [CHAR LIMIT=30] -->
<string name="filter_personal_apps">Personal</string>
<!-- Label for showing work apps in list [CHAR LIMIT=30] -->

View File

@@ -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<CharSequence> {
private final ManageApplications mManageApplications;
@@ -1042,6 +1049,7 @@ public class ManageApplications extends InstrumentedPreferenceFragment
}
mManageApplications.setHasDisabled(mState.haveDisabledApps());
mManageApplications.setHasInstant(mState.haveInstantApps());
}
private void rebuildSections() {