Add tests for LPH override for 3 button mode Taskbar.

Override == Launcher handles via AssistUtils instead of SysUI.

Bug: 297561673
Test: TaskbarNavButtonControllerTest + bug bash session
Change-Id: I079d4b9045d6f7d94d74e91bcabbbc182de6e17d
This commit is contained in:
Andy Wickham
2023-08-30 14:45:18 -07:00
parent b8ca7ae13c
commit 976876ec5b
3 changed files with 41 additions and 8 deletions

View File

@@ -109,15 +109,17 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
private final TouchInteractionService mService;
private final SystemUiProxy mSystemUiProxy;
private final Handler mHandler;
private final AssistUtils mAssistUtils;
@Nullable private StatsLogManager mStatsLogManager;
private final Runnable mResetLongPress = this::resetScreenUnpin;
public TaskbarNavButtonController(TouchInteractionService service,
SystemUiProxy systemUiProxy, Handler handler) {
SystemUiProxy systemUiProxy, Handler handler, AssistUtils assistUtils) {
mService = service;
mSystemUiProxy = systemUiProxy;
mHandler = handler;
mAssistUtils = assistUtils;
}
public void onButtonClick(@TaskbarButton int buttonType, View view) {
@@ -313,8 +315,7 @@ public class TaskbarNavButtonController implements TaskbarControllers.LoggableTa
return;
}
// Attempt to start Assist with AssistUtils, otherwise fall back to SysUi's implementation.
if (!AssistUtils.newInstance(mService.getApplicationContext()).tryStartAssistOverride(
INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS)) {
if (!mAssistUtils.tryStartAssistOverride(INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS)) {
Bundle args = new Bundle();
args.putInt(INVOCATION_TYPE_KEY, INVOCATION_TYPE_HOME_BUTTON_LONG_PRESS);
mSystemUiProxy.startAssistant(args);