Skip to content

Commit

Permalink
Release 3.5.3
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqiangliu committed Nov 10, 2022
1 parent faa0e83 commit 5a50374
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
2 changes: 1 addition & 1 deletion plugin/ext.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
project.ext {
pluginVersion = '3.5.2'
pluginVersion = '3.5.3'
Properties properties = new Properties()
if (project.file('local.properties').exists()) {
properties.load(project.file('local.properties').newDataInputStream())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ class SensorsAnalyticsPlugin implements Plugin<Project> {
boolean disableSensorsAnalyticsIncrementalBuild = Boolean.parseBoolean(properties.getOrDefault("sensorsAnalytics.disableIncrementalBuild", "false"))
boolean isHookOnMethodEnter = Boolean.parseBoolean(properties.getOrDefault("sensorsAnalytics.isHookOnMethodEnter", "false"))
boolean isAndroidTv = Boolean.parseBoolean(properties.getOrDefault("sensorsAnalytics.isAndroidTv", "false"))
String asmVersion = properties.getOrDefault("sensorsAnalytics.asmVersion", "ASM7")
SensorsAnalyticsUtil.updateASMVersion(asmVersion)

if (!disableSensorsAnalyticsPlugin) {
BaseExtension baseExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import java.util.jar.JarOutputStream

class SensorsAnalyticsTransform extends Transform {
private SensorsAnalyticsTransformHelper transformHelper
public static final String VERSION = "3.5.2"
public static final String VERSION = "3.5.3"
public static final String MIN_SDK_VERSION = "6.5.3"
private WaitableExecutor waitableExecutor
private URLClassLoader urlClassLoader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import org.objectweb.asm.Type

@CompileStatic
class SensorsAnalyticsUtil {
public static final int ASM_VERSION = Opcodes.ASM7
public static int ASM_VERSION = Opcodes.ASM7
private static final HashSet<String> targetFragmentClass = new HashSet()
private static final HashSet<String> targetMenuMethodDesc = new HashSet()
private static final HashSet<String> specialClass = new HashSet()
Expand Down Expand Up @@ -202,4 +202,24 @@ class SensorsAnalyticsUtil {
static String appendDescBeforeGiven(String givenDesc, String appendDesc) {
return givenDesc.replaceFirst("\\(", "(" + appendDesc);
}

static void updateASMVersion(String asmVersion){
switch (asmVersion){
case "ASM6":
ASM_VERSION = Opcodes.ASM6
break
case "ASM7":
ASM_VERSION = Opcodes.ASM7
break
case "ASM8":
ASM_VERSION = Opcodes.ASM8
break
case "ASM9":
ASM_VERSION = Opcodes.ASM9
break
default:
ASM_VERSION = Opcodes.ASM7
break;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,18 @@ public void visitInvokeDynamicInsn(String name1, String desc1, Handle bsm, Objec
return;
}
try {
String desc2 = ((Type)bsmArgs[0]).getDescriptor();
String owner = bsm.getOwner();
if (!"java/lang/invoke/LambdaMetafactory".equals(owner)) {
return;
}
String desc2 = ((Type) bsmArgs[0]).getDescriptor();
SensorsAnalyticsMethodCell sensorsAnalyticsMethodCell = SensorsAnalyticsHookConfig.LAMBDA_METHODS.get(Type.getReturnType(desc1).getDescriptor() + name1 + desc2);
if (sensorsAnalyticsMethodCell != null) {
Handle it = (Handle) bsmArgs[1];
mLambdaMethodCells.put(it.getName() + it.getDesc(), sensorsAnalyticsMethodCell);
}
} catch (Exception e) {
e.printStackTrace();
Logger.warn("Some exception happened when call visitInvokeDynamicInsn: className: " + mClassName + ", error message: " + e.getLocalizedMessage());
}
}

Expand Down

0 comments on commit 5a50374

Please sign in to comment.