Use MessageUtils in ConnectivityManager.
Change-Id: I0179b45bc54ffced8e5647d6f005b891b5de93ab
This commit is contained in:
@@ -45,10 +45,12 @@ import android.provider.Settings;
|
||||
import android.telephony.SubscriptionManager;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.util.SparseArray;
|
||||
|
||||
import com.android.internal.telephony.ITelephony;
|
||||
import com.android.internal.telephony.PhoneConstants;
|
||||
import com.android.internal.util.Protocol;
|
||||
import com.android.internal.util.MessageUtils;
|
||||
|
||||
import libcore.net.event.NetworkEventDispatcher;
|
||||
|
||||
@@ -79,6 +81,13 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
public class ConnectivityManager {
|
||||
private static final String TAG = "ConnectivityManager";
|
||||
|
||||
private static final SparseArray<String> sMagicDecoderRing = MessageUtils.findMessageNames(
|
||||
new Class[]{ConnectivityManager.class}, new String[]{"CALLBACK_"});
|
||||
|
||||
private static final String whatToString(int what) {
|
||||
return sMagicDecoderRing.get(what, Integer.toString(what));
|
||||
}
|
||||
|
||||
/**
|
||||
* A change in network connectivity has occurred. A default connection has either
|
||||
* been established or lost. The NetworkInfo for the affected network is
|
||||
@@ -2563,9 +2572,11 @@ public class ConnectivityManager {
|
||||
|
||||
@Override
|
||||
public void handleMessage(Message message) {
|
||||
if (DBG) Log.d(TAG, "CM callback handler got msg " + message.what);
|
||||
NetworkRequest request = (NetworkRequest) getObject(message, NetworkRequest.class);
|
||||
Network network = (Network) getObject(message, Network.class);
|
||||
if (DBG) {
|
||||
Log.d(TAG, whatToString(message.what) + " for network " + network);
|
||||
}
|
||||
switch (message.what) {
|
||||
case CALLBACK_PRECHECK: {
|
||||
NetworkCallback callback = getCallback(request, "PRECHECK");
|
||||
|
||||
Reference in New Issue
Block a user