Merge "Fix dangling pointer bug when transitioning to background." into lmp-dev