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

Commit b974a86c authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Add IDs to buttons in 3 button nav for Taskbar

Bug: 191449914
Test: testSwitchToOverview passes
See bug for more details

Change-Id: I108bbe7607181680bca7cb5fad5e7289191edde6
parent d7e17a86
Loading
Loading
Loading
Loading
+12 −9
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_I

import android.animation.ObjectAnimator;
import android.annotation.DrawableRes;
import android.annotation.IdRes;
import android.graphics.Rect;
import android.graphics.Region;
import android.graphics.Region.Op;
@@ -123,7 +124,8 @@ public class NavbarButtonsViewController {
                    flags -> (flags & FLAG_KEYGUARD_VISIBLE) == 0, MultiValueAlpha.VALUE, 1, 0));

            // Rotation button
            RotationButton rotationButton = new RotationButtonImpl(addButton(mEndContainer));
            RotationButton rotationButton = new RotationButtonImpl(
                    addButton(mEndContainer, R.id.rotate_suggestion));
            rotationButton.hide();
            mControllers.rotationButtonController.setRotationButton(rotationButton);
        } else {
@@ -138,7 +140,7 @@ public class NavbarButtonsViewController {
            TaskbarNavButtonController navButtonController) {

        View backButton = addButton(R.drawable.ic_sysbar_back, BUTTON_BACK,
                startContainer, navButtonController);
                startContainer, navButtonController, R.id.back);
        // Rotate when Ime visible
        mPropertyHolders.add(new StatePropertyHolder(backButton,
                flags -> (flags & FLAG_IME_VISIBLE) == 0, View.ROTATION, 0,
@@ -149,19 +151,19 @@ public class NavbarButtonsViewController {

        // home and recents buttons
        View homeButton = addButton(R.drawable.ic_sysbar_home, BUTTON_HOME, startContainer,
                navButtonController);
                navButtonController, R.id.home);
        mPropertyHolders.add(new StatePropertyHolder(homeButton,
                flags -> (flags & FLAG_IME_VISIBLE) == 0 &&
                        (flags & FLAG_KEYGUARD_VISIBLE) == 0));
        View recentsButton = addButton(R.drawable.ic_sysbar_recent, BUTTON_RECENTS,
                startContainer, navButtonController);
                startContainer, navButtonController, R.id.recent_apps);
        mPropertyHolders.add(new StatePropertyHolder(recentsButton,
                flags -> (flags & FLAG_IME_VISIBLE) == 0 &&
                        (flags & FLAG_KEYGUARD_VISIBLE) == 0));

        // IME switcher
        View imeSwitcherButton = addButton(R.drawable.ic_ime_switcher, BUTTON_IME_SWITCH,
                endContainer, navButtonController);
                endContainer, navButtonController, R.id.ime_switcher);
        mPropertyHolders.add(new StatePropertyHolder(imeSwitcherButton,
                flags -> ((flags & MASK_IME_SWITCHER_VISIBLE) == MASK_IME_SWITCHER_VISIBLE)
                        && ((flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0)
@@ -169,7 +171,7 @@ public class NavbarButtonsViewController {

        // A11y button
        mA11yButton = addButton(R.drawable.ic_sysbar_accessibility_button, BUTTON_A11Y,
                endContainer, navButtonController);
                endContainer, navButtonController, R.id.accessibility_button);
        mPropertyHolders.add(new StatePropertyHolder(mA11yButton,
                flags -> (flags & FLAG_A11Y_VISIBLE) != 0
                        && (flags & FLAG_ROTATION_BUTTON_VISIBLE) == 0));
@@ -251,16 +253,17 @@ public class NavbarButtonsViewController {
    }

    private ImageView addButton(@DrawableRes int drawableId, @TaskbarButton int buttonType,
            ViewGroup parent, TaskbarNavButtonController navButtonController) {
        ImageView buttonView = addButton(parent);
            ViewGroup parent, TaskbarNavButtonController navButtonController, @IdRes int id) {
        ImageView buttonView = addButton(parent, id);
        buttonView.setImageResource(drawableId);
        buttonView.setOnClickListener(view -> navButtonController.onButtonClick(buttonType));
        return buttonView;
    }

    private ImageView addButton(ViewGroup parent) {
    private ImageView addButton(ViewGroup parent, int id) {
        ImageView buttonView = (ImageView) mContext.getLayoutInflater()
                .inflate(R.layout.taskbar_nav_button, parent, false);
        buttonView.setId(id);
        parent.addView(buttonView);
        mAllButtons.add(buttonView);
        return buttonView;
+3 −0
Original line number Diff line number Diff line
@@ -23,6 +23,8 @@ import android.view.inputmethod.InputMethodManager;

import androidx.annotation.IntDef;

import com.android.launcher3.testing.TestLogging;
import com.android.launcher3.testing.TestProtocol;
import com.android.quickstep.OverviewCommandHelper;
import com.android.quickstep.SystemUiProxy;
import com.android.quickstep.TouchInteractionService;
@@ -94,6 +96,7 @@ public class TaskbarNavButtonController {
    }

    private void navigateToOverview() {
        TestLogging.recordEvent(TestProtocol.SEQUENCE_MAIN, "onOverviewToggle");
        mService.getOverviewCommandHelper().addCommand(OverviewCommandHelper.TYPE_TOGGLE);
    }

+9 −0
Original line number Diff line number Diff line
@@ -19,4 +19,13 @@
    <item type="id" name="view_type_widgets_list" />
    <item type="id" name="view_type_widgets_header" />
    <item type="id" name="view_type_widgets_search_header" />

    <!--  Do not change, must be kept in sync with sysui navbar button IDs for tests!  -->
    <item type="id" name="home" />
    <item type="id" name="recent_apps" />
    <item type="id" name="back" />
    <item type="id" name="ime_switcher" />
    <item type="id" name="accessibility_button" />
    <item type="id" name="rotate_suggestion" />
    <!--  /Do not change, must be kept in sync with sysui navbar button IDs for tests!  -->
</resources>
+4 −0
Original line number Diff line number Diff line
@@ -117,6 +117,10 @@ public class TestInformationHandler implements ResourceBasedOverride {
                TestProtocol.sDisableSensorRotation = true;
                return response;

            case TestProtocol.REQUEST_IS_TABLET:
                response.putBoolean(TestProtocol.TEST_INFO_RESPONSE_FIELD, mDeviceProfile.isTablet);
                return response;

            default:
                return null;
        }
+1 −0
Original line number Diff line number Diff line
@@ -94,6 +94,7 @@ public final class TestProtocol {
    public static final String REQUEST_GET_TEST_EVENTS = "get-test-events";
    public static final String REQUEST_STOP_EVENT_LOGGING = "stop-event-logging";
    public static final String REQUEST_CLEAR_DATA = "clear-data";
    public static final String REQUEST_IS_TABLET = "is-tablet";

    public static boolean sDebugTracing = false;
    public static final String REQUEST_ENABLE_DEBUG_TRACING = "enable-debug-tracing";
Loading