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

Commit a86115fd authored by Daniel Nishi's avatar Daniel Nishi
Browse files

Add a photos app filter and a metric for using it.

Bug: 64147318
Test: SettingsLib integ tests
Change-Id: I4cae384fa565ac0928177bd85804d7904cd6156c
parent 743cfba7
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -1638,6 +1638,21 @@ public class ApplicationsState {
        }
    };

    public static final AppFilter FILTER_PHOTOS =
            new AppFilter() {
                @Override
                public void init() {}

                @Override
                public boolean filterApp(AppEntry entry) {
                    boolean isPhotosApp;
                    synchronized (entry) {
                        isPhotosApp = entry.info.category == ApplicationInfo.CATEGORY_IMAGE;
                    }
                    return isPhotosApp;
                }
            };

    public static final AppFilter FILTER_OTHER_APPS =
            new AppFilter() {
                @Override
+21 −0
Original line number Diff line number Diff line
@@ -109,6 +109,27 @@ public class ApplicationsStateTest {
        assertThat(ApplicationsState.FILTER_OTHER_APPS.filterApp(mEntry)).isTrue();
    }

    @Test
    public void testPhotosFilterAcceptsFilter() {
        mEntry.info.category = ApplicationInfo.CATEGORY_IMAGE;

        assertThat(ApplicationsState.FILTER_PHOTOS.filterApp(mEntry)).isTrue();
    }

    @Test
    public void testPhotosFilterRejectsNotPhotos() {
        mEntry.info.category = ApplicationInfo.CATEGORY_VIDEO;

        assertThat(ApplicationsState.FILTER_PHOTOS.filterApp(mEntry)).isFalse();
    }

    @Test
    public void testPhotosFilterRejectsDefaultCategory() {
        mEntry.info.category = ApplicationInfo.CATEGORY_UNDEFINED;

        assertThat(ApplicationsState.FILTER_PHOTOS.filterApp(mEntry)).isFalse();
    }

    @Test
    public void testDownloadAndLauncherAndInstantAcceptsCorrectApps() {
        // should include instant apps
+5 −0
Original line number Diff line number Diff line
@@ -4281,6 +4281,11 @@ message MetricsEvent {
    // the app transition.
    APP_TRANSITION_REPORTED_DRAWN_MS = 1091;

    // OPEN: Settings > Storage > Photos & Videos
    // CATEGORY: SETTINGS
    // OS: O MR
    APPLICATIONS_STORAGE_PHOTOS = 1092;

    // ---- End O-MR1 Constants, all O-MR1 constants go above this line ----

    // OPEN: Settings > Network & Internet > Mobile network