Skip to content

Commit c4efa10

Browse files
author
jordanqin
committed
update qcloud sdk to 1.5.77
1 parent 16111ef commit c4efa10

File tree

10 files changed

+45
-35
lines changed

10 files changed

+45
-35
lines changed

QCloudFoundation/foundation/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
minSdkVersion 15
88
targetSdkVersion 28
99

10-
versionCode 10577
11-
versionName "1.5.76"
10+
versionCode 10578
11+
versionName "1.5.77"
1212

1313
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
1414

QCloudFoundation/qcloud-track/build.gradle

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ android {
77
minSdkVersion 19
88
targetSdkVersion 33
99

10-
versionCode 10002
11-
versionName "1.0.2"
10+
versionCode 10003
11+
versionName "1.0.3"
1212

1313
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
1414
consumerProguardFiles "consumer-rules.pro"
@@ -50,10 +50,7 @@ dependencies {
5050
compileOnly 'com.google.guava:guava:27.0.1-android'
5151

5252
compileOnly files(
53-
'libs/beacon-android-release-4.2.86.7-hf1-official.aar',
54-
'libs/qimei-1.2.18.3.aar',
55-
'libs/qimei-core-1.2.18.3-normal.aar',
56-
'libs/qmsp-oaid2-1.0.4.aar'
53+
'libs/beacon-android-release-4.2.86.7-hf1-external-official.aar',
5754
)
5855
}
5956

QCloudFoundation/qcloud-track/consumer-rules.pro

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
-keep class net.jpountz.lz4.** { *; }
22

33
# beacon
4-
-keep class com.tencent**qimei.** { *;}
5-
-keep class com.tencent.qmsp.oaid2.** {*;}
64
-keep class com.tencent.beacon.** { *;}
75

86
# R8
@@ -14,12 +12,6 @@
1412
-dontwarn com.tencent.beacon.event.open.EventResult
1513
-dontwarn com.tencent.beacon.event.open.EventType
1614

17-
-dontwarn com.tencent.qimei.sdk.IQimeiSDK
18-
-dontwarn com.tencent.qimei.sdk.QimeiSDK
19-
-dontwarn com.tencent.qimei.strategy.terminal.ITerminalStrategy
20-
-dontwarn com.tencent.qimei.codez.FalconSdk
21-
-dontwarn com.tencent.qimei.codez.IFalconSdk
22-
-dontwarn com.tencent.qimei.codez.shell.UserInfoType
2315
-dontwarn com.tencent.smtt.export.external.extension.interfaces.IX5WebViewExtension
2416
-dontwarn com.tencent.smtt.sdk.WebSettings
2517
-dontwarn com.tencent.smtt.sdk.WebView
Binary file not shown.
Binary file not shown.
-1.13 KB
Binary file not shown.
Binary file not shown.
-54.5 KB
Binary file not shown.

QCloudFoundation/qcloud-track/src/main/java/com/tencent/qcloud/track/QCloudTrackService.java

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,11 @@
2323
package com.tencent.qcloud.track;
2424

2525
import android.content.Context;
26+
import android.content.SharedPreferences;
2627
import android.content.pm.PackageInfo;
2728
import android.content.pm.PackageManager;
2829
import android.os.Build;
30+
import android.provider.Settings;
2931
import android.util.Log;
3032

3133
import com.tencent.beacon.event.open.BeaconConfig;
@@ -34,13 +36,12 @@
3436
import com.tencent.qcloud.track.service.BeaconTrackService;
3537
import com.tencent.qcloud.track.service.ClsTrackService;
3638
import com.tencent.qcloud.track.utils.NetworkUtils;
37-
import com.tencent.qimei.sdk.IQimeiSDK;
38-
import com.tencent.qimei.sdk.QimeiSDK;
3939

4040
import java.util.ArrayList;
4141
import java.util.HashMap;
4242
import java.util.List;
4343
import java.util.Map;
44+
import java.util.UUID;
4445

4546
/**
4647
* 数据追踪服务
@@ -92,9 +93,9 @@ public synchronized void init(Context context) {
9293
if (!isInitialized) {
9394
this.context = context.getApplicationContext();
9495
commonParams = getCommonParams();
95-
// 因为默认上报简单数据到灯塔,因此默认初始化灯塔和QIMEI
96+
// 因为默认上报简单数据到灯塔,因此默认初始化灯塔
9697
if (BeaconTrackService.isInclude()) {
97-
initBeaconAndQimei();
98+
initBeacon();
9899
simpleDataTrackService = new BeaconTrackService();
99100
// 设置context
100101
simpleDataTrackService.setContext(context);
@@ -230,36 +231,28 @@ public void setDebug(boolean debug) {
230231
}
231232

232233
/**
233-
* 初始化灯塔和qimei
234+
* 初始化灯塔
234235
*/
235-
private void initBeaconAndQimei() {
236+
private void initBeacon() {
236237
BeaconConfig.Builder builder = BeaconConfig.builder()
237238
.auditEnable(false)
238239
.bidEnable(false)
239240
.qmspEnable(false)
240241
.pagePathEnable(false)
241-
// .setNeedInitQimei(false)
242242
.setNormalPollingTime(30000);
243243
BeaconConfig config = builder.build();
244-
245244
BeaconReport beaconReport = BeaconReport.getInstance();
246245
try {
247246
beaconReport.setCollectProcessInfo(false); //该项设为false即关闭采集processInfo功能
248247
} catch (NoSuchMethodError error) {
249248
}
249+
250250
// 多次初始化,或者初始化时传入的appkey和manifest.xml文件内不同,debug模式
251251
// 下会主动抛出异常
252252
try {
253-
IQimeiSDK qimeiSDK = QimeiSDK.getInstance(Constants.SIMPLE_DATA_BEACON_APP_KEY);
254-
qimeiSDK.getStrategy()
255-
.enableOAID(false) // 关闭oaid采集,这里设置false
256-
.enableIMEI(false) // 关闭imei采集,这里设置false,建议如用户授权,尽可能采集,便于复核问题
257-
.enableIMSI(false) // 关闭imsi采集,这里设置false
258-
.enableAndroidId(false) // 关闭android id采集,这里设置false,建议如用户授权,尽可能采集,便于复核问题
259-
.enableMAC(false) // 关闭mac采集,这里设置false
260-
.enableCid(false) // 关闭cid采集,这里设置false
261-
.enableProcessInfo(false) // 关闭应用列表枚举,这里设置false,1.0.5以上版本有效
262-
.enableBuildModel(false); // 关闭BUILD.MODEL采集,这里设置false,1.2.3以上版本有效
253+
String deviceId = getSafeDeviceId();
254+
// Log.d(TAG, "ostar_deviceId: " + deviceId);
255+
beaconReport.setOstar(deviceId, deviceId); //必须,但可以在初始化之后设置,灯塔会缓存ostar为空的事件set之后重报
263256

264257
beaconReport.start(context, Constants.SIMPLE_DATA_BEACON_APP_KEY, config);
265258
} catch (Exception e) {
@@ -304,4 +297,33 @@ private Map<String, String> getCommonParams() {
304297

305298
return params;
306299
}
300+
301+
/**
302+
* 获取安全设备标识(自动生成并缓存)
303+
*/
304+
public String getSafeDeviceId() {
305+
SharedPreferences prefs = context.getSharedPreferences("cossdk_device_info", Context.MODE_PRIVATE);
306+
String storedId = prefs.getString("device_id", null);
307+
if (storedId != null) {
308+
return storedId;
309+
}
310+
String newId = createNewId();
311+
prefs.edit().putString("device_id", newId).apply();
312+
return newId;
313+
}
314+
315+
/**
316+
* 生成新标识的私有方法
317+
*/
318+
private String createNewId() {
319+
String androidId = Settings.Secure.getString(
320+
context.getContentResolver(),
321+
Settings.Secure.ANDROID_ID
322+
);
323+
if (androidId != null && !androidId.isEmpty()) {
324+
return androidId;
325+
} else {
326+
return UUID.randomUUID().toString();
327+
}
328+
}
307329
}

QCloudFoundation/qcloud-track/src/main/java/com/tencent/qcloud/track/service/BeaconTrackService.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ public void setDebug(boolean debug) {
104104
public static boolean isInclude() {
105105
try {
106106
Class.forName("com.tencent.beacon.event.open.BeaconReport");
107-
Class.forName("com.tencent.qimei.sdk.QimeiSDK");
108107
return true;
109108
} catch (ClassNotFoundException e){
110109
return false;

0 commit comments

Comments
 (0)