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

Commit 0cbfca13 authored by Maryam Dehaini's avatar Maryam Dehaini
Browse files

Put education changes under new flag

Education feature might be released after the APIs that were added, so
the changes need to be put under a new flag.

Test: m
Bug: 359226240
Flag: com.android.window.flags.enable_desktop_windowing_app_to_web_education_integration
Change-Id: I30115487d8571f343bd965c1713b0362e4afcfa3
parent ed6a189e
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -116,7 +116,12 @@ class AppToWebEducationController(
    }

    private inline fun runIfEducationFeatureEnabled(block: () -> Unit) {
        if (canEnterDesktopMode(context) && Flags.enableDesktopWindowingAppToWebEducation()) block()
        if (
            canEnterDesktopMode(context) &&
                Flags.enableDesktopWindowingAppToWebEducationIntegration()
        ) {
            block()
        }
    }

    private fun showEducation(captionState: CaptionState, colorScheme: EducationColorScheme) {
+2 −2
Original line number Diff line number Diff line
@@ -1428,7 +1428,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
                /* openInBrowserClickListener= */ (intent) -> {
                    mOpenInBrowserClickListener.accept(intent);
                    onCapturedLinkExpired();
                    if (Flags.enableDesktopWindowingAppToWebEducation()) {
                    if (Flags.enableDesktopWindowingAppToWebEducationIntegration()) {
                        mWindowDecorCaptionHandleRepository.onAppToWebUsage();
                    }
                    return Unit.INSTANCE;
@@ -1681,7 +1681,7 @@ public class DesktopModeWindowDecoration extends WindowDecoration<WindowDecorLin
    /** Returns true if at least one education flag is enabled. */
    private boolean isEducationEnabled() {
        return Flags.enableDesktopWindowingAppHandleEducation()
                || Flags.enableDesktopWindowingAppToWebEducation();
                || Flags.enableDesktopWindowingAppToWebEducationIntegration();
    }

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -1429,7 +1429,7 @@ public class DesktopModeWindowDecorationTests extends ShellTestCase {

    @Test
    @DisableFlags({Flags.FLAG_ENABLE_DESKTOP_WINDOWING_APP_HANDLE_EDUCATION,
            Flags.FLAG_ENABLE_DESKTOP_WINDOWING_APP_TO_WEB_EDUCATION})
            Flags.FLAG_ENABLE_DESKTOP_WINDOWING_APP_TO_WEB_EDUCATION_INTEGRATION})
    public void notifyCaptionStateChanged_flagDisabled_doNoNotify() {
        when(DesktopModeStatus.canEnterDesktopMode(mContext)).thenReturn(true);
        final ActivityManager.RunningTaskInfo taskInfo = createTaskInfo(/* visible= */ true);