Merge "IpManager: delete dead getLinkProperties() code" into nyc-dev

This commit is contained in:
Erik Kline
2016-04-26 07:14:58 +00:00
committed by Android (Google) Code Review

View File

@@ -41,7 +41,6 @@ import android.util.LocalLog;
import android.util.Log; import android.util.Log;
import android.util.SparseArray; import android.util.SparseArray;
import com.android.internal.annotations.GuardedBy;
import com.android.internal.annotations.VisibleForTesting; import com.android.internal.annotations.VisibleForTesting;
import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.IndentingPrintWriter;
import com.android.internal.util.State; import com.android.internal.util.State;
@@ -330,7 +329,6 @@ public class IpManager extends StateMachine {
// TODO: Revert this hack once IpManager and Nat464Xlat work in concert. // TODO: Revert this hack once IpManager and Nat464Xlat work in concert.
private static final String CLAT_PREFIX = "v4-"; private static final String CLAT_PREFIX = "v4-";
private final Object mLock = new Object();
private final State mStoppedState = new StoppedState(); private final State mStoppedState = new StoppedState();
private final State mStoppingState = new StoppingState(); private final State mStoppingState = new StoppingState();
private final State mStartedState = new StartedState(); private final State mStartedState = new StartedState();
@@ -350,6 +348,7 @@ public class IpManager extends StateMachine {
/** /**
* Non-final member variables accessed only from within our StateMachine. * Non-final member variables accessed only from within our StateMachine.
*/ */
private LinkProperties mLinkProperties;
private ProvisioningConfiguration mConfiguration; private ProvisioningConfiguration mConfiguration;
private IpReachabilityMonitor mIpReachabilityMonitor; private IpReachabilityMonitor mIpReachabilityMonitor;
private DhcpClient mDhcpClient; private DhcpClient mDhcpClient;
@@ -360,13 +359,6 @@ public class IpManager extends StateMachine {
private boolean mMulticastFiltering; private boolean mMulticastFiltering;
private long mStartTimeMillis; private long mStartTimeMillis;
/**
* Member variables accessed both from within the StateMachine thread
* and via accessors from other threads.
*/
@GuardedBy("mLock")
private LinkProperties mLinkProperties;
public IpManager(Context context, String ifName, Callback callback) public IpManager(Context context, String ifName, Callback callback)
throws IllegalArgumentException { throws IllegalArgumentException {
this(context, ifName, callback, INetworkManagementService.Stub.asInterface( this(context, ifName, callback, INetworkManagementService.Stub.asInterface(
@@ -506,12 +498,6 @@ public class IpManager extends StateMachine {
sendMessage(CMD_SET_MULTICAST_FILTER, enabled); sendMessage(CMD_SET_MULTICAST_FILTER, enabled);
} }
public LinkProperties getLinkProperties() {
synchronized (mLock) {
return new LinkProperties(mLinkProperties);
}
}
public void dump(FileDescriptor fd, PrintWriter writer, String[] args) { public void dump(FileDescriptor fd, PrintWriter writer, String[] args) {
IndentingPrintWriter pw = new IndentingPrintWriter(writer, " "); IndentingPrintWriter pw = new IndentingPrintWriter(writer, " ");
pw.println("APF dump:"); pw.println("APF dump:");
@@ -586,11 +572,9 @@ public class IpManager extends StateMachine {
mTcpBufferSizes = ""; mTcpBufferSizes = "";
mHttpProxy = null; mHttpProxy = null;
synchronized (mLock) {
mLinkProperties = new LinkProperties(); mLinkProperties = new LinkProperties();
mLinkProperties.setInterfaceName(mInterfaceName); mLinkProperties.setInterfaceName(mInterfaceName);
} }
}
private void recordMetric(final int type) { private void recordMetric(final int type) {
if (mStartTimeMillis <= 0) { Log.wtf(mTag, "Start time undefined!"); } if (mStartTimeMillis <= 0) { Log.wtf(mTag, "Start time undefined!"); }
@@ -695,11 +679,8 @@ public class IpManager extends StateMachine {
mIpReachabilityMonitor.updateLinkProperties(newLp); mIpReachabilityMonitor.updateLinkProperties(newLp);
} }
ProvisioningChange delta; ProvisioningChange delta = compareProvisioning(mLinkProperties, newLp);
synchronized (mLock) {
delta = compareProvisioning(mLinkProperties, newLp);
mLinkProperties = new LinkProperties(newLp); mLinkProperties = new LinkProperties(newLp);
}
if (DBG) { if (DBG) {
switch (delta) { switch (delta) {
@@ -714,10 +695,8 @@ public class IpManager extends StateMachine {
} }
private boolean linkPropertiesUnchanged(LinkProperties newLp) { private boolean linkPropertiesUnchanged(LinkProperties newLp) {
synchronized (mLock) {
return Objects.equals(newLp, mLinkProperties); return Objects.equals(newLp, mLinkProperties);
} }
}
private LinkProperties assembleLinkProperties() { private LinkProperties assembleLinkProperties() {
// [1] Create a new LinkProperties object to populate. // [1] Create a new LinkProperties object to populate.
@@ -970,7 +949,7 @@ public class IpManager extends StateMachine {
} else { } else {
if (VDBG) { Log.d(mTag, "onProvisioningFailure()"); } if (VDBG) { Log.d(mTag, "onProvisioningFailure()"); }
recordMetric(IPCE_IPMGR_PROVISIONING_FAIL); recordMetric(IPCE_IPMGR_PROVISIONING_FAIL);
mCallback.onProvisioningFailure(getLinkProperties()); mCallback.onProvisioningFailure(new LinkProperties(mLinkProperties));
transitionTo(mStoppingState); transitionTo(mStoppingState);
} }
} else { } else {