Skip to content

Commit

Permalink
Release 3.2.15
Browse files Browse the repository at this point in the history
  • Loading branch information
weiqiangliu committed Nov 8, 2020
1 parent 59735dc commit 8e2556c
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 35 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
![logo](https://opensource.sensorsdata.cn/wp-content/uploads/logo.png)

# sa-sdk-android-plugin2
## 神策简介

[**神策数据**](https://www.sensorsdata.cn/)
(Sensors Data),隶属于神策网络科技(北京)有限公司,是一家专业的大数据分析服务公司,大数据分析行业开拓者,为客户提供深度用户行为分析平台、以及专业的咨询服务和行业解决方案,致力于帮助客户实现数据驱动。神策数据立足大数据及用户行为分析的技术与实践前沿,业务现已覆盖以互联网、金融、零售快消、高科技、制造等为代表的十多个主要行业、并可支持企业多个职能部门。公司总部在北京,并在上海、深圳、合肥、武汉等地拥有本地化的服务团队,覆盖东区及南区市场;公司拥有专业的服务团队,为客户提供一对一的客户服务。公司在大数据领域积累的核心关键技术,包括在海量数据采集、存储、清洗、分析挖掘、可视化、智能应用、安全与隐私保护等领域。 [**More**](https://www.sensorsdata.cn/about/aboutus.html)


## SDK 简介

SensorsAnalytics SDK 是国内第一家开源商用版用户行为采集 SDK,目前支持代码埋点、全埋点、App 点击图、可视化全埋点等。目前已累计有 1500 多家付费客户,2500+ 的 App 集成使用,作为 App 数据采集利器,致力于帮助客户挖掘更多的商业价值,为其精准运营和业务支撑提供了可靠的数据来源。其采集全面而灵活、性能良好,并一直保持稳定的迭代,经受住了时间和客户的考验。

The official Android SDK Plugin for Sensors Analytics

## 快速集成

Expand Down
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.2.14'
pluginVersion = '3.2.15'
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 @@ -257,21 +257,17 @@ class SensorsAnalyticsClassVisitor extends ClassVisitor {
methodVisitor.visitVarInsn(ILOAD, 3)
methodVisitor.visitVarInsn(ISTORE, third)
localIds.add(third)
} else if (nameDesc == 'setUserVisibleHint(Z)V' && pubAndNoStaticAccess) {
isSetUserVisibleHint = true
variableID = newLocal(Type.getObjectType("java/lang/Integer"))
methodVisitor.visitVarInsn(ILOAD, 1)
methodVisitor.visitVarInsn(ISTORE, variableID)
} else if (nameDesc == 'onViewCreated(Landroid/view/View;Landroid/os/Bundle;)V' && pubAndNoStaticAccess) {
} else if (pubAndNoStaticAccess && SensorsAnalyticsUtil.isInstanceOfFragment(mSuperName)
&& SensorsAnalyticsHookConfig.FRAGMENT_METHODS.get(nameDesc) != null) {
SensorsAnalyticsMethodCell sensorsAnalyticsMethodCell = SensorsAnalyticsHookConfig.FRAGMENT_METHODS.get(nameDesc)
localIds = new ArrayList<>()
int localId = newLocal(Type.getObjectType("java/lang/Integer"))
methodVisitor.visitVarInsn(ALOAD, 1)
methodVisitor.visitVarInsn(ASTORE, localId)
localIds.add(localId)
localId = newLocal(Type.getObjectType("java/lang/Integer"))
methodVisitor.visitVarInsn(ALOAD, 2)
methodVisitor.visitVarInsn(ASTORE, localId)
localIds.add(localId)
Type[] types = Type.getArgumentTypes(desc)
for (int i = 1; i < sensorsAnalyticsMethodCell.paramsCount; i++) {
int localId = newLocal(types[i - 1])
methodVisitor.visitVarInsn(sensorsAnalyticsMethodCell.opcodes.get(i), i)
methodVisitor.visitVarInsn(SensorsAnalyticsUtil.convertOpcodes(sensorsAnalyticsMethodCell.opcodes.get(i)), localId)
localIds.add(localId)
}
} else if (nameDesc == "onCheckedChanged(Landroid/widget/RadioGroup;I)V" && pubAndNoStaticAccess) {
localIds = new ArrayList<>()
int firstLocalId = newLocal(Type.getObjectType("android/widget/RadioGroup"))
Expand Down Expand Up @@ -308,19 +304,16 @@ class SensorsAnalyticsClassVisitor extends ClassVisitor {
methodVisitor.visitVarInsn(ALOAD, 1)
methodVisitor.visitVarInsn(ASTORE, secondLocalId)
localIds.add(secondLocalId)
} else if (!transformHelper.isHookOnMethodEnter && nameDesc == "onMenuItemClick(Landroid/view/MenuItem;)Z" && pubAndNoStaticAccess) {
} else if (nameDesc == "onMenuItemClick(Landroid/view/MenuItem;)Z" && pubAndNoStaticAccess) {
localIds = new ArrayList<>()
int firstLocalId = newLocal(Type.getObjectType("android/view/MenuItem"))
methodVisitor.visitVarInsn(ALOAD, 1)
methodVisitor.visitVarInsn(ASTORE, firstLocalId)
localIds.add(firstLocalId)
}
if (transformHelper.isHookOnMethodEnter) {
handleCode()
}

// Lambda 参数优化部分,对现有参数进行复制
if (!transformHelper.isHookOnMethodEnter && transformHelper.extension.lambdaEnabled) {
if (transformHelper.extension.lambdaEnabled) {
SensorsAnalyticsMethodCell lambdaMethodCell = mLambdaMethodCells.get(nameDesc)
if (lambdaMethodCell != null) {
//判断是否是在采样中,在采样中才会处理或者开关打开也统一处理
Expand Down Expand Up @@ -350,6 +343,10 @@ class SensorsAnalyticsClassVisitor extends ClassVisitor {
}
}
}

if (transformHelper.isHookOnMethodEnter) {
handleCode()
}
}

@Override
Expand Down Expand Up @@ -384,19 +381,11 @@ class SensorsAnalyticsClassVisitor extends ClassVisitor {
SensorsAnalyticsMethodCell sensorsAnalyticsMethodCell = SensorsAnalyticsHookConfig.FRAGMENT_METHODS.get(nameDesc)
if (sensorsAnalyticsMethodCell != null) {
visitedFragMethods.add(nameDesc)
if (isSetUserVisibleHint) {
methodVisitor.visitVarInsn(ALOAD, 0)
methodVisitor.visitVarInsn(ILOAD, variableID)
methodVisitor.visitMethodInsn(Opcodes.INVOKESTATIC, SensorsAnalyticsHookConfig.SENSORS_ANALYTICS_API, sensorsAnalyticsMethodCell.agentName, sensorsAnalyticsMethodCell.agentDesc, false)
} else if (localIds != null) {
methodVisitor.visitVarInsn(ALOAD, 0)
for (localId in localIds) {
methodVisitor.visitVarInsn(ALOAD, localId)
}
methodVisitor.visitMethodInsn(Opcodes.INVOKESTATIC, SensorsAnalyticsHookConfig.SENSORS_ANALYTICS_API, sensorsAnalyticsMethodCell.agentName, sensorsAnalyticsMethodCell.agentDesc, false)
} else {
visitMethodWithLoadedParams(methodVisitor, Opcodes.INVOKESTATIC, SensorsAnalyticsHookConfig.SENSORS_ANALYTICS_API, sensorsAnalyticsMethodCell.agentName, sensorsAnalyticsMethodCell.agentDesc, sensorsAnalyticsMethodCell.paramsStart, sensorsAnalyticsMethodCell.paramsCount, sensorsAnalyticsMethodCell.opcodes)
methodVisitor.visitVarInsn(ALOAD, 0)
for (int i = 1; i < sensorsAnalyticsMethodCell.paramsCount; i++) {
methodVisitor.visitVarInsn(sensorsAnalyticsMethodCell.opcodes.get(i), localIds[i - 1])
}
methodVisitor.visitMethodInsn(INVOKESTATIC, SensorsAnalyticsHookConfig.SENSORS_ANALYTICS_API, sensorsAnalyticsMethodCell.agentName, sensorsAnalyticsMethodCell.agentDesc, false)
isHasTracked = true
return
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import java.util.jar.JarOutputStream

class SensorsAnalyticsTransform extends Transform {
private SensorsAnalyticsTransformHelper transformHelper
public static final String VERSION = "3.2.14"
public static final String VERSION = "3.2.15"
public static final String MIN_SDK_VERSION = "4.3.2"
private WaitableExecutor waitableExecutor
private URLClassLoader urlClassLoader
Expand Down

0 comments on commit 8e2556c

Please sign in to comment.