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

Commit 85ccf120 authored by Brian Isganitis's avatar Brian Isganitis Committed by Jon Miranda
Browse files

Better support transient and persistent taskbar in taskbar's overlays.

- Transient taskbar nav threshold now works in overlays.
- Delay closing overlay to transient app-window threshold if necessary.
- Persistent taskbar no longer stashes for EDU overlay.
- EDU overlay provides enough bottom padding for transient and
  persistent taskbar.

Test: Manual
Bug: 217261955
Change-Id: I2ae5612ef70a6d09e22f83f8117cdbf2a0a053b8
Fix: 260769010
parent d31c8bae
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@
            android:id="@+id/edu_start_button"
            android:layout_width="wrap_content"
            android:layout_height="36dp"
            android:layout_marginBottom="92dp"
            android:layout_marginBottom="18dp"
            android:layout_marginTop="32dp"
            app:layout_constraintTop_toBottomOf="@id/content"
            app:layout_constraintBottom_toBottomOf="parent"
+10 −0
Original line number Diff line number Diff line
@@ -877,6 +877,16 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(false);
    }

    /** Called when we want to hide the overlay window when user performs swipe up gesture. */
    public void onSwipeToHideOverlay() {
        mControllers.taskbarOverlayController.hideWindow();
    }

    /** Returns {@code true} if taskbar is stashed. */
    public boolean isTaskbarStashed() {
        return mControllers.taskbarStashController.isStashed();
    }

    /**
     * Called to start the taskbar translation spring to its settled translation (0).
     */
+15 −14
Original line number Diff line number Diff line
@@ -15,11 +15,11 @@
 */
package com.android.launcher3.taskbar;

import static com.android.launcher3.taskbar.TaskbarStashController.FLAG_STASHED_IN_APP_EDU;
import static com.android.launcher3.util.Executors.MAIN_EXECUTOR;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayContext;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayController;
@@ -62,20 +62,21 @@ public class TaskbarEduController implements TaskbarControllers.LoggableTaskbarC
                        : R.layout.taskbar_edu_pages_persistent,
                mPagedView,
                true);

        // Provide enough room for taskbar.
        View startButton = mTaskbarEduView.findViewById(R.id.edu_start_button);
        ViewGroup.MarginLayoutParams layoutParams =
                (ViewGroup.MarginLayoutParams) startButton.getLayoutParams();
        DeviceProfile dp = overlayContext.getDeviceProfile();
        layoutParams.bottomMargin += DisplayController.isTransientTaskbar(overlayContext)
                ? dp.taskbarSize + dp.transientTaskbarMargin
                : dp.taskbarSize;

        mTaskbarEduView.init(new TaskbarEduCallbacks());

        mControllers.navbarButtonsViewController.setSlideInViewVisible(true);
        TaskbarStashController stashController = mControllers.taskbarStashController;
        stashController.updateStateForFlag(FLAG_STASHED_IN_APP_EDU, true);
        stashController.applyState(overlayController.getOpenDuration());

        mTaskbarEduView.setOnCloseBeginListener(() -> {
            mControllers.navbarButtonsViewController.setSlideInViewVisible(false);
            // Post in case view is closing due to gesture navigation. If a gesture is in progress,
            // wait to unstash until after the gesture is finished.
            MAIN_EXECUTOR.post(() -> stashController.resetFlagIfNoGestureInProgress(
                    FLAG_STASHED_IN_APP_EDU));
        });
        mTaskbarEduView.setOnCloseBeginListener(
                () -> mControllers.navbarButtonsViewController.setSlideInViewVisible(false));
        mTaskbarEduView.addOnCloseListener(() -> mTaskbarEduView = null);
        mTaskbarEduView.show();
    }
+2 −5
Original line number Diff line number Diff line
@@ -82,7 +82,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
    public static final int FLAG_IN_SETUP = 1 << 8; // In the Setup Wizard
    public static final int FLAG_STASHED_SMALL_SCREEN = 1 << 9; // phone screen gesture nav, stashed
    public static final int FLAG_STASHED_IN_APP_AUTO = 1 << 10; // Autohide (transient taskbar).
    public static final int FLAG_STASHED_IN_APP_EDU = 1 << 11; // EDU is visible.

    // If any of these flags are enabled, isInApp should return true.
    private static final int FLAGS_IN_APP = FLAG_IN_APP | FLAG_IN_SETUP;
@@ -91,7 +90,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
    private static final int FLAGS_STASHED_IN_APP = FLAG_STASHED_IN_APP_MANUAL
            | FLAG_STASHED_IN_SYSUI_STATE | FLAG_STASHED_IN_APP_EMPTY | FLAG_STASHED_IN_APP_SETUP
            | FLAG_STASHED_IN_APP_IME | FLAG_STASHED_IN_TASKBAR_ALL_APPS
            | FLAG_STASHED_SMALL_SCREEN | FLAG_STASHED_IN_APP_AUTO | FLAG_STASHED_IN_APP_EDU;
            | FLAG_STASHED_SMALL_SCREEN | FLAG_STASHED_IN_APP_AUTO;

    private static final int FLAGS_STASHED_IN_APP_IGNORING_IME =
            FLAGS_STASHED_IN_APP & ~FLAG_STASHED_IN_APP_IME;
@@ -101,8 +100,7 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
    // Currently any flag that causes us to stash in an app is included, except for IME or All Apps
    // since those cover the underlying app anyway and thus the app shouldn't change insets.
    private static final int FLAGS_REPORT_STASHED_INSETS_TO_APP = FLAGS_STASHED_IN_APP
            & ~FLAG_STASHED_IN_APP_IME & ~FLAG_STASHED_IN_TASKBAR_ALL_APPS
            & ~FLAG_STASHED_IN_APP_EDU;
            & ~FLAG_STASHED_IN_APP_IME & ~FLAG_STASHED_IN_TASKBAR_ALL_APPS;

    /**
     * How long to stash/unstash when manually invoked via long press.
@@ -728,7 +726,6 @@ public class TaskbarStashController implements TaskbarControllers.LoggableTaskba
        // Only update the following flags when system gesture is not in progress.
        boolean shouldStashForIme = shouldStashForIme();
        updateStateForFlag(FLAG_STASHED_IN_TASKBAR_ALL_APPS, false);
        updateStateForFlag(FLAG_STASHED_IN_APP_EDU, false);
        if (hasAnyFlag(FLAG_STASHED_IN_APP_IME) != shouldStashForIme) {
            updateStateForFlag(FLAG_STASHED_IN_APP_IME, shouldStashForIme);
            applyState(TASKBAR_STASH_DURATION_FOR_IME, getTaskbarStashStartDelayForIme());
+4 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import androidx.annotation.Nullable;

import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.ItemInfoWithIcon;
import com.android.launcher3.util.DisplayController;
import com.android.quickstep.views.RecentsView;
import com.android.quickstep.views.TaskView;

@@ -84,8 +85,10 @@ public class TaskbarUIController {
     * Manually closes the overlay window.
     */
    public void hideOverlayWindow() {
        if (!DisplayController.isTransientTaskbar(mControllers.taskbarActivityContext)) {
            mControllers.taskbarOverlayController.hideWindow();
        }
    }

    /**
     * User expands PiP to full-screen (or split-screen) mode, try to hide the Taskbar.
Loading