This is a program that exercises Scenic's input subsystem. It directly talks to Scenic, and runs without the help of a root presenter. Other presenters should be disabled while this program runs.
You should see two Views, one vended by hello_input, and an inset View vended by hello_input_child. The functionality is the same: display a finger tracker for each finger on the touchscreen, and “blink” when a keyboard input is received by one of the Views.
Run it like this:
$ run hello_input [--verbose=1]
There are two packages, each containing an independent binary.
Some high-level functionality provided by HelloInput:
It forwards InputEvents to Scenic to be routed to the correct destination based on hit testing. Scenic will send an InputEvent to a View over its SessionListener, as a session event.
To receive InputEvents from Scenic, HelloInput implements the following callback, given to its session as the event handler:
void App::OnSessionEvents(fidl::VectorPtr<fuchsia::ui::scenic::Event> events);
On receipt of an InputEvent from Scenic, we switch based on its type: Focus, Pointer, or Keyboard.
UP
event.To exercise the multi-View case, HelloInput requests a child program to be launched, and sets up a ViewHolder into which the child can vend its View. HelloInput requests the child to create a View into the provided ViewHolder through the ViewProvider interface, implemented by the child.
HelloInputChild represents a typical user application — e.g., there is no logic to manage input devices and input reports. Instead, it implements the ViewProvider interface (allowing other programs to request we create a View) and sets up its UI logic into its View.
The specifics of how HelloInputChild handles InputEvents are identical to HelloInput. However, we deliberately keep the code independent and duplicated so that you can play around with each View independently of the other.