Skip to content

Commit 878a998

Browse files
committed
upgrade version code(6->7) name(0.1.3 -> 0.1.4)
1 parent a39ede5 commit 878a998

File tree

5 files changed

+97
-10
lines changed

5 files changed

+97
-10
lines changed

CHANGELOG-ZH.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# Change log
22

3+
### Version 0.1.4
4+
5+
#### 新接口
6+
7+
- `FileDownloader#unBindServiceIfIdle(void)`: 如果目前下载进程没有任务正在执行,则关停下载进程
8+
- `FileDownloader#getStatus(downloadId)`: 获取下载Id为downloadId的状态(可参考[任务管理demo](https://github.com/lingochamp/FileDownloader/blob/master/demo/src/main/java/com/liulishuo/filedownloader/demo/TasksManagerDemoActivity.java))
9+
- `FileDownloader#isServiceConnected(void)`: 是否已经启动并且连接上下载进程(可参考[任务管理demo](https://github.com/lingochamp/FileDownloader/blob/master/demo/src/main/java/com/liulishuo/filedownloader/demo/TasksManagerDemoActivity.java))
10+
11+
#### 性能与提高
12+
13+
- 支持[Chunked transfer encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding) 数据下载(建议看一眼[Single Task Test](https://github.com/lingochamp/FileDownloader/blob/master/demo/src/main/java/com/liulishuo/filedownloader/demo/SingleTaskTestActivity.java)).
14+
- 提高性能: 减少 IPC。
15+
- 提高性能: 减少线程锁。
16+
- 提高性能: 在`:filedownloader`进程启动时,对数据库中的数据进行第一级别维护。
17+
- 提高性能: 忽略数据库中的`callbackProgressTimes`字段。
18+
19+
#### 修复
20+
21+
- 修复: 在低内存情况下,ui进程处于后台进程的情况下被回收,而下载进程(服务进程)还在, 并且还存在在下载中的任务,此时重新启动ui进程`FileDownloader#pauseAll`无法暂停已经在下载进程启动的任务的bug。
22+
- 修复: 主动调用`FileDownloader#unBinderService`,没有释放连接相关资源的bug。
23+
- 修复: ui进程被干掉,下载进程健还有活跃的并行任务正在下载,ui进程启动以后启动相同的队列列表,无法收到进度只收到warn的bug。
24+
325
### Version 0.1.3
426

527
- 不再受到1.99G限制;如果是大于1.99G的文件,请使用`FileDownloadLargeFileListener`作为监听器,使用对应的`getLargeFileSoFarBytes()``getLargeFileTotalBytes()`接口
@@ -29,4 +51,4 @@
2951

3052
### Version 0.0.8
3153

32-
- initial release
54+
- initial release

CHANGELOG.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@
22

33
> [中文迭代日志](https://github.com/lingochamp/FileDownloader/blob/master/CHANGELOG-ZH.md)
44
5+
### Version 0.1.4
6+
7+
#### New Interfaces
8+
9+
- `FileDownloader#unBindServiceIfIdle(void)`: If there is no active task in the `:filedownloader` progress currently , then unbind & stop `:filedownloader` process
10+
- `FileDownloader#getStatus(downloadId)`: Get download status by the downloadId(ps: Please refer to [Tasks Manager demo](https://github.com/lingochamp/FileDownloader/blob/master/demo/src/main/java/com/liulishuo/filedownloader/demo/TasksManagerDemoActivity.java)
11+
- `FileDownloader#isServiceConnected(void)`: Whether started and connected to the `:filedownloader` progress(ps: Please refer to [Tasks Manager demo](https://github.com/lingochamp/FileDownloader/blob/master/demo/src/main/java/com/liulishuo/filedownloader/demo/TasksManagerDemoActivity.java))
12+
13+
#### Enhancement
14+
15+
- Supported [Chunked transfer encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding) data download(Recommend to glance at demo on [Single Task Test](https://github.com/lingochamp/FileDownloader/blob/master/demo/src/main/java/com/liulishuo/filedownloader/demo/SingleTaskTestActivity.java)).
16+
- Improve Performance: Reduce IPC.
17+
- Improve Performance: Reduce lock.
18+
- Improve Performance: Delete invalid datas in db with the `:filedownloader` progress start.
19+
- Improve Performance: Ignore the `callbackProgressTimes` column in db.
20+
21+
#### Fix
22+
23+
- Fix `FileDownloader#pauseAll` not effect in case of low memory and ui progress is Background Progress situation and the `:filedownloader` progress(Service Progress) alive and still have running tasks in the `filedownloader` progress but ui progress has died and relived.
24+
- Fix not release connect resources when invoke `FileDownloader#unBinderService` manually.
25+
- Handle case of ui progress be killed by sys and download progress not be killed, and ui progress relives and reexecutes same tasks queue.
26+
27+
528
### Version 0.1.3
629

730
- Enhancement: no longer subject to the upper bound of 1.99G, add `FileDownloadLargeFileListener`, `getLargeFileSoFarBytes()`,`getLargeFileTotalBytes()`.
@@ -31,4 +54,4 @@
3154

3255
### Version 0.0.8
3356

34-
- initial release
57+
- initial release

README-zh.md

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Android 文件下载引擎,稳定、高效、简单易用
4343
在项目中引用:
4444

4545
```
46-
compile 'com.liulishuo.filedownloader:library:0.1.3'
46+
compile 'com.liulishuo.filedownloader:library:0.1.4'
4747
```
4848

4949
#### 全局初始化在`Application.onCreate`
@@ -150,6 +150,7 @@ final FileDownloadListener queueTarget = new FileDownloadListener() {
150150
for (String url : URLS) {
151151
FileDownloader.getImpl().create(url)
152152
.setListener(queueTarget)
153+
.setCallbackProgressTimes(0) // 由于是队列任务, 这里是我们假设了现在不需要每个任务都回调`FileDownloadListener#progress`, 所以这里这样设置可以很有效的减少ipc.
153154
.ready();
154155
}
155156
@@ -180,7 +181,10 @@ if(parallel){
180181
| getSoFar(downloadId) | 获得下载Id为downloadId的soFarBytes
181182
| getTotal(downloadId) | 获得下载Id为downloadId的totalBytes
182183
| bindService(void) | 主动启动下载进程(可事先调用该方法(可以不调用),保证第一次下载的时候没有启动进程的速度消耗)
183-
| unBindService(void) | 主动停止下载进程(如果不调用该方法,进程闲置一段时间以后,系统调度会自动将其回收)
184+
| unBindService(void) | 主动关停下载进程
185+
| unBindServiceIfIdle(void) | 如果目前下载进程没有任务正在执行,则关停下载进程
186+
| isServiceConnected(void) | 是否已经启动并且连接上下载进程(可参考任务管理demo中的使用)
187+
| getStatus(downloadId) | 获取下载Id为downloadId的状态(可参考任务管理demo中的使用)
184188

185189
#### Task接口说明
186190

@@ -250,7 +254,33 @@ blockComplete -> completed
250254

251255
![][file_download_listener_callback_flow_png]
252256

253-
## III. LICENSE
257+
## III. 低内存情况
258+
259+
### 非下载进程(一般是UI进程):
260+
261+
> 这边的数据并不多,只是一些队列数据,用不了多少内存。
262+
263+
#### [前台进程](http://developer.android.com/intl/zh-cn/guide/components/processes-and-threads.html)数据被回收:
264+
265+
如果在前台的时候这个数据都被回收了, 你的应用应该也挂了。极低概率事件。
266+
267+
#### [后台进程](http://developer.android.com/intl/zh-cn/guide/components/processes-and-threads.html)数据被回收:
268+
269+
一般事件, 如果是你的下载是UI进程启动的,如果你的UI进程处于`后台进程`(可以理解为应用被退到后台)状态,在内存不足的情况下会被回收(回收优先级高于`服务进程`),此时分两种情况:
270+
271+
1. 是串行队列任务,在回收掉UI进程内存以后,下载进程会继续下载完已经pending到下载进程的那个任务,而还未pending到下载进程的任务会中断下载(由于任务驱动线性执行的是在UI进程); 有损体验: 下次进入应用重启启动整个队列,会继续上次的下载。
272+
273+
2. 是并行队列任务,在回收掉UI进程内存以后,下载进程会继续下载所有任务(所有已经pending到下载进程的任务,由于这里的pending速度是很快的,因此几乎是点击并行下载,所有任务在很短的时间内都已经pending到下载进程了),而UI进程由于被回收,将不会收到所有的监听; 有损体验: 下次进入应用重新启动整个队列,就会和正常的下载启动一致,收到所有情况的监听。
274+
275+
### 下载进程:
276+
277+
> 对内存有一定的占用,但是并不多,每次启动进程会根据数据的有效性进行清理冗余数据,被回收是低概率事件
278+
279+
由于下载不断有不同的buffer占用内存,但是由于在下载时,是活跃的`服务进程`,因此被回收是低概率事件(会先回收完所有`空进程``后台进程`(后台应用)以后,如果内存还不够,才会回收该进程)。
280+
281+
即使被回收,也不会有任何问题。由于我们使用的是`START_STICKY`(如果不希望被重启可主动调用`FileDownloader#unBindService`/`FileDownloader#unBindServiceIfIdle`),因此在内存足够的时候,下载进程会尝试重启(系统调度),非下载进程(一般是UI进程) 接收到下载进程的连接,会继续下载与继续接收回调,下载进程也会断点续传没有下载完的所有任务(无论并行与串行),不会影响体验。
282+
283+
## IV. LICENSE
254284

255285
```
256286
Copyright (c) 2015 LingoChamp Inc.

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ FileDownloader is installed by adding the following dependency to your build.gra
2424

2525
```
2626
dependencies {
27-
compile 'com.liulishuo.filedownloader:library:0.1.3'
27+
compile 'com.liulishuo.filedownloader:library:0.1.4'
2828
}
2929
```
3030

@@ -139,6 +139,7 @@ final FileDownloadListener queueTarget = new FileDownloadListener() {
139139
140140
for (String url : URLS) {
141141
FileDownloader.getImpl().create(url)
142+
.setCallbackProgressTimes(0) // why do this? in here i assume do not need callback each task's `FileDownloadListener#progress`, so in this way reduce ipc will be effective optimization
142143
.setListener(queueTarget)
143144
.ready();
144145
}
@@ -167,14 +168,17 @@ if(parallel){
167168
| --- | ---
168169
| init(Application) | Just cache ApplicationContext
169170
| create(url:String) | Create a download task
170-
| start(listener:FileDownloadListener, isSerial:boolean) | Start the download queue by the same listener
171+
| start(listener:FileDownloadListener, isSerial:boolean) | Start the download queue by the same listener(maybe do not need callback each task's `FileDownloadListener#progress` in this case, then set `setCallbackProgressTimes(0)` is effective optimization)
171172
| pause(listener:FileDownloadListener) | Pause the download queue by the same listener
172173
| pauseAll(void) | Pause all task
173174
| pause(downloadId) | Pause the download task by the downloadId
174175
| getSoFar(downloadId) | Get downloaded so far bytes by the downloadId
175176
| getTotal(downloadId) | Get file total bytes by the downloadId
176177
| bindService(void) | Bind & start `:filedownloader` process manually(Do not need, will bind & start automatically by Download Engine if real need)
177-
| unBindService(void) | Unbind & stop `:filedownloader` process manually(Do not need, will unbind & stop automatically by System if leave unused period)
178+
| unBindService(void) | Unbind & stop `:filedownloader` process manually
179+
| unBindServiceIfIdle(void) | If there is no active task in the `:filedownloader` progress currently , then unbind & stop `:filedownloader` process
180+
| isServiceConnected(void) | Whether started and connected to the `:filedownloader` progress(ps: Please refer to [Tasks Manager demo](https://github.com/lingochamp/FileDownloader/blob/master/demo/src/main/java/com/liulishuo/filedownloader/demo/TasksManagerDemoActivity.java))
181+
| getStatus(downloadId) | Get download status by the downloadId(ps: Please refer to [Tasks Manager demo](https://github.com/lingochamp/FileDownloader/blob/master/demo/src/main/java/com/liulishuo/filedownloader/demo/TasksManagerDemoActivity.java))
178182

179183
#### `FileDownloadTask`
180184

@@ -250,6 +254,14 @@ blockComplete -> completed
250254
- Default by okhttp: retryOnConnectionFailure: Unreachable IP addresses/Stale pooled connections/Unreachable proxy servers
251255
- Default by okhttp: connection/read/write time out 10s
252256

257+
#### Low Memory?
258+
259+
We covered all low memory cases follow [Processes and Threads](http://developer.android.com/guide/components/processes-and-threads.html), just feel free to use the FileDownloader, it will be follow your expect.
260+
261+
262+
#### Chunked transfer encoding data?
263+
264+
Has supported, just use as normal task, but recommend to glance at demo on [Single Task Test](https://github.com/lingochamp/FileDownloader/blob/master/demo/src/main/java/com/liulishuo/filedownloader/demo/SingleTaskTestActivity.java).
253265

254266
## LICENSE
255267

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
VERSION_NAME=0.1.3
2-
VERSION_CODE=6
1+
VERSION_NAME=0.1.4
2+
VERSION_CODE=7
33
BUILD_TOOLS_VERSION=23.0.1
44
COMPILE_SDK_VERSION=23
55

0 commit comments

Comments
 (0)