Add telemetry for debug build (#1564)
This commit is contained in:
parent
3dcbe46f88
commit
f6e9ad3b91
|
|
@ -126,6 +126,13 @@ android {
|
|||
}
|
||||
}
|
||||
}
|
||||
sourceSets {
|
||||
named("release") {
|
||||
java {
|
||||
srcDirs("src/release/java")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val optimizeReleaseRes = task("optimizeReleaseRes").doLast {
|
||||
|
|
@ -228,6 +235,10 @@ dependencies {
|
|||
implementation("me.zhanghai.android.appiconloader:appiconloader:1.3.1")
|
||||
implementation("org.lsposed.hiddenapibypass:hiddenapibypass:4.2")
|
||||
implementation(project(":manager-service"))
|
||||
|
||||
val appCenter = "4.3.1"
|
||||
debugImplementation("com.microsoft.appcenter:appcenter-analytics:${appCenter}")
|
||||
debugImplementation("com.microsoft.appcenter:appcenter-crashes:${appCenter}")
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package org.lsposed.manager.util;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import com.microsoft.appcenter.AppCenter;
|
||||
import com.microsoft.appcenter.crashes.AbstractCrashesListener;
|
||||
import com.microsoft.appcenter.crashes.Crashes;
|
||||
import com.microsoft.appcenter.crashes.model.ErrorReport;
|
||||
|
||||
import org.lsposed.manager.BuildConfig;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class Telemetry {
|
||||
public static void start(Application app) {
|
||||
Crashes.setListener(new AbstractCrashesListener() {
|
||||
@Override
|
||||
public void onBeforeSending(ErrorReport report) {
|
||||
var d = report.getDevice();
|
||||
d.setAppVersion(String.format(Locale.ROOT, "%s (%d)", BuildConfig.VERSION_NAME, BuildConfig.VERSION_CODE));
|
||||
d.setAppBuild(String.valueOf(BuildConfig.VERSION_CODE));
|
||||
d.setAppNamespace(BuildConfig.APPLICATION_ID);
|
||||
report.setDevice(d);
|
||||
}
|
||||
});
|
||||
AppCenter.start(app, "eb3c4175-e879-4312-a72e-b0e64bca142c", Crashes.class);
|
||||
}
|
||||
}
|
||||
|
|
@ -43,6 +43,7 @@ import org.lsposed.manager.repo.RepoLoader;
|
|||
import org.lsposed.manager.ui.activity.CrashReportActivity;
|
||||
import org.lsposed.manager.util.DoHDNS;
|
||||
import org.lsposed.manager.util.ModuleUtil;
|
||||
import org.lsposed.manager.util.Telemetry;
|
||||
import org.lsposed.manager.util.ThemeUtil;
|
||||
import org.lsposed.manager.util.UpdateUtil;
|
||||
|
||||
|
|
@ -143,6 +144,14 @@ public class App extends Application {
|
|||
return !Process.isApplicationUid(Process.myUid());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
if (BuildConfig.DEBUG) {
|
||||
Telemetry.start(this);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressLint("WrongConstant")
|
||||
private void setCrashReport() {
|
||||
Thread.setDefaultUncaughtExceptionHandler((thread, throwable) -> {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
package org.lsposed.manager.util;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
public class Telemetry {
|
||||
public static void start(Application application) {}
|
||||
}
|
||||
Loading…
Reference in New Issue