Skip to content

Commit d7a8453

Browse files
committed
Merge branch 'github_dev'
2 parents dd0e106 + d69dc66 commit d7a8453

File tree

165 files changed

+48040
-21566
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

165 files changed

+48040
-21566
lines changed

LICENSE

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ All rights reserved.
3131
Copyright(c)2004,Cisco URP imburses and Network Information Center in Beijing University of Posts and Telecommunications researches
3232
All right reserved
3333

34+
5. google protobuf
35+
Copyright 2014, Google Inc. All rights reserved.
36+
3437

3538
Terms of the BSD 3-Clause License:
3639
--------------------------------------------------------------------

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
## Mars
22

33
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](https://github.com/Tencent/mars/blob/master/LICENSE)
4-
[![Release Version](https://img.shields.io/badge/release-1.1.3-red.svg)](https://github.com/Tencent/mars/releases)
4+
[![Release Version](https://img.shields.io/badge/release-1.1.4-red.svg)](https://github.com/Tencent/mars/releases)
55
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/mars/pulls)
6-
[![WeChat Approved](https://img.shields.io/badge/Wechat_Approved-1.1.3-red.svg)](https://github.com/Tencent/mars/wiki)
6+
[![WeChat Approved](https://img.shields.io/badge/Wechat_Approved-1.1.4-red.svg)](https://github.com/Tencent/mars/wiki)
77
[![WeChat Approved](https://img.shields.io/badge/Platform-iOS | OS X | Android -brightgreen.svg)](https://github.com/Tencent/mars/wiki)
88

99
(中文版本请参看[这里](#mars_cn))
@@ -41,7 +41,7 @@ Add dependencies by adding the following lines to your app/build.gradle.
4141

4242
```xml
4343
dependencies {
44-
compile 'com.tencent.mars:mars-wrapper:1.1.3'
44+
compile 'com.tencent.mars:mars-wrapper:1.1.4'
4545
}
4646
```
4747

@@ -53,7 +53,7 @@ Add dependencies by adding the following lines to your app/build.gradle.
5353

5454
```xml
5555
dependencies {
56-
compile 'com.tencent.mars:mars-core:1.1.3'
56+
compile 'com.tencent.mars:mars-core:1.1.4'
5757
}
5858
```
5959

@@ -295,9 +295,9 @@ Mars is under the MIT license. See the [LICENSE](https://github.com/Tencent/mars
295295
## <a name="mars_cn">Mars</a>
296296

297297
[![license](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat)](https://github.com/Tencent/mars/blob/master/LICENSE)
298-
[![Release Version](https://img.shields.io/badge/release-1.1.3-red.svg)](https://github.com/Tencent/mars/releases)
298+
[![Release Version](https://img.shields.io/badge/release-1.1.4-red.svg)](https://github.com/Tencent/mars/releases)
299299
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/Tencent/mars/pulls)
300-
[![WeChat Approved](https://img.shields.io/badge/Wechat_Approved-1.1.3-red.svg)](https://github.com/Tencent/mars/wiki)
300+
[![WeChat Approved](https://img.shields.io/badge/Wechat_Approved-1.1.4-red.svg)](https://github.com/Tencent/mars/wiki)
301301
[![WeChat Approved](https://img.shields.io/badge/Platform-iOS | OS X | Android -brightgreen.svg)](https://github.com/Tencent/mars/wiki)
302302

303303
Mars 是微信官方的跨平台跨业务的终端基础组件。
@@ -329,7 +329,7 @@ gradle 接入我们提供了两种接入方式:[mars-wrapper](#wrapper) 或者
329329

330330
```xml
331331
dependencies {
332-
compile 'com.tencent.mars:mars-wrapper:1.1.3'
332+
compile 'com.tencent.mars:mars-wrapper:1.1.4'
333333
}
334334
```
335335

@@ -342,7 +342,7 @@ dependencies {
342342

343343
```xml
344344
dependencies {
345-
compile 'com.tencent.mars:mars-core:1.1.3'
345+
compile 'com.tencent.mars:mars-core:1.1.4'
346346
}
347347
```
348348
接着往下操作之前,请先确保你已经添加了 mars-wrapper 或者 mars-core 的依赖

mars/comm/verinfo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
#ifndef Mars_verinfo_h
33
#define Mars_verinfo_h
44

5-
#define MARS_REVISION "ab6c6dd"
6-
#define MARS_PATH "hotfix/1.x"
5+
#define MARS_REVISION "dfebb49"
6+
#define MARS_PATH "master"
77
#define MARS_URL ""
8-
#define MARS_BUILD_TIME "2016-12-29 19:57:02"
9-
#define MARS_TAG "fffff_[2016-12-29_19.56]@git-ab6c6dd@garry"
8+
#define MARS_BUILD_TIME "2017-01-10 21:41:50"
9+
#define MARS_TAG "samplelibs"
1010

1111
#endif

mars/libraries/build_android.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ def main():
248248
shutil.rmtree(SO_CACHE_DIR)
249249

250250
for i in range(0, len(archs)):
251-
print "build %s" %(archs[i])
251+
print ("build %s" %(archs[i]))
252252

253253
arch = archs[i]
254254

mars/libraries/mars_android_sdk/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ PROJ_GROUP=com.tencent.mars
33
# 库的ID
44
PROJ_ARTIFACTID=mars-core
55
# 库的版本
6-
PROJ_VERSION=1.1.3
6+
PROJ_VERSION=1.1.4
77
### 最后 gradle引用的形式就是 $PROJ_GROUP:$PROJ_ARTIFACTID:$PROJ_VERSION
88

99
# 库名

mars/libraries/mars_android_sdk/src/main/java/com/tencent/mars/stn/StnLogic.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,10 @@ public interface ICallBack {
222222

223223
/**
224224
* 流量统计
225-
* @param wifiRecv
226-
* @param wifiSend
227-
* @param mobileRecv
228-
* @param mobileSend
225+
* @param send
226+
* @param recv
229227
*/
230-
void reportFlow(final int wifiRecv, final int wifiSend, final int mobileRecv, final int mobileSend);
228+
void trafficData(final int send, final int recv);
231229

232230
/**
233231
* 连接状态通知
@@ -492,18 +490,16 @@ private static int onTaskEnd(final int taskID, Object userContext, final int err
492490

493491
/**
494492
* 上报信令消耗的流量
495-
* @param wifiRecv
496-
* @param wifiSend
497-
* @param mobileRecv
498-
* @param mobileSend
493+
* @param send
494+
* @param recv
499495
*/
500-
private static void reportFlow(final int wifiRecv, final int wifiSend, final int mobileRecv, final int mobileSend) {
496+
private static void trafficData(final int send, final int recv) {
501497
try {
502498
if (callBack == null) {
503499
new NullPointerException("callback is null").printStackTrace();
504500
return;
505501
}
506-
callBack.reportFlow(wifiRecv, wifiSend, mobileRecv, mobileSend);
502+
callBack.trafficData(send, recv);
507503
} catch (Exception e) {
508504
e.printStackTrace();
509505
}

mars/libraries/mars_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def parse_as_git():
110110

111111
def gen_revision_file(save_path, tag):
112112
now_path = os.path.dirname(os.path.abspath(__file__))
113-
print now_path
113+
print (now_path)
114114

115115
# TRY AS SVN
116116
revision, path, url = parse_as_svn()
@@ -162,7 +162,7 @@ def gen_revision_file(save_path, tag):
162162

163163
output += html
164164

165-
print ''.join(output.splitlines())
165+
print (''.join(output.splitlines()))
166166

167167
def get_revision(path):
168168

mars/stn/jni/com_tencent_mars_stn_StnLogic_C2Java.cc

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -305,27 +305,15 @@ bool OnLonglinkIdentifyResponse(const AutoBuffer& _response_buffer, const AutoBu
305305
return ret != 0;
306306
}
307307

308+
DEFINE_FIND_STATIC_METHOD(KC2Java_trafficData, KC2Java, "trafficData", "(II)V")
308309
WEAK_FUNC void TrafficData(ssize_t _send, ssize_t _recv) {
309-
int net_info = getNetInfo();
310-
311-
if (kWifi == net_info) {
312-
ReportFlow(_recv, _send, 0, 0);
313-
}else if (kMobile == net_info) {
314-
ReportFlow(0, 0, _recv, _send);
315-
} else {
316-
317-
}
318-
}
319-
320-
DEFINE_FIND_STATIC_METHOD(KC2Java_reportFlowData, KC2Java, "reportFlow", "(IIII)V")
321-
void ReportFlow(const int _wifi_recv_data_size, const int _wifi_send_data_size, int _mobile_recv_data_size, int _mobile_send_data_size) {
322-
xverbose2(TSF"wifiRecvDataSize:%0, wifiSendDataSize:%1, mobileRecvDataSize:%2, mobileSendDataSize:%3", _wifi_recv_data_size, _wifi_send_data_size, _mobile_recv_data_size, _mobile_send_data_size);
323310

324311
VarCache* cache_instance = VarCache::Singleton();
325312
ScopeJEnv scope_jenv(cache_instance->GetJvm());
326313
JNIEnv *env = scope_jenv.GetEnv();
327314

328-
JNU_CallStaticMethodByMethodInfo(env, KC2Java_reportFlowData, (jint)_wifi_recv_data_size, (jint)_wifi_send_data_size, (jint)_mobile_recv_data_size, (jint)_mobile_send_data_size);
315+
JNU_CallStaticMethodByMethodInfo(env, KC2Java_trafficData, (jint)_send, (jint)_recv);
316+
329317
}
330318

331319
DEFINE_FIND_STATIC_METHOD(KC2Java_reportNetConnectInfo, KC2Java, "reportConnectStatus", "(II)V")

mars/stn/stn.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,7 @@ extern bool Req2Buf(int32_t taskid, void* const user_context, AutoBuffer& outbu
220220
extern int Buf2Resp(int32_t taskid, void* const user_context, const AutoBuffer& inbuffer, int& error_code, const int channel_select);
221221
//任务执行结束
222222
extern int OnTaskEnd(int32_t taskid, void* const user_context, int error_type, int error_code);
223-
//上报流量数据
224-
extern void ReportFlow(int32_t wifi_recv, int32_t wifi_send, int32_t mobile_recv, int32_t mobile_send);
223+
225224
//上报网络连接状态
226225
extern void ReportConnectStatus(int status, int longlink_status);
227226
//长连信令校验 ECHECK_NOW = 0, ECHECK_NEVER = 1, ECHECK_NEXT = 2

mars/stn/stn_logic.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -286,11 +286,7 @@ void network_export_symbols_0(){}
286286
xassert2(sg_callback != NULL);
287287
return sg_callback->OnTaskEnd(taskid, user_context, error_type, error_code);
288288
}
289-
//上报流量数据
290-
void ReportFlow(int32_t wifi_recv, int32_t wifi_send, int32_t mobile_recv, int32_t mobile_send) {
291-
xassert2(sg_callback != NULL);
292-
sg_callback->ReportFlow(wifi_recv, wifi_send, mobile_recv, mobile_send);
293-
}
289+
294290
//上报网络连接状态
295291
void ReportConnectStatus(int status, int longlink_status) {
296292
xassert2(sg_callback != NULL);

mars/stn/stn_logic.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ namespace stn{
5151
virtual int Buf2Resp(int32_t taskid, void* const user_context, const AutoBuffer& inbuffer, int& error_code, const int channel_select) = 0;
5252
//任务执行结束
5353
virtual int OnTaskEnd(int32_t taskid, void* const user_context, int error_type, int error_code) = 0;
54-
//上报流量数据
55-
virtual void ReportFlow(int32_t wifi_recv, int32_t wifi_send, int32_t mobile_recv, int32_t mobile_send) = 0;
5654

5755
//上报网络连接状态
5856
virtual void ReportConnectStatus(int status, int longlink_status) = 0;

samples/Mac/PublicComponentV2/stn_callback.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ class StnCallBack : public Callback {
5555
virtual int Buf2Resp(int32_t _taskid, void* const _user_context, const AutoBuffer& _inbuffer, int& _error_code, const int _channel_select);
5656
//任务执行结束
5757
virtual int OnTaskEnd(int32_t _taskid, void* const _user_context, int _error_type, int _error_code);
58-
//上报流量数据
59-
virtual void ReportFlow(int32_t _wifi_recv, int32_t _wifi_send, int32_t _mobile_recv, int32_t _mobile_send);
58+
6059
//上报网络连接状态
6160
virtual void ReportConnectStatus(int _status, int longlink_status);
6261
//长连信令校验 ECHECK_NOW, ECHECK_NEVER = 1, ECHECK_NEXT = 2

samples/Mac/PublicComponentV2/stn_callback.mm

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,6 @@
8383

8484
}
8585

86-
void StnCallBack::ReportFlow(int32_t _wifi_recv, int32_t _wifi_send, int32_t _mobile_recv, int32_t _mobile_send) {
87-
88-
}
8986

9087
void StnCallBack::ReportConnectStatus(int _status, int longlink_status) {
9188

samples/android/marsSampleChat/app/src/main/java/com/tencent/mars/sample/ConversationActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public void onPostDecode(Main.ConversationListResponse response) {
220220
}
221221

222222
@Override
223-
public void onTaskEnd() {
223+
public void onTaskEnd(int errType, int errCode) {
224224
runOnUiThread(new Runnable() {
225225

226226
@Override

samples/android/marsSampleChat/app/src/main/java/com/tencent/mars/sample/chat/TextMessageTask.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,12 @@ public void onPostDecode(Chat.SendMessageResponse response) {
7272
}
7373

7474
@Override
75-
public void onTaskEnd() {
75+
public void onTaskEnd(int errType, int errCode) {
7676
if (callback == null) {
7777
callback = onError;
7878
}
7979

8080
uiHandler.post(callback);
81-
super.onTaskEnd();
8281
}
8382

8483
public TextMessageTask onOK(Runnable onOK) {

samples/android/marsSampleChat/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ subprojects {
2323

2424
ext {
2525
GROUP = 'com.tencent.mars.sample'
26-
VERSION_NAME_PREFIX = '1.1.3'
26+
VERSION_NAME_PREFIX = '1.1.4'
2727
VERSION_NAME_SUFFIX = '' // '-SNAPSHOT'
2828

2929
minSdkVersion = 16

samples/android/marsSampleChat/wrapper/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ PROJ_GROUP=com.tencent.mars
77
# 库的ID
88
PROJ_ARTIFACTID=mars-wrapper
99
# 库的版本
10-
PROJ_VERSION=1.1.3
10+
PROJ_VERSION=1.1.4
1111
### 最后 gradle引用的形式就是 $PROJ_GROUP:$PROJ_ARTIFACTID:$PROJ_VERSION
1212

1313
# 库名

samples/android/marsSampleChat/wrapper/src/main/aidl/com/tencent/mars/sample/wrapper/remote/MarsTaskWrapper.aidl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@ interface MarsTaskWrapper {
1111

1212
int buf2resp(in byte[] buf);
1313

14-
void onTaskEnd();
14+
void onTaskEnd(in int errType, in int errCode);
1515
}

samples/android/marsSampleChat/wrapper/src/main/java/com/tencent/mars/sample/wrapper/remote/AbstractTaskWrapper.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,7 @@ public Bundle getProperties() {
4848
}
4949

5050
@Override
51-
public void onTaskEnd() {
52-
// TODO: Running in client, need to complete onTaskEnd if service connection break
53-
// Nothing to do by defaults
54-
}
51+
public abstract void onTaskEnd(int errType, int errCode);
5552

5653
public AbstractTaskWrapper setHttpRequest(String host, String path) {
5754
properties.putString(MarsTaskProperty.OPTIONS_HOST, ("".equals(host) ? null : host));

samples/android/marsSampleChat/wrapper/src/main/java/com/tencent/mars/sample/wrapper/remote/MarsServiceProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ private void cancelSpecifiedTaskWrapper(MarsTaskWrapper marsTaskWrapper) {
161161
if (queue.remove(marsTaskWrapper)) {
162162
// Remove from queue, not exec yet, call MarsTaskWrapper::onTaskEnd
163163
try {
164-
marsTaskWrapper.onTaskEnd();
164+
marsTaskWrapper.onTaskEnd(-1, -1);
165165

166166
} catch (RemoteException e) {
167167
// Called in client, ignore RemoteException

samples/android/marsSampleChat/wrapper/src/main/java/com/tencent/mars/sample/wrapper/service/MarsServiceStub.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ public void onPush(int cmdid, byte[] data) {
187187
}
188188

189189
@Override
190-
public void reportFlow(int wifiRecv, int wifiSend, int mobileRecv, int mobileSend) {
191-
onPush(BaseConstants.FLOW_CMDID, String.format("%d,%d,%d,%d", wifiRecv, wifiSend, mobileRecv, mobileSend).getBytes(Charset.forName("UTF-8")));
190+
public void trafficData(int send, int recv) {
191+
onPush(BaseConstants.FLOW_CMDID, String.format("%d,%d", send, recv).getBytes(Charset.forName("UTF-8")));
192192
}
193193

194194
@Override
@@ -233,7 +233,7 @@ public int onTaskEnd(int taskID, Object userContext, int errType, int errCode) {
233233
}
234234

235235
try {
236-
wrapper.onTaskEnd();
236+
wrapper.onTaskEnd(errType, errCode);
237237

238238
} catch (RemoteException e) {
239239
e.printStackTrace();

0 commit comments

Comments
 (0)