[INTERNAL] m.Switch: extract code from .setState() (refactoring)

Change-Id: Ib95c785592c4f6261a9ac15952c2a119e0c3dc72
Merge "[INTERNAL] m.Switch: extract code from .setState() (refactoring)"