ConnectivityManager: fix potential NPE

ConnectivityManager static sCallbackHandler is referenced and directly
used in a way that is not ensuring its proper initialization.

This patch fixes this potential NPE by using getHandler() instead.

Also this patch changes sendRequestForNetwork's signature to only accept
the subtype CallbackHandler instead of Handler: without using
CallbackHandler the NetworkCallbacks are not triggered properly and
bookkeeping of sCallbacks does not happen. sendRequestForNetwork's
signature now makes this explicit.

This step prepares the addition of overloaded versions of
registerNetworkCallback and cie that takes custom Handlers.

Test: build, flashed, manually checked connectivity
Change-Id: I52e8a2cb5075e7aef7b35e30c9845cacba927d13
1 file changed