Android runtime: use list instead of vector.

This fixes an issue of arrays being freed multiple times.
Cleanup: pass by reference.