Toggle taskbar button nav assistant availability

* New signals coming in from Sysui reflect the toggle
in Settings for long pressing on home button to
invoke assistant.

Fixes: 255909545
Test: Manual + added unit test for TaskbarNavButtonController
Change-Id: Ic65a80b0b9697990931b7e89756773fb086cc3bd
This commit is contained in:
Vinit Nayak
2023-01-03 20:07:27 -08:00
parent 39688d2d61
commit 0d784ee7fb
4 changed files with 25 additions and 3 deletions

View File

@@ -18,6 +18,7 @@ import static com.android.systemui.shared.system.QuickStepContract.SYSUI_STATE_S
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -103,11 +104,19 @@ public class TaskbarNavButtonControllerTest {
}
@Test
public void testLongPressHome() {
public void testLongPressHome_enabled() {
mNavButtonController.setAssistantLongPressEnabled(true /*assistantLongPressEnabled*/);
mNavButtonController.onButtonLongClick(BUTTON_HOME, mockView);
verify(mockSystemUiProxy, times(1)).startAssistant(any());
}
@Test
public void testLongPressHome_disabled() {
mNavButtonController.setAssistantLongPressEnabled(false /*assistantLongPressEnabled*/);
mNavButtonController.onButtonLongClick(BUTTON_HOME, mockView);
verify(mockSystemUiProxy, never()).startAssistant(any());
}
@Test
public void testPressHome() {
mNavButtonController.onButtonClick(BUTTON_HOME, mockView);