-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
91 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,4 @@ | |
.cxx | ||
local.properties | ||
/plugin-sentry/~/.m2/ | ||
/privacy-ui | ||
/privacy-processor | ||
/.build_history | ||
.build_history/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
.../com/yl/lib/plugin/sentry/transform/booster/classtransform/hook/FlushHookDataTransform.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.yl.lib.plugin.sentry.transform.booster.classtransform.hook | ||
|
||
import com.didiglobal.booster.transform.TransformContext | ||
import com.yl.lib.plugin.sentry.util.PrivacyMoveAssetsUtil | ||
import org.objectweb.asm.tree.ClassNode | ||
|
||
/** | ||
* @author yulun | ||
* @since 2023-08-29 11:22 | ||
*/ | ||
class FlushHookDataTransform : BaseHookTransform(){ | ||
override fun ignoreClass(context: TransformContext, klass: ClassNode): Boolean { | ||
return true | ||
} | ||
|
||
override fun onPostTransform(context: TransformContext) { | ||
super.onPostTransform(context) | ||
PrivacyMoveAssetsUtil.Asset.doFlushProxyData() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 0 additions & 47 deletions
47
...ry/src/main/java/com/yl/lib/plugin/sentry/transform/booster/task/PrivacyMoveAssetsTask.kt
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
plugin-sentry/src/main/java/com/yl/lib/plugin/sentry/util/PrivacyMoveAssetsUtil.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package com.yl.lib.plugin.sentry.util | ||
|
||
import com.yl.lib.plugin.sentry.transform.manager.HookedDataManger | ||
import org.gradle.util.GFileUtils | ||
import java.io.File | ||
|
||
/** | ||
* @author yulun | ||
* @since 2022-06-29 16:06 | ||
* 把扫描生成的静态文件 写到apk assets目录下 | ||
* todo demo里task可以执行,但是在项目里,task注入不进去,待排查 | ||
*/ | ||
open class PrivacyMoveAssetsUtil{ | ||
|
||
object Asset{ | ||
|
||
var fileName: String? = null | ||
|
||
var assetsPathList: ArrayList<String> = ArrayList() | ||
|
||
var buildDir:File?=null | ||
|
||
fun doFlushProxyData() { | ||
PrivacyPluginUtil.privacyPluginUtil.i("MoveAssetsTask-flushToFile") | ||
// 写入被代理所有的类和文件 | ||
fileName?.let { | ||
HookedDataManger.MANAGER.flushToFile(it, buildDir!!) | ||
} | ||
|
||
var originFile = File(buildDir?.absolutePath + File.separator + fileName) | ||
if (!originFile.exists()) { | ||
PrivacyPluginUtil.privacyPluginUtil.i("MoveAssetsTask originFile don't exist,path is ${buildDir?.absolutePath + File.separator + fileName}") | ||
return | ||
} | ||
assetsPathList.forEach { assetsPath -> | ||
var assetsFile = File(assetsPath+ File.separator+ fileName) | ||
PrivacyPluginUtil.privacyPluginUtil.i("MoveAssetsTask assetsPath is ${assetsPath}") | ||
assetsFile.let { | ||
GFileUtils.deleteFileQuietly(assetsFile) | ||
} | ||
PrivacyPluginUtil.privacyPluginUtil.i("MoveAssetsTask originFile is ${originFile.absolutePath} assetsPath is $assetsPath") | ||
GFileUtils.copyFile(originFile, assetsFile) | ||
} | ||
|
||
} | ||
} | ||
|
||
|
||
|
||
|
||
} |