Make Android part work for M40 rebase

All instrumentation tests passed.