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

Commit c5d3fcb6 authored by Vinit Nayak's avatar Vinit Nayak Committed by Android (Google) Code Review
Browse files

Merge "Address jank and memory issues with OverviewActionsView" into 24D1-dev

parents 6dc980e0 1abc4761
Loading
Loading
Loading
Loading
+9 −17
Original line number Diff line number Diff line
@@ -124,23 +124,15 @@
    </LinearLayout>

    <!-- Unused. Included only for compatibility with parent class. -->
    <LinearLayout
        android:id="@+id/group_action_buttons"
        android:layout_width="match_parent"
        android:layout_height="@dimen/overview_actions_height"
        android:layout_gravity="top|center_horizontal"
        android:orientation="horizontal"
        android:visibility="gone">

    <Button
        android:id="@+id/action_save_app_pair"
        style="@style/GoOverviewActionButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="top|center_horizontal"
        android:drawableStart="@drawable/ic_save_app_pair_up_down"
        android:text="@string/action_save_app_pair"
            android:theme="@style/ThemeControlHighlightWorkspaceColor" />

    </LinearLayout>
        android:theme="@style/ThemeControlHighlightWorkspaceColor"
        android:visibility="gone" />

</com.android.quickstep.views.GoOverviewActionsView>
 No newline at end of file
+9 −15
Original line number Diff line number Diff line
@@ -47,22 +47,16 @@

    </LinearLayout>

    <LinearLayout
        android:id="@+id/group_action_buttons"
        android:layout_width="wrap_content"
        android:layout_height="@dimen/overview_actions_height"
        android:layout_gravity="bottom|center_horizontal"
        android:orientation="horizontal"
        android:visibility="gone">

    <!-- Currently, the only "group action button" is this save app pair button. If more are added,
    a new LinearLayout may be needed to contain them, but beware of increased memory usage. -->
    <Button
        android:id="@+id/action_save_app_pair"
        style="@style/OverviewActionButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="@string/action_save_app_pair"
            android:theme="@style/ThemeControlHighlightWorkspaceColor" />

    </LinearLayout>
        android:theme="@style/ThemeControlHighlightWorkspaceColor"
        android:layout_gravity="bottom|center_horizontal"
        android:visibility="gone" />

</com.android.quickstep.views.OverviewActionsView>
 No newline at end of file
+13 −11
Original line number Diff line number Diff line
@@ -113,9 +113,11 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo

    /** Container for the action buttons below a focused, non-split Overview tile. */
    protected LinearLayout mActionButtons;
    /** Container for the action buttons below a focused, split Overview tile. */
    protected LinearLayout mGroupActionButtons;
    private Button mSplitButton;
    /**
     * The "save app pair" button. Currently this is the only button that is not contained in
     * mActionButtons, since it is the sole button that appears for a grouped task.
     */
    private Button mSaveAppPairButton;

    @ActionsHiddenFlags
@@ -153,15 +155,16 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
        super.onFinishInflate();
        // Initialize 2 view containers: one for single tasks, one for grouped tasks.
        // These will take up the same space on the screen and alternate visibility as needed.
        // Currently, the only grouped task action is "save app pairs".
        mActionButtons = findViewById(R.id.action_buttons);
        mGroupActionButtons = findViewById(R.id.group_action_buttons);
        // Initialize a list to hold alphas for mActionButtons and mGroupActionButtons.
        mSaveAppPairButton = findViewById(R.id.action_save_app_pair);
        // Initialize a list to hold alphas for mActionButtons and any group action buttons.
        mMultiValueAlphas[ACTIONS_ALPHAS] = new MultiValueAlpha(mActionButtons, NUM_ALPHAS);
        mMultiValueAlphas[GROUP_ACTIONS_ALPHAS] =
                new MultiValueAlpha(mGroupActionButtons, NUM_ALPHAS);
                new MultiValueAlpha(mSaveAppPairButton, NUM_ALPHAS);
        Arrays.stream(mMultiValueAlphas).forEach(a -> a.setUpdateVisibility(true));
        // To control alpha simultaneously on mActionButtons and mGroupActionButtons, we set up an
        // AnimatedFloat for each alpha property.
        // To control alpha simultaneously on mActionButtons and any group action buttons, we set up
        // an AnimatedFloat for each alpha property.
        for (int i = 0; i < NUM_ALPHAS; i++) {
            final int index = i;
            mAlphaProperties[index] = new AnimatedFloat(() -> {
@@ -178,7 +181,6 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
        screenshotButton.setOnClickListener(this);
        mSplitButton = findViewById(R.id.action_split);
        mSplitButton.setOnClickListener(this);
        mSaveAppPairButton = findViewById(R.id.action_save_app_pair);
        mSaveAppPairButton.setOnClickListener(this);
    }

@@ -339,7 +341,7 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
     */
    public boolean areActionsButtonsVisible() {
        return mActionButtons.getVisibility() == View.VISIBLE
                || mGroupActionButtons.getVisibility() == View.VISIBLE;
                || mSaveAppPairButton.getVisibility() == View.VISIBLE;
    }

    /**
@@ -353,11 +355,11 @@ public class OverviewActionsView<T extends OverlayUICallbacks> extends FrameLayo
    /** Updates vertical margins for different navigation mode or configuration changes. */
    public void updateVerticalMargin(NavigationMode mode) {
        updateActionBarPosition(mActionButtons);
        updateActionBarPosition(mGroupActionButtons);
        updateActionBarPosition(mSaveAppPairButton);
    }

    /** Positions actions buttons according to device settings and insets. */
    private void updateActionBarPosition(LinearLayout actionBar) {
    private void updateActionBarPosition(View actionBar) {
        if (mDp == null) {
            return;
        }
+0 −2
Original line number Diff line number Diff line
@@ -129,8 +129,6 @@ public class TaplTestsSplitscreen extends AbstractQuickStepTest {
                    overview.getCurrentTask()
                            .tapMenu()
                            .hasMenuItem("Save app pair"));
        } else {
            overview.getOverviewGroupActions().assertHasAction("Save app pair");
        }
    }

+2 −17
Original line number Diff line number Diff line
@@ -361,21 +361,6 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {
        }
    }

    /**
     * Gets Overview Actions specific to grouped tasks.
     *
     * @return The Overview group actions bar
     */
    @NonNull
    public OverviewActions getOverviewGroupActions() {
        try (LauncherInstrumentation.Closable c = mLauncher.addContextLayer(
                "want to get overview group actions")) {
            verifyActiveContainer();
            UiObject2 groupActions = mLauncher.waitForOverviewObject("group_action_buttons");
            return new OverviewActions(groupActions, mLauncher);
        }
    }

    /**
     * Returns if clear all button is visible.
     */
@@ -474,13 +459,13 @@ public class BaseOverview extends LauncherInstrumentation.VisibleContainer {

            if (isActionsViewVisible()) {
                if (task.isTaskSplit()) {
                    mLauncher.waitForOverviewObject("group_action_buttons");
                    mLauncher.waitForOverviewObject("action_save_app_pair");
                } else {
                    mLauncher.waitForOverviewObject("action_buttons");
                }
            } else {
                mLauncher.waitUntilOverviewObjectGone("action_buttons");
                mLauncher.waitUntilOverviewObjectGone("group_action_buttons");
                mLauncher.waitUntilOverviewObjectGone("action_save_app_pair");
            }
        }
    }
Loading