Skip to content

Commit

Permalink
chore(upgrade): version name(0.2.3->0.2.4) code(14->15)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacksgong committed Apr 18, 2016
1 parent 204270e commit 9b4cf04
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 13 deletions.
23 changes: 21 additions & 2 deletions CHANGELOG-ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

> [ Change log in english](https://github.com/lingochamp/FileDownloader/blob/master/CHANGELOG.md)
## Version 0.2.4

_2016-04-18_

#### 新接口

- 添加 `BaseDownloadTask#getSpeed` 以及 `BaseDownloadTask#setMinIntervalUpdateSpeed`: 如果当前正在下载中(状态是 {@link FileDownloadStatus#progress}),那么在距离上一次计算的时间大于 {@link #minIntervalUpdateSpeed} 时,在每次 {@link FileDownloadListener#progress(BaseDownloadTask, int, int)} 回调之前进行计算; 如果当前已经结束下载({@link FileDownloadStatus#isOver(int)}),这个速度将会是全程下载的平均速度,区间 (connected, over)。 Closes #95
- 添加 `FileDownloader#startForeground` 以及 `FileDownloader#stopForeground` 用于支持 前台模式(http://developer.android.com/intl/zh-cn/reference/android/app/Service.html#startForeground(int, android.app.Notification)),保证用户从最近应用列表移除应用以后下载服务被杀。 Closes #110
- 支持 新的配置参数 `download.min-progress-step` 以及 `download.min-progress-time`: 最小缓冲大小以及最小缓冲时间,用于判定是否是时候将缓冲区中进度同步到数据库,以及是否是时候要确保下缓存区的数据都已经写文件。这两个值越小,更新会越频繁,下载速度会越慢,但是应对进程被无法预料的情况杀死时会更加安全。默认值是与 `com.android.providers.downloads.Constants`中的一致 65536(最小缓冲大小) 以及 2000(最小缓冲时间)。
- 支持 新的配置参数 `process.non-separate``filedownloader.properties` 中 : FileDownloadService 默认是运行在独立进程':filedownloader'上的, 如果你想要FileDownloadService共享并运行在主进程上, 添加将该配置参数值设置为 `true`。 Closes #106

#### 性能与提高

- 提高性能: 提高了下载速度, 优化了同步缓冲区的数据到本地文件以及数据库的架构,很大程度的提高了下载速度。 Closes #112

#### 修复

- 修复: 无法重新启动一个已经暂停但是依然存在下载线程池中在pending中的任务。 Closes #111

## Version 0.2.3

_2016-04-11_
Expand Down Expand Up @@ -46,7 +65,7 @@ _2016-04-06_

- 修复: 在 `FileDownloadLog.NEED_LOG``true` 时,并且事件无效的情况下,`EventPool` 出现 `IllegalFormatConversionException` 异常的问题。 Closes #30
- 修复: 在 Filedownloader进程被杀以后, 在 `IFileDownloadIPCService` 出现异常。Closes #38
- 修复: 修复 reponse-body 可能存在的泄漏: 'WARNING: A connection to https://... was leaked. Did you forget to close a response body?' Closes #68
- 修复: 修复 response-body 可能存在的泄漏: 'WARNING: A connection to https://... was leaked. Did you forget to close a response body?' Closes #68
- 修复: 使用 `internal-string` 作为同步的对象,而非直接用 String对象。
- 修复: 在一些情况下如果存在重复任务,在高并发下进行中的回调次数可能不对的bug。

Expand Down Expand Up @@ -81,7 +100,7 @@ _2016-01-23_

- `FileDownloadMonitor`: 现在你可以通过这个来添加一个全局的监听器,方便调试或打点
- `FileDownloader#enableAvoidDropFrame(void)`: 开启 避免掉帧, 原理最多10ms抛一个消息到ui线程,每次在ui线程每次处理5个回调(FileDownloadListener), 默认: 开启。
- `FileDownloader#disableAvoidDropFrame(void)`: 关闭 避免掉帧,会和之前的版本一样,每个回调(FileDownloadListener)都抛一个消息到ui线程,如果频率非常高(如高并发的文件检测)可以导致ui线程被ddos
- `FileDownloader#disableAvoidDropFrame(void)`: 关闭 避免掉帧,会和之前的版本一样,每个回调(FileDownloadListener)都抛一个消息到ui线程,如果频率非常高(如高并发的文件检测)可以导致ui线程被DDOS
- `FileDownloader#isEnabledAvoidDropFrame(void)`: 是否是 开启了避免掉帧,目前如果没有设置默认是开启的。
- `FileDownloader#setGlobalPost2UIInterval(intervalMillisecond:int)`: 设置最多intervalMillisecond毫秒抛一个消息到ui线程,是 避免掉帧的具体设置。默认: 10ms,如果设置为小于0的数值,会 关闭 避免掉帧。
- `FileDownloader#setGlobalHandleSubPackageSize(packageSize:int)`: 设置每次在ui线程每次处理packageSize个回调,如果已经关闭了 避免掉帧,那么这个值将没有任何意义,默认: 5个。
Expand Down
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

> [中文迭代日志](https://github.com/lingochamp/FileDownloader/blob/master/CHANGELOG-ZH.md)
## Version 0.2.4

_2016-04-18_

#### New Interfaces

- Add `BaseDownloadTask#getSpeed` and `BaseDownloadTask#setMinIntervalUpdateSpeed`: If in downloading process(status equal {@link FileDownloadStatus#progress}),Calculating when the interval from the last calculation more than {@link #minIntervalUpdateSpeed} before each {@link FileDownloadListener#progress(BaseDownloadTask, int, int)} call-back method; If finished({@link FileDownloadStatus#isOver(int)}), Would be average speed. The scope is (connected, over). Closes #95
- Add the `FileDownloader#startForeground` and `FileDownloader#stopForeground` for supporting the Foreground mode(http://developer.android.com/intl/in/reference/android/app/Service.html#startForeground(int, android.app.Notification)); For ensure the FileDownloadService would keep alive when user removed the App from the recent apps. Closes #110 .
- Support configurations `download.min-progress-step` and `download.min-progress-time`: The min buffered so far bytes and millisecond, used for adjudging whether is time to sync the download so far bytes to database and make sure sync the downloaded buffers to local file.More smaller more frequently, then download more slowly, but will more safer in scene of the process is killed unexpected. Default 65536(MinProgressStep) and 2000(MinProgressTime), which follow the value in `com.android.providers.downloads.Constants`.
- Support the configuration `process.non-separate` in `filedownloader.properties`: The FileDownloadService runs in the separate process ':filedownloader' as default, if you want to run the FileDownloadService in the main process, set this configuration as `true`. Closes #106 .

#### Enhancement

- Improve Performance: Download more quickly, Optimize the strategy about sync the buffered datum to db and local file when processing. Closes #112 .

#### Fix

- Fix: Can't re-start the task which paused but is still settling in the download-pool. Closes #111

## Version 0.2.3

_2016-04-11_
Expand Down
15 changes: 11 additions & 4 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Android 文件下载引擎,稳定、高效、简单易用

- 简单易用
- 高并发
- 独立进程
- 可选择性支持: 独立/非独立进程
- 自动断点续传

#### 需要注意
Expand Down Expand Up @@ -60,7 +60,7 @@ Android 文件下载引擎,稳定、高效、简单易用
在项目中引用:

```
compile 'com.liulishuo.filedownloader:library:0.2.3'
compile 'com.liulishuo.filedownloader:library:0.2.4'
```

#### 全局初始化在`Application.onCreate`
Expand Down Expand Up @@ -236,7 +236,7 @@ if (parallel) {
| start(listener:FileDownloadListener, isSerial:boolean) | 启动是相同监听器的任务,串行/并行启动
| pause(listener:FileDownloadListener) | 暂停启动相同监听器的任务
| pauseAll(void) | 暂停所有任务
| pause(downloadId) | 启动downloadId的任务
| pause(downloadId) | 暂停downloadId的任务
| getSoFar(downloadId) | 获得下载Id为downloadId的soFarBytes
| getTotal(downloadId) | 获得下载Id为downloadId的totalBytes
| bindService(void) | 主动启动下载进程(可事先调用该方法(可以不调用),保证第一次下载的时候没有启动进程的速度消耗)
Expand All @@ -248,7 +248,9 @@ if (parallel) {
| setGlobalHandleSubPackageSize(packageSize:int) | 为了避免掉帧, 如果上面的方法设置的间隔是一个小于0的数,这个packageSize将不会生效。packageSize这个值是为了避免在ui线程中一次处理过多回调,结合上面的间隔,就是每个interval毫秒间隔抛一个消息到ui线程,而每个消息在ui线程中处理packageSize个回调。默认值: 5
| enableAvoidDropFrame(void) | 开启 避免掉帧处理。就是将抛消息到ui线程的间隔设为默认值10ms, 很明显会影响的是回调不会立马通知到监听器(FileDownloadListener)中,默认值是: 最多10ms处理5个回调到监听器中
| disableAvoidDropFrame(void) | 关闭 避免掉帧处理。就是将抛消息到ui线程的间隔设置-1(无效值),这个就是让每个回调都会抛一个消息ui线程中,可能引起掉帧
| isEnabledAvoidDropFrame(void) | 是否开启了 避免掉帧处理。默认是开启的。
| isEnabledAvoidDropFrame(void) | 是否开启了 避免掉帧处理。默认是开启的
| startForeground(id:int, notification:Notification) | 设置FileDownloadService为前台模式,保证用户从最近应用列表移除应用以后下载服务不会被杀
| stopForeground(removeNotification:boolean) | 取消FileDownloadService的前台模式


#### Task接口说明
Expand All @@ -266,6 +268,7 @@ if (parallel) {
| setSyncCallback(syncCallback:boolean) | 如果设为true, 所有FileDownloadListener中的回调都会直接在下载线程中回调而不抛到ui线程, 默认为false
| addHeader(name:String, value:String) | 添加自定义的请求头参数,需要注意的是内部为了断点续传,在判断断点续传有效时会自动添加上(`If-Match``Range`参数),请勿重复添加导致400或其他错误
| addHeader(line:String) | 添加自定义的请求头参数,需要注意的是内部为了断点续传,在判断断点续传有效时会自动添加上(`If-Match``Range`参数),请勿重复添加导致400或其他错误
| setMinIntervalUpdateSpeed(minIntervalUpdateSpeedMs:int) | 设置下载中刷新下载速度的最小间隔
| removeAllHeaders(name:String) | 删除由自定义添加上去请求参数为`{name}`的所有键对
| ready(void) | 用于队列下载的单任务的结束符(见上面:启动多任务下载的案例)
| start(void) | 启动下载任务
Expand All @@ -288,6 +291,7 @@ if (parallel) {
| getAutoRetryTimes(void):int | 自动重试次数
| getRetryingTimes(void):int | 当前重试次数。将要开始重试的时候,会将接下来是第几次
| isSyncCallback(void):boolean | 是否是设置了所有FileDownloadListener中的回调都直接在下载线程直接回调而不抛到ui线程
| getSpeed():int | 获取下载速度,如果当前正在下载中(状态是 {@link FileDownloadStatus#progress}),那么在距离上一次计算的时间大于 {@link #minIntervalUpdateSpeed} 时,在每次 {@link FileDownloadListener#progress(BaseDownloadTask, int, int)} 回调之前进行计算; 如果当前已经结束下载({@link FileDownloadStatus#isOver(int)}),这个速度将会是全程下载的平均速度,区间 (connected, over)

#### 监听器(`FileDownloadListener`)说明

Expand Down Expand Up @@ -376,6 +380,9 @@ blockComplete -> completed
| 关键字 | 描述 | 默认值
| --- | --- | ---
| http.lenient | 如果你遇到了: 'can't know the size of the download file, and its Transfer-Encoding is not Chunked either', 但是你想要忽略类似的返回头不规范的错误,直接将该关键字参数设置为`true`即可,我们将会将其作为`chunck`进行处理 | false
| process.non-separate | FileDownloadService 默认是运行在独立进程':filedownloader'上的, 如果你想要FileDownloadService共享并运行在主进程上, 将该关键字参数设置为`true` | false
| download.min-progress-step | 最小缓冲大小,用于判定是否是时候将缓冲区中进度同步到数据库,以及是否是时候要确保下缓存区的数据都已经写文件。值越小,更新会越频繁,下载速度会越慢,但是应对进程被无法预料的情况杀死时会更加安全 | 65536
| download.min-progress-time | 最小缓冲时间,用于判定是否是时候将缓冲区中进度同步到数据库,以及是否是时候要确保下缓存区的数据都已经写文件。值越小,更新会越频繁,下载速度会越慢,但是应对进程被无法预料的情况杀死时会更加安全 | 2000


III. 异常处理
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ FileDownloader is installed by adding the following dependency to your build.gra

```
dependencies {
compile 'com.liulishuo.filedownloader:library:0.2.3'
compile 'com.liulishuo.filedownloader:library:0.2.4'
}
```

Expand Down
7 changes: 3 additions & 4 deletions filedownloader.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,22 @@
# encoding. default false.
http.lenient=true

# The FileDownloadService runs in the separate process ':filedownloader` as default, if you want to
# The FileDownloadService runs in the separate process ':filedownloader' as default, if you want to
# run the FileDownloadService in the main process, just set true. default false.
process.non-separate=false

# The min buffered so far bytes.
# Used for adjudging whether is time to sync the downloaded so far bytes to database and make sure
# sync the downloaded buffer to local file.
# More smaller more frequently, then download more slowly, but will more safer in scene of the
# process is killed unexpected.
# process is killed unexpectedly.
# Default 65536, which follow the value in com.android.providers.downloads.Constants.
download.min-progress-step=65536

# The min buffered millisecond.
# Used for adjudging whether is time to sync the downloaded so far bytes to database and make sure
# sync the downloaded buffer to local file.
# More smaller more frequently, then download more slowly, but will more safer in scene of the
# process is killed unexpected.
# process is killed unexpectedly.
# Default 2000, which follow the value in com.android.providers.downloads.Constants.
download.min-progress-time=2000

4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
VERSION_NAME=0.2.3
VERSION_CODE=14
VERSION_NAME=0.2.4
VERSION_CODE=15
BUILD_TOOLS_VERSION=23.0.1
COMPILE_SDK_VERSION=23

Expand Down

0 comments on commit 9b4cf04

Please sign in to comment.