Fix race condition bug related to freezing apps. am: 41d2be0f0f
am: a025a0cdec

Change-Id: Id93b2a652b53e687b0a5201957abde1efbd1037c