Refactor ReplState.phoneState usage to ensure it is consistent.

Make sure phoneState is reset properly when projects are switched.

Change-Id: I36f8dde8f81ebf8e255044b24c5c6a2e03e28b4b