[Settings] Code refactor for Lifecycle listening

This is an abstract class for building a set of callback behavior
based on Lifecycle status change.

Through extending this class, the implemented methods are invoked
only when required.

Bug: 229689535
Test: unit test
Change-Id: I7534393546f821738a63ebde121a5a88ee03b23b
(cherry picked from commit 9a4c66d23ba1631350bcdf5d4bba0d5067e2beff)
2 files changed