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

Commit 1384dd6b authored by Marzia Favaro's avatar Marzia Favaro
Browse files

Enable app handle on foldables

Test: DesktopModeWindowDecorViewModelAppHandleOnlyTest
Test: DesktopModeWindowDecorViewModelTests
Bug: 377689543
Flag: com.android.window.flags.show_app_handle_large_screens
Change-Id: Ia7cccdea68916744c733e865c303900af829391f
parent 24b7260a
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -281,5 +281,8 @@ public class DesktopModeStatus {
        SystemProperties.Handle maxTaskLimitHandle = SystemProperties.find(MAX_TASK_LIMIT_SYS_PROP);
        pw.print(innerPrefix); pw.print("maxTaskLimit sysprop=");
        pw.println(maxTaskLimitHandle == null ? "null" : maxTaskLimitHandle.getInt(/* def= */ -1));

        pw.print(innerPrefix); pw.print("showAppHandle config override=");
        pw.print(context.getResources().getBoolean(R.bool.config_enableAppHandle));
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -636,7 +636,7 @@ public abstract class WMShellBaseModule {
    static Optional<FreeformComponents> provideFreeformComponents(
            @DynamicOverride Optional<FreeformComponents> freeformComponents,
            Context context) {
        if (FreeformComponents.isFreeformEnabled(context)) {
        if (FreeformComponents.requiresFreeformComponents(context)) {
            return freeformComponents;
        }
        return Optional.empty();
@@ -992,7 +992,7 @@ public abstract class WMShellBaseModule {
        // Lazy ensures that this provider will not be the cause the dependency is created
        // when it will not be returned due to the condition below.
        return desktopTasksController.flatMap((lazy) -> {
            if (DesktopModeStatus.canEnterDesktopMode(context)) {
            if (DesktopModeStatus.canEnterDesktopModeOrShowAppHandle(context)) {
                return Optional.of(lazy.get());
            }
            return Optional.empty();
+5 −4
Original line number Diff line number Diff line
@@ -307,7 +307,7 @@ public abstract class WMShellModule {
            Optional<DesktopActivityOrientationChangeHandler> desktopActivityOrientationHandler,
            FocusTransitionObserver focusTransitionObserver,
            DesktopModeEventLogger desktopModeEventLogger) {
        if (DesktopModeStatus.canEnterDesktopMode(context)) {
        if (DesktopModeStatus.canEnterDesktopModeOrShowAppHandle(context)) {
            return new DesktopModeWindowDecorViewModel(
                    context,
                    mainExecutor,
@@ -406,7 +406,7 @@ public abstract class WMShellModule {
            Optional<TaskChangeListener> taskChangeListener) {
        // TODO(b/238217847): Temporarily add this check here until we can remove the dynamic
        //                    override for this controller from the base module
        ShellInit init = FreeformComponents.isFreeformEnabled(context) ? shellInit : null;
        ShellInit init = FreeformComponents.requiresFreeformComponents(context) ? shellInit : null;
        return new FreeformTaskListener(
                context,
                init,
@@ -847,7 +847,7 @@ public abstract class WMShellModule {
            DisplayController displayController,
            ShellTaskOrganizer shellTaskOrganizer,
            ShellCommandHandler shellCommandHandler) {
        if (DesktopModeStatus.canEnterDesktopMode(context)) {
        if (DesktopModeStatus.canEnterDesktopModeOrShowAppHandle(context)) {
            return Optional.of(
                    new DesktopImmersiveController(
                            shellInit,
@@ -1074,7 +1074,8 @@ public abstract class WMShellModule {
            ShellInit shellInit,
            RootTaskDisplayAreaOrganizer rootTaskDisplayAreaOrganizer
    ) {
        if (!DesktopModeStatus.canEnterDesktopMode(context)) {
        if (!DesktopModeStatus.canEnterDesktopMode(context)
                && !DesktopModeStatus.overridesShowAppHandle(context)) {
            return Optional.empty();
        }
        return Optional.of(
+9 −0
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import android.content.Context;
import android.provider.Settings;

import com.android.wm.shell.ShellTaskOrganizer;
import com.android.wm.shell.shared.desktopmode.DesktopModeStatus;
import com.android.wm.shell.transition.Transitions;

import java.util.Optional;
@@ -59,4 +60,12 @@ public class FreeformComponents {
                || Settings.Global.getInt(context.getContentResolver(),
                DEVELOPMENT_ENABLE_FREEFORM_WINDOWS_SUPPORT, 0) != 0;
    }

    /**
     * Freeform is enabled or we need the components to enable the app handle when desktop mode is
     * not enabled
     */
    public static boolean requiresFreeformComponents(Context context) {
        return isFreeformEnabled(context) || DesktopModeStatus.overridesShowAppHandle(context);
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ public class FreeformTaskTransitionObserver implements Transitions.TransitionObs
        mWindowDecorViewModel = windowDecorViewModel;
        mTaskChangeListener = taskChangeListener;
        mFocusTransitionObserver = focusTransitionObserver;
        if (FreeformComponents.isFreeformEnabled(context)) {
        if (FreeformComponents.requiresFreeformComponents(context)) {
            shellInit.addInitCallback(this::onInit, this);
        }
    }
Loading