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

Commit b29f968f authored by Annie Lin's avatar Annie Lin
Browse files

Force consume insets for TaskView behind a flag.

Before: screenshot/AHTugfhQiiZVpSa
After: screenshot/3UjdKdQy43FJuyj
Bug: 384610303
Fix: 399160282
Test: wm presubmit
Flag: com.android.wm.shell.enable_bubble_app_compat_fixes
Change-Id: I33314047c1dd4ee9c6a98a4c4109a257df9e2ccc
parent 0cb9b34e
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -100,6 +100,16 @@ flag {
    }
}

flag {
    name: "enable_bubble_app_compat_fixes"
    namespace: "multitasking"
    description: "Enable fixes for app compat (e.g. insets and layout issues) for bubbles"
    bug: "384610402"
    metadata {
        purpose: PURPOSE_BUGFIX
    }
}

flag {
    name: "enable_taskbar_on_phones"
    namespace: "multitasking"
+5 −0
Original line number Diff line number Diff line
@@ -37,6 +37,11 @@ public class BubbleAnythingFlagHelper {
                && com.android.window.flags.Flags.excludeTaskFromRecents();
    }

    /** Whether creating any bubble and app compat fixes for bubbles are enabled. */
    public static boolean enableCreateAnyBubbleWithAppCompatFixes() {
        return Flags.enableCreateAnyBubble() && Flags.enableBubbleAppCompatFixes();
    }

    /**
     * Whether creating any bubble and transforming to fullscreen, or the overall bubble anything
     * feature is enabled.
+11 −1
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.wm.shell.taskview;

import static android.view.InsetsSource.FLAG_FORCE_CONSUMING;
import static android.view.InsetsSource.FLAG_FORCE_CONSUMING_OPAQUE_CAPTION_BAR;

import static com.android.wm.shell.protolog.ShellProtoLogGroup.WM_SHELL_BUBBLES_NOISY;

import android.annotation.NonNull;
@@ -411,9 +414,16 @@ public class TaskViewTaskController implements ShellTaskOrganizer.TaskListener {
        if (mTaskToken == null) return;
        WindowContainerTransaction wct = new WindowContainerTransaction();
        if (mCaptionInsets != null) {
            int flags = 0;
            if (BubbleAnythingFlagHelper.enableCreateAnyBubbleWithAppCompatFixes()) {
                // When the bubble bar app handle is visible, the caption insets will be set and
                // should always be consumed, otherwise the handle may block app content.
                flags = FLAG_FORCE_CONSUMING | FLAG_FORCE_CONSUMING_OPAQUE_CAPTION_BAR;
            }
            wct.addInsetsSource(mTaskToken, mCaptionInsetsOwner, 0,
                    WindowInsets.Type.captionBar(), mCaptionInsets, null /* boundingRects */,
                    0 /* flags */);
                    flags);

        } else {
            wct.removeInsetsSource(mTaskToken, mCaptionInsetsOwner, 0,
                    WindowInsets.Type.captionBar());