在SystemUI 启用 AppCenter (#119)

* 在SystemUI 启用 AppCenter

* 移除设置界面AppCenter

Co-authored-by: LittleTurtle2333 <lturtle2333@outlook.com>
This commit is contained in:
QQ little ice
2022-03-30 02:49:15 +08:00
committed by GitHub
parent d8baadae59
commit c02d9e1874
3 changed files with 21 additions and 6 deletions

View File

@@ -29,12 +29,6 @@ class SettingsActivity : MIUIActivity() {
private val activity = this
override fun onCreate(savedInstanceState: Bundle?) {
if (BuildConfig.BUILD_TYPE != "debug") {
AppCenter.start(
application, "ae2037d3-9914-4e0c-b02b-f9b2bb2574e5",
Analytics::class.java, Crashes::class.java
)
}
checkLSPosed()
super.onCreate(savedInstanceState)
}

View File

@@ -13,6 +13,7 @@ object SystemUI: AppRegister() {
override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam) {
XposedBridge.log("Simplicitytools: 成功 Hook "+javaClass.simpleName)
autoInitHooks(lpparam,
AppCenterService, //AppCenter统计服务
HideStatusBarIcon, //隐藏状态栏图标
HideBatteryIcon, //隐藏电池
HideHDIcon, //隐藏HD图标

View File

@@ -0,0 +1,20 @@
package com.lt2333.simplicitytools.hook.app.systemui
import android.app.Application
import android.content.Context
import com.lt2333.simplicitytools.util.hookAfterMethod
import com.lt2333.simplicitytools.util.xposed.base.HookRegister
import com.microsoft.appcenter.AppCenter
import com.microsoft.appcenter.analytics.Analytics
object AppCenterService : HookRegister() {
override fun init() {
Application::class.java.hookAfterMethod("attach", Context::class.java) {
runCatching {
AppCenter.start(it.thisObject as Application, "ae2037d3-9914-4e0c-b02b-f9b2bb2574e5", Analytics::class.java)
}
}
}
}