summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Shields <keepcalm444@gmail.com>2016-12-28 11:51:38 +1100
committerZhao Wei Liew <zhaoweiliew@gmail.com>2016-12-31 14:26:41 +0000
commit39de418560fc3d9ea9238aca19303d94c33cdeeb (patch)
tree68256d98d860113e4702c6aa8260237111ba2efb
parent640c391b1521005d99f54165ff20fd47a2a13d2d (diff)
downloadpackages_apps_Settings-39de418560fc3d9ea9238aca19303d94c33cdeeb.zip
packages_apps_Settings-39de418560fc3d9ea9238aca19303d94c33cdeeb.tar.gz
packages_apps_Settings-39de418560fc3d9ea9238aca19303d94c33cdeeb.tar.bz2
Settings: cmstats: Stop tracking opt-out events
Change-Id: Ia0e50b4af3979c374b4202cd6a187a9f0ded9e60
-rw-r--r--src/com/android/settings/cmstats/AnonymousStats.java28
-rw-r--r--src/com/android/settings/cmstats/ReportingService.java10
-rw-r--r--src/com/android/settings/cmstats/ReportingServiceManager.java16
-rw-r--r--src/com/android/settings/cmstats/StatsUploadJobService.java8
4 files changed, 4 insertions, 58 deletions
diff --git a/src/com/android/settings/cmstats/AnonymousStats.java b/src/com/android/settings/cmstats/AnonymousStats.java
index 232a533..54e124d 100644
--- a/src/com/android/settings/cmstats/AnonymousStats.java
+++ b/src/com/android/settings/cmstats/AnonymousStats.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2015 The CyanogenMod Project
+ * (C) 2017 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,15 +21,9 @@ import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
-import android.os.UserHandle;
-import android.preference.Preference;
-import android.preference.PreferenceScreen;
-import android.preference.SwitchPreference;
import com.android.settings.R;
import com.android.settings.SettingsPreferenceFragment;
-import cyanogenmod.providers.CMSettings;
-
import org.cyanogenmod.internal.logging.CMMetricsLogger;
public class AnonymousStats extends SettingsPreferenceFragment {
@@ -40,10 +35,6 @@ public class AnonymousStats extends SettingsPreferenceFragment {
/* package */ static final String KEY_LAST_JOB_ID = "last_job_id";
/* package */ static final int QUEUE_MAX_THRESHOLD = 1000;
- public static final String KEY_STATS = "stats_collection";
-
- SwitchPreference mStatsSwitch;
-
public static SharedPreferences getPreferences(Context context) {
return context.getSharedPreferences(PREF_FILE_NAME, 0);
}
@@ -52,23 +43,6 @@ public class AnonymousStats extends SettingsPreferenceFragment {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.anonymous_stats);
- mStatsSwitch = (SwitchPreference) findPreference(KEY_STATS);
- }
-
- @Override
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
- if (preference == mStatsSwitch) {
- boolean checked = mStatsSwitch.isChecked();
- if (checked) {
- // clear opt out flags
- CMSettings.Secure.putIntForUser(getContentResolver(),
- CMSettings.Secure.STATS_COLLECTION_REPORTED, 0, UserHandle.USER_OWNER);
- }
- // will initiate opt out sequence if necessary
- ReportingServiceManager.setAlarm(getActivity());
- return true;
- }
- return super.onPreferenceTreeClick(preferenceScreen, preference);
}
public static void updateLastSynced(Context context) {
diff --git a/src/com/android/settings/cmstats/ReportingService.java b/src/com/android/settings/cmstats/ReportingService.java
index 5c876b9..f04786d 100644
--- a/src/com/android/settings/cmstats/ReportingService.java
+++ b/src/com/android/settings/cmstats/ReportingService.java
@@ -34,8 +34,6 @@ public class ReportingService extends IntentService {
/* package */ static final String TAG = "CMStats";
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
- public static final String EXTRA_OPTING_OUT = "cmstats::opt_out";
-
public ReportingService() {
super(ReportingService.class.getSimpleName());
}
@@ -50,14 +48,12 @@ public class ReportingService extends IntentService {
String deviceCountry = Utilities.getCountryCode(getApplicationContext());
String deviceCarrier = Utilities.getCarrier(getApplicationContext());
String deviceCarrierId = Utilities.getCarrierId(getApplicationContext());
- boolean optOut = intent.getBooleanExtra(EXTRA_OPTING_OUT, false);
final int cmOrgJobId = AnonymousStats.getNextJobId(getApplicationContext());
if (DEBUG) Log.d(TAG, "scheduling job id: " + cmOrgJobId);
PersistableBundle cmBundle = new PersistableBundle();
- cmBundle.putBoolean(StatsUploadJobService.KEY_OPT_OUT, optOut);
cmBundle.putString(StatsUploadJobService.KEY_DEVICE_NAME, deviceName);
cmBundle.putString(StatsUploadJobService.KEY_UNIQUE_ID, deviceId);
cmBundle.putString(StatsUploadJobService.KEY_VERSION, deviceVersion);
@@ -79,12 +75,6 @@ public class ReportingService extends IntentService {
.setPersisted(true)
.build());
- if (optOut) {
- // we've successfully scheduled the opt out.
- CMSettings.Secure.putIntForUser(getContentResolver(),
- CMSettings.Secure.STATS_COLLECTION_REPORTED, 1, UserHandle.USER_OWNER);
- }
-
// reschedule
AnonymousStats.updateLastSynced(this);
ReportingServiceManager.setAlarm(this);
diff --git a/src/com/android/settings/cmstats/ReportingServiceManager.java b/src/com/android/settings/cmstats/ReportingServiceManager.java
index bce1372..286618c 100644
--- a/src/com/android/settings/cmstats/ReportingServiceManager.java
+++ b/src/com/android/settings/cmstats/ReportingServiceManager.java
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2012 The CyanogenMod Project
+ * (C) 2017 The LineageOS Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -47,27 +48,12 @@ public class ReportingServiceManager extends BroadcastReceiver {
}
}
- /**
- * opt out if we haven't yet
- */
- public static void initiateOptOut(Context context) {
- final boolean optOutReported = CMSettings.Secure.getIntForUser(context.getContentResolver(),
- CMSettings.Secure.STATS_COLLECTION_REPORTED, 0, UserHandle.USER_OWNER) == 1;
- if (!optOutReported) {
- Intent intent = new Intent();
- intent.setClass(context, ReportingService.class);
- intent.putExtra(ReportingService.EXTRA_OPTING_OUT, true);
- context.startServiceAsUser(intent, UserHandle.OWNER);
- }
- }
-
public static void setAlarm(Context context) {
SharedPreferences prefs = AnonymousStats.getPreferences(context);
if (prefs.contains(AnonymousStats.ANONYMOUS_OPT_IN)) {
migrate(context, prefs);
}
if (!Utilities.isStatsCollectionEnabled(context)) {
- initiateOptOut(context);
return;
}
long lastSynced = prefs.getLong(AnonymousStats.ANONYMOUS_LAST_CHECKED, 0);
diff --git a/src/com/android/settings/cmstats/StatsUploadJobService.java b/src/com/android/settings/cmstats/StatsUploadJobService.java
index 0171988..c4b69ff 100644
--- a/src/com/android/settings/cmstats/StatsUploadJobService.java
+++ b/src/com/android/settings/cmstats/StatsUploadJobService.java
@@ -56,7 +56,6 @@ public class StatsUploadJobService extends JobService {
public static final String KEY_CARRIER = "carrier";
public static final String KEY_CARRIER_ID = "carrierId";
public static final String KEY_TIMESTAMP = "timeStamp";
- public static final String KEY_OPT_OUT = "optOut";
private final Map<JobParameters, StatsUploadTask> mCurrentJobs
= Collections.synchronizedMap(new ArrayMap<JobParameters, StatsUploadTask>());
@@ -108,7 +107,6 @@ public class StatsUploadJobService extends JobService {
String deviceCarrier = extras.getString(KEY_CARRIER);
String deviceCarrierId = extras.getString(KEY_CARRIER_ID);
long timeStamp = extras.getLong(KEY_TIMESTAMP);
- boolean optOut = extras.getBoolean(KEY_OPT_OUT);
boolean success = false;
int jobType = extras.getInt(KEY_JOB_TYPE, -1);
@@ -117,7 +115,7 @@ public class StatsUploadJobService extends JobService {
case JOB_TYPE_CMORG:
try {
success = uploadToCM(deviceId, deviceName, deviceVersion, deviceCountry,
- deviceCarrier, deviceCarrierId, optOut);
+ deviceCarrier, deviceCarrierId);
} catch (IOException e) {
Log.e(TAG, "Could not upload stats checkin to commnity server", e);
success = false;
@@ -140,12 +138,10 @@ public class StatsUploadJobService extends JobService {
private boolean uploadToCM(String deviceId, String deviceName, String deviceVersion,
- String deviceCountry, String deviceCarrier, String deviceCarrierId,
- boolean optOut)
+ String deviceCountry, String deviceCarrier, String deviceCarrierId)
throws IOException {
final Uri uri = Uri.parse(getString(R.string.stats_cm_url)).buildUpon()
- .appendQueryParameter("opt_out", optOut ? "1" : "0")
.appendQueryParameter("device_hash", deviceId)
.appendQueryParameter("device_name", deviceName)
.appendQueryParameter("device_version", deviceVersion)