Merge "Reduce connectivity logging" into ics-factoryrom
This commit is contained in:
@@ -56,7 +56,7 @@ import java.io.PrintWriter;
|
||||
public class MobileDataStateTracker implements NetworkStateTracker {
|
||||
|
||||
private static final String TAG = "MobileDataStateTracker";
|
||||
private static final boolean DBG = true;
|
||||
private static final boolean DBG = false;
|
||||
private static final boolean VDBG = false;
|
||||
|
||||
private Phone.DataState mMobileDataState;
|
||||
|
||||
@@ -137,6 +137,8 @@ public class ProxyProperties implements Parcelable {
|
||||
if (mExclusionList != null) {
|
||||
sb.append(" xl=").append(mExclusionList);
|
||||
}
|
||||
} else {
|
||||
sb.append("[ProxyProperties.mHost == null]");
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ import java.util.List;
|
||||
public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
|
||||
private static final boolean DBG = true;
|
||||
private static final boolean VDBG = true;
|
||||
private static final boolean VDBG = false;
|
||||
private static final String TAG = "ConnectivityService";
|
||||
|
||||
private static final boolean LOGD_RULES = false;
|
||||
@@ -867,7 +867,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
// javadoc from interface
|
||||
public int startUsingNetworkFeature(int networkType, String feature,
|
||||
IBinder binder) {
|
||||
if (DBG) {
|
||||
if (VDBG) {
|
||||
log("startUsingNetworkFeature for net " + networkType + ": " + feature);
|
||||
}
|
||||
enforceChangePermission();
|
||||
@@ -933,17 +933,19 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
if (ni.isConnected() == true) {
|
||||
// add the pid-specific dns
|
||||
handleDnsConfigurationChange(usedNetworkType);
|
||||
if (DBG) log("special network already active");
|
||||
if (VDBG) log("special network already active");
|
||||
return Phone.APN_ALREADY_ACTIVE;
|
||||
}
|
||||
if (DBG) log("special network already connecting");
|
||||
if (VDBG) log("special network already connecting");
|
||||
return Phone.APN_REQUEST_STARTED;
|
||||
}
|
||||
|
||||
// check if the radio in play can make another contact
|
||||
// assume if cannot for now
|
||||
|
||||
if (DBG) log("reconnecting to special network");
|
||||
if (DBG) {
|
||||
log("startUsingNetworkFeature reconnecting to " + networkType + ": " + feature);
|
||||
}
|
||||
network.reconnect();
|
||||
return Phone.APN_REQUEST_STARTED;
|
||||
} else {
|
||||
@@ -985,7 +987,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
return stopUsingNetworkFeature(u, true);
|
||||
} else {
|
||||
// none found!
|
||||
if (VDBG) log("ignoring stopUsingNetworkFeature - not a live request");
|
||||
if (VDBG) log("stopUsingNetworkFeature - not a live request, ignoring");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -999,12 +1001,15 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
NetworkStateTracker tracker = null;
|
||||
boolean callTeardown = false; // used to carry our decision outside of sync block
|
||||
|
||||
if (DBG) {
|
||||
log("stopUsingNetworkFeature for net " + networkType +
|
||||
": " + feature);
|
||||
if (VDBG) {
|
||||
log("stopUsingNetworkFeature: net " + networkType + ": " + feature);
|
||||
}
|
||||
|
||||
if (!ConnectivityManager.isNetworkTypeValid(networkType)) {
|
||||
if (DBG) {
|
||||
log("stopUsingNetworkFeature: net " + networkType + ": " + feature +
|
||||
", net is invalid");
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -1013,7 +1018,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
synchronized(this) {
|
||||
// check if this process still has an outstanding start request
|
||||
if (!mFeatureUsers.contains(u)) {
|
||||
if (DBG) log("ignoring - this process has no outstanding requests");
|
||||
if (VDBG) {
|
||||
log("stopUsingNetworkFeature: this process has no outstanding requests" +
|
||||
", ignoring");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
u.unlinkDeathRecipient();
|
||||
@@ -1028,7 +1036,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
if (ignoreDups == false) {
|
||||
for (FeatureUser x : mFeatureUsers) {
|
||||
if (x.isSameUser(u)) {
|
||||
if (DBG) log("ignoring stopUsingNetworkFeature as dup is found");
|
||||
if (VDBG) log("stopUsingNetworkFeature: dup is found, ignoring");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -1039,7 +1047,10 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
|
||||
tracker = mNetTrackers[usedNetworkType];
|
||||
if (tracker == null) {
|
||||
if (DBG) log("ignoring - no known tracker for net type " + usedNetworkType);
|
||||
if (DBG) {
|
||||
log("stopUsingNetworkFeature: net " + networkType + ": " + feature +
|
||||
" no known tracker for used net type " + usedNetworkType);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
if (usedNetworkType != networkType) {
|
||||
@@ -1047,17 +1058,25 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
mNetRequestersPids[usedNetworkType].remove(currentPid);
|
||||
reassessPidDns(pid, true);
|
||||
if (mNetRequestersPids[usedNetworkType].size() != 0) {
|
||||
if (DBG) log("not tearing down special network - " +
|
||||
"others still using it");
|
||||
if (VDBG) {
|
||||
log("stopUsingNetworkFeature: net " + networkType + ": " + feature +
|
||||
" others still using it");
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
callTeardown = true;
|
||||
} else {
|
||||
if (DBG) log("not a known feature - dropping");
|
||||
if (DBG) {
|
||||
log("stopUsingNetworkFeature: net " + networkType + ": " + feature +
|
||||
" not a known feature - dropping");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (DBG) log("Doing network teardown");
|
||||
|
||||
if (callTeardown) {
|
||||
if (DBG) {
|
||||
log("stopUsingNetworkFeature: teardown net " + networkType + ": " + feature);
|
||||
}
|
||||
tracker.teardown();
|
||||
return 1;
|
||||
} else {
|
||||
@@ -1592,7 +1611,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
mInitialBroadcast = new Intent(intent);
|
||||
}
|
||||
intent.addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY_BEFORE_BOOT);
|
||||
if (DBG) {
|
||||
if (VDBG) {
|
||||
log("sendStickyBroadcast: action=" + intent.getAction());
|
||||
}
|
||||
|
||||
@@ -1604,7 +1623,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
if (delayMs <= 0) {
|
||||
sendStickyBroadcast(intent);
|
||||
} else {
|
||||
if (DBG) {
|
||||
if (VDBG) {
|
||||
log("sendStickyBroadcastDelayed: delayMs=" + delayMs + ", action="
|
||||
+ intent.getAction());
|
||||
}
|
||||
@@ -1779,12 +1798,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
}
|
||||
}
|
||||
if (resetDns) {
|
||||
if (DBG) log("resetting DNS cache for " + iface);
|
||||
if (VDBG) log("resetting DNS cache for " + iface);
|
||||
try {
|
||||
mNetd.flushInterfaceDnsCache(iface);
|
||||
} catch (Exception e) {
|
||||
// never crash - catch them all
|
||||
loge("Exception resetting dns cache: " + e);
|
||||
if (DBG) loge("Exception resetting dns cache: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1840,12 +1859,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
// remove the default route unless somebody else has asked for it
|
||||
String ifaceName = newLp.getInterfaceName();
|
||||
if (TextUtils.isEmpty(ifaceName) == false && mAddedRoutes.contains(r) == false) {
|
||||
if (DBG) log("Removing " + r + " for interface " + ifaceName);
|
||||
if (VDBG) log("Removing " + r + " for interface " + ifaceName);
|
||||
try {
|
||||
mNetd.removeRoute(ifaceName, r);
|
||||
} catch (Exception e) {
|
||||
// never crash - catch them all
|
||||
loge("Exception trying to remove a route: " + e);
|
||||
if (VDBG) loge("Exception trying to remove a route: " + e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2059,7 +2078,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
mNetd.setDnsServersForInterface(iface, NetworkUtils.makeStrings(dnses));
|
||||
mNetd.setDefaultInterfaceForDns(iface);
|
||||
} catch (Exception e) {
|
||||
loge("exception setting default dns interface: " + e);
|
||||
if (VDBG) loge("exception setting default dns interface: " + e);
|
||||
}
|
||||
}
|
||||
if (!domains.equals(SystemProperties.get("net.dns.search"))) {
|
||||
@@ -2089,7 +2108,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
mNetd.setDnsServersForInterface(p.getInterfaceName(),
|
||||
NetworkUtils.makeStrings(dnses));
|
||||
} catch (Exception e) {
|
||||
loge("exception setting dns servers: " + e);
|
||||
if (VDBG) loge("exception setting dns servers: " + e);
|
||||
}
|
||||
// set per-pid dns for attached secondary nets
|
||||
List pids = mNetRequestersPids[netType];
|
||||
@@ -2194,9 +2213,12 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
int type = info.getType();
|
||||
NetworkInfo.State state = info.getState();
|
||||
|
||||
if (DBG) log("ConnectivityChange for " +
|
||||
if (VDBG || (state == NetworkInfo.State.CONNECTED) ||
|
||||
(state == NetworkInfo.State.DISCONNECTED)) {
|
||||
log("ConnectivityChange for " +
|
||||
info.getTypeName() + ": " +
|
||||
state + "/" + info.getDetailedState());
|
||||
}
|
||||
|
||||
// Connectivity state changed:
|
||||
// [31-13] Reserved for future use
|
||||
@@ -2458,23 +2480,24 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
}
|
||||
|
||||
private void handleInetConditionChange(int netType, int condition) {
|
||||
if (DBG) {
|
||||
log("Inet connectivity change, net=" +
|
||||
netType + ", condition=" + condition +
|
||||
",mActiveDefaultNetwork=" + mActiveDefaultNetwork);
|
||||
}
|
||||
if (mActiveDefaultNetwork == -1) {
|
||||
if (DBG) log("no active default network - aborting");
|
||||
if (DBG) log("handleInetConditionChange: no active default network - ignore");
|
||||
return;
|
||||
}
|
||||
if (mActiveDefaultNetwork != netType) {
|
||||
if (DBG) log("given net not default - aborting");
|
||||
if (DBG) log("handleInetConditionChange: net=" + netType +
|
||||
" != default=" + mActiveDefaultNetwork + " - ignore");
|
||||
return;
|
||||
}
|
||||
if (VDBG) {
|
||||
log("handleInetConditionChange: net=" +
|
||||
netType + ", condition=" + condition +
|
||||
",mActiveDefaultNetwork=" + mActiveDefaultNetwork);
|
||||
}
|
||||
mDefaultInetCondition = condition;
|
||||
int delay;
|
||||
if (mInetConditionChangeInFlight == false) {
|
||||
if (VDBG) log("starting a change hold");
|
||||
if (VDBG) log("handleInetConditionChange: starting a change hold");
|
||||
// setup a new hold to debounce this
|
||||
if (mDefaultInetCondition > 50) {
|
||||
delay = Settings.Secure.getInt(mContext.getContentResolver(),
|
||||
@@ -2487,26 +2510,25 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
mHandler.sendMessageDelayed(mHandler.obtainMessage(EVENT_INET_CONDITION_HOLD_END,
|
||||
mActiveDefaultNetwork, mDefaultConnectionSequence), delay);
|
||||
} else {
|
||||
// we've set the new condition, when this hold ends that will get
|
||||
// picked up
|
||||
if (VDBG) log("currently in hold - not setting new end evt");
|
||||
// we've set the new condition, when this hold ends that will get picked up
|
||||
if (VDBG) log("handleInetConditionChange: currently in hold - not setting new end evt");
|
||||
}
|
||||
}
|
||||
|
||||
private void handleInetConditionHoldEnd(int netType, int sequence) {
|
||||
if (VDBG) {
|
||||
log("Inet hold end, net=" + netType +
|
||||
", condition =" + mDefaultInetCondition +
|
||||
", published condition =" + mDefaultInetConditionPublished);
|
||||
if (DBG) {
|
||||
log("handleInetConditionHoldEnd: net=" + netType +
|
||||
", condition=" + mDefaultInetCondition +
|
||||
", published condition=" + mDefaultInetConditionPublished);
|
||||
}
|
||||
mInetConditionChangeInFlight = false;
|
||||
|
||||
if (mActiveDefaultNetwork == -1) {
|
||||
if (DBG) log("no active default network - aborting");
|
||||
if (DBG) log("handleInetConditionHoldEnd: no active default network - ignoring");
|
||||
return;
|
||||
}
|
||||
if (mDefaultConnectionSequence != sequence) {
|
||||
if (DBG) log("event hold for obsolete network - aborting");
|
||||
if (DBG) log("handleInetConditionHoldEnd: event hold for obsolete network - ignoring");
|
||||
return;
|
||||
}
|
||||
// TODO: Figure out why this optimization sometimes causes a
|
||||
@@ -2518,7 +2540,7 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
||||
//}
|
||||
NetworkInfo networkInfo = mNetTrackers[mActiveDefaultNetwork].getNetworkInfo();
|
||||
if (networkInfo.isConnected() == false) {
|
||||
if (DBG) log("default network not connected - aborting");
|
||||
if (DBG) log("handleInetConditionHoldEnd: default network not connected - ignoring");
|
||||
return;
|
||||
}
|
||||
mDefaultInetConditionPublished = mDefaultInetCondition;
|
||||
|
||||
@@ -560,8 +560,10 @@ public class NetworkManagementService extends INetworkManagementService.Stub
|
||||
+ e);
|
||||
}
|
||||
|
||||
for (String line : rsp) {
|
||||
Log.v(TAG, "add route response is " + line);
|
||||
if (DBG) {
|
||||
for (String line : rsp) {
|
||||
Log.v(TAG, "add route response is " + line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ import com.android.server.am.BatteryStatsService;
|
||||
*/
|
||||
class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
private static final String TAG = "TelephonyRegistry";
|
||||
private static final boolean DBG = false;
|
||||
|
||||
private static class Record {
|
||||
String pkgForDebug;
|
||||
@@ -387,9 +388,11 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
if (!checkNotifyPermission("notifyDataConnection()" )) {
|
||||
return;
|
||||
}
|
||||
Slog.i(TAG, "notifyDataConnection: state=" + state + " isDataConnectivityPossible="
|
||||
if (DBG) {
|
||||
Slog.i(TAG, "notifyDataConnection: state=" + state + " isDataConnectivityPossible="
|
||||
+ isDataConnectivityPossible + " reason='" + reason
|
||||
+ "' apn='" + apn + "' apnType=" + apnType + " networkType=" + networkType);
|
||||
}
|
||||
synchronized (mRecords) {
|
||||
boolean modified = false;
|
||||
if (state == TelephonyManager.DATA_CONNECTED) {
|
||||
@@ -421,8 +424,10 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
modified = true;
|
||||
}
|
||||
if (modified) {
|
||||
Slog.d(TAG, "onDataConnectionStateChanged(" + mDataConnectionState
|
||||
if (DBG) {
|
||||
Slog.d(TAG, "onDataConnectionStateChanged(" + mDataConnectionState
|
||||
+ ", " + mDataConnectionNetworkType + ")");
|
||||
}
|
||||
for (Record r : mRecords) {
|
||||
if ((r.events & PhoneStateListener.LISTEN_DATA_CONNECTION_STATE) != 0) {
|
||||
try {
|
||||
@@ -639,7 +644,7 @@ class TelephonyRegistry extends ITelephonyRegistry.Stub {
|
||||
}
|
||||
String msg = "Modify Phone State Permission Denial: " + method + " from pid="
|
||||
+ Binder.getCallingPid() + ", uid=" + Binder.getCallingUid();
|
||||
Slog.w(TAG, msg);
|
||||
if (DBG) Slog.w(TAG, msg);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -71,7 +71,8 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
|
||||
private Context mContext;
|
||||
private final static String TAG = "Tethering";
|
||||
private final static boolean DEBUG = true;
|
||||
private final static boolean DBG = true;
|
||||
private final static boolean VDBG = false;
|
||||
|
||||
// TODO - remove both of these - should be part of interface inspection/selection stuff
|
||||
private String[] mTetherableUsbRegexs;
|
||||
@@ -178,7 +179,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
}
|
||||
|
||||
public void interfaceStatusChanged(String iface, boolean up) {
|
||||
if (DEBUG) Log.d(TAG, "interfaceStatusChanged " + iface + ", " + up);
|
||||
if (VDBG) Log.d(TAG, "interfaceStatusChanged " + iface + ", " + up);
|
||||
boolean found = false;
|
||||
boolean usb = false;
|
||||
if (isWifi(iface)) {
|
||||
@@ -203,7 +204,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
if (isUsb(iface)) {
|
||||
// ignore usb0 down after enabling RNDIS
|
||||
// we will handle disconnect in interfaceRemoved instead
|
||||
Log.d(TAG, "ignoring interface down for " + iface);
|
||||
if (VDBG) Log.d(TAG, "ignoring interface down for " + iface);
|
||||
} else if (sm != null) {
|
||||
sm.sendMessage(TetherInterfaceSM.CMD_INTERFACE_DOWN);
|
||||
mIfaces.remove(iface);
|
||||
@@ -213,7 +214,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
}
|
||||
|
||||
public void interfaceLinkStateChanged(String iface, boolean up) {
|
||||
if (DEBUG) Log.d(TAG, "interfaceLinkStateChanged " + iface + ", " + up);
|
||||
if (VDBG) Log.d(TAG, "interfaceLinkStateChanged " + iface + ", " + up);
|
||||
interfaceStatusChanged(iface, up);
|
||||
}
|
||||
|
||||
@@ -239,7 +240,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
}
|
||||
|
||||
public void interfaceAdded(String iface) {
|
||||
if (DEBUG) Log.d(TAG, "interfaceAdded " + iface);
|
||||
if (VDBG) Log.d(TAG, "interfaceAdded " + iface);
|
||||
boolean found = false;
|
||||
boolean usb = false;
|
||||
if (isWifi(iface)) {
|
||||
@@ -253,29 +254,29 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
found = true;
|
||||
}
|
||||
if (found == false) {
|
||||
if (DEBUG) Log.d(TAG, iface + " is not a tetherable iface, ignoring");
|
||||
if (VDBG) Log.d(TAG, iface + " is not a tetherable iface, ignoring");
|
||||
return;
|
||||
}
|
||||
|
||||
synchronized (mIfaces) {
|
||||
TetherInterfaceSM sm = mIfaces.get(iface);
|
||||
if (sm != null) {
|
||||
if (DEBUG) Log.d(TAG, "active iface (" + iface + ") reported as added, ignoring");
|
||||
if (VDBG) Log.d(TAG, "active iface (" + iface + ") reported as added, ignoring");
|
||||
return;
|
||||
}
|
||||
sm = new TetherInterfaceSM(iface, mLooper, usb);
|
||||
mIfaces.put(iface, sm);
|
||||
sm.start();
|
||||
}
|
||||
if (DEBUG) Log.d(TAG, "interfaceAdded :" + iface);
|
||||
if (VDBG) Log.d(TAG, "interfaceAdded :" + iface);
|
||||
}
|
||||
|
||||
public void interfaceRemoved(String iface) {
|
||||
if (DEBUG) Log.d(TAG, "interfaceRemoved " + iface);
|
||||
if (VDBG) Log.d(TAG, "interfaceRemoved " + iface);
|
||||
synchronized (mIfaces) {
|
||||
TetherInterfaceSM sm = mIfaces.get(iface);
|
||||
if (sm == null) {
|
||||
if (DEBUG) {
|
||||
if (VDBG) {
|
||||
Log.e(TAG, "attempting to remove unknown iface (" + iface + "), ignoring");
|
||||
}
|
||||
return;
|
||||
@@ -288,7 +289,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
public void limitReached(String limitName, String iface) {}
|
||||
|
||||
public int tether(String iface) {
|
||||
Log.d(TAG, "Tethering " + iface);
|
||||
if (DBG) Log.d(TAG, "Tethering " + iface);
|
||||
TetherInterfaceSM sm = null;
|
||||
synchronized (mIfaces) {
|
||||
sm = mIfaces.get(iface);
|
||||
@@ -306,7 +307,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
}
|
||||
|
||||
public int untether(String iface) {
|
||||
Log.d(TAG, "Untethering " + iface);
|
||||
if (DBG) Log.d(TAG, "Untethering " + iface);
|
||||
TetherInterfaceSM sm = null;
|
||||
synchronized (mIfaces) {
|
||||
sm = mIfaces.get(iface);
|
||||
@@ -383,7 +384,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
broadcast.putStringArrayListExtra(ConnectivityManager.EXTRA_ERRORED_TETHER,
|
||||
erroredList);
|
||||
mContext.sendStickyBroadcast(broadcast);
|
||||
if (DEBUG) {
|
||||
if (VDBG) {
|
||||
Log.d(TAG, "sendTetherStateChangedBroadcast " + availableList.size() + ", " +
|
||||
activeList.size() + ", " + erroredList.size());
|
||||
}
|
||||
@@ -468,14 +469,14 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
mUsbTetherRequested = false;
|
||||
}
|
||||
} else if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) {
|
||||
if (DEBUG) Log.d(TAG, "Tethering got CONNECTIVITY_ACTION");
|
||||
if (VDBG) Log.d(TAG, "Tethering got CONNECTIVITY_ACTION");
|
||||
mTetherMasterSM.sendMessage(TetherMasterSM.CMD_UPSTREAM_CHANGED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void tetherUsb(boolean enable) {
|
||||
if (DEBUG) Log.d(TAG, "tetherUsb " + enable);
|
||||
if (VDBG) Log.d(TAG, "tetherUsb " + enable);
|
||||
|
||||
String[] ifaces = new String[0];
|
||||
try {
|
||||
@@ -497,7 +498,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
|
||||
// configured when we start tethering and unconfig'd on error or conclusion
|
||||
private boolean configureUsbIface(boolean enabled) {
|
||||
if (DEBUG) Log.d(TAG, "configureUsbIface(" + enabled + ")");
|
||||
if (VDBG) Log.d(TAG, "configureUsbIface(" + enabled + ")");
|
||||
|
||||
// toggle the USB interfaces
|
||||
String[] ifaces = new String[0];
|
||||
@@ -547,7 +548,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
}
|
||||
|
||||
public int setUsbTethering(boolean enable) {
|
||||
if (DEBUG) Log.d(TAG, "setUsbTethering(" + enable + ")");
|
||||
if (VDBG) Log.d(TAG, "setUsbTethering(" + enable + ")");
|
||||
UsbManager usbManager = (UsbManager)mContext.getSystemService(Context.USB_SERVICE);
|
||||
|
||||
synchronized (this) {
|
||||
@@ -808,7 +809,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
|
||||
@Override
|
||||
public boolean processMessage(Message message) {
|
||||
if (DEBUG) Log.d(TAG, "InitialState.processMessage what=" + message.what);
|
||||
if (VDBG) Log.d(TAG, "InitialState.processMessage what=" + message.what);
|
||||
boolean retValue = true;
|
||||
switch (message.what) {
|
||||
case CMD_TETHER_REQUESTED:
|
||||
@@ -849,7 +850,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
}
|
||||
@Override
|
||||
public boolean processMessage(Message message) {
|
||||
if (DEBUG) Log.d(TAG, "StartingState.processMessage what=" + message.what);
|
||||
if (VDBG) Log.d(TAG, "StartingState.processMessage what=" + message.what);
|
||||
boolean retValue = true;
|
||||
switch (message.what) {
|
||||
// maybe a parent class?
|
||||
@@ -897,14 +898,14 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
transitionTo(mInitialState);
|
||||
return;
|
||||
}
|
||||
if (DEBUG) Log.d(TAG, "Tethered " + mIfaceName);
|
||||
if (DBG) Log.d(TAG, "Tethered " + mIfaceName);
|
||||
setAvailable(false);
|
||||
setTethered(true);
|
||||
sendTetherStateChangedBroadcast();
|
||||
}
|
||||
@Override
|
||||
public boolean processMessage(Message message) {
|
||||
if (DEBUG) Log.d(TAG, "TetheredState.processMessage what=" + message.what);
|
||||
if (VDBG) Log.d(TAG, "TetheredState.processMessage what=" + message.what);
|
||||
boolean retValue = true;
|
||||
boolean error = false;
|
||||
switch (message.what) {
|
||||
@@ -944,14 +945,14 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
} else if (message.what == CMD_INTERFACE_DOWN) {
|
||||
transitionTo(mUnavailableState);
|
||||
}
|
||||
if (DEBUG) Log.d(TAG, "Untethered " + mIfaceName);
|
||||
if (DBG) Log.d(TAG, "Untethered " + mIfaceName);
|
||||
break;
|
||||
case CMD_TETHER_CONNECTION_CHANGED:
|
||||
String newUpstreamIfaceName = (String)(message.obj);
|
||||
if ((mMyUpstreamIfaceName == null && newUpstreamIfaceName == null) ||
|
||||
(mMyUpstreamIfaceName != null &&
|
||||
mMyUpstreamIfaceName.equals(newUpstreamIfaceName))) {
|
||||
if (DEBUG) Log.d(TAG, "Connection changed noop - dropping");
|
||||
if (VDBG) Log.d(TAG, "Connection changed noop - dropping");
|
||||
break;
|
||||
}
|
||||
if (mMyUpstreamIfaceName != null) {
|
||||
@@ -1018,7 +1019,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
ConnectivityManager.TETHER_ERROR_MASTER_ERROR);
|
||||
break;
|
||||
}
|
||||
if (DEBUG) Log.d(TAG, "Tether lost upstream connection " + mIfaceName);
|
||||
if (VDBG) Log.d(TAG, "Tether lost upstream connection " + mIfaceName);
|
||||
sendTetherStateChangedBroadcast();
|
||||
if (mUsb) {
|
||||
if (!Tethering.this.configureUsbIface(false)) {
|
||||
@@ -1248,7 +1249,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
}
|
||||
}
|
||||
|
||||
if (DEBUG) {
|
||||
if (VDBG) {
|
||||
Log.d(TAG, "chooseUpstreamType(" + tryCell + "), preferredApn ="
|
||||
+ mPreferredUpstreamMobileApn + ", got type=" + upType);
|
||||
}
|
||||
@@ -1280,7 +1281,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
}
|
||||
|
||||
protected void notifyTetheredOfNewUpstreamIface(String ifaceName) {
|
||||
if (DEBUG) Log.d(TAG, "notifying tethered with iface =" + ifaceName);
|
||||
if (VDBG) Log.d(TAG, "notifying tethered with iface =" + ifaceName);
|
||||
mUpstreamIfaceName = ifaceName;
|
||||
for (Object o : mNotifyList) {
|
||||
TetherInterfaceSM sm = (TetherInterfaceSM)o;
|
||||
@@ -1296,19 +1297,19 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
}
|
||||
@Override
|
||||
public boolean processMessage(Message message) {
|
||||
if (DEBUG) Log.d(TAG, "MasterInitialState.processMessage what=" + message.what);
|
||||
if (VDBG) Log.d(TAG, "MasterInitialState.processMessage what=" + message.what);
|
||||
boolean retValue = true;
|
||||
switch (message.what) {
|
||||
case CMD_TETHER_MODE_REQUESTED:
|
||||
checkDunRequired();
|
||||
TetherInterfaceSM who = (TetherInterfaceSM)message.obj;
|
||||
if (DEBUG) Log.d(TAG, "Tether Mode requested by " + who.toString());
|
||||
if (VDBG) Log.d(TAG, "Tether Mode requested by " + who.toString());
|
||||
mNotifyList.add(who);
|
||||
transitionTo(mTetherModeAliveState);
|
||||
break;
|
||||
case CMD_TETHER_MODE_UNREQUESTED:
|
||||
who = (TetherInterfaceSM)message.obj;
|
||||
if (DEBUG) Log.d(TAG, "Tether Mode unrequested by " + who.toString());
|
||||
if (VDBG) Log.d(TAG, "Tether Mode unrequested by " + who.toString());
|
||||
int index = mNotifyList.indexOf(who);
|
||||
if (index != -1) {
|
||||
mNotifyList.remove(who);
|
||||
@@ -1339,7 +1340,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
}
|
||||
@Override
|
||||
public boolean processMessage(Message message) {
|
||||
if (DEBUG) Log.d(TAG, "TetherModeAliveState.processMessage what=" + message.what);
|
||||
if (VDBG) Log.d(TAG, "TetherModeAliveState.processMessage what=" + message.what);
|
||||
boolean retValue = true;
|
||||
switch (message.what) {
|
||||
case CMD_TETHER_MODE_REQUESTED:
|
||||
@@ -1368,7 +1369,7 @@ public class Tethering extends INetworkManagementEventObserver.Stub {
|
||||
// make sure we're still using a requested connection - may have found
|
||||
// wifi or something since then.
|
||||
if (mCurrentConnectionSequence == message.arg1) {
|
||||
if (DEBUG) {
|
||||
if (VDBG) {
|
||||
Log.d(TAG, "renewing mobile connection - requeuing for another " +
|
||||
CELL_CONNECTION_RENEW_MS + "ms");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user