Merge "Fix instant app filtering in ApplicationsState" into oc-dev

This commit is contained in:
TreeHugger Robot
2017-04-14 04:49:39 +00:00
committed by Android (Google) Code Review
2 changed files with 18 additions and 1 deletions

View File

@ -1502,7 +1502,8 @@ public class ApplicationsState {
@Override @Override
public boolean filterApp(AppEntry entry) { public boolean filterApp(AppEntry entry) {
return (entry.info.privateFlags & ApplicationInfo.PRIVATE_FLAG_HAS_DOMAIN_URLS) != 0; return !AppUtils.isInstant(entry.info)
&& (entry.info.privateFlags & ApplicationInfo.PRIVATE_FLAG_HAS_DOMAIN_URLS) != 0;
} }
}; };

View File

@ -200,6 +200,22 @@ public class ApplicationsStateTest {
assertThat(ApplicationsState.FILTER_ALL_ENABLED.filterApp(mEntry)).isFalse(); assertThat(ApplicationsState.FILTER_ALL_ENABLED.filterApp(mEntry)).isFalse();
} }
@Test
public void testFilterWithDomainUrls() {
mEntry.info.privateFlags |= ApplicationInfo.PRIVATE_FLAG_HAS_DOMAIN_URLS;
// should included updated system apps
when(mEntry.info.isInstantApp()).thenReturn(false);
assertThat(ApplicationsState.FILTER_WITH_DOMAIN_URLS.filterApp(mEntry))
.isTrue();
mEntry.info.privateFlags &= ~ApplicationInfo.PRIVATE_FLAG_HAS_DOMAIN_URLS;
assertThat(ApplicationsState.FILTER_WITH_DOMAIN_URLS.filterApp(mEntry))
.isFalse();
mEntry.info.privateFlags |= ApplicationInfo.PRIVATE_FLAG_HAS_DOMAIN_URLS;
when(mEntry.info.isInstantApp()).thenReturn(true);
assertThat(ApplicationsState.FILTER_WITH_DOMAIN_URLS.filterApp(mEntry))
.isFalse();
}
@Test @Test
public void testDisabledFilterRejectsInstantApp() { public void testDisabledFilterRejectsInstantApp() {
mEntry.info.enabled = false; mEntry.info.enabled = false;