Merge "Fix instant app filtering in ApplicationsState" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
9bdaa9c9fa
@ -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;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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;
|
||||||
|
Reference in New Issue
Block a user