Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: chrome/android/java/src/org/chromium/chrome/browser/download/DownloadUmaStatsEntry.java

Issue 2767143006: Remove null entries from UMA stats SharedPrefs (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.chrome.browser.download; 5 package org.chromium.chrome.browser.download;
6 6
7 import org.chromium.base.Log; 7 import org.chromium.base.Log;
8 8
9 /** 9 /**
10 * SharedPreferences entries for for helping report UMA stats. A download may re quire several 10 * SharedPreferences entries for for helping report UMA stats. A download may re quire several
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 try { 50 try {
51 boolean useDownloadManager = "1".equals(values[0]); 51 boolean useDownloadManager = "1".equals(values[0]);
52 boolean isPaused = "1".equals(values[1]); 52 boolean isPaused = "1".equals(values[1]);
53 long downloadStartTime = Long.parseLong(values[2]); 53 long downloadStartTime = Long.parseLong(values[2]);
54 int numInterruptions = Integer.parseInt(values[3]); 54 int numInterruptions = Integer.parseInt(values[3]);
55 String id = values[4]; 55 String id = values[4];
56 long lastReceived = 0; 56 long lastReceived = 0;
57 long wasted = 0; 57 long wasted = 0;
58 if (values.length == 7) { 58 if (values.length == 7) {
59 lastReceived = Long.parseLong(values[5].trim()); 59 lastReceived = Long.parseLong(values[5].trim());
60 wasted = Integer.parseInt(values[6].trim()); 60 wasted = Long.parseLong(values[6].trim());
61 } 61 }
62 return new DownloadUmaStatsEntry( 62 return new DownloadUmaStatsEntry(
63 id, downloadStartTime, numInterruptions, isPaused, useDo wnloadManager, 63 id, downloadStartTime, numInterruptions, isPaused, useDo wnloadManager,
64 lastReceived, wasted); 64 lastReceived, wasted);
65 } catch (NumberFormatException nfe) { 65 } catch (NumberFormatException nfe) {
66 Log.w(TAG, "Exception while parsing UMA entry:" + sharedPrefStri ng); 66 Log.w(TAG, "Exception while parsing UMA entry:" + sharedPrefStri ng);
67 } 67 }
68 } 68 }
69 return null; 69 return null;
70 } 70 }
(...skipping 17 matching lines...) Expand all
88 if (useDownloadManager) { 88 if (useDownloadManager) {
89 item.setSystemDownloadId(Long.parseLong(id)); 89 item.setSystemDownloadId(Long.parseLong(id));
90 } else { 90 } else {
91 DownloadInfo info = new DownloadInfo.Builder().setDownloadGuid(id) 91 DownloadInfo info = new DownloadInfo.Builder().setDownloadGuid(id)
92 .setBytesReceived(lastBytesReceived).build(); 92 .setBytesReceived(lastBytesReceived).build();
93 item.setDownloadInfo(info); 93 item.setDownloadInfo(info);
94 } 94 }
95 return item; 95 return item;
96 } 96 }
97 } 97 }
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698