Request all tethering interfaces, fix corruption.
netd now tracks statistics for tethered interfaces across tethering sessions, so switch to asking for all tethering stats. (Currently we're double-counting all tethering data, ever since it started tracking across sessions.) Also catch OOME to handle corrupt stats files, which we then dump to DropBox and then start over. Bug: 5868832, 9796109 Change-Id: I2eb2a1bf01b993dd198597d770fe0e022466c6b9
This commit is contained in:
@@ -93,12 +93,6 @@ interface IConnectivityManager
|
|||||||
|
|
||||||
String[] getTetheredIfaces();
|
String[] getTetheredIfaces();
|
||||||
|
|
||||||
/**
|
|
||||||
* Return list of interface pairs that are actively tethered. Even indexes are
|
|
||||||
* remote interface, and odd indexes are corresponding local interfaces.
|
|
||||||
*/
|
|
||||||
String[] getTetheredIfacePairs();
|
|
||||||
|
|
||||||
String[] getTetheringErroredIfaces();
|
String[] getTetheringErroredIfaces();
|
||||||
|
|
||||||
String[] getTetherableUsbRegexs();
|
String[] getTetherableUsbRegexs();
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ import android.net.INetworkPolicyManager;
|
|||||||
import android.net.INetworkStatsService;
|
import android.net.INetworkStatsService;
|
||||||
import android.net.LinkAddress;
|
import android.net.LinkAddress;
|
||||||
import android.net.LinkProperties;
|
import android.net.LinkProperties;
|
||||||
import android.net.LinkQualityInfo;
|
|
||||||
import android.net.LinkProperties.CompareResult;
|
import android.net.LinkProperties.CompareResult;
|
||||||
|
import android.net.LinkQualityInfo;
|
||||||
import android.net.MobileDataStateTracker;
|
import android.net.MobileDataStateTracker;
|
||||||
import android.net.NetworkConfig;
|
import android.net.NetworkConfig;
|
||||||
import android.net.NetworkInfo;
|
import android.net.NetworkInfo;
|
||||||
@@ -89,7 +89,6 @@ import android.os.ParcelFileDescriptor;
|
|||||||
import android.os.PowerManager;
|
import android.os.PowerManager;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.os.RemoteException;
|
import android.os.RemoteException;
|
||||||
import android.os.ResultReceiver;
|
|
||||||
import android.os.ServiceManager;
|
import android.os.ServiceManager;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
import android.os.SystemProperties;
|
import android.os.SystemProperties;
|
||||||
@@ -114,7 +113,6 @@ import com.android.internal.telephony.Phone;
|
|||||||
import com.android.internal.telephony.PhoneConstants;
|
import com.android.internal.telephony.PhoneConstants;
|
||||||
import com.android.internal.util.IndentingPrintWriter;
|
import com.android.internal.util.IndentingPrintWriter;
|
||||||
import com.android.internal.util.XmlUtils;
|
import com.android.internal.util.XmlUtils;
|
||||||
import com.android.net.IProxyService;
|
|
||||||
import com.android.server.am.BatteryStatsService;
|
import com.android.server.am.BatteryStatsService;
|
||||||
import com.android.server.connectivity.DataConnectionStats;
|
import com.android.server.connectivity.DataConnectionStats;
|
||||||
import com.android.server.connectivity.Nat464Xlat;
|
import com.android.server.connectivity.Nat464Xlat;
|
||||||
@@ -3209,12 +3207,6 @@ public class ConnectivityService extends IConnectivityManager.Stub {
|
|||||||
return mTethering.getTetheredIfaces();
|
return mTethering.getTetheredIfaces();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String[] getTetheredIfacePairs() {
|
|
||||||
enforceTetherAccessPermission();
|
|
||||||
return mTethering.getTetheredIfacePairs();
|
|
||||||
}
|
|
||||||
|
|
||||||
public String[] getTetheringErroredIfaces() {
|
public String[] getTetheringErroredIfaces() {
|
||||||
enforceTetherAccessPermission();
|
enforceTetherAccessPermission();
|
||||||
return mTethering.getErroredIfaces();
|
return mTethering.getErroredIfaces();
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ import static android.text.format.DateUtils.MINUTE_IN_MILLIS;
|
|||||||
import static android.text.format.DateUtils.WEEK_IN_MILLIS;
|
import static android.text.format.DateUtils.WEEK_IN_MILLIS;
|
||||||
import static com.android.server.net.NetworkStatsService.ACTION_NETWORK_STATS_POLL;
|
import static com.android.server.net.NetworkStatsService.ACTION_NETWORK_STATS_POLL;
|
||||||
import static org.easymock.EasyMock.anyLong;
|
import static org.easymock.EasyMock.anyLong;
|
||||||
import static org.easymock.EasyMock.aryEq;
|
|
||||||
import static org.easymock.EasyMock.capture;
|
import static org.easymock.EasyMock.capture;
|
||||||
import static org.easymock.EasyMock.createMock;
|
import static org.easymock.EasyMock.createMock;
|
||||||
import static org.easymock.EasyMock.eq;
|
import static org.easymock.EasyMock.eq;
|
||||||
@@ -74,13 +73,13 @@ import com.android.server.net.NetworkStatsService;
|
|||||||
import com.android.server.net.NetworkStatsService.NetworkStatsSettings;
|
import com.android.server.net.NetworkStatsService.NetworkStatsSettings;
|
||||||
import com.android.server.net.NetworkStatsService.NetworkStatsSettings.Config;
|
import com.android.server.net.NetworkStatsService.NetworkStatsSettings.Config;
|
||||||
|
|
||||||
|
import libcore.io.IoUtils;
|
||||||
|
|
||||||
import org.easymock.Capture;
|
import org.easymock.Capture;
|
||||||
import org.easymock.EasyMock;
|
import org.easymock.EasyMock;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
import libcore.io.IoUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link NetworkStatsService}.
|
* Tests for {@link NetworkStatsService}.
|
||||||
*/
|
*/
|
||||||
@@ -919,8 +918,7 @@ public class NetworkStatsServiceTest extends AndroidTestCase {
|
|||||||
expect(mNetManager.getNetworkStatsUidDetail(eq(UID_ALL))).andReturn(detail).atLeastOnce();
|
expect(mNetManager.getNetworkStatsUidDetail(eq(UID_ALL))).andReturn(detail).atLeastOnce();
|
||||||
|
|
||||||
// also include tethering details, since they are folded into UID
|
// also include tethering details, since they are folded into UID
|
||||||
expect(mConnManager.getTetheredIfacePairs()).andReturn(tetherIfacePairs).atLeastOnce();
|
expect(mNetManager.getNetworkStatsTethering())
|
||||||
expect(mNetManager.getNetworkStatsTethering(aryEq(tetherIfacePairs)))
|
|
||||||
.andReturn(tetherStats).atLeastOnce();
|
.andReturn(tetherStats).atLeastOnce();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user