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

Commit afc3bff1 authored by Sam Dubey's avatar Sam Dubey
Browse files

Revert "Add a way to stash/unstash transient taskbar."

This reverts commit 6163e2d3.

Reason for revert: Part of Platinum+DM rotation for testing as likely culprit for breaking launcher tests on tablet. Won't be commited until proven otherwise.

Bug: 256988243
Bug: 256987492
Change-Id: I21b3561f489e17c48131d2223a7d90267968232f
parent 6163e2d3
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -292,7 +292,6 @@
    <dimen name="taskbar_app_window_threshold">150dp</dimen>
    <dimen name="taskbar_home_overview_threshold">225dp</dimen>
    <dimen name="taskbar_catch_up_threshold">300dp</dimen>
    <dimen name="taskbar_nav_threshold">40dp</dimen>

    <!--  Taskbar 3 button spacing  -->
    <dimen name="taskbar_button_space_inbetween">24dp</dimen>
+9 −40
Original line number Diff line number Diff line
@@ -24,8 +24,6 @@ import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL;
import static com.android.launcher3.AbstractFloatingView.TYPE_ALL;
import static com.android.launcher3.AbstractFloatingView.TYPE_REBIND_SAFE;
import static com.android.launcher3.logging.StatsLogManager.LauncherEvent.LAUNCHER_FOLDER_OPEN;
import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_DRAGGING;
import static com.android.launcher3.taskbar.TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN;
import static com.android.launcher3.taskbar.TaskbarManager.FLAG_HIDE_NAVBAR_WINDOW;
import static com.android.launcher3.testing.shared.ResourceUtils.getBoolByName;
import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_NOTIFICATION_PANEL_EXPANDED;
@@ -77,7 +75,6 @@ import com.android.launcher3.model.data.FolderInfo;
import com.android.launcher3.model.data.ItemInfo;
import com.android.launcher3.model.data.WorkspaceItemInfo;
import com.android.launcher3.popup.PopupDataProvider;
import com.android.launcher3.taskbar.TaskbarAutohideSuspendController.AutohideSuspendFlag;
import com.android.launcher3.taskbar.allapps.TaskbarAllAppsController;
import com.android.launcher3.taskbar.overlay.TaskbarOverlayController;
import com.android.launcher3.testing.TestLogging;
@@ -306,9 +303,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
                type,
                WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
                        | WindowManager.LayoutParams.FLAG_SLIPPERY
                        | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH
                        | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL
                        | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
                        | WindowManager.LayoutParams.FLAG_SPLIT_TOUCH,
                PixelFormat.TRANSLUCENT);
        windowLayoutParams.setTitle(WINDOW_TITLE);
        windowLayoutParams.packageName = getPackageName();
