[Settings] Code refactor for async Lifecycle listening

This is an extension of LifecycleCallbackAdapter.
A postResult(T) and a Consumer<T> is designed for supporting pass result
back to UI thread, and is invoked only when required.

Bug: 229689535
Test: unit test
Change-Id: I0ef5afc31cd23aa865a2dd1d05f9b212242c2e41
(cherry picked from commit 5d2a76cbb4daf504547a6196d5ae9c5e79e8da48)
2 files changed