input-android: Consolidate some code.