Prevent javacrash when TELEPHONY_SERVICE is not found

The API context.getSystemService can return NULL
A Javacrash can happend when trying to obtain the TELEPHONY_SERVICE
and getting null instead.

The patch warn about the value of the instance of the service returned.
It also log and prevent its use in function startListenForPhoneState and

If the TELEPHONY_SERVICE is not available, the internal variables wont

Change-Id: I9e4abc88a58f7f037bbc4f3f7c1cf1b44328ce38
Signed-off-by: franck Lenormand <>
Signed-off-by: Zhiquan Liu <>
1 file changed