[android] refactor spaces encoding and test filter