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:
@@ -135,6 +135,9 @@ public class NetworkStatsRecorder {
|
||||
} catch (IOException e) {
|
||||
Log.wtf(TAG, "problem completely reading network stats", e);
|
||||
recoverFromWtf();
|
||||
} catch (OutOfMemoryError e) {
|
||||
Log.wtf(TAG, "problem completely reading network stats", e);
|
||||
recoverFromWtf();
|
||||
}
|
||||
}
|
||||
return complete;
|
||||
@@ -226,6 +229,9 @@ public class NetworkStatsRecorder {
|
||||
} catch (IOException e) {
|
||||
Log.wtf(TAG, "problem persisting pending stats", e);
|
||||
recoverFromWtf();
|
||||
} catch (OutOfMemoryError e) {
|
||||
Log.wtf(TAG, "problem persisting pending stats", e);
|
||||
recoverFromWtf();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -241,6 +247,9 @@ public class NetworkStatsRecorder {
|
||||
} catch (IOException e) {
|
||||
Log.wtf(TAG, "problem removing UIDs " + Arrays.toString(uids), e);
|
||||
recoverFromWtf();
|
||||
} catch (OutOfMemoryError e) {
|
||||
Log.wtf(TAG, "problem removing UIDs " + Arrays.toString(uids), e);
|
||||
recoverFromWtf();
|
||||
}
|
||||
|
||||
// Remove any pending stats
|
||||
|
||||
@@ -412,6 +412,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.wtf(TAG, "problem during legacy upgrade", e);
|
||||
} catch (OutOfMemoryError e) {
|
||||
Log.wtf(TAG, "problem during legacy upgrade", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1186,8 +1188,7 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
|
||||
*/
|
||||
private NetworkStats getNetworkStatsTethering() throws RemoteException {
|
||||
try {
|
||||
final String[] tetheredIfacePairs = mConnManager.getTetheredIfacePairs();
|
||||
return mNetworkManager.getNetworkStatsTethering(tetheredIfacePairs);
|
||||
return mNetworkManager.getNetworkStatsTethering();
|
||||
} catch (IllegalStateException e) {
|
||||
Log.wtf(TAG, "problem reading network stats", e);
|
||||
return new NetworkStats(0L, 10);
|
||||
|
||||
Reference in New Issue
Block a user