Merge "Fix race condition resulting in unbalanced wakelock calls" into tm-dev