Merge "Revert "Revert "Add TaskbarModeSwitchRule to test both transient/persistent taskbar.""" into tm-qpr-dev

This commit is contained in:
TreeHugger Robot
2022-11-15 22:31:55 +00:00
committed by Android (Google) Code Review
12 changed files with 269 additions and 9 deletions
@@ -11,9 +11,11 @@ import android.os.Bundle;
import androidx.annotation.Nullable;
import com.android.launcher3.R;
import com.android.launcher3.taskbar.TaskbarActivityContext;
import com.android.launcher3.testing.TestInformationHandler;
import com.android.launcher3.testing.shared.TestProtocol;
import com.android.launcher3.touch.PagedOrientationHandler;
import com.android.launcher3.util.DisplayController;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.TISBindHelper;
@@ -120,6 +122,30 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
.getCurrentActivityContext()
.getTaskbarAllAppsTopPadding());
}
case TestProtocol.REQUEST_ENABLE_BLOCK_TIMEOUT:
runOnTISBinder(tisBinder -> {
enableBlockingTimeout(tisBinder, true);
});
return response;
case TestProtocol.REQUEST_DISABLE_BLOCK_TIMEOUT:
runOnTISBinder(tisBinder -> {
enableBlockingTimeout(tisBinder, false);
});
return response;
case TestProtocol.REQUEST_ENABLE_TRANSIENT_TASKBAR:
runOnTISBinder(tisBinder -> {
enableTransientTaskbar(tisBinder, true);
});
return response;
case TestProtocol.REQUEST_DISABLE_TRANSIENT_TASKBAR:
runOnTISBinder(tisBinder -> {
enableTransientTaskbar(tisBinder, false);
});
return response;
}
return super.call(method, arg, extras);
@@ -149,6 +175,20 @@ public class QuickstepTestInformationHandler extends TestInformationHandler {
enable);
}
private void enableBlockingTimeout(
TouchInteractionService.TISBinder tisBinder, boolean enable) {
// Allow null-pointer to catch illegal states.
tisBinder.getTaskbarManager().getCurrentActivityContext().enableBlockingTimeoutDuringTests(
enable);
}
private void enableTransientTaskbar(
TouchInteractionService.TISBinder tisBinder, boolean enable) {
// Allow null-pointer to catch illegal states.
TaskbarActivityContext context = tisBinder.getTaskbarManager().getCurrentActivityContext();
DisplayController.INSTANCE.get(context).enableTransientTaskbarForTests(enable);
}
/**
* Runs the given command on the UI thread, after ensuring we are connected to
* TouchInteractionService.