Remove Telemetry
Current fork has no access to the analytics provide by Microsoft appcenter, and we prefer to leave users anonymous.
This commit is contained in:
parent
705e8daee7
commit
403b5fa516
|
|
@ -154,9 +154,6 @@ dependencies {
|
|||
implementation(libs.kotlin.stdlib)
|
||||
implementation(libs.kotlinx.coroutines.core)
|
||||
implementation(projects.services.managerService)
|
||||
|
||||
debugImplementation(libs.appcenter.analytics)
|
||||
debugImplementation(libs.appcenter.crashes)
|
||||
}
|
||||
|
||||
configurations.all {
|
||||
|
|
|
|||
|
|
@ -1,86 +0,0 @@
|
|||
/*
|
||||
* This file is part of LSPosed.
|
||||
*
|
||||
* LSPosed is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* LSPosed is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
* Copyright (C) 2022 LSPosed Contributors
|
||||
*/
|
||||
|
||||
package org.lsposed.manager.util;
|
||||
|
||||
import android.app.Application;
|
||||
import android.os.Handler;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.microsoft.appcenter.AppCenter;
|
||||
import com.microsoft.appcenter.analytics.Analytics;
|
||||
import com.microsoft.appcenter.channel.AbstractChannelListener;
|
||||
import com.microsoft.appcenter.channel.Channel;
|
||||
import com.microsoft.appcenter.crashes.Crashes;
|
||||
import com.microsoft.appcenter.ingestion.models.Log;
|
||||
|
||||
import org.lsposed.manager.App;
|
||||
import org.lsposed.manager.BuildConfig;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class Telemetry {
|
||||
private static final Channel.Listener patchDeviceListener = new AbstractChannelListener() {
|
||||
@Override
|
||||
public void onPreparedLog(@NonNull Log log, @NonNull String groupName, int flags) {
|
||||
var device = log.getDevice();
|
||||
device.setAppVersion(BuildConfig.VERSION_NAME);
|
||||
device.setAppBuild(String.valueOf(BuildConfig.VERSION_CODE));
|
||||
}
|
||||
};
|
||||
|
||||
private static void addPatchDeviceListener() {
|
||||
try {
|
||||
var channelField = AppCenter.class.getDeclaredField("mChannel");
|
||||
channelField.setAccessible(true);
|
||||
var channel = (Channel) channelField.get(AppCenter.getInstance());
|
||||
assert channel != null;
|
||||
channel.addListener(patchDeviceListener);
|
||||
} catch (ReflectiveOperationException e) {
|
||||
android.util.Log.e(App.TAG, "add listener", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void patchDevice() {
|
||||
try {
|
||||
var handlerField = AppCenter.class.getDeclaredField("mHandler");
|
||||
handlerField.setAccessible(true);
|
||||
var handler = ((Handler) handlerField.get(AppCenter.getInstance()));
|
||||
assert handler != null;
|
||||
handler.post(Telemetry::addPatchDeviceListener);
|
||||
} catch (ReflectiveOperationException e) {
|
||||
android.util.Log.e(App.TAG, "patch device", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void start(Application app) {
|
||||
AppCenter.start(app, "eb3c4175-e879-4312-a72e-b0e64bca142c",
|
||||
Analytics.class, Crashes.class);
|
||||
patchDevice();
|
||||
}
|
||||
|
||||
public static void trackEvent(String name, Map<String, String> properties) {
|
||||
Analytics.trackEvent(name, properties);
|
||||
}
|
||||
|
||||
public static void trackError(Throwable throwable, Map<String, String> properties) {
|
||||
Crashes.trackError(throwable, properties, null);
|
||||
}
|
||||
}
|
||||
|
|
@ -49,7 +49,6 @@ import org.lsposed.manager.receivers.LSPManagerServiceHolder;
|
|||
import org.lsposed.manager.repo.RepoLoader;
|
||||
import org.lsposed.manager.util.CloudflareDNS;
|
||||
import org.lsposed.manager.util.ModuleUtil;
|
||||
import org.lsposed.manager.util.Telemetry;
|
||||
import org.lsposed.manager.util.ThemeUtil;
|
||||
import org.lsposed.manager.util.UpdateUtil;
|
||||
|
||||
|
|
@ -141,10 +140,8 @@ public class App extends Application {
|
|||
@Override
|
||||
protected void attachBaseContext(Context base) {
|
||||
super.attachBaseContext(base);
|
||||
Telemetry.start(this);
|
||||
var map = new HashMap<String, String>(1);
|
||||
map.put("isParasitic", String.valueOf(isParasitic));
|
||||
Telemetry.trackEvent("App start", map);
|
||||
var am = getSystemService(ActivityManager.class);
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
|
||||
map.clear();
|
||||
|
|
@ -155,7 +152,6 @@ public class App extends Application {
|
|||
map.put("process", reasons.get(0).getProcessName());
|
||||
map.put("reason", String.valueOf(reasons.get(0).getReason()));
|
||||
map.put("status", String.valueOf(reasons.get(0).getStatus()));
|
||||
Telemetry.trackEvent("Last exit reasons", map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,6 @@ import androidx.annotation.Nullable;
|
|||
|
||||
import org.lsposed.manager.App;
|
||||
import org.lsposed.manager.R;
|
||||
import org.lsposed.manager.util.Telemetry;
|
||||
import org.lsposed.manager.util.ThemeUtil;
|
||||
|
||||
import rikka.material.app.MaterialActivity;
|
||||
|
|
@ -70,12 +69,6 @@ public class BaseActivity extends MaterialActivity {
|
|||
setTaskDescription(new ActivityManager.TaskDescription(getTitle().toString(), icon, getColor(R.color.ic_launcher_background)));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
Telemetry.trackEvent("BaseActivity stop", null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplyUserThemeResource(@NonNull Resources.Theme theme, boolean isDecorView) {
|
||||
if (!ThemeUtil.isSystemAccent()) {
|
||||
|
|
|
|||
|
|
@ -50,7 +50,6 @@ import org.lsposed.manager.ui.dialog.BlurBehindDialogBuilder;
|
|||
import org.lsposed.manager.ui.dialog.FlashDialogBuilder;
|
||||
import org.lsposed.manager.ui.dialog.WelcomeDialog;
|
||||
import org.lsposed.manager.util.NavUtil;
|
||||
import org.lsposed.manager.util.Telemetry;
|
||||
import org.lsposed.manager.util.UpdateUtil;
|
||||
import org.lsposed.manager.util.chrome.LinkTransformationMethod;
|
||||
|
||||
|
|
@ -246,7 +245,6 @@ public class HomeFragment extends BaseFragment implements MenuProvider {
|
|||
map.put("api", binding.api.getText().toString());
|
||||
map.put("frameworkVersion", binding.frameworkVersion.getText().toString());
|
||||
map.put("systemAbi", Arrays.toString(Build.SUPPORTED_ABIS));
|
||||
Telemetry.trackEvent("HomeFragment", map);
|
||||
binding.copyInfo.setOnClickListener(v -> {
|
||||
ClipboardUtils.put(activity, info);
|
||||
showHint(R.string.info_copied, false);
|
||||
|
|
|
|||
|
|
@ -1,16 +0,0 @@
|
|||
package org.lsposed.manager.util;
|
||||
|
||||
import android.app.Application;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class Telemetry {
|
||||
public static void start(Application application) {
|
||||
}
|
||||
|
||||
public static void trackEvent(String name, Map<String, String> properties) {
|
||||
}
|
||||
|
||||
public static void trackError(Throwable throwable, Map<String, String> properties) {
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit acdd096d3ef4220d6cf27b71308606eaa8741aac
|
||||
Subproject commit 6da9b91a2e305c6d473ab39f2af8504ba65ff16e
|
||||
|
|
@ -20,9 +20,6 @@ lsplugin-cmaker = { id = "org.lsposed.lsplugin.cmaker", version = "1.2" }
|
|||
lsplugin-jgit = { id = "org.lsposed.lsplugin.jgit", version = "1.1" }
|
||||
|
||||
[libraries]
|
||||
appcenter-crashes = { group = "com.microsoft.appcenter", name = "appcenter-crashes", version.ref = "appcenter" }
|
||||
appcenter-analytics = { group = "com.microsoft.appcenter", name = "appcenter-analytics", version.ref = "appcenter" }
|
||||
|
||||
rikkax-appcompat = { module = "dev.rikka.rikkax.appcompat:appcompat", version = "1.6.1" }
|
||||
rikkax-core = { module = "dev.rikka.rikkax.core:core", version = "1.4.1" }
|
||||
rikkax-insets = { module = "dev.rikka.rikkax.insets:insets", version = "1.3.0" }
|
||||
|
|
|
|||
Loading…
Reference in New Issue