Add thread safety check to libgui build

Fix places that had errors to ensure locks are correctly held in libgui

Test: Builds
Bug: 268091723
Change-Id: I8a94edeb649608ff66d25a482026a81074466305
5 files changed