├── .gitignore ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle ├── libs │ └── bcprov-jdk16-139.jar ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── yl │ │ └── lib │ │ └── privacysentry │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ ├── java │ │ └── com │ │ │ └── yl │ │ │ └── lib │ │ │ └── privacysentry │ │ │ ├── APP.kt │ │ │ ├── MainActivity.kt │ │ │ ├── ReflexObjectUtil.java │ │ │ ├── calendar │ │ │ ├── CalendarManager.kt │ │ │ ├── CalenderActivity.kt │ │ │ └── RRuleConstant.kt │ │ │ ├── contact │ │ │ ├── ContactActivity.kt │ │ │ └── ContactManager.kt │ │ │ ├── location │ │ │ └── LocationTestActivity.java │ │ │ ├── process │ │ │ ├── MultiProcessB.kt │ │ │ └── MultiProcessC.kt │ │ │ ├── telephony │ │ │ └── TelephonyTestActivity.kt │ │ │ └── test │ │ │ ├── PrivacyMethod.kt │ │ │ ├── PrivacyProxyCallJava.java │ │ │ ├── PrivacyProxySelfTest.kt │ │ │ ├── PrivacyTestMacAddress.java │ │ │ ├── TestBCSeri.java │ │ │ ├── TestFragmentActivity.kt │ │ │ ├── TestInJava.java │ │ │ ├── TestOaidGetter.java │ │ │ ├── TestReflex.kt │ │ │ ├── TestReflexJava.java │ │ │ ├── TestService.kt │ │ │ ├── constructor │ │ │ └── ui │ │ │ └── main │ │ │ └── TestPermissionFragment.kt │ └── res │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ ├── activity_calender.xml │ │ ├── activity_contact.xml │ │ ├── activity_location_test.xml │ │ ├── activity_main.xml │ │ ├── activity_telephony_test.xml │ │ ├── activity_test_frament.xml │ │ └── fragment_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.webp │ │ └── ic_launcher_round.webp │ │ ├── values-night │ │ └── themes.xml │ │ └── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── themes.xml │ └── test │ └── java │ └── com │ └── yl │ └── lib │ └── privacysentry │ └── ExampleUnitTest.kt ├── build.gradle ├── config.gradle ├── demo_result.xls ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── hook-sentry ├── .gitignore ├── build.gradle ├── gradle.properties ├── proguard-rules.pro ├── src │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── yl │ │ │ └── lib │ │ │ └── hook_sentry │ │ │ └── ExampleInstrumentedTest.kt │ ├── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── com │ │ │ └── yl │ │ │ └── lib │ │ │ └── sentry │ │ │ └── hook │ │ │ ├── PrivacySentry.kt │ │ │ ├── PrivacySentryBuilder.kt │ │ │ ├── cache │ │ │ ├── BasePrivacyCache.kt │ │ │ ├── CachePrivacyManager.kt │ │ │ ├── CacheUtils.kt │ │ │ ├── DiskCache.kt │ │ │ ├── MemoryCache.kt │ │ │ ├── PrivacyCacheType.kt │ │ │ ├── TimeLessDiskCache.kt │ │ │ └── TimeLessMemoryCache.kt │ │ │ ├── excel │ │ │ ├── ExcelBuildDataListener.kt │ │ │ └── ExcelUtil.kt │ │ │ ├── printer │ │ │ ├── BaseFilePrinter.kt │ │ │ ├── BasePrinter.kt │ │ │ ├── DefaultFilePrint.kt │ │ │ ├── DefaultLogPrint.kt │ │ │ ├── PrintCallBack.kt │ │ │ └── PrivacyFunBean.kt │ │ │ ├── util │ │ │ ├── MainProcessUtil.kt │ │ │ ├── PrivacyClipBoardManager.kt │ │ │ ├── PrivacyLog.kt │ │ │ ├── PrivacyProxyUtil.kt │ │ │ ├── PrivacyUtil.kt │ │ │ └── ReflectUtils.kt │ │ │ └── watcher │ │ │ ├── DelayTimeWatcher.kt │ │ │ └── PrivacyDataManager.kt │ └── test │ │ └── java │ │ └── com │ │ └── yl │ │ └── lib │ │ └── hook_sentry │ │ └── ExampleUnitTest.kt └── ~ │ └── .m2 │ └── repository │ └── com │ └── yl │ └── lib │ └── privacy │ └── hook-sentry │ ├── 0.0.1-SNAPSHOT │ ├── maven-metadata-remote.xml │ └── resolver-status.properties │ ├── maven-metadata-remote.xml │ └── resolver-status.properties ├── plugin-sentry ├── .gitignore ├── build.gradle ├── gradle.properties └── src │ └── main │ ├── java │ └── com │ │ └── yl │ │ └── lib │ │ └── plugin │ │ └── sentry │ │ ├── PrivacySentryPlugin.kt │ │ ├── PrivacyTransformTask.kt │ │ ├── extension │ │ └── PrivacyExtension.kt │ │ ├── transform │ │ ├── PrivacyTransformContext.kt │ │ ├── PrivacyTransformInvocation.kt │ │ ├── booster │ │ │ ├── asmtransform │ │ │ │ └── AbsClassTransformer.kt │ │ │ ├── classtransform │ │ │ │ ├── collect │ │ │ │ │ ├── ClassProxyCollectTransform.kt │ │ │ │ │ └── MethodProxyCollectTransform.kt │ │ │ │ └── hook │ │ │ │ │ ├── BaseHookTransform.kt │ │ │ │ │ ├── ClassProxyTransform.kt │ │ │ │ │ ├── FieldProxyTransform.kt │ │ │ │ │ ├── FlushHookDataTransform.kt │ │ │ │ │ ├── MethodHookTransform.kt │ │ │ │ │ └── ServiceHookTransform.kt │ │ │ ├── processor │ │ │ │ ├── PrivacyAssetsProcessor.kt │ │ │ │ └── PrivacyManifestProcessor.kt │ │ │ ├── task │ │ │ │ └── PrivacyManifestTask.kt │ │ │ └── transformer │ │ │ │ └── PrivacyBaseTransformer.kt │ │ └── manager │ │ │ ├── HookFieldManager.kt │ │ │ ├── HookMethodManager.kt │ │ │ ├── HookedDataManger.kt │ │ │ └── ReplaceClassManager.kt │ │ └── util │ │ ├── PrivacyExt.kt │ │ ├── PrivacyMoveAssetsUtil.kt │ │ └── PrivacyPluginUtil.kt │ └── resources │ └── META-INF │ └── gradle-plugins │ ├── com.allenymt.plugin.privacy.properties │ └── privacy-sentry-plugin.properties ├── privacy ├── privacy-annotation ├── .gitignore ├── build.gradle ├── gradle.properties ├── src │ └── main │ │ └── java │ │ └── com │ │ └── yl │ │ └── lib │ │ └── privacy_annotation │ │ ├── MethodInvokeOpcode.java │ │ ├── PrivacyClassBlack.java │ │ ├── PrivacyClassProxy.java │ │ ├── PrivacyClassReplace.java │ │ ├── PrivacyFieldProxy.java │ │ └── PrivacyMethodProxy.java └── ~ │ └── .m2 │ └── repository │ └── com │ └── yl │ └── lib │ └── privacy │ └── privacy-annotation │ ├── 0.0.1-SNAPSHOT │ ├── maven-metadata-remote.xml │ └── resolver-status.properties │ ├── 0.0.2-SNAPSHOT │ ├── maven-metadata-remote.xml │ └── resolver-status.properties │ ├── maven-metadata-remote.xml │ ├── maven-metadata-remote.xml.sha1 │ └── resolver-status.properties ├── privacy-proxy ├── .gitignore ├── README.md ├── build.gradle ├── gradle.properties └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── yl │ └── lib │ └── privacy_proxy │ ├── PrivacyPermissionProxy.kt │ ├── PrivacyProxyCall.kt │ ├── PrivacyProxyCallJava.java │ ├── PrivacyProxyResolver.kt │ ├── PrivacyReflectProxy.kt │ ├── PrivacySensorProxy.kt │ ├── PrivacyTelephonyProxy.kt │ └── ProxyProxyField.java ├── privacy-replace ├── .gitignore ├── README.md ├── build.gradle ├── consumer-rules.pro ├── gradle.properties ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── vdian │ │ └── android │ │ └── wdb │ │ └── privacy_replace │ │ └── ExampleInstrumentedTest.kt │ ├── main │ ├── AndroidManifest.xml │ └── java │ │ └── com │ │ └── yl │ │ └── lib │ │ └── privacy_replace │ │ ├── PrivacyFile.java │ │ ├── PrivacyFileInputStream.java │ │ └── PrivacyFileReader.java │ └── test │ └── java │ └── com │ └── vdian │ └── android │ └── wdb │ └── privacy_replace │ └── ExampleUnitTest.kt ├── privacy-test ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ └── main │ ├── AndroidManifest.xml │ └── java │ └── com │ └── yl │ └── lib │ └── privacy_test │ ├── PrivacyProxySelfTest2.java │ ├── TestMethod.kt │ └── TestMethodInJava.java ├── privacy-ui └── build │ ├── generated │ └── source │ │ └── buildConfig │ │ └── debug │ │ └── com │ │ └── yl │ │ └── lib │ │ └── privacy_ui │ │ └── BuildConfig.java │ ├── intermediates │ ├── aapt_friendly_merged_manifests │ │ └── debug │ │ │ └── aapt │ │ │ ├── AndroidManifest.xml │ │ │ └── output-metadata.json │ ├── aar_metadata │ │ └── debug │ │ │ └── aar-metadata.properties │ ├── annotation_processor_list │ │ └── debug │ │ │ └── annotationProcessors.json │ ├── compile_library_classes_jar │ │ └── debug │ │ │ └── classes.jar │ ├── compile_r_class_jar │ │ └── debug │ │ │ └── R.jar │ ├── compile_symbol_list │ │ └── debug │ │ │ └── R.txt │ ├── compiled_local_resources │ │ └── debug │ │ │ └── out │ │ │ ├── layout_activity_permission_list.xml.flat │ │ │ ├── layout_activity_real_time_privacy_item.xml.flat │ │ │ ├── layout_activity_replace_list.xml.flat │ │ │ ├── layout_permission_item_view.xml.flat │ │ │ ├── layout_real_tile_item_view.xml.flat │ │ │ └── layout_replace_item_view.xml.flat │ ├── incremental │ │ ├── mergeDebugJniLibFolders │ │ │ └── merger.xml │ │ ├── mergeDebugShaders │ │ │ └── merger.xml │ │ ├── packageDebugAssets │ │ │ └── merger.xml │ │ └── packageDebugResources │ │ │ ├── compile-file-map.properties │ │ │ └── merger.xml │ ├── javac │ │ └── debug │ │ │ └── classes │ │ │ └── com │ │ │ └── yl │ │ │ └── lib │ │ │ └── privacy_ui │ │ │ └── BuildConfig.class │ ├── library_java_res │ │ └── debug │ │ │ └── res.jar │ ├── library_manifest │ │ └── debug │ │ │ └── AndroidManifest.xml │ ├── local_only_symbol_list │ │ └── debug │ │ │ └── R-def.txt │ ├── manifest_merge_blame_file │ │ └── debug │ │ │ └── manifest-merger-blame-debug-report.txt │ ├── navigation_json │ │ └── debug │ │ │ └── navigation.json │ ├── packaged_manifests │ │ └── debug │ │ │ └── output-metadata.json │ ├── packaged_res │ │ └── debug │ │ │ └── layout │ │ │ ├── activity_permission_list.xml │ │ │ ├── activity_real_time_privacy_item.xml │ │ │ ├── activity_replace_list.xml │ │ │ ├── permission_item_view.xml │ │ │ ├── real_tile_item_view.xml │ │ │ └── replace_item_view.xml │ ├── runtime_library_classes_jar │ │ └── debug │ │ │ └── classes.jar │ └── symbol_list_with_package_name │ │ └── debug │ │ └── package-aware-r.txt │ ├── kotlin │ └── compileDebugKotlin │ │ ├── build-history.bin │ │ ├── caches-jvm │ │ ├── inputs │ │ │ ├── source-to-output.tab │ │ │ ├── source-to-output.tab.keystream │ │ │ ├── source-to-output.tab.keystream.len │ │ │ ├── source-to-output.tab.len │ │ │ ├── source-to-output.tab.values.at │ │ │ ├── source-to-output.tab_i │ │ │ └── source-to-output.tab_i.len │ │ ├── jvm │ │ │ └── kotlin │ │ │ │ ├── class-fq-name-to-source.tab │ │ │ │ ├── class-fq-name-to-source.tab.keystream │ │ │ │ ├── class-fq-name-to-source.tab.keystream.len │ │ │ │ ├── class-fq-name-to-source.tab.len │ │ │ │ ├── class-fq-name-to-source.tab.values.at │ │ │ │ ├── class-fq-name-to-source.tab_i │ │ │ │ ├── class-fq-name-to-source.tab_i.len │ │ │ │ ├── internal-name-to-source.tab │ │ │ │ ├── internal-name-to-source.tab.keystream │ │ │ │ ├── internal-name-to-source.tab.keystream.len │ │ │ │ ├── internal-name-to-source.tab.len │ │ │ │ ├── internal-name-to-source.tab.values.at │ │ │ │ ├── internal-name-to-source.tab_i │ │ │ │ ├── internal-name-to-source.tab_i.len │ │ │ │ ├── proto.tab │ │ │ │ ├── proto.tab.keystream │ │ │ │ ├── proto.tab.keystream.len │ │ │ │ ├── proto.tab.len │ │ │ │ ├── proto.tab.values.at │ │ │ │ ├── proto.tab_i │ │ │ │ ├── proto.tab_i.len │ │ │ │ ├── source-to-classes.tab │ │ │ │ ├── source-to-classes.tab.keystream │ │ │ │ ├── source-to-classes.tab.keystream.len │ │ │ │ ├── source-to-classes.tab.len │ │ │ │ ├── source-to-classes.tab.values.at │ │ │ │ ├── source-to-classes.tab_i │ │ │ │ ├── source-to-classes.tab_i.len │ │ │ │ ├── subtypes.tab │ │ │ │ ├── subtypes.tab.keystream │ │ │ │ ├── subtypes.tab.keystream.len │ │ │ │ ├── subtypes.tab.len │ │ │ │ ├── subtypes.tab.values.at │ │ │ │ ├── subtypes.tab_i │ │ │ │ ├── subtypes.tab_i.len │ │ │ │ ├── supertypes.tab │ │ │ │ ├── supertypes.tab.keystream │ │ │ │ ├── supertypes.tab.keystream.len │ │ │ │ ├── supertypes.tab.len │ │ │ │ ├── supertypes.tab.values.at │ │ │ │ ├── supertypes.tab_i │ │ │ │ └── supertypes.tab_i.len │ │ └── lookups │ │ │ ├── counters.tab │ │ │ ├── file-to-id.tab │ │ │ ├── file-to-id.tab.keystream │ │ │ ├── file-to-id.tab.keystream.len │ │ │ ├── file-to-id.tab.len │ │ │ ├── file-to-id.tab.values.at │ │ │ ├── file-to-id.tab_i │ │ │ ├── file-to-id.tab_i.len │ │ │ ├── id-to-file.tab │ │ │ ├── id-to-file.tab.keystream │ │ │ ├── id-to-file.tab.keystream.len │ │ │ ├── id-to-file.tab.len │ │ │ ├── id-to-file.tab.values.at │ │ │ ├── id-to-file.tab_i │ │ │ ├── id-to-file.tab_i.len │ │ │ ├── lookups.tab │ │ │ ├── lookups.tab.keystream │ │ │ ├── lookups.tab.keystream.len │ │ │ ├── lookups.tab.len │ │ │ ├── lookups.tab.values.at │ │ │ ├── lookups.tab_i │ │ │ └── lookups.tab_i.len │ │ └── last-build.bin │ ├── outputs │ └── logs │ │ └── manifest-merger-debug-report.txt │ └── tmp │ ├── compileDebugJavaWithJavac │ └── source-classes-mapping.txt │ └── kotlin-classes │ └── debug │ ├── META-INF │ └── privacy-ui_debug.kotlin_module │ └── com │ └── yl │ └── lib │ └── privacy_ui │ ├── PermissionListActivity$buildData$1.class │ ├── PermissionListActivity$onCreate$1.class │ ├── PermissionListActivity.class │ ├── RealTimePrivacyItemActivity$buildData$1.class │ ├── RealTimePrivacyItemActivity$onCreate$1.class │ ├── RealTimePrivacyItemActivity.class │ ├── ReplaceListActivity$buildData$1.class │ ├── ReplaceListActivity$onCreate$1.class │ ├── ReplaceListActivity.class │ ├── permission │ ├── PermissionAdapter.class │ ├── PermissionItem.class │ ├── PermissionVieHolder.class │ ├── PermissionViewModel$originData$2.class │ └── PermissionViewModel.class │ ├── real_time │ ├── RealTimeAdapter.class │ ├── RealTimeViewModel$buildData$2.class │ ├── RealTimeViewModel.class │ ├── ReplaceVieHolder$1$1.class │ ├── ReplaceVieHolder$1.class │ └── ReplaceVieHolder.class │ └── replace │ ├── ReplaceAdapter.class │ ├── ReplaceItem.class │ ├── ReplaceItemList.class │ ├── ReplaceVieHolder$1$2.class │ ├── ReplaceVieHolder$1$3.class │ ├── ReplaceVieHolder$1.class │ ├── ReplaceVieHolder.class │ ├── ReplaceViewModel$buildData$1$1$result$1.class │ ├── ReplaceViewModel$buildData$1$invokeSuspend$$inlined$let$lambda$1.class │ ├── ReplaceViewModel$buildData$1.class │ └── ReplaceViewModel.class ├── privacy_hook.json ├── publish.gradle ├── settings.gradle.kts └── upload_local.sh /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/ 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild 9 | .cxx 10 | local.properties 11 | /plugin-sentry/~/.m2/ 12 | .build_history/ 13 | /local 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 alleny 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /app/libs/bcprov-jdk16-139.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/allenymt/PrivacySentry/831c8b0d370b0dbf9fd8ce122d7996c21b01b22f/app/libs/bcprov-jdk16-139.jar -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile -------------------------------------------------------------------------------- /app/src/androidTest/java/com/yl/lib/privacysentry/ExampleInstrumentedTest.kt: -------------------------------------------------------------------------------- 1 | package com.yl.lib.privacysentry 2 | 3 | import androidx.test.platform.app.InstrumentationRegistry 4 | import androidx.test.ext.junit.runners.AndroidJUnit4 5 | 6 | import org.junit.Test 7 | import org.junit.runner.RunWith 8 | 9 | import org.junit.Assert.* 10 | 11 | /** 12 | * Instrumented test, which will execute on an Android device. 13 | * 14 | * See [testing documentation](http://d.android.com/tools/testing). 15 | */ 16 | @RunWith(AndroidJUnit4::class) 17 | class ExampleInstrumentedTest { 18 | @Test 19 | fun useAppContext() { 20 | // Context of the app under test. 21 | val appContext = InstrumentationRegistry.getInstrumentation().targetContext 22 | assertEquals("com.yl.lib.privacysentry", appContext.packageName) 23 | } 24 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yl/lib/privacysentry/APP.kt: -------------------------------------------------------------------------------- 1 | package com.yl.lib.privacysentry 2 | 3 | import android.app.Application 4 | import android.content.Context 5 | import android.os.Build 6 | import androidx.multidex.MultiDex 7 | import com.yl.lib.privacysentry.test.PrivacyMethod 8 | import com.yl.lib.sentry.hook.PrivacyResultCallBack 9 | import com.yl.lib.sentry.hook.PrivacySentry 10 | import com.yl.lib.sentry.hook.PrivacySentryBuilder 11 | import com.yl.lib.sentry.hook.util.PrivacyLog 12 | 13 | /** 14 | * @author yulun 15 | * @sinice 2021-11-19 10:20 16 | */ 17 | class APP : Application() { 18 | override fun onCreate() { 19 | super.onCreate() 20 | var str = testJustSerial() 21 | } 22 | 23 | override fun attachBaseContext(base: Context?) { 24 | super.attachBaseContext(base) 25 | // 注意尽可能在attachBaseContext里第一个调用,因为attachBaseContext之后才能反射拿到ActivityThread的application 26 | // 所以如果是在attachBaseContext中,且隐私合规SDK未初始化,不管是不是首次启动,都会认为是危险期,无法调用敏感api 27 | PrivacyMethod.PrivacyMethod.getAndroidId(base!!) 28 | MultiDex.install(this) 29 | Thread { initPrivacyTransformComplete() }.start() 30 | 31 | } 32 | 33 | private fun initPrivacyTransform() { 34 | PrivacySentry.Privacy.initTransform(this) 35 | } 36 | 37 | 38 | private fun initPrivacyTransformComplete() { 39 | 40 | // 完整版配置 41 | var builder = PrivacySentryBuilder() 42 | // 自定义文件结果的输出名 43 | .configResultFileName("demo_test") 44 | //自定义检测时间,也支持主动停止检测 PrivacySentry.Privacy.stopWatch() 45 | .configWatchTime(10 * 60 * 1000) 46 | // 打开写入文件开关 47 | .enableFileResult(true) 48 | .syncDebug(true) 49 | // 文件输出后的回调 50 | .configResultCallBack(object : PrivacyResultCallBack { 51 | override fun onResultCallBack(filePath: String) { 52 | PrivacyLog.i("result file patch is $filePath") 53 | } 54 | }) 55 | // 添加默认结果输出,包含log输出和文件输出 56 | PrivacySentry.Privacy.init(this, builder) 57 | // 简易版配置 58 | // PrivacySentry.Privacy.init(this) 59 | } 60 | 61 | fun testJustSerial() { 62 | val serialNum = android.os.Build.SERIAL 63 | } 64 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yl/lib/privacysentry/calendar/CalenderActivity.kt: -------------------------------------------------------------------------------- 1 | package com.yl.lib.privacysentry.calendar 2 | 3 | import android.Manifest 4 | import android.os.Bundle 5 | import android.widget.Button 6 | import androidx.appcompat.app.AppCompatActivity 7 | import android.content.pm.PackageManager 8 | import androidx.core.app.ActivityCompat 9 | import androidx.core.content.ContextCompat 10 | import com.yl.lib.privacysentry.R 11 | import com.yl.lib.sentry.hook.util.PrivacyLog 12 | 13 | 14 | class CalenderActivity : AppCompatActivity() { 15 | override fun onCreate(savedInstanceState: Bundle?) { 16 | super.onCreate(savedInstanceState) 17 | setContentView(R.layout.activity_calender) 18 | 19 | findViewById