Skip to content

Commit c4970c4

Browse files
author
dengshiwei
committed
Release 3.2.0
1 parent 20cf377 commit c4970c4

File tree

4 files changed

+24
-10
lines changed

4 files changed

+24
-10
lines changed

plugin/ext.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project.ext {
2-
pluginVersion = '3.1.9'
2+
pluginVersion = '3.2.0'
33
Properties properties = new Properties()
44
if (project.file('local.properties').exists()) {
55
properties.load(project.file('local.properties').newDataInputStream())

plugin/src/main/groovy/com/sensorsdata/analytics/android/plugin/Logger.groovy

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,15 @@ class Logger {
3434
static void printCopyright() {
3535
println()
3636
println("${LogUI.C_BLACK_GREEN.value}" + "####################################################################" + "${LogUI.E_NORMAL.value}")
37-
println("${LogUI.C_BLACK_GREEN.value}" + "######## ########" + "${LogUI.E_NORMAL.value}")
38-
println("${LogUI.C_BLACK_GREEN.value}" + "######## ########" + "${LogUI.E_NORMAL.value}")
39-
println("${LogUI.C_BLACK_GREEN.value}" + "######## 欢迎使用 SensorsAnalytics® (v" + SensorsAnalyticsTransform.VERSION + ")编译插件 ########" + "${LogUI.E_NORMAL.value}")
40-
println("${LogUI.C_BLACK_GREEN.value}" + "######## 使用过程中碰到任何问题请联系我们 ########" + "${LogUI.E_NORMAL.value}")
41-
println("${LogUI.C_BLACK_GREEN.value}" + "######## ########" + "${LogUI.E_NORMAL.value}")
42-
println("${LogUI.C_BLACK_GREEN.value}" + "######## ########" + "${LogUI.E_NORMAL.value}")
37+
println("${LogUI.C_BLACK_GREEN.value}" + "### ###" + "${LogUI.E_NORMAL.value}")
38+
println("${LogUI.C_BLACK_GREEN.value}" + "### ###" + "${LogUI.E_NORMAL.value}")
39+
println("${LogUI.C_BLACK_GREEN.value}" + "### 欢迎使用 SensorsAnalytics® (v" + SensorsAnalyticsTransform.VERSION + ")编译插件 ###" + "${LogUI.E_NORMAL.value}")
40+
println("${LogUI.C_BLACK_GREEN.value}" + "### 使用过程中碰到任何问题请联系我们 ###" + "${LogUI.E_NORMAL.value}")
41+
println("${LogUI.C_BLACK_GREEN.value}" + "### QQ 群号:785122381 ###" + "${LogUI.E_NORMAL.value}")
42+
println("${LogUI.C_BLACK_GREEN.value}" + "### GitHub 地址: ###" + "${LogUI.E_NORMAL.value}")
43+
println("${LogUI.C_BLACK_GREEN.value}" + "### https://github.com/sensorsdata/sa-sdk-android-plugin2 ###" + "${LogUI.E_NORMAL.value}")
44+
println("${LogUI.C_BLACK_GREEN.value}" + "### ###" + "${LogUI.E_NORMAL.value}")
45+
println("${LogUI.C_BLACK_GREEN.value}" + "### ###" + "${LogUI.E_NORMAL.value}")
4346
println("${LogUI.C_BLACK_GREEN.value}" + "####################################################################" + "${LogUI.E_NORMAL.value}")
4447
println()
4548
}

plugin/src/main/groovy/com/sensorsdata/analytics/android/plugin/SensorsAnalyticsSDKHookConfig.groovy

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ class SensorsAnalyticsSDKHookConfig {
2727

2828
void disableIMEI(String methodName) {
2929
def imei = new SensorsAnalyticsMethodCell('getIMEI', '(Landroid/content/Context;)Ljava/lang/String;', 'createGetIMEI')
30-
def imeiMethods = [imei]
30+
def deviceID = new SensorsAnalyticsMethodCell('getDeviceID', '(Landroid/content/Context;I)Ljava/lang/String;', 'createGetDeviceID')
31+
def imeiMethods = [imei, deviceID]
3132
def imeiMethodCells = new HashMap<String, ArrayList<SensorsAnalyticsMethodCell>>()
3233
imeiMethodCells.put("com/sensorsdata/analytics/android/sdk/util/SensorsDataUtils", imeiMethods)
3334
methodCells.put(methodName, imeiMethodCells)
@@ -154,6 +155,15 @@ class SensorsAnalyticsSDKHookConfig {
154155
mv.visitEnd()
155156
}
156157

158+
void createGetDeviceID(ClassVisitor classVisitor, SensorsAnalyticsMethodCell methodCell) {
159+
def mv = classVisitor.visitMethod(Opcodes.ACC_PRIVATE + Opcodes.ACC_STATIC, methodCell.name, methodCell.desc, null, null)
160+
mv.visitCode()
161+
mv.visitLdcInsn("")
162+
mv.visitInsn(Opcodes.ARETURN)
163+
mv.visitMaxs(1, 1)
164+
mv.visitEnd()
165+
}
166+
157167
//todo 扩展
158168

159169
}

plugin/src/main/groovy/com/sensorsdata/analytics/android/plugin/SensorsAnalyticsTransform.groovy

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ import java.util.jar.JarOutputStream
4545

4646
class SensorsAnalyticsTransform extends Transform {
4747
private SensorsAnalyticsTransformHelper transformHelper
48-
public static final String VERSION = "3.1.9"
48+
public static final String VERSION = "3.2.0"
4949
public static final String MIN_SDK_VERSION = "3.0.0"
5050
private WaitableExecutor waitableExecutor
5151

@@ -276,12 +276,13 @@ class SensorsAnalyticsTransform extends Transform {
276276
} else {
277277
String className
278278
JarEntry entry = new JarEntry(entryName)
279-
jarOutputStream.putNextEntry(entry)
280279
byte[] modifiedClassBytes = null
281280
byte[] sourceClassBytes
282281
try {
282+
jarOutputStream.putNextEntry(entry)
283283
sourceClassBytes = IOUtils.toByteArray(inputStream)
284284
} catch (Exception e) {
285+
Logger.error("Exception encountered while processing jar: " + jarFile.getAbsolutePath())
285286
e.printStackTrace()
286287
return null
287288
}

0 commit comments

Comments
 (0)