Skip to content

Commit 7e266a3

Browse files
authored
Merge pull request #373 from JemyCheung/v4log
V4log
2 parents 9685db0 + 365f6b4 commit 7e266a3

32 files changed

+1500
-155
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,4 @@ build/
3232
.idea/libraries
3333
.idea/kotlinc.xml
3434
.idea/caches/
35+
library/library.iml

library/build.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ android {
2424
buildToolsVersion '29.0.2'
2525
defaultConfig {
2626
//applicationId "com.qiniu.android"
27-
minSdkVersion 15
27+
minSdkVersion 18
2828
targetSdkVersion 26
2929
versionCode code
3030
versionName version
@@ -55,6 +55,7 @@ dependencies {
5555
// implementation 'com.google.code.findbugs:jsr305:3.0.2'
5656
implementation fileTree(include: ['*.jar'], dir: 'libs')
5757
androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
58+
implementation 'com.google.code.gson:gson:2.8.6'
5859
}
5960

6061
task releaseJar(type: Jar, dependsOn: 'build') {

library/library.iml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@
108108
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib:1.3.50@jar" level="project" />
109109
<orderEntry type="library" name="Gradle: org.jetbrains.kotlin:kotlin-stdlib-common:1.3.50@jar" level="project" />
110110
<orderEntry type="library" name="Gradle: org.jetbrains:annotations:13.0@jar" level="project" />
111+
<orderEntry type="library" name="Gradle: com.google.code.gson:gson:2.8.6@jar" level="project" />
111112
<orderEntry type="library" name="Gradle: android.test.mock-android-29" level="project" />
112113
<orderEntry type="library" name="Gradle: android.test.base-android-29" level="project" />
113114
<orderEntry type="library" name="Gradle: android.test.runner-android-29" level="project" />

library/src/androidTest/java/com/qiniu/android/HttpTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ protected void setUp() throws Exception {
4646

4747
@SmallTest
4848
public void testPost1() throws Throwable {
49-
httpManager.asyncPost("http://www.baidu.com",
49+
httpManager.asyncPost(null,"http://www.baidu.com",
5050
"hello".getBytes(), null, UpToken.parse(TestConfig.token_z0), "hello".getBytes().length,
5151
null, new CompletionHandler() {
5252
@Override
@@ -69,7 +69,7 @@ public void complete(ResponseInfo rinfo, JSONObject response) {
6969
@SmallTest
7070
public void testPost2() throws Throwable {
7171

72-
httpManager.asyncPost("http://up.qiniu.com", "hello".getBytes(), null,
72+
httpManager.asyncPost(null,"http://up.qiniu.com", "hello".getBytes(), null,
7373
UpToken.parse(TestConfig.token_z0), "hello".getBytes().length,
7474
null, new CompletionHandler() {
7575
@Override
@@ -92,7 +92,7 @@ public void complete(ResponseInfo rinfo, JSONObject response) {
9292
public void testPost3() throws Throwable {
9393
runTestOnUiThread(new Runnable() { // THIS IS THE KEY TO SUCCESS
9494
public void run() {
95-
httpManager.asyncPost("http://httpbin.org/status/500", "hello".getBytes(),
95+
httpManager.asyncPost(null,"http://httpbin.org/status/500", "hello".getBytes(),
9696
null, UpToken.parse(TestConfig.token_z0), "hello".getBytes().length,
9797
null, new CompletionHandler() {
9898
@Override
@@ -118,7 +118,7 @@ public void complete(ResponseInfo rinfo, JSONObject response) {
118118
public void testPost4() throws Throwable {
119119
runTestOnUiThread(new Runnable() { // THIS IS THE KEY TO SUCCESS
120120
public void run() {
121-
httpManager.asyncPost("http://httpbin.org/status/418",
121+
httpManager.asyncPost(null,"http://httpbin.org/status/418",
122122
"hello".getBytes(),
123123
null, UpToken.parse(TestConfig.token_z0), "hello".getBytes().length,
124124
null, new CompletionHandler() {
@@ -144,7 +144,7 @@ public void complete(ResponseInfo rinfo, JSONObject response) {
144144
@SmallTest
145145
public void testPostNoDomain() throws Throwable {
146146

147-
httpManager.asyncPost("http://no-domain.qiniu.com", "hello".getBytes(),
147+
httpManager.asyncPost(null,"http://no-domain.qiniu.com", "hello".getBytes(),
148148
null, UpToken.parse(TestConfig.token_z0), "hello".getBytes().length,
149149
null, new CompletionHandler() {
150150
@Override
@@ -190,7 +190,7 @@ public void complete(ResponseInfo rinfo, JSONObject response) {
190190
@SmallTest
191191
public void testPostIP() throws Throwable {
192192
StringMap x = new StringMap().put("Host", "up.qiniu.com");
193-
httpManager.asyncPost("http://183.131.7.18", "hello".getBytes(),
193+
httpManager.asyncPost(null,"http://183.131.7.18", "hello".getBytes(),
194194
x, UpToken.parse(TestConfig.token_z0), "hello".getBytes().length,
195195
null, new CompletionHandler() {
196196
@Override
@@ -215,7 +215,7 @@ public void testProxy() throws Throwable {
215215
StringMap x = new StringMap();
216216
ProxyConfiguration p = new ProxyConfiguration("115.238.101.32", 80);
217217
Client c = new Client(p, 10, 30, null, null);
218-
c.asyncPost("http://upproxy1.qiniu.com", "hello".getBytes(),
218+
c.asyncPost(null,"http://upproxy1.qiniu.com", "hello".getBytes(),
219219
x, UpToken.parse(TestConfig.token_z0), "hello".getBytes().length,
220220
null, new CompletionHandler() {
221221
@Override

library/src/androidTest/java/com/qiniu/android/common/AutoZoneTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void testSplitE() {
5959
public void testC1() {
6060
AutoZone autoZone = new AutoZone();
6161
final CountDownLatch countDownLatch = new CountDownLatch(1);
62-
autoZone.preQueryIndex(new AutoZone.ZoneIndex(ak, bkt), new Zone.QueryHandler() {
62+
autoZone.preQueryIndex(null, new AutoZone.ZoneIndex(ak, bkt), new Zone.QueryHandler() {
6363
@Override
6464
public void onSuccess() {
6565
countDownLatch.countDown();

library/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.qiniu.android">
33

4+
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
45
<uses-permission android:name="android.permission.INTERNET" />
56
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
67
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
8+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
9+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
710

811
<application android:label="@string/app_name">
912
<uses-library

library/src/main/java/com/qiniu/android/bigdata/pipeline/Pipeline.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,8 @@ private void send(String repo, StringBuilder builder, String token, final PumpCo
7373
StringMap headers = new StringMap();
7474
headers.put(HTTPHeaderAuthorization, token);
7575
headers.put(Client.ContentTypeHeader, TEXT_PLAIN);
76-
client.asyncPost(url(repo), data, headers, null, data.length, null, new CompletionHandler() {
76+
// TODO: 2020-04-15 repo上报时不记录,logHandler为null
77+
client.asyncPost(null, url(repo), data, headers, null, data.length, null, new CompletionHandler() {
7778
@Override
7879
public void complete(ResponseInfo info, JSONObject response) {
7980
handler.complete(info);

library/src/main/java/com/qiniu/android/collect/Config.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public final class Config {
1111
/**
1212
* 上传信息收集文件的地址
1313
*/
14-
public final static String serverURL = "https://uplog.qbox.me/log/3";
14+
public final static String serverURL = "https://uplog.qbox.me/log/4";
1515
/**
1616
* 是否记录上传状态信息。 true 表示记录,false 表示不记录。
1717
* <p>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.qiniu.android.collect;
2+
3+
/**
4+
* 实现接口,需要log打点时直接send回来处理
5+
* 后面拓展直接搜LogHandler.send可查询打点位置,新增直接LogHandler.send即可
6+
*/
7+
public interface LogHandler {
8+
void send(String key, Object value);
9+
10+
Object getUploadInfo();
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package com.qiniu.android.collect;
2+
3+
public class UploadInfo {
4+
5+
public static UploadInfoElement.ReqInfo getReqInfo() {
6+
return new UploadInfoElement.ReqInfo();
7+
}
8+
9+
public static UploadInfoElement.BlockInfo getBlockInfo() {
10+
return new UploadInfoElement.BlockInfo();
11+
}
12+
13+
public static UploadInfoElement.UploadQuality getUploadQuality() {
14+
return new UploadInfoElement.UploadQuality();
15+
}
16+
}

0 commit comments

Comments
 (0)