Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
383df3f0
authored
Dec 13, 2018
by
eguven
Committed by
Oliver Woodman
Dec 14, 2018
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add start and update time fields to DownloadState
PiperOrigin-RevId: 225363788
parent
36f2bead
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
6 deletions
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadManager.java
library/core/src/main/java/com/google/android/exoplayer2/offline/DownloadManager.java
View file @
383df3f0
...
@@ -508,15 +508,16 @@ public final class DownloadManager {
...
@@ -508,15 +508,16 @@ public final class DownloadManager {
public
final
DownloadAction
action
;
public
final
DownloadAction
action
;
/** The state of the download. */
/** The state of the download. */
public
final
@State
int
state
;
public
final
@State
int
state
;
/** The estimated download percentage, or {@link C#PERCENTAGE_UNSET} if unavailable. */
/**
* The estimated download percentage, or {@link C#PERCENTAGE_UNSET} if no estimate is available.
*/
public
final
float
downloadPercentage
;
public
final
float
downloadPercentage
;
/** The total number of downloaded bytes. */
/** The total number of downloaded bytes. */
public
final
long
downloadedBytes
;
public
final
long
downloadedBytes
;
/** The total size of the media, or {@link C#LENGTH_UNSET} if unknown. */
/** The total size of the media, or {@link C#LENGTH_UNSET} if unknown. */
public
final
long
totalBytes
;
public
final
long
totalBytes
;
/** The first time when download entry is created. */
public
final
long
startTimeMs
;
/** The last update time. */
public
final
long
updateTimeMs
;
/**
/**
* If {@link #state} is {@link #STATE_FAILED} then this is the cause, otherwise {@link
* If {@link #state} is {@link #STATE_FAILED} then this is the cause, otherwise {@link
...
@@ -530,7 +531,8 @@ public final class DownloadManager {
...
@@ -530,7 +531,8 @@ public final class DownloadManager {
float
downloadPercentage
,
float
downloadPercentage
,
long
downloadedBytes
,
long
downloadedBytes
,
long
totalBytes
,
long
totalBytes
,
@FailureReason
int
failureReason
)
{
@FailureReason
int
failureReason
,
long
startTimeMs
)
{
Assertions
.
checkState
(
Assertions
.
checkState
(
failureReason
==
FAILURE_REASON_NONE
?
state
!=
STATE_FAILED
:
state
==
STATE_FAILED
);
failureReason
==
FAILURE_REASON_NONE
?
state
!=
STATE_FAILED
:
state
==
STATE_FAILED
);
this
.
id
=
action
.
id
;
this
.
id
=
action
.
id
;
...
@@ -540,6 +542,8 @@ public final class DownloadManager {
...
@@ -540,6 +542,8 @@ public final class DownloadManager {
this
.
downloadedBytes
=
downloadedBytes
;
this
.
downloadedBytes
=
downloadedBytes
;
this
.
totalBytes
=
totalBytes
;
this
.
totalBytes
=
totalBytes
;
this
.
failureReason
=
failureReason
;
this
.
failureReason
=
failureReason
;
this
.
startTimeMs
=
startTimeMs
;
updateTimeMs
=
System
.
currentTimeMillis
();
}
}
}
}
...
@@ -556,6 +560,7 @@ public final class DownloadManager {
...
@@ -556,6 +560,7 @@ public final class DownloadManager {
private
final
DownloadManager
downloadManager
;
private
final
DownloadManager
downloadManager
;
private
final
DownloaderFactory
downloaderFactory
;
private
final
DownloaderFactory
downloaderFactory
;
private
final
int
minRetryCount
;
private
final
int
minRetryCount
;
private
final
long
startTimeMs
;
private
final
ArrayDeque
<
DownloadAction
>
actionQueue
;
private
final
ArrayDeque
<
DownloadAction
>
actionQueue
;
private
DownloadAction
action
;
private
DownloadAction
action
;
/** The current state of the download. */
/** The current state of the download. */
...
@@ -580,6 +585,7 @@ public final class DownloadManager {
...
@@ -580,6 +585,7 @@ public final class DownloadManager {
this
.
downloaderFactory
=
downloaderFactory
;
this
.
downloaderFactory
=
downloaderFactory
;
this
.
action
=
action
;
this
.
action
=
action
;
this
.
minRetryCount
=
minRetryCount
;
this
.
minRetryCount
=
minRetryCount
;
this
.
startTimeMs
=
System
.
currentTimeMillis
();
state
=
STATE_QUEUED
;
state
=
STATE_QUEUED
;
targetState
=
STATE_COMPLETED
;
targetState
=
STATE_COMPLETED
;
actionQueue
=
new
ArrayDeque
<>();
actionQueue
=
new
ArrayDeque
<>();
...
@@ -614,7 +620,13 @@ public final class DownloadManager {
...
@@ -614,7 +620,13 @@ public final class DownloadManager {
totalBytes
=
downloader
.
getTotalBytes
();
totalBytes
=
downloader
.
getTotalBytes
();
}
}
return
new
DownloadState
(
return
new
DownloadState
(
action
,
state
,
downloadPercentage
,
downloadedBytes
,
totalBytes
,
failureReason
);
action
,
state
,
downloadPercentage
,
downloadedBytes
,
totalBytes
,
failureReason
,
startTimeMs
);
}
}
/** Returns whether the download is finished. */
/** Returns whether the download is finished. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment