Prevent reentrancy while setting keyboard

Changing the keyboard might cause a selection change which
might cause another keyboard change which we don't want.

Change-Id: I70d1f15067c97f3b3e8218eb421a7cc29818cf8e