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

Unverified Commit 5b8f2176 authored by Michael W's avatar Michael W Committed by Michael Bestas
Browse files

Trebuchet: Don't show split screen options ...

... when window animations are disabled

* Everything about split screen relies on animations
* Do not show the option to split the screen when they were disabled
  (which can be done either via accessibility or developer settings)

Change-Id: I834308a7220e1027d6c54e346ff551369c7d292e
parent 5bdcc696
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.graphics.Insets;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.os.Build;
import android.provider.Settings;
import android.view.View;
import android.widget.Toast;

@@ -136,9 +137,10 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
        ActivityManager activityManager =
                (ActivityManager) taskView.getContext().getSystemService(Context.ACTIVITY_SERVICE);
        boolean isLockTaskMode = activityManager.isInLockTaskMode();
        boolean windowAnimationsDisabled = areWindowAnimationsDisabled(taskView.getContext());

        if (taskViewHasMultipleTasks || notEnoughTasksToSplit || isLockTaskMode ||
                (isFocusedTask && isTaskInExpectedScrollPosition)) {
                (isFocusedTask && isTaskInExpectedScrollPosition) || windowAnimationsDisabled) {
            return;
        }

@@ -149,6 +151,11 @@ public class TaskOverlayFactory implements ResourceBasedOverride {
        }
    }

    private static boolean areWindowAnimationsDisabled(Context context) {
        return Settings.Global.getFloat(context.getContentResolver(),
                Settings.Global.WINDOW_ANIMATION_SCALE, 1f) == 0f;
    }

    public TaskOverlay createOverlay(TaskThumbnailView thumbnailView) {
        return new TaskOverlay(thumbnailView);
    }