Reduce lock contention in ContextImpl

Use double-check pattern.
Don't use same lock for dir creation work and for resources work.

Bug: 259323318
Change-Id: I4da7e00f1e87d15bb22701a602beeae965b61a32
1 file changed