OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |