Skip to content

Commit 5a50374

Browse files
author
weiqiangliu
committed
Release 3.5.3
1 parent faa0e83 commit 5a50374

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
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.5.2'
2+
pluginVersion = '3.5.3'
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/SensorsAnalyticsPlugin.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class SensorsAnalyticsPlugin implements Plugin<Project> {
3939
boolean disableSensorsAnalyticsIncrementalBuild = Boolean.parseBoolean(properties.getOrDefault("sensorsAnalytics.disableIncrementalBuild", "false"))
4040
boolean isHookOnMethodEnter = Boolean.parseBoolean(properties.getOrDefault("sensorsAnalytics.isHookOnMethodEnter", "false"))
4141
boolean isAndroidTv = Boolean.parseBoolean(properties.getOrDefault("sensorsAnalytics.isAndroidTv", "false"))
42+
String asmVersion = properties.getOrDefault("sensorsAnalytics.asmVersion", "ASM7")
43+
SensorsAnalyticsUtil.updateASMVersion(asmVersion)
4244

4345
if (!disableSensorsAnalyticsPlugin) {
4446
BaseExtension baseExtension

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import java.util.jar.JarOutputStream
5151

5252
class SensorsAnalyticsTransform extends Transform {
5353
private SensorsAnalyticsTransformHelper transformHelper
54-
public static final String VERSION = "3.5.2"
54+
public static final String VERSION = "3.5.3"
5555
public static final String MIN_SDK_VERSION = "6.5.3"
5656
private WaitableExecutor waitableExecutor
5757
private URLClassLoader urlClassLoader

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

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import org.objectweb.asm.Type
2424

2525
@CompileStatic
2626
class SensorsAnalyticsUtil {
27-
public static final int ASM_VERSION = Opcodes.ASM7
27+
public static int ASM_VERSION = Opcodes.ASM7
2828
private static final HashSet<String> targetFragmentClass = new HashSet()
2929
private static final HashSet<String> targetMenuMethodDesc = new HashSet()
3030
private static final HashSet<String> specialClass = new HashSet()
@@ -202,4 +202,24 @@ class SensorsAnalyticsUtil {
202202
static String appendDescBeforeGiven(String givenDesc, String appendDesc) {
203203
return givenDesc.replaceFirst("\\(", "(" + appendDesc);
204204
}
205+
206+
static void updateASMVersion(String asmVersion){
207+
switch (asmVersion){
208+
case "ASM6":
209+
ASM_VERSION = Opcodes.ASM6
210+
break
211+
case "ASM7":
212+
ASM_VERSION = Opcodes.ASM7
213+
break
214+
case "ASM8":
215+
ASM_VERSION = Opcodes.ASM8
216+
break
217+
case "ASM9":
218+
ASM_VERSION = Opcodes.ASM9
219+
break
220+
default:
221+
ASM_VERSION = Opcodes.ASM7
222+
break;
223+
}
224+
}
205225
}

plugin/src/main/groovy/com/sensorsdata/analytics/android/plugin/viewclick/SensorsAutoTrackMethodVisitor.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,18 @@ public void visitInvokeDynamicInsn(String name1, String desc1, Handle bsm, Objec
8787
return;
8888
}
8989
try {
90-
String desc2 = ((Type)bsmArgs[0]).getDescriptor();
90+
String owner = bsm.getOwner();
91+
if (!"java/lang/invoke/LambdaMetafactory".equals(owner)) {
92+
return;
93+
}
94+
String desc2 = ((Type) bsmArgs[0]).getDescriptor();
9195
SensorsAnalyticsMethodCell sensorsAnalyticsMethodCell = SensorsAnalyticsHookConfig.LAMBDA_METHODS.get(Type.getReturnType(desc1).getDescriptor() + name1 + desc2);
9296
if (sensorsAnalyticsMethodCell != null) {
9397
Handle it = (Handle) bsmArgs[1];
9498
mLambdaMethodCells.put(it.getName() + it.getDesc(), sensorsAnalyticsMethodCell);
9599
}
96100
} catch (Exception e) {
97-
e.printStackTrace();
101+
Logger.warn("Some exception happened when call visitInvokeDynamicInsn: className: " + mClassName + ", error message: " + e.getLocalizedMessage());
98102
}
99103
}
100104

0 commit comments

Comments
 (0)