summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Daniel Nishi <dhnishi@google.com> 2017-03-31 10:20:08 -0700
committer Daniel Nishi <dhnishi@google.com> 2017-04-07 14:26:38 -0700
commit140ceb1dccabe79468586a7ef74ed02ec114485c (patch)
tree479efb8540358062725f139564e2b8f980f3d492
parent45c23fa6894b790ccb065552921563342d95942b (diff)
Use the real filters when determining Other Apps.
This fixes a bug where an app could be classified twice. Fixes: 36535527 Test: SettingsLib Unit Test Change-Id: I830a76fa33680b1dd71b285d9419139f84f1d60d
-rw-r--r--packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java33
-rw-r--r--packages/SettingsLib/tests/integ/src/com/android/settingslib/applications/ApplicationsStateTest.java7
2 files changed, 24 insertions, 16 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
index 296b4d6f5c05..02f1162fc968 100644
--- a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
+++ b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
@@ -1616,20 +1616,21 @@ public class ApplicationsState {
}
};
- public static final AppFilter FILTER_OTHER_APPS = new AppFilter() {
- @Override
- public void init() {
- }
-
- @Override
- public boolean filterApp(AppEntry entry) {
- boolean isCategorized;
- synchronized(entry) {
- isCategorized = entry.info.category == ApplicationInfo.CATEGORY_AUDIO ||
- entry.info.category == ApplicationInfo.CATEGORY_GAME ||
- entry.info.category == ApplicationInfo.CATEGORY_VIDEO;
- }
- return !isCategorized;
- }
- };
+ public static final AppFilter FILTER_OTHER_APPS =
+ new AppFilter() {
+ @Override
+ public void init() {}
+
+ @Override
+ public boolean filterApp(AppEntry entry) {
+ boolean isCategorized;
+ synchronized (entry) {
+ isCategorized =
+ FILTER_AUDIO.filterApp(entry)
+ || FILTER_GAMES.filterApp(entry)
+ || FILTER_MOVIES.filterApp(entry);
+ }
+ return !isCategorized;
+ }
+ };
}
diff --git a/packages/SettingsLib/tests/integ/src/com/android/settingslib/applications/ApplicationsStateTest.java b/packages/SettingsLib/tests/integ/src/com/android/settingslib/applications/ApplicationsStateTest.java
index d6ab8d2f2587..c680b2a2ce4b 100644
--- a/packages/SettingsLib/tests/integ/src/com/android/settingslib/applications/ApplicationsStateTest.java
+++ b/packages/SettingsLib/tests/integ/src/com/android/settingslib/applications/ApplicationsStateTest.java
@@ -174,6 +174,13 @@ public class ApplicationsStateTest {
}
@Test
+ public void testOtherAppsRejectsLegacyGame() {
+ mEntry.info.flags = ApplicationInfo.FLAG_IS_GAME;
+
+ assertThat(ApplicationsState.FILTER_OTHER_APPS.filterApp(mEntry)).isFalse();
+ }
+
+ @Test
public void testInstantFilterAcceptsInstantApp() {
when(mEntry.info.isInstantApp()).thenReturn(true);
assertThat(ApplicationsState.FILTER_INSTANT.filterApp(mEntry)).isTrue();