Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 632e4afb authored by Jesse Evans's avatar Jesse Evans Committed by android-build-merger
Browse files

Merge "Fix instant app filtering in ApplicationsState" into oc-dev am: 9bdaa9c9

am: 78302671

Change-Id: Id5a474354f69264a6959e8334f014860f6c98c8e
parents e0c9bc15 78302671
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1502,7 +1502,8 @@ public class ApplicationsState {

        @Override
        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;
        }
    };

+16 −0
Original line number Diff line number Diff line
@@ -200,6 +200,22 @@ public class ApplicationsStateTest {
        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
    public void testDisabledFilterRejectsInstantApp() {
        mEntry.info.enabled = false;