Avoid taking a lock when we shouldn't

Pull out code that shouldn't be executed with the mPackages
lock held. Also changed the names of some methods [added a
'NotLocked' suffix] and added a WTF to be ensure that the
mPackages lock is not held when those methods are called.

Fixes: 129500384
Test: atest
Change-Id: I6853d4e6db92b962aa79e22470845296c2a77e58
1 file changed