@@ -472,7 +467,7 @@ public class TaskbarActivityContext extends BaseTaskbarContext {

    @Override
    public void onDragEnd() {
        onDragEndOrViewRemoved();
        maybeSetTaskbarWindowNotFullscreen();
    }

    @Override
@@ -576,34 +571,25 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
                .updateValue(darkIntensity);
    }

    /**
     * Called to update a {@link AutohideSuspendFlag} with a new value.
     */
    public void setAutohideSuspendFlag(@AutohideSuspendFlag int flag, boolean newValue) {
        mControllers.taskbarAutohideSuspendController.updateFlag(flag, newValue);
    }

    /**
     * Updates the TaskbarContainer to MATCH_PARENT vs original Taskbar size.
     */
    public void setTaskbarWindowFullscreen(boolean fullscreen) {
        setAutohideSuspendFlag(FLAG_AUTOHIDE_SUSPEND_FULLSCREEN, fullscreen);
        mControllers.taskbarAutohideSuspendController.updateFlag(
                TaskbarAutohideSuspendController.FLAG_AUTOHIDE_SUSPEND_FULLSCREEN, fullscreen);
        mIsFullscreen = fullscreen;
        setTaskbarWindowHeight(fullscreen ? MATCH_PARENT : mLastRequestedNonFullscreenHeight);
    }

    /**
     * Called when drag ends or when a view is removed from the DragLayer.
     * Reverts Taskbar window to its original size, if all floating views are closed and there is
     * no system drag operation in progress.
     */
    void onDragEndOrViewRemoved() {
        boolean isDragInProgress = mControllers.taskbarDragController.isSystemDragInProgress();

        if (!isDragInProgress && !AbstractFloatingView.hasOpenView(this, TYPE_ALL)) {
            // Reverts Taskbar window to its original size
    void maybeSetTaskbarWindowNotFullscreen() {
        if (AbstractFloatingView.getAnyView(this, TYPE_ALL) == null
                && !mControllers.taskbarDragController.isSystemDragInProgress()) {
            setTaskbarWindowFullscreen(false);
        }

        setAutohideSuspendFlag(FLAG_AUTOHIDE_SUSPEND_DRAGGING, isDragInProgress);
    }

    public boolean isTaskbarWindowFullscreen() {
@@ -717,7 +703,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
            Task task = (Task) tag;
            ActivityManagerWrapper.getInstance().startActivityFromRecents(task.key,
                    ActivityOptions.makeBasic());
            mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
        } else if (tag instanceof FolderInfo) {
            FolderIcon folderIcon = (FolderIcon) view;
            Folder folder = folderIcon.getFolder();
@@ -777,7 +762,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
                    }

                    mControllers.uiController.onTaskbarIconLaunched(info);
                    mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
                } catch (NullPointerException | ActivityNotFoundException | SecurityException e) {
                    Toast.makeText(this, R.string.activity_not_found, Toast.LENGTH_SHORT)
                            .show();
@@ -787,7 +771,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        } else if (tag instanceof AppInfo) {
            startItemInfoActivity((AppInfo) tag);
            mControllers.uiController.onTaskbarIconLaunched((AppInfo) tag);
            mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
        } else {
            Log.e(TAG, "Unknown type clicked: " + tag);
        }
@@ -822,20 +805,6 @@ public class TaskbarActivityContext extends BaseTaskbarContext {
        return mControllers.taskbarStashController.onLongPressToUnstashTaskbar();
    }

    /**
     * Called when we want to unstash taskbar when user performs swipes up gesture.
     */
    public void onSwipeToUnstashTaskbar() {
        mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(false);
    }

    /**
     * Called when a transient Autohide flag suspend status changes.
     */
    public void onTransientAutohideSuspendFlagChanged(boolean isSuspended) {
        mControllers.taskbarStashController.updateTaskbarTimeout(isSuspended);
    }

    /**
     * Called when we detect a motion down or up/cancel in the nav region while stashed.
     * @param animateForward Whether to animate towards the unstashed hint state or back to stashed.
+1 −24
Original line number Diff line number Diff line
@@ -33,28 +33,21 @@ import java.util.StringJoiner;
public class TaskbarAutohideSuspendController implements
        TaskbarControllers.LoggableTaskbarController {

    // Taskbar window is fullscreen.
    public static final int FLAG_AUTOHIDE_SUSPEND_FULLSCREEN = 1 << 0;
    // User is dragging item.
    public static final int FLAG_AUTOHIDE_SUSPEND_DRAGGING = 1 << 1;
    // User has touched down but has not lifted finger.
    public static final int FLAG_AUTOHIDE_SUSPEND_TOUCHING = 1 << 2;

    @IntDef(flag = true, value = {
            FLAG_AUTOHIDE_SUSPEND_FULLSCREEN,
            FLAG_AUTOHIDE_SUSPEND_DRAGGING,
            FLAG_AUTOHIDE_SUSPEND_TOUCHING,
    })
    @Retention(RetentionPolicy.SOURCE)
    public @interface AutohideSuspendFlag {}

    private final TaskbarActivityContext mActivity;
    private final SystemUiProxy mSystemUiProxy;

    private @AutohideSuspendFlag int mAutohideSuspendFlags = 0;

    public TaskbarAutohideSuspendController(TaskbarActivityContext activity) {
        mActivity = activity;
        mSystemUiProxy = SystemUiProxy.INSTANCE.get(activity);
    }

@@ -66,27 +59,12 @@ public class TaskbarAutohideSuspendController implements
     * Adds or removes the given flag, then notifies system UI proxy whether to suspend auto-hide.
     */
    public void updateFlag(@AutohideSuspendFlag int flag, boolean enabled) {
        int flagsBefore = mAutohideSuspendFlags;
        if (enabled) {
            mAutohideSuspendFlags |= flag;
        } else {
            mAutohideSuspendFlags &= ~flag;
        }
        if (flagsBefore == mAutohideSuspendFlags) {
            // Nothing has changed, no need to notify.
            return;
        }

        boolean isSuspended = isSuspended();
        mSystemUiProxy.notifyTaskbarAutohideSuspend(isSuspended);
        mActivity.onTransientAutohideSuspendFlagChanged(isSuspended);
    }

    /**
     * Returns true iff taskbar autohide is currently suspended.
     */
    public boolean isSuspended() {
        return mAutohideSuspendFlags != 0;
        mSystemUiProxy.notifyTaskbarAutohideSuspend(mAutohideSuspendFlags != 0);
    }

    @Override
@@ -101,7 +79,6 @@ public class TaskbarAutohideSuspendController implements
        appendFlag(str, flags, FLAG_AUTOHIDE_SUSPEND_FULLSCREEN,
                "FLAG_AUTOHIDE_SUSPEND_FULLSCREEN");
        appendFlag(str, flags, FLAG_AUTOHIDE_SUSPEND_DRAGGING, "FLAG_AUTOHIDE_SUSPEND_DRAGGING");
        appendFlag(str, flags, FLAG_AUTOHIDE_SUSPEND_TOUCHING, "FLAG_AUTOHIDE_SUSPEND_TOUCHING");
        return str.toString();
    }
}
+0 −8
Original line number Diff line number Diff line
@@ -115,14 +115,6 @@ public class TaskbarDragLayer extends BaseDragLayer<TaskbarActivityContext> {
        return true;
    }

    @Override
    public boolean onTouchEvent(MotionEvent ev) {
        if (mControllerCallbacks != null && ev.getAction() == MotionEvent.ACTION_OUTSIDE) {
            mControllerCallbacks.onActionOutsideEvent();
        }
        return super.onTouchEvent(ev);
    }

    @Override
    public void onViewRemoved(View child) {
        super.onViewRemoved(child);
+1 −16
Original line number Diff line number Diff line
@@ -23,7 +23,6 @@ import android.view.ViewTreeObserver;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.R;
import com.android.launcher3.util.DimensionUtils;
import com.android.launcher3.util.DisplayController;
import com.android.launcher3.util.TouchController;
import com.android.quickstep.AnimatedFloat;

@@ -166,25 +165,11 @@ public class TaskbarDragLayerController implements TaskbarControllers.LoggableTa
            mControllers.taskbarInsetsController.updateInsetsTouchability(insetsInfo);
        }

        /**
         * Called whenever TaskbarDragLayer receives an ACTION_OUTSIDE event.
         */
        public void onActionOutsideEvent() {
            if (!DisplayController.isTransientTaskbar(mActivity)) {
                return;
            }
            if (mControllers.taskbarStashController.isStashed()) {
                return;
            }

            mControllers.taskbarStashController.updateAndAnimateTransientTaskbar(true);
        }

        /**
         * Called when a child is removed from TaskbarDragLayer.
         */
        public void onDragLayerViewRemoved() {
            mActivity.onDragEndOrViewRemoved();
            mActivity.maybeSetTaskbarWindowNotFullscreen();
        }

        /**
Loading