Merge "ConnectivityManager: fix potential NPE" am: b688dd18ab am: 95d22b0c92
am: 3b0915b6f5
Change-Id: I6f487ce9da656610c939ddc78e834ac8ef5f8135
This commit is contained in:
@@ -1439,8 +1439,9 @@ public class ConnectivityManager {
|
|||||||
private void sendExpireMsgForFeature(NetworkCapabilities netCap, int seqNum, int delay) {
|
private void sendExpireMsgForFeature(NetworkCapabilities netCap, int seqNum, int delay) {
|
||||||
if (delay >= 0) {
|
if (delay >= 0) {
|
||||||
Log.d(TAG, "sending expire msg with seqNum " + seqNum + " and delay " + delay);
|
Log.d(TAG, "sending expire msg with seqNum " + seqNum + " and delay " + delay);
|
||||||
Message msg = sCallbackHandler.obtainMessage(EXPIRE_LEGACY_REQUEST, seqNum, 0, netCap);
|
CallbackHandler handler = getHandler();
|
||||||
sCallbackHandler.sendMessageDelayed(msg, delay);
|
Message msg = handler.obtainMessage(EXPIRE_LEGACY_REQUEST, seqNum, 0, netCap);
|
||||||
|
handler.sendMessageDelayed(msg, delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2875,19 +2876,19 @@ public class ConnectivityManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static final HashMap<NetworkRequest, NetworkCallback> sCallbacks = new HashMap<>();
|
private static final HashMap<NetworkRequest, NetworkCallback> sCallbacks = new HashMap<>();
|
||||||
static CallbackHandler sCallbackHandler;
|
private static CallbackHandler sCallbackHandler;
|
||||||
|
|
||||||
private final static int LISTEN = 1;
|
private static final int LISTEN = 1;
|
||||||
private final static int REQUEST = 2;
|
private static final int REQUEST = 2;
|
||||||
|
|
||||||
private NetworkRequest sendRequestForNetwork(NetworkCapabilities need,
|
private NetworkRequest sendRequestForNetwork(NetworkCapabilities need,
|
||||||
NetworkCallback callback, int timeoutMs, int action, int legacyType) {
|
NetworkCallback callback, int timeoutMs, int action, int legacyType) {
|
||||||
return sendRequestForNetwork(need, callback, getHandler(), timeoutMs, action, legacyType);
|
return sendRequestForNetwork(need, callback, timeoutMs, action, legacyType, getHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
private NetworkRequest sendRequestForNetwork(NetworkCapabilities need,
|
private NetworkRequest sendRequestForNetwork(NetworkCapabilities need, NetworkCallback callback,
|
||||||
NetworkCallback callback, Handler handler, int timeoutMs, int action, int legacyType) {
|
int timeoutMs, int action, int legacyType, CallbackHandler handler) {
|
||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
throw new IllegalArgumentException("null NetworkCallback");
|
throw new IllegalArgumentException("null NetworkCallback");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user