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

Commit e895869f authored by Zak Cohen's avatar Zak Cohen
Browse files

Overview actions - adds feature flag and base class for Overview Actions.

Adds ENABLE_OVERVIEW_ACTIONS feature flag and base factory. Requires an
implementation in overlay to show any actions.

Test: run locally with flag on and off.
Bug: 145628186

Change-Id: I1c36330464cc01e1e987ebfea1a9f451067598a5
parent 0aa4bfeb
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@ import com.android.launcher3.R;
import com.android.launcher3.Workspace;
import com.android.launcher3.allapps.DiscoveryBounce;
import com.android.launcher3.anim.AnimatorSetBuilder;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action;
import com.android.launcher3.userevent.nano.LauncherLogProto.ContainerType;
import com.android.quickstep.SysUINavigationMode;
@@ -140,6 +141,10 @@ public class OverviewState extends LauncherState {
        if (launcher.getDeviceProfile().isVerticalBarLayout()) {
            return VERTICAL_SWIPE_INDICATOR | RECENTS_CLEAR_ALL_BUTTON;
        } else {
            if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) {
                return VERTICAL_SWIPE_INDICATOR | RECENTS_CLEAR_ALL_BUTTON;
            }

            boolean hasAllAppsHeaderExtra = launcher.getAppsView() != null
                    && launcher.getAppsView().getFloatingHeaderView().hasVisibleContent();
            return HOTSEAT_SEARCH_BOX | VERTICAL_SWIPE_INDICATOR | RECENTS_CLEAR_ALL_BUTTON |
+48 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2019 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.quickstep;

import static com.android.launcher3.util.MainThreadInitializedObject.forOverride;

import android.view.View;

import com.android.launcher3.R;
import com.android.launcher3.util.MainThreadInitializedObject;
import com.android.launcher3.util.ResourceBasedOverride;

/**
 * Overview actions are shown in overview underneath the task snapshot. This factory class is
 * overrideable in an overlay. The {@link OverviewActions} class provides the view that should be
 * shown in the Overview.
 */
public class OverviewActionsFactory implements ResourceBasedOverride {

    public static final MainThreadInitializedObject<OverviewActionsFactory> INSTANCE =
            forOverride(OverviewActionsFactory.class, R.string.overview_actions_factory_class);

    /** Create a new Overview Actions for interacting between the actions and overview. */
    public OverviewActions createOverviewActions() {
        return new OverviewActions();
    }

    /** Overlay overrideable, base class does nothing. */
    public static class OverviewActions {
        /** Get the view to show in the overview. */
        public View getView() {
            return null;
        }
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -111,6 +111,7 @@ import com.android.quickstep.TaskThumbnailCache;
import com.android.quickstep.TaskUtils;
import com.android.quickstep.ViewUtils;
import com.android.quickstep.util.AppWindowAnimationHelper;
import com.android.quickstep.util.LayoutUtils;
import com.android.systemui.shared.recents.model.Task;
import com.android.systemui.shared.recents.model.ThumbnailData;
import com.android.systemui.shared.system.ActivityManagerWrapper;
@@ -344,8 +345,7 @@ public abstract class RecentsView<T extends BaseActivity> extends PagedView impl
        setLayoutDirection(mIsRtl ? View.LAYOUT_DIRECTION_RTL : View.LAYOUT_DIRECTION_LTR);
        mTaskTopMargin = getResources()
                .getDimensionPixelSize(R.dimen.task_thumbnail_top_margin);
        mTaskBottomMargin = getResources().getDimensionPixelSize(
                R.dimen.task_thumbnail_bottom_margin);
        mTaskBottomMargin = LayoutUtils.thumbnailBottomMargin(getResources());
        mSquaredTouchSlop = squaredTouchSlop(context);

        mEmptyIcon = context.getDrawable(R.drawable.ic_empty_recents);
+34 −1
Original line number Diff line number Diff line
@@ -47,11 +47,14 @@ import android.view.accessibility.AccessibilityNodeInfo;
import android.widget.FrameLayout;
import android.widget.Toast;

import androidx.annotation.Nullable;

import com.android.launcher3.BaseDraggingActivity;
import com.android.launcher3.R;
import com.android.launcher3.Utilities;
import com.android.launcher3.anim.AnimatorPlaybackController;
import com.android.launcher3.anim.Interpolators;
import com.android.launcher3.config.FeatureFlags;
import com.android.launcher3.logging.UserEventDispatcher;
import com.android.launcher3.popup.SystemShortcut;
import com.android.launcher3.userevent.nano.LauncherLogProto;
@@ -59,11 +62,13 @@ import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Direction;
import com.android.launcher3.userevent.nano.LauncherLogProto.Action.Touch;
import com.android.launcher3.util.PendingAnimation;
import com.android.launcher3.util.ViewPool.Reusable;
import com.android.quickstep.OverviewActionsFactory;
import com.android.quickstep.RecentsModel;
import com.android.quickstep.TaskIconCache;
import com.android.quickstep.TaskOverlayFactory;
import com.android.quickstep.TaskThumbnailCache;
import com.android.quickstep.TaskUtils;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.TaskCornerRadius;
import com.android.quickstep.views.RecentsView.PageCallbacks;
import com.android.quickstep.views.RecentsView.ScrollState;
@@ -159,6 +164,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
    private final float mWindowCornerRadius;
    private final BaseDraggingActivity mActivity;

    private OverviewActionsFactory.OverviewActions mOverviewActions;
    @Nullable private View mActionsView;

    private ObjectAnimator mIconAndDimAnimator;
    private float mIconScaleAnimStartProgress = 0;
    private float mFocusTransitionProgress = 1;
@@ -214,6 +222,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
        mCurrentFullscreenParams = new FullscreenDrawParams(mCornerRadius);
        mDigitalWellBeingToast = new DigitalWellBeingToast(mActivity, this);

        mOverviewActions = OverviewActionsFactory.INSTANCE.get(context).createOverviewActions();
        mOutlineProvider = new TaskOutlineProvider(getResources(), mCurrentFullscreenParams);
        setOutlineProvider(mOutlineProvider);
    }
@@ -223,6 +232,21 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
        super.onFinishInflate();
        mSnapshotView = findViewById(R.id.snapshot);
        mIconView = findViewById(R.id.icon);

        TaskView.LayoutParams thumbnailParams = (LayoutParams) mSnapshotView.getLayoutParams();
        thumbnailParams.bottomMargin = LayoutUtils.thumbnailBottomMargin(getResources());
        mSnapshotView.setLayoutParams(thumbnailParams);


        if (FeatureFlags.ENABLE_OVERVIEW_ACTIONS.get()) {
            mActionsView = mOverviewActions.getView();
            if (mActionsView != null) {
                TaskView.LayoutParams params = new TaskView.LayoutParams(LayoutParams.MATCH_PARENT,
                        getResources().getDimensionPixelSize(R.dimen.overview_actions_height),
                        Gravity.BOTTOM);
                addView(mActionsView, params);
            }
        }
    }

    public TaskMenuView getMenuView() {
@@ -422,6 +446,10 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
        mIconView.setScaleX(scale);
        mIconView.setScaleY(scale);

        if (mActionsView != null) {
            mActionsView.setAlpha(scale);
        }

        mFooterVerticalOffset = 1.0f - scale;
        for (FooterWrapper footer : mFooters) {
            if (footer != null) {
@@ -626,7 +654,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {

        TaskOutlineProvider(Resources res, FullscreenDrawParams fullscreenParams) {
            mMarginTop = res.getDimensionPixelSize(R.dimen.task_thumbnail_top_margin);
            mMarginBottom = res.getDimensionPixelSize(R.dimen.task_thumbnail_bottom_margin);
            mMarginBottom = LayoutUtils.thumbnailBottomMargin(res);
            mFullscreenParams = fullscreenParams;
        }

@@ -783,6 +811,7 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {

    /**
     * Hides the icon and shows insets when this TaskView is about to be shown fullscreen.
     *
     * @param progress: 0 = show icon and no insets; 1 = don't show icon and show full insets.
     */
    public void setFullscreenProgress(float progress) {
@@ -793,6 +822,9 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
        mFullscreenProgress = progress;
        boolean isFullscreen = mFullscreenProgress > 0;
        mIconView.setVisibility(progress < 1 ? VISIBLE : INVISIBLE);
        if (mActionsView != null) {
            mActionsView.setVisibility(progress < 1 ? VISIBLE : INVISIBLE);
        }
        setClipChildren(!isFullscreen);
        setClipToPadding(!isFullscreen);

@@ -873,4 +905,5 @@ public class TaskView extends FrameLayout implements PageCallbacks, Reusable {
            mScale = scale;
        }
    }

}
+1 −2
Original line number Diff line number Diff line
@@ -25,8 +25,7 @@
        android:id="@+id/snapshot"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="@dimen/task_thumbnail_top_margin"
        android:layout_marginBottom="@dimen/task_thumbnail_bottom_margin"/>
        android:layout_marginTop="@dimen/task_thumbnail_top_margin"/>

    <com.android.quickstep.views.IconView
        android:id="@+id/icon"
Loading