Allow atoms to save their own state/result

Instead of having storage adjust the internals of
the atom detail types (which requires type checking),
remove the type checking and let the types themselves
decide where to put their own states and results.

Change-Id: I397954dc746e9dacb2b65e352d11d8f7f36cdac4
Avoid holding the state lock while notifying

To avoid dead lock where a notifier will callback
into the engine to perform a further state transition
make sure we activate the state change notifiation
after locking and not during it.

Fixes bug 1301091

Change-Id: Ic81e15150e44d36489757372db32adfb5440feb4
Merge "Avoid holding the state lock while notifying"