Fix settings NPE crash on launch.

Sometimes when the settings app is resumed, HeadsetProfileManager's
getConnectedDevices() method is called before the onServiceConnected()
callback gives us the proxy object, causing an NPE. Check that we
have the proxy object, and return an empty list otherwise. The
correct states will be shown in the UI because the
onServiceConnected() callback makes its own call to getConnectedDevices()
to set the correct headset profile state.

Bug: 3378431
Change-Id: I364ade0804fb2090378438c8721afef6cac2b0b8
1 file changed