Put audio_route into its own library

The audio_route library allows mixer paths to be
loaded from an XML file and can control a mixer
via tinyalsa. It contains useful functions that
can be factored out of the audio HAL.

Change-Id: Iebcb2b492c5936dbf0e0b976aeaa4ffbab136588
Add audio_route_reset_path()

Change-Id: I24905ef23f74673e1f97b591d7dcb04a54744f05
audio_route: use ctl_index instead of searching

Store the ctl_index instead of the ctl in the path so
that path_apply() and path_reset() don't have to
do a linear search through all the controls each time
to locate the index.

Change-Id: I0204310df55303dffdf10f68b652a820ca252d95
audio_route: skip missing controls

Mixer controls that are in mixer_paths.xml but missing from
the mixer should be skipped, otherwise arrays will be accessed
out of bounds. This happened in b/8893515.

Also print the missing control name to aid debugging.

Change-Id: Ia808df48734f78a02281408a4025652dec9762c0
audio_route: use mixer_ctl_get/set_array

Rather than make individual calls to tinyalsa for every
value in each mixer control, which is expensive for linked
controls, use the array get/set functions instead. This
reduces the number of system calls that tinyalsa has to
make. The majority of controls are linked and have 1 or 2
values so the CPU overhead is small.

Change-Id: If32cb8c639e113403641cab0d68b32799cebb059
audio_route: fix possible segfault

* Mixers may not allocate memory to save their values if the type is not
  of bool, enum, or int. However we do not check the type when actually
  attempting to use the allocated memory, resulting in possibly writing
  into random memory.

Change-Id: I8e59c8e6211b7ea10bd128069378632e0ced27a5
Revert "audio_route: fix possible segfault"

This reverts commit 84f0b1899302784c679105f444e87686a66c1274.
audio_route: Add APIs to update mixer based on path

audio_route_apply_and_update_path
audio_route_reset_and_update_path

These routines allows updating the mixer controls for
just the specified path. The controls will be updated
in the order listed in the XML file.

Change-Id: If193bc047ccbb8c6497926d6181c5c4541a9d6aa
CRs-Fixed: 581453