Wrap the resource registration in a global environment

Change-Id: I065dadc9fae19ab21d6d4aeae08334f20da161bb
Merge "Wrap the resource registration in a global environment"