Fix race condition bug related to freezing apps. am: 41d2be0f0f am: 453efdc065
am: 1395bf02cc

Change-Id: I7d9478a626e3217cf061da22394d4c6263f1fb66