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

Commit 78302671 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

Change-Id: I1f3b4dfe6c6f9f53c9af5483ab4b31726026d219
parents 7031cdda 9bdaa9c9
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;