Merge changes I9b96cdcf,Ib4b29a7f into mnc-dev
* changes: Remove the IPv4 address from the interface when DHCP fails. Make the dumpsys connectivity shorter and easier to read.
This commit is contained in:
committed by
Android (Google) Code Review
commit
0326f7772c
@@ -543,16 +543,24 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
}
|
||||
|
||||
public void dump(IndentingPrintWriter pw) {
|
||||
pw.println("mLegacyTypeTracker:");
|
||||
pw.increaseIndent();
|
||||
pw.print("Supported types:");
|
||||
for (int type = 0; type < mTypeLists.length; type++) {
|
||||
if (mTypeLists[type] == null) continue;
|
||||
pw.print(type + " ");
|
||||
pw.increaseIndent();
|
||||
if (mTypeLists[type].size() == 0) pw.println("none");
|
||||
for (NetworkAgentInfo nai : mTypeLists[type]) {
|
||||
pw.println(naiToString(nai));
|
||||
}
|
||||
pw.decreaseIndent();
|
||||
if (mTypeLists[type] != null) pw.print(" " + type);
|
||||
}
|
||||
pw.println();
|
||||
pw.println("Current state:");
|
||||
pw.increaseIndent();
|
||||
for (int type = 0; type < mTypeLists.length; type++) {
|
||||
if (mTypeLists[type] == null|| mTypeLists[type].size() == 0) continue;
|
||||
for (NetworkAgentInfo nai : mTypeLists[type]) {
|
||||
pw.println(type + " " + naiToString(nai));
|
||||
}
|
||||
}
|
||||
pw.decreaseIndent();
|
||||
pw.decreaseIndent();
|
||||
pw.println();
|
||||
}
|
||||
|
||||
// This class needs its own log method because it has a different TAG.
|
||||
@@ -1750,12 +1758,11 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
return;
|
||||
}
|
||||
|
||||
pw.println("NetworkFactories for:");
|
||||
pw.increaseIndent();
|
||||
pw.print("NetworkFactories for:");
|
||||
for (NetworkFactoryInfo nfi : mNetworkFactoryInfos.values()) {
|
||||
pw.println(nfi.name);
|
||||
pw.print(" " + nfi.name);
|
||||
}
|
||||
pw.decreaseIndent();
|
||||
pw.println();
|
||||
pw.println();
|
||||
|
||||
NetworkAgentInfo defaultNai = mNetworkForRequestId.get(mDefaultRequest.requestId);
|
||||
@@ -1795,22 +1802,22 @@ public class ConnectivityService extends IConnectivityManager.Stub
|
||||
pw.println();
|
||||
pw.decreaseIndent();
|
||||
|
||||
pw.println("mLegacyTypeTracker:");
|
||||
pw.increaseIndent();
|
||||
mLegacyTypeTracker.dump(pw);
|
||||
pw.decreaseIndent();
|
||||
pw.println();
|
||||
|
||||
synchronized (this) {
|
||||
pw.println("NetworkTransitionWakeLock is currently " +
|
||||
(mNetTransitionWakeLock.isHeld() ? "" : "not ") + "held.");
|
||||
pw.println("It was last requested for "+mNetTransitionWakeLockCausedBy);
|
||||
pw.print("mNetTransitionWakeLock: currently " +
|
||||
(mNetTransitionWakeLock.isHeld() ? "" : "not ") + "held");
|
||||
if (!TextUtils.isEmpty(mNetTransitionWakeLockCausedBy)) {
|
||||
pw.println(", last requested for " + mNetTransitionWakeLockCausedBy);
|
||||
} else {
|
||||
pw.println(", last requested never");
|
||||
}
|
||||
}
|
||||
pw.println();
|
||||
|
||||
mTethering.dump(fd, pw, args);
|
||||
|
||||
if (mInetLog != null) {
|
||||
if (mInetLog != null && mInetLog.size() > 0) {
|
||||
pw.println();
|
||||
pw.println("Inet condition reports:");
|
||||
pw.increaseIndent();
|
||||
|
||||
@@ -48,6 +48,7 @@ import com.android.internal.telephony.IccCardConstants;
|
||||
import com.android.internal.telephony.Phone;
|
||||
import com.android.internal.telephony.PhoneConstants;
|
||||
import com.android.internal.telephony.TelephonyIntents;
|
||||
import com.android.internal.util.IndentingPrintWriter;
|
||||
import com.android.internal.util.IState;
|
||||
import com.android.internal.util.State;
|
||||
import com.android.internal.util.StateMachine;
|
||||
@@ -1684,7 +1685,9 @@ public class Tethering extends BaseNetworkObserver {
|
||||
}
|
||||
}
|
||||
|
||||
public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
|
||||
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
|
||||
final IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
|
||||
|
||||
if (mContext.checkCallingOrSelfPermission(
|
||||
android.Manifest.permission.DUMP) != PackageManager.PERMISSION_GRANTED) {
|
||||
pw.println("Permission Denial: can't dump ConnectivityService.Tether " +
|
||||
@@ -1693,19 +1696,23 @@ public class Tethering extends BaseNetworkObserver {
|
||||
return;
|
||||
}
|
||||
|
||||
pw.println("Tethering:");
|
||||
pw.increaseIndent();
|
||||
pw.print("mUpstreamIfaceTypes:");
|
||||
synchronized (mPublicSync) {
|
||||
pw.println("mUpstreamIfaceTypes: ");
|
||||
for (Integer netType : mUpstreamIfaceTypes) {
|
||||
pw.println(" " + netType);
|
||||
pw.print(" " + ConnectivityManager.getNetworkTypeName(netType));
|
||||
}
|
||||
|
||||
pw.println();
|
||||
|
||||
pw.println("Tether state:");
|
||||
pw.increaseIndent();
|
||||
for (Object o : mIfaces.values()) {
|
||||
pw.println(" " + o);
|
||||
pw.println(o);
|
||||
}
|
||||
pw.decreaseIndent();
|
||||
}
|
||||
pw.println();
|
||||
pw.decreaseIndent();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,6 +165,7 @@ public class DhcpClient extends BaseDhcpStateMachine {
|
||||
private State mDhcpInitState = new DhcpInitState();
|
||||
private State mDhcpSelectingState = new DhcpSelectingState();
|
||||
private State mDhcpRequestingState = new DhcpRequestingState();
|
||||
private State mDhcpHaveAddressState = new DhcpHaveAddressState();
|
||||
private State mDhcpBoundState = new DhcpBoundState();
|
||||
private State mDhcpRenewingState = new DhcpRenewingState();
|
||||
private State mDhcpRebindingState = new DhcpRebindingState();
|
||||
@@ -186,10 +187,11 @@ public class DhcpClient extends BaseDhcpStateMachine {
|
||||
addState(mWaitBeforeStartState, mDhcpState);
|
||||
addState(mDhcpSelectingState, mDhcpState);
|
||||
addState(mDhcpRequestingState, mDhcpState);
|
||||
addState(mDhcpBoundState, mDhcpState);
|
||||
addState(mWaitBeforeRenewalState, mDhcpState);
|
||||
addState(mDhcpRenewingState, mDhcpState);
|
||||
addState(mDhcpRebindingState, mDhcpState);
|
||||
addState(mDhcpHaveAddressState, mDhcpState);
|
||||
addState(mDhcpBoundState, mDhcpHaveAddressState);
|
||||
addState(mWaitBeforeRenewalState, mDhcpHaveAddressState);
|
||||
addState(mDhcpRenewingState, mDhcpHaveAddressState);
|
||||
addState(mDhcpRebindingState, mDhcpHaveAddressState);
|
||||
addState(mDhcpInitRebootState, mDhcpState);
|
||||
addState(mDhcpRebootingState, mDhcpState);
|
||||
|
||||
@@ -402,7 +404,7 @@ public class DhcpClient extends BaseDhcpStateMachine {
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyLease() {
|
||||
private void notifySuccess() {
|
||||
mController.sendMessage(DhcpStateMachine.CMD_POST_DHCP_ACTION,
|
||||
DhcpStateMachine.DHCP_SUCCESS, 0, new DhcpResults(mDhcpLease));
|
||||
}
|
||||
@@ -752,19 +754,30 @@ public class DhcpClient extends BaseDhcpStateMachine {
|
||||
}
|
||||
}
|
||||
|
||||
class DhcpHaveAddressState extends LoggingState {
|
||||
@Override
|
||||
public void enter() {
|
||||
super.enter();
|
||||
if (!setIpAddress(mDhcpLease.ipAddress)) {
|
||||
notifyFailure();
|
||||
transitionTo(mStoppedState);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void exit() {
|
||||
setIpAddress(new LinkAddress("0.0.0.0/0"));
|
||||
}
|
||||
}
|
||||
|
||||
class DhcpBoundState extends LoggingState {
|
||||
@Override
|
||||
public void enter() {
|
||||
super.enter();
|
||||
if (setIpAddress(mDhcpLease.ipAddress)) {
|
||||
notifyLease();
|
||||
// TODO: DhcpStateMachine only supports renewing at 50% of the lease time,
|
||||
// and does not support rebinding. Fix this.
|
||||
scheduleRenew();
|
||||
} else {
|
||||
notifyFailure();
|
||||
transitionTo(mStoppedState);
|
||||
}
|
||||
notifySuccess();
|
||||
// TODO: DhcpStateMachine only supports renewing at 50% of the lease time, and does not
|
||||
// support rebinding. Fix this.
|
||||
scheduleRenew();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user