Update mini tutorial code to use @OnStateChange

Change-Id: I509213ade4ed9765db8a7773c42051f8f182b272