LN: bring inline with AOSPAL implementation

Original commit: https://github.com/TheKang/frameworks_base/commit/94bc4374da2090e0864a570d3427a62e51e00c44

Change-Id: Ie4eb57ad8e068100455d89f405cd44466f76efba
LN: Fix possible NPE

Change-Id: I597021f64aaee43b6964e2b6709ebd427b0a7cbc