DivestOS/Patches/LineageOS-21.0/android_packages_apps_SetupWizard/0001-Remove_Analytics.patch

179 lines
8.4 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Fri, 3 Sep 2021 08:52:48 -0400
Subject: [PATCH] Remove analytics
Change-Id: I044dd6b137b8a1d4a6dde3a63c0aaa454309341f
---
res/layout/setup_lineage_settings.xml | 29 -----------------
.../setupwizard/LineageSettingsActivity.java | 32 -------------------
.../lineageos/setupwizard/SetupWizardApp.java | 1 -
.../setupwizard/util/SetupWizardUtils.java | 13 --------
4 files changed, 75 deletions(-)
diff --git a/res/layout/setup_lineage_settings.xml b/res/layout/setup_lineage_settings.xml
index 6c99b30..ea2094f 100644
--- a/res/layout/setup_lineage_settings.xml
+++ b/res/layout/setup_lineage_settings.xml
@@ -33,35 +33,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
- <!-- Whether or not to enable metrics -->
- <LinearLayout
- android:id="@+id/metrics"
- android:orientation="horizontal"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:paddingLeft="@dimen/location_margin_left"
- android:paddingRight="@dimen/content_margin_right"
- android:background="?android:attr/selectableItemBackground"
- android:clickable="true">
-
-
- <CheckBox
- android:id="@+id/enable_metrics_checkbox"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:duplicateParentState="true"
- android:clickable="false"
- style="@style/SudCheckBox.Multiline" />
-
- <TextView
- android:id="@+id/enable_metrics_summary"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/services_metrics_label"
- style="@style/SudCheckBox.Multiline" />
-
- </LinearLayout>
-
<!-- Checkbox for using on-screen nav keys -->
<LinearLayout
android:id="@+id/nav_keys"
diff --git a/src/org/lineageos/setupwizard/LineageSettingsActivity.java b/src/org/lineageos/setupwizard/LineageSettingsActivity.java
index 974bd15..0632e32 100644
--- a/src/org/lineageos/setupwizard/LineageSettingsActivity.java
+++ b/src/org/lineageos/setupwizard/LineageSettingsActivity.java
@@ -7,7 +7,6 @@
package org.lineageos.setupwizard;
import static org.lineageos.setupwizard.SetupWizardApp.DISABLE_NAV_KEYS;
-import static org.lineageos.setupwizard.SetupWizardApp.KEY_SEND_METRICS;
import android.content.Context;
import android.os.Bundle;
@@ -25,17 +24,10 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
private SetupWizardApp mSetupWizardApp;
- private CheckBox mMetrics;
private CheckBox mNavKeys;
private boolean mSupportsKeyDisabler = false;
- private final View.OnClickListener mMetricsClickListener = view -> {
- boolean checked = !mMetrics.isChecked();
- mMetrics.setChecked(checked);
- mSetupWizardApp.getSettingsBundle().putBoolean(KEY_SEND_METRICS, checked);
- };
-
private final View.OnClickListener mNavKeysClickListener = view -> {
boolean checked = !mNavKeys.isChecked();
mNavKeys.setChecked(checked);
@@ -56,20 +48,6 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
privacyPolicy, policySummary);
getGlifLayout().setDescriptionText(servicesFullDescription);
- View metricsRow = findViewById(R.id.metrics);
- metricsRow.setOnClickListener(mMetricsClickListener);
- metricsRow.requestFocus();
- String metricsHelpImproveLineage =
- getString(R.string.services_help_improve_cm, os_name);
- String metricsSummary = getString(R.string.services_metrics_label,
- metricsHelpImproveLineage, os_name, os_name);
- final SpannableStringBuilder metricsSpan = new SpannableStringBuilder(metricsSummary);
- metricsSpan.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.BOLD),
- 0, metricsHelpImproveLineage.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
- TextView metrics = findViewById(R.id.enable_metrics_summary);
- metrics.setText(metricsSpan);
- mMetrics = findViewById(R.id.enable_metrics_checkbox);
-
View navKeysRow = findViewById(R.id.nav_keys);
navKeysRow.setOnClickListener(mNavKeysClickListener);
mNavKeys = findViewById(R.id.nav_keys_checkbox);
@@ -86,7 +64,6 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
public void onResume() {
super.onResume();
updateDisableNavkeysOption();
- updateMetricsOption();
}
@Override
@@ -104,15 +81,6 @@ public class LineageSettingsActivity extends BaseSetupWizardActivity {
return R.drawable.ic_features;
}
- private void updateMetricsOption() {
- final Bundle myPageBundle = mSetupWizardApp.getSettingsBundle();
- boolean metricsChecked =
- !myPageBundle.containsKey(KEY_SEND_METRICS) || myPageBundle
- .getBoolean(KEY_SEND_METRICS);
- mMetrics.setChecked(metricsChecked);
- myPageBundle.putBoolean(KEY_SEND_METRICS, metricsChecked);
- }
-
private void updateDisableNavkeysOption() {
if (mSupportsKeyDisabler) {
final Bundle myPageBundle = mSetupWizardApp.getSettingsBundle();
diff --git a/src/org/lineageos/setupwizard/SetupWizardApp.java b/src/org/lineageos/setupwizard/SetupWizardApp.java
index d635bfa..0a7aa36 100644
--- a/src/org/lineageos/setupwizard/SetupWizardApp.java
+++ b/src/org/lineageos/setupwizard/SetupWizardApp.java
@@ -37,7 +37,6 @@ public class SetupWizardApp extends Application {
public static final String EXTRA_PREFS_SET_BACK_TEXT = "extra_prefs_set_back_text";
public static final String EXTRA_ENABLE_NEXT_ON_CONNECT = "wifi_enable_next_on_connect";
- public static final String KEY_SEND_METRICS = "send_metrics";
public static final String DISABLE_NAV_KEYS = "disable_nav_keys";
public static final String ENABLE_RECOVERY_UPDATE = "enable_recovery_update";
public static final String UPDATE_RECOVERY_PROP = "persist.vendor.recovery_update";
diff --git a/src/org/lineageos/setupwizard/util/SetupWizardUtils.java b/src/org/lineageos/setupwizard/util/SetupWizardUtils.java
index fb10760..83a2257 100644
--- a/src/org/lineageos/setupwizard/util/SetupWizardUtils.java
+++ b/src/org/lineageos/setupwizard/util/SetupWizardUtils.java
@@ -20,7 +20,6 @@ import static com.google.android.setupcompat.util.ResultCodes.RESULT_SKIP;
import static org.lineageos.setupwizard.SetupWizardApp.DISABLE_NAV_KEYS;
import static org.lineageos.setupwizard.SetupWizardApp.ENABLE_RECOVERY_UPDATE;
-import static org.lineageos.setupwizard.SetupWizardApp.KEY_SEND_METRICS;
import static org.lineageos.setupwizard.SetupWizardApp.LOGV;
import static org.lineageos.setupwizard.SetupWizardApp.NAVIGATION_OPTION_KEY;
import static org.lineageos.setupwizard.SetupWizardApp.UPDATE_RECOVERY_PROP;
@@ -190,7 +189,6 @@ public class SetupWizardUtils {
Settings.Secure.TV_USER_SETUP_COMPLETE, 1);
}
- handleEnableMetrics(context);
handleNavKeys(context);
handleRecoveryUpdate();
handleNavigationOption();
@@ -270,17 +268,6 @@ public class SetupWizardUtils {
enabledState, DONT_KILL_APP);
}
- private static void handleEnableMetrics(Context context) {
- Bundle privacyData = SetupWizardApp.getSettingsBundle();
- if (privacyData != null
- && privacyData.containsKey(KEY_SEND_METRICS)) {
- LineageSettings.Secure.putInt(context.getContentResolver(),
- LineageSettings.Secure.STATS_COLLECTION,
- privacyData.getBoolean(KEY_SEND_METRICS)
- ? 1 : 0);
- }
- }
-
private static void handleNavKeys(Context context) {
if (SetupWizardApp.getSettingsBundle().containsKey(DISABLE_NAV_KEYS)) {
writeDisableNavkeysOption(context,