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:
Jeff Sharkey
2013-09-10 21:03:27 -07:00
parent e79657d5fb
commit 73c92d5077
2 changed files with 12 additions and 2 deletions

View File

@@ -135,6 +135,9 @@ public class NetworkStatsRecorder {
} catch (IOException e) { } catch (IOException e) {
Log.wtf(TAG, "problem completely reading network stats", e); Log.wtf(TAG, "problem completely reading network stats", e);
recoverFromWtf(); recoverFromWtf();
} catch (OutOfMemoryError e) {
Log.wtf(TAG, "problem completely reading network stats", e);
recoverFromWtf();
} }
} }
return complete; return complete;
@@ -226,6 +229,9 @@ public class NetworkStatsRecorder {
} catch (IOException e) { } catch (IOException e) {
Log.wtf(TAG, "problem persisting pending stats", e); Log.wtf(TAG, "problem persisting pending stats", e);
recoverFromWtf(); recoverFromWtf();
} catch (OutOfMemoryError e) {
Log.wtf(TAG, "problem persisting pending stats", e);
recoverFromWtf();
} }
} }
} }
@@ -241,6 +247,9 @@ public class NetworkStatsRecorder {
} catch (IOException e) { } catch (IOException e) {
Log.wtf(TAG, "problem removing UIDs " + Arrays.toString(uids), e); Log.wtf(TAG, "problem removing UIDs " + Arrays.toString(uids), e);
recoverFromWtf(); recoverFromWtf();
} catch (OutOfMemoryError e) {
Log.wtf(TAG, "problem removing UIDs " + Arrays.toString(uids), e);
recoverFromWtf();
} }
// Remove any pending stats // Remove any pending stats

View File

@@ -412,6 +412,8 @@ public class NetworkStatsService extends INetworkStatsService.Stub {
} }
} catch (IOException e) { } catch (IOException e) {
Log.wtf(TAG, "problem during legacy upgrade", 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 { private NetworkStats getNetworkStatsTethering() throws RemoteException {
try { try {
final String[] tetheredIfacePairs = mConnManager.getTetheredIfacePairs(); return mNetworkManager.getNetworkStatsTethering();
return mNetworkManager.getNetworkStatsTethering(tetheredIfacePairs);
} catch (IllegalStateException e) { } catch (IllegalStateException e) {
Log.wtf(TAG, "problem reading network stats", e); Log.wtf(TAG, "problem reading network stats", e);
return new NetworkStats(0L, 10); return new NetworkStats(0L, 10);