mirror of
https://github.com/Divested-Mobile/DivestOS-Build.git
synced 2024-10-01 01:35:54 -04:00
LAOS-11.0 and nex Fixes
This commit is contained in:
parent
10686a9480
commit
0a2f23c228
@ -0,0 +1,673 @@
|
|||||||
|
From 587a8d5cfc2db51381303579b73854f06ef99d66 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Tad <tad@spotco.us>
|
||||||
|
Date: Mon, 6 Nov 2017 19:01:08 -0500
|
||||||
|
Subject: [PATCH] Remove CMStats
|
||||||
|
|
||||||
|
Change-Id: I073b062a3e71c33dab4379c7c60a016595579562
|
||||||
|
---
|
||||||
|
AndroidManifest.xml | 8 --
|
||||||
|
res/xml/security_settings_cyanogenmod.xml | 30 -----
|
||||||
|
src/com/android/settings/Settings.java | 1 -
|
||||||
|
.../android/settings/cmstats/AnonymousStats.java | 127 ------------------
|
||||||
|
src/com/android/settings/cmstats/PreviewData.java | 49 -------
|
||||||
|
.../android/settings/cmstats/ReportingService.java | 149 ---------------------
|
||||||
|
.../settings/cmstats/ReportingServiceManager.java | 113 ----------------
|
||||||
|
src/com/android/settings/cmstats/Utilities.java | 99 --------------
|
||||||
|
.../settings/cyanogenmod/PrivacySettings.java | 1 -
|
||||||
|
9 files changed, 577 deletions(-)
|
||||||
|
delete mode 100644 res/xml/security_settings_cyanogenmod.xml
|
||||||
|
delete mode 100644 src/com/android/settings/cmstats/AnonymousStats.java
|
||||||
|
delete mode 100644 src/com/android/settings/cmstats/PreviewData.java
|
||||||
|
delete mode 100644 src/com/android/settings/cmstats/ReportingService.java
|
||||||
|
delete mode 100644 src/com/android/settings/cmstats/ReportingServiceManager.java
|
||||||
|
delete mode 100644 src/com/android/settings/cmstats/Utilities.java
|
||||||
|
|
||||||
|
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
|
||||||
|
index 3f53b75d5..f0f89bec5 100644
|
||||||
|
--- a/AndroidManifest.xml
|
||||||
|
+++ b/AndroidManifest.xml
|
||||||
|
@@ -1871,14 +1871,6 @@
|
||||||
|
|
||||||
|
<activity android:name=".ApnEditor" />
|
||||||
|
|
||||||
|
- <activity android:name="Settings$AnonymousStatsActivity"
|
||||||
|
- android:label="@string/anonymous_statistics_title"
|
||||||
|
- android:configChanges="orientation|keyboardHidden|screenSize"
|
||||||
|
- android:clearTaskOnLaunch="true">
|
||||||
|
- <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
|
||||||
|
- android:value="com.android.settings.cmstats.AnonymousStats" />
|
||||||
|
- </activity>
|
||||||
|
-
|
||||||
|
<activity android:name=".cyanogenmod.ChangeLog" />
|
||||||
|
|
||||||
|
<activity android:name=".cyanogenmod.ContributorsCloud" />
|
||||||
|
diff --git a/res/xml/security_settings_cyanogenmod.xml b/res/xml/security_settings_cyanogenmod.xml
|
||||||
|
deleted file mode 100644
|
||||||
|
index 68aba9510..000000000
|
||||||
|
--- a/res/xml/security_settings_cyanogenmod.xml
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,30 +0,0 @@
|
||||||
|
-<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
-<!-- Copyright (C) 2013 The CyanogenMod Project
|
||||||
|
-
|
||||||
|
- Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
- you may not use this file except in compliance with the License.
|
||||||
|
- You may obtain a copy of the License at
|
||||||
|
-
|
||||||
|
- http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
-
|
||||||
|
- Unless required by applicable law or agreed to in writing, software
|
||||||
|
- distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
- See the License for the specific language governing permissions and
|
||||||
|
- limitations under the License.
|
||||||
|
--->
|
||||||
|
-
|
||||||
|
-<PreferenceScreen
|
||||||
|
- xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
-
|
||||||
|
- <PreferenceCategory android:key="cmprivacy" android:title="@string/privacy_settings_cyanogenmod_category">
|
||||||
|
- <!-- Anonymous statistics - (CMStats) -->
|
||||||
|
- <PreferenceScreen
|
||||||
|
- android:key="cmstats"
|
||||||
|
- android:title="@string/anonymous_statistics_title"
|
||||||
|
- android:summary="@string/anonymous_statistics_summary"
|
||||||
|
- android:fragment="com.android.settings.cmstats.AnonymousStats" >
|
||||||
|
- </PreferenceScreen>
|
||||||
|
- </PreferenceCategory>
|
||||||
|
-
|
||||||
|
-</PreferenceScreen>
|
||||||
|
diff --git a/src/com/android/settings/Settings.java b/src/com/android/settings/Settings.java
|
||||||
|
index 81b8cf65e..464258166 100644
|
||||||
|
--- a/src/com/android/settings/Settings.java
|
||||||
|
+++ b/src/com/android/settings/Settings.java
|
||||||
|
@@ -1403,7 +1403,6 @@ public class Settings extends PreferenceActivity
|
||||||
|
public static class PaymentSettingsActivity extends Settings { /* empty */ }
|
||||||
|
public static class PrintSettingsActivity extends Settings { /* empty */ }
|
||||||
|
public static class PrintJobSettingsActivity extends Settings { /* empty */ }
|
||||||
|
- public static class AnonymousStatsActivity extends Settings { /* empty */ }
|
||||||
|
public static class ApnSettingsActivity extends Settings { /* empty */ }
|
||||||
|
public static class ApnEditorActivity extends Settings { /* empty */ }
|
||||||
|
public static class BlacklistSettingsActivity extends Settings { /* empty */ }
|
||||||
|
diff --git a/src/com/android/settings/cmstats/AnonymousStats.java b/src/com/android/settings/cmstats/AnonymousStats.java
|
||||||
|
deleted file mode 100644
|
||||||
|
index 2e6d016b7..000000000
|
||||||
|
--- a/src/com/android/settings/cmstats/AnonymousStats.java
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,127 +0,0 @@
|
||||||
|
-/*
|
||||||
|
- * Copyright (C) 2012 The CyanogenMod Project
|
||||||
|
- *
|
||||||
|
- * Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
- * you may not use this file except in compliance with the License.
|
||||||
|
- * You may obtain a copy of the License at
|
||||||
|
- *
|
||||||
|
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
- *
|
||||||
|
- * Unless required by applicable law or agreed to in writing, software
|
||||||
|
- * distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
- * See the License for the specific language governing permissions and
|
||||||
|
- * limitations under the License.
|
||||||
|
- */
|
||||||
|
-
|
||||||
|
-package com.android.settings.cmstats;
|
||||||
|
-
|
||||||
|
-import android.app.AlertDialog;
|
||||||
|
-import android.app.Dialog;
|
||||||
|
-import android.content.Context;
|
||||||
|
-import android.content.DialogInterface;
|
||||||
|
-import android.content.Intent;
|
||||||
|
-import android.content.SharedPreferences;
|
||||||
|
-import android.net.Uri;
|
||||||
|
-import android.os.Bundle;
|
||||||
|
-import android.preference.CheckBoxPreference;
|
||||||
|
-import android.preference.Preference;
|
||||||
|
-import android.preference.PreferenceScreen;
|
||||||
|
-
|
||||||
|
-import android.provider.Settings;
|
||||||
|
-import com.android.settings.R;
|
||||||
|
-import com.android.settings.SettingsPreferenceFragment;
|
||||||
|
-
|
||||||
|
-public class AnonymousStats extends SettingsPreferenceFragment implements
|
||||||
|
- DialogInterface.OnClickListener, DialogInterface.OnDismissListener,
|
||||||
|
- Preference.OnPreferenceChangeListener {
|
||||||
|
- private static final String VIEW_STATS = "pref_view_stats";
|
||||||
|
-
|
||||||
|
- private static final String PREF_FILE_NAME = "CMStats";
|
||||||
|
- /* package */ static final String ANONYMOUS_OPT_IN = "pref_anonymous_opt_in";
|
||||||
|
- /* package */ static final String ANONYMOUS_LAST_CHECKED = "pref_anonymous_checked_in";
|
||||||
|
-
|
||||||
|
- private CheckBoxPreference mEnableReporting;
|
||||||
|
- private Preference mViewStats;
|
||||||
|
-
|
||||||
|
- private Dialog mOkDialog;
|
||||||
|
- private boolean mOkClicked;
|
||||||
|
-
|
||||||
|
- private SharedPreferences mPrefs;
|
||||||
|
-
|
||||||
|
- public static SharedPreferences getPreferences(Context context) {
|
||||||
|
- return context.getSharedPreferences(PREF_FILE_NAME, 0);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public void onCreate(Bundle savedInstanceState) {
|
||||||
|
- super.onCreate(savedInstanceState);
|
||||||
|
-
|
||||||
|
- addPreferencesFromResource(R.xml.anonymous_stats);
|
||||||
|
-
|
||||||
|
- mPrefs = getPreferences(getActivity());
|
||||||
|
-
|
||||||
|
- PreferenceScreen prefSet = getPreferenceScreen();
|
||||||
|
- mEnableReporting = (CheckBoxPreference) prefSet.findPreference(ANONYMOUS_OPT_IN);
|
||||||
|
- mViewStats = (Preference) prefSet.findPreference(VIEW_STATS);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public boolean onPreferenceTreeClick(PreferenceScreen preferenceScreen, Preference preference) {
|
||||||
|
- if (preference == mEnableReporting) {
|
||||||
|
- if (mEnableReporting.isChecked()) {
|
||||||
|
- // Display the confirmation dialog
|
||||||
|
- mOkClicked = false;
|
||||||
|
- if (mOkDialog != null) {
|
||||||
|
- mOkDialog.dismiss();
|
||||||
|
- }
|
||||||
|
- mOkDialog = new AlertDialog.Builder(getActivity())
|
||||||
|
- .setMessage(R.string.anonymous_statistics_warning)
|
||||||
|
- .setTitle(R.string.anonymous_statistics_warning_title)
|
||||||
|
- .setIconAttribute(android.R.attr.alertDialogIcon)
|
||||||
|
- .setPositiveButton(android.R.string.yes, this)
|
||||||
|
- .setNeutralButton(R.string.anonymous_learn_more, this)
|
||||||
|
- .setNegativeButton(android.R.string.no, this)
|
||||||
|
- .show();
|
||||||
|
- mOkDialog.setOnDismissListener(this);
|
||||||
|
- } else {
|
||||||
|
- // Disable reporting
|
||||||
|
- Utilities.setStatsCollectionEnabled(getActivity(), false);
|
||||||
|
- }
|
||||||
|
- } else if (preference == mViewStats) {
|
||||||
|
- // Display the stats page
|
||||||
|
- Uri uri = Uri.parse("http://stats.cyanogenmod.org");
|
||||||
|
- startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||||
|
- } else {
|
||||||
|
- // If we didn't handle it, let preferences handle it.
|
||||||
|
- return super.onPreferenceTreeClick(preferenceScreen, preference);
|
||||||
|
- }
|
||||||
|
- return true;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||||
|
- return false;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public void onDismiss(DialogInterface dialog) {
|
||||||
|
- if (!mOkClicked) {
|
||||||
|
- mEnableReporting.setChecked(false);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public void onClick(DialogInterface dialog, int which) {
|
||||||
|
- if (which == DialogInterface.BUTTON_POSITIVE) {
|
||||||
|
- mOkClicked = true;
|
||||||
|
- Utilities.setStatsCollectionEnabled(getActivity(), true);
|
||||||
|
- ReportingServiceManager.launchService(getActivity());
|
||||||
|
- } else if (which == DialogInterface.BUTTON_NEGATIVE) {
|
||||||
|
- mEnableReporting.setChecked(false);
|
||||||
|
- } else {
|
||||||
|
- Uri uri = Uri.parse("http://www.cyanogenmod.org/blog/cmstats-what-it-is-and-why-you-should-opt-in");
|
||||||
|
- startActivity(new Intent(Intent.ACTION_VIEW, uri));
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
diff --git a/src/com/android/settings/cmstats/PreviewData.java b/src/com/android/settings/cmstats/PreviewData.java
|
||||||
|
deleted file mode 100644
|
||||||
|
index 7a78aea51..000000000
|
||||||
|
--- a/src/com/android/settings/cmstats/PreviewData.java
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,49 +0,0 @@
|
||||||
|
-/*
|
||||||
|
- * Copyright (C) 2012 The CyanogenMod Project
|
||||||
|
- *
|
||||||
|
- * Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
- * you may not use this file except in compliance with the License.
|
||||||
|
- * You may obtain a copy of the License at
|
||||||
|
- *
|
||||||
|
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
- *
|
||||||
|
- * Unless required by applicable law or agreed to in writing, software
|
||||||
|
- * distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
- * See the License for the specific language governing permissions and
|
||||||
|
- * limitations under the License.
|
||||||
|
- */
|
||||||
|
-
|
||||||
|
-package com.android.settings.cmstats;
|
||||||
|
-
|
||||||
|
-import android.content.Context;
|
||||||
|
-import android.os.Bundle;
|
||||||
|
-import android.preference.Preference;
|
||||||
|
-import android.preference.PreferenceScreen;
|
||||||
|
-
|
||||||
|
-import com.android.settings.R;
|
||||||
|
-import com.android.settings.SettingsPreferenceFragment;
|
||||||
|
-
|
||||||
|
-public class PreviewData extends SettingsPreferenceFragment {
|
||||||
|
- private static final String UNIQUE_ID = "preview_id";
|
||||||
|
- private static final String DEVICE = "preview_device";
|
||||||
|
- private static final String VERSION = "preview_version";
|
||||||
|
- private static final String COUNTRY = "preview_country";
|
||||||
|
- private static final String CARRIER = "preview_carrier";
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public void onCreate(Bundle savedInstanceState) {
|
||||||
|
- super.onCreate(savedInstanceState);
|
||||||
|
-
|
||||||
|
- addPreferencesFromResource(R.xml.preview_data);
|
||||||
|
-
|
||||||
|
- final PreferenceScreen prefSet = getPreferenceScreen();
|
||||||
|
- final Context context = getActivity();
|
||||||
|
-
|
||||||
|
- prefSet.findPreference(UNIQUE_ID).setSummary(Utilities.getUniqueID(context));
|
||||||
|
- prefSet.findPreference(DEVICE).setSummary(Utilities.getDevice());
|
||||||
|
- prefSet.findPreference(VERSION).setSummary(Utilities.getModVersion());
|
||||||
|
- prefSet.findPreference(COUNTRY).setSummary(Utilities.getCountryCode(context));
|
||||||
|
- prefSet.findPreference(CARRIER).setSummary(Utilities.getCarrier(context));
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
diff --git a/src/com/android/settings/cmstats/ReportingService.java b/src/com/android/settings/cmstats/ReportingService.java
|
||||||
|
deleted file mode 100644
|
||||||
|
index 32db82011..000000000
|
||||||
|
--- a/src/com/android/settings/cmstats/ReportingService.java
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,149 +0,0 @@
|
||||||
|
-/*
|
||||||
|
- * Copyright (C) 2012 The CyanogenMod Project
|
||||||
|
- *
|
||||||
|
- * Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
- * you may not use this file except in compliance with the License.
|
||||||
|
- * You may obtain a copy of the License at
|
||||||
|
- *
|
||||||
|
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
- *
|
||||||
|
- * Unless required by applicable law or agreed to in writing, software
|
||||||
|
- * distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
- * See the License for the specific language governing permissions and
|
||||||
|
- * limitations under the License.
|
||||||
|
- */
|
||||||
|
-
|
||||||
|
-package com.android.settings.cmstats;
|
||||||
|
-
|
||||||
|
-import android.app.Service;
|
||||||
|
-import android.content.Context;
|
||||||
|
-import android.content.Intent;
|
||||||
|
-import android.content.SharedPreferences;
|
||||||
|
-import android.os.AsyncTask;
|
||||||
|
-import android.os.IBinder;
|
||||||
|
-import android.util.Log;
|
||||||
|
-
|
||||||
|
-import com.android.settings.R;
|
||||||
|
-import com.android.settings.Settings;
|
||||||
|
-
|
||||||
|
-import com.google.analytics.tracking.android.GoogleAnalytics;
|
||||||
|
-import com.google.analytics.tracking.android.Tracker;
|
||||||
|
-
|
||||||
|
-import org.apache.http.NameValuePair;
|
||||||
|
-import org.apache.http.client.HttpClient;
|
||||||
|
-import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||||
|
-import org.apache.http.client.methods.HttpPost;
|
||||||
|
-import org.apache.http.impl.client.DefaultHttpClient;
|
||||||
|
-import org.apache.http.message.BasicNameValuePair;
|
||||||
|
-
|
||||||
|
-import java.io.IOException;
|
||||||
|
-import java.util.ArrayList;
|
||||||
|
-import java.util.List;
|
||||||
|
-
|
||||||
|
-public class ReportingService extends Service {
|
||||||
|
- /* package */ static final String TAG = "CMStats";
|
||||||
|
-
|
||||||
|
- private StatsUploadTask mTask;
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public IBinder onBind(Intent intent) {
|
||||||
|
- return null;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public int onStartCommand (Intent intent, int flags, int startId) {
|
||||||
|
- Log.d(TAG, "User has opted in -- reporting.");
|
||||||
|
-
|
||||||
|
- if (mTask == null || mTask.getStatus() == AsyncTask.Status.FINISHED) {
|
||||||
|
- mTask = new StatsUploadTask();
|
||||||
|
- mTask.execute();
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- return Service.START_REDELIVER_INTENT;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- private class StatsUploadTask extends AsyncTask<Void, Void, Boolean> {
|
||||||
|
- @Override
|
||||||
|
- protected Boolean doInBackground(Void... params) {
|
||||||
|
- String deviceId = Utilities.getUniqueID(getApplicationContext());
|
||||||
|
- String deviceName = Utilities.getDevice();
|
||||||
|
- String deviceVersion = Utilities.getModVersion();
|
||||||
|
- String deviceCountry = Utilities.getCountryCode(getApplicationContext());
|
||||||
|
- String deviceCarrier = Utilities.getCarrier(getApplicationContext());
|
||||||
|
- String deviceCarrierId = Utilities.getCarrierId(getApplicationContext());
|
||||||
|
-
|
||||||
|
- Log.d(TAG, "SERVICE: Device ID=" + deviceId);
|
||||||
|
- Log.d(TAG, "SERVICE: Device Name=" + deviceName);
|
||||||
|
- Log.d(TAG, "SERVICE: Device Version=" + deviceVersion);
|
||||||
|
- Log.d(TAG, "SERVICE: Country=" + deviceCountry);
|
||||||
|
- Log.d(TAG, "SERVICE: Carrier=" + deviceCarrier);
|
||||||
|
- Log.d(TAG, "SERVICE: Carrier ID=" + deviceCarrierId);
|
||||||
|
-
|
||||||
|
- // report to google analytics
|
||||||
|
- GoogleAnalytics ga = GoogleAnalytics.getInstance(ReportingService.this);
|
||||||
|
- Tracker tracker = ga.getTracker(getString(R.string.ga_trackingId));
|
||||||
|
- tracker.sendEvent(deviceName, deviceVersion, deviceCountry, null);
|
||||||
|
-
|
||||||
|
- // this really should be set at build time...
|
||||||
|
- // format of version should be:
|
||||||
|
- // version[-date-type]-device
|
||||||
|
- String[] parts = deviceVersion.split("-");
|
||||||
|
- String deviceVersionNoDevice = null;
|
||||||
|
- if (parts.length == 2) {
|
||||||
|
- deviceVersionNoDevice = parts[0];
|
||||||
|
- } else if (parts.length == 4) {
|
||||||
|
- deviceVersionNoDevice = parts[0] + "-" + parts[2];
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (deviceVersionNoDevice != null) {
|
||||||
|
- tracker.sendEvent("checkin", deviceName, deviceVersionNoDevice, null);
|
||||||
|
- }
|
||||||
|
- tracker.close();
|
||||||
|
-
|
||||||
|
- // report to the cmstats service
|
||||||
|
- HttpClient httpClient = new DefaultHttpClient();
|
||||||
|
- HttpPost httpPost = new HttpPost("https://stats.cyanogenmod.org/submit");
|
||||||
|
- boolean success = false;
|
||||||
|
-
|
||||||
|
- try {
|
||||||
|
- List<NameValuePair> kv = new ArrayList<NameValuePair>(5);
|
||||||
|
- kv.add(new BasicNameValuePair("device_hash", deviceId));
|
||||||
|
- kv.add(new BasicNameValuePair("device_name", deviceName));
|
||||||
|
- kv.add(new BasicNameValuePair("device_version", deviceVersion));
|
||||||
|
- kv.add(new BasicNameValuePair("device_country", deviceCountry));
|
||||||
|
- kv.add(new BasicNameValuePair("device_carrier", deviceCarrier));
|
||||||
|
- kv.add(new BasicNameValuePair("device_carrier_id", deviceCarrierId));
|
||||||
|
-
|
||||||
|
- httpPost.setEntity(new UrlEncodedFormEntity(kv));
|
||||||
|
- httpClient.execute(httpPost);
|
||||||
|
-
|
||||||
|
- success = true;
|
||||||
|
- } catch (IOException e) {
|
||||||
|
- Log.w(TAG, "Could not upload stats checkin", e);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- return success;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- protected void onPostExecute(Boolean result) {
|
||||||
|
- final Context context = ReportingService.this;
|
||||||
|
- long interval;
|
||||||
|
-
|
||||||
|
- if (result) {
|
||||||
|
- final SharedPreferences prefs = AnonymousStats.getPreferences(context);
|
||||||
|
- prefs.edit().putLong(AnonymousStats.ANONYMOUS_LAST_CHECKED,
|
||||||
|
- System.currentTimeMillis()).apply();
|
||||||
|
- // use set interval
|
||||||
|
- interval = 0;
|
||||||
|
- } else {
|
||||||
|
- // error, try again in 3 hours
|
||||||
|
- interval = 3L * 60L * 60L * 1000L;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- ReportingServiceManager.setAlarm(context, interval);
|
||||||
|
- stopSelf();
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
diff --git a/src/com/android/settings/cmstats/ReportingServiceManager.java b/src/com/android/settings/cmstats/ReportingServiceManager.java
|
||||||
|
deleted file mode 100644
|
||||||
|
index 540f55e4d..000000000
|
||||||
|
--- a/src/com/android/settings/cmstats/ReportingServiceManager.java
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,113 +0,0 @@
|
||||||
|
-/*
|
||||||
|
- * Copyright (C) 2012 The CyanogenMod Project
|
||||||
|
- *
|
||||||
|
- * Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
- * you may not use this file except in compliance with the License.
|
||||||
|
- * You may obtain a copy of the License at
|
||||||
|
- *
|
||||||
|
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
- *
|
||||||
|
- * Unless required by applicable law or agreed to in writing, software
|
||||||
|
- * distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
- * See the License for the specific language governing permissions and
|
||||||
|
- * limitations under the License.
|
||||||
|
- */
|
||||||
|
-
|
||||||
|
-package com.android.settings.cmstats;
|
||||||
|
-
|
||||||
|
-import android.app.AlarmManager;
|
||||||
|
-import android.app.PendingIntent;
|
||||||
|
-import android.content.BroadcastReceiver;
|
||||||
|
-import android.content.Context;
|
||||||
|
-import android.content.Intent;
|
||||||
|
-import android.content.SharedPreferences;
|
||||||
|
-import android.net.ConnectivityManager;
|
||||||
|
-import android.net.NetworkInfo;
|
||||||
|
-import android.provider.Settings;
|
||||||
|
-import android.util.Log;
|
||||||
|
-
|
||||||
|
-public class ReportingServiceManager extends BroadcastReceiver {
|
||||||
|
- private static final long MILLIS_PER_HOUR = 60L * 60L * 1000L;
|
||||||
|
- private static final long MILLIS_PER_DAY = 24L * MILLIS_PER_HOUR;
|
||||||
|
- private static final long UPDATE_INTERVAL = 1L * MILLIS_PER_DAY;
|
||||||
|
-
|
||||||
|
- @Override
|
||||||
|
- public void onReceive(Context context, Intent intent) {
|
||||||
|
- if (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
|
||||||
|
- setAlarm(context, 0);
|
||||||
|
- } else {
|
||||||
|
- launchService(context);
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public static void setAlarm(Context context, long millisFromNow) {
|
||||||
|
- SharedPreferences prefs = AnonymousStats.getPreferences(context);
|
||||||
|
- if (prefs.contains(AnonymousStats.ANONYMOUS_OPT_IN)) {
|
||||||
|
- migrate(context, prefs);
|
||||||
|
- }
|
||||||
|
- if (!Utilities.isStatsCollectionEnabled(context)) {
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- if (millisFromNow <= 0) {
|
||||||
|
- long lastSynced = prefs.getLong(AnonymousStats.ANONYMOUS_LAST_CHECKED, 0);
|
||||||
|
- if (lastSynced == 0) {
|
||||||
|
- // never synced, so let's fake out that the last sync was just now.
|
||||||
|
- // this will allow the user tFrame time to opt out before it will start
|
||||||
|
- // sending up anonymous stats.
|
||||||
|
- lastSynced = System.currentTimeMillis();
|
||||||
|
- prefs.edit().putLong(AnonymousStats.ANONYMOUS_LAST_CHECKED, lastSynced).apply();
|
||||||
|
- Log.d(ReportingService.TAG, "Set alarm for first sync.");
|
||||||
|
- }
|
||||||
|
- millisFromNow = (lastSynced + UPDATE_INTERVAL) - System.currentTimeMillis();
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- Intent intent = new Intent(ConnectivityManager.CONNECTIVITY_ACTION);
|
||||||
|
- intent.setClass(context, ReportingServiceManager.class);
|
||||||
|
-
|
||||||
|
- AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||||
|
- alarmManager.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + millisFromNow,
|
||||||
|
- PendingIntent.getBroadcast(context, 0, intent, 0));
|
||||||
|
- Log.d(ReportingService.TAG, "Next sync attempt in : " + millisFromNow / MILLIS_PER_HOUR + " hours");
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public static void launchService(Context context) {
|
||||||
|
- ConnectivityManager cm = (ConnectivityManager)
|
||||||
|
- context.getSystemService(Context.CONNECTIVITY_SERVICE);
|
||||||
|
-
|
||||||
|
- NetworkInfo networkInfo = cm.getActiveNetworkInfo();
|
||||||
|
- if (networkInfo == null || !networkInfo.isConnected()) {
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- SharedPreferences prefs = AnonymousStats.getPreferences(context);
|
||||||
|
-
|
||||||
|
- if (!Utilities.isStatsCollectionEnabled(context)) {
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- long lastSynced = prefs.getLong(AnonymousStats.ANONYMOUS_LAST_CHECKED, 0);
|
||||||
|
- if (lastSynced == 0) {
|
||||||
|
- setAlarm(context, 0);
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
- long timeElapsed = System.currentTimeMillis() - lastSynced;
|
||||||
|
- if (timeElapsed < UPDATE_INTERVAL) {
|
||||||
|
- long timeLeft = UPDATE_INTERVAL - timeElapsed;
|
||||||
|
- Log.d(ReportingService.TAG, "Waiting for next sync : " + timeLeft / MILLIS_PER_HOUR + " hours");
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- Intent intent = new Intent();
|
||||||
|
- intent.setClass(context, ReportingService.class);
|
||||||
|
- context.startService(intent);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- private static void migrate(Context context, SharedPreferences prefs) {
|
||||||
|
- Utilities.setStatsCollectionEnabled(context,
|
||||||
|
- prefs.getBoolean(AnonymousStats.ANONYMOUS_OPT_IN, true));
|
||||||
|
- prefs.edit().remove(AnonymousStats.ANONYMOUS_OPT_IN).commit();
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
-}
|
||||||
|
diff --git a/src/com/android/settings/cmstats/Utilities.java b/src/com/android/settings/cmstats/Utilities.java
|
||||||
|
deleted file mode 100644
|
||||||
|
index 4d4ff48fa..000000000
|
||||||
|
--- a/src/com/android/settings/cmstats/Utilities.java
|
||||||
|
+++ /dev/null
|
||||||
|
@@ -1,99 +0,0 @@
|
||||||
|
-/*
|
||||||
|
- * Copyright (C) 2012 The CyanogenMod Project
|
||||||
|
- *
|
||||||
|
- * Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
- * you may not use this file except in compliance with the License.
|
||||||
|
- * You may obtain a copy of the License at
|
||||||
|
- *
|
||||||
|
- * http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
- *
|
||||||
|
- * Unless required by applicable law or agreed to in writing, software
|
||||||
|
- * distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
- * See the License for the specific language governing permissions and
|
||||||
|
- * limitations under the License.
|
||||||
|
- */
|
||||||
|
-
|
||||||
|
-package com.android.settings.cmstats;
|
||||||
|
-
|
||||||
|
-import android.content.Context;
|
||||||
|
-import android.os.SystemProperties;
|
||||||
|
-import android.provider.Settings;
|
||||||
|
-import android.telephony.TelephonyManager;
|
||||||
|
-import android.text.TextUtils;
|
||||||
|
-
|
||||||
|
-import java.math.BigInteger;
|
||||||
|
-import java.net.NetworkInterface;
|
||||||
|
-import java.security.MessageDigest;
|
||||||
|
-
|
||||||
|
-public class Utilities {
|
||||||
|
- public static String getUniqueID(Context context) {
|
||||||
|
- final String id = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
|
||||||
|
- return digest(context.getPackageName() + id);
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public static String getCarrier(Context context) {
|
||||||
|
- TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
- String carrier = tm.getNetworkOperatorName();
|
||||||
|
- if (TextUtils.isEmpty(carrier)) {
|
||||||
|
- carrier = "Unknown";
|
||||||
|
- }
|
||||||
|
- return carrier;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public static String getCarrierId(Context context) {
|
||||||
|
- TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
- String carrierId = tm.getNetworkOperator();
|
||||||
|
- if (TextUtils.isEmpty(carrierId)) {
|
||||||
|
- carrierId = "0";
|
||||||
|
- }
|
||||||
|
- return carrierId;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public static String getCountryCode(Context context) {
|
||||||
|
- TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
||||||
|
- String countryCode = tm.getNetworkCountryIso();
|
||||||
|
- if (TextUtils.isEmpty(countryCode)) {
|
||||||
|
- countryCode = "Unknown";
|
||||||
|
- }
|
||||||
|
- return countryCode;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public static String getDevice() {
|
||||||
|
- return SystemProperties.get("ro.cm.device");
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public static String getModVersion() {
|
||||||
|
- return SystemProperties.get("ro.cm.version");
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- public static String digest(String input) {
|
||||||
|
- try {
|
||||||
|
- MessageDigest md = MessageDigest.getInstance("MD5");
|
||||||
|
- return new BigInteger(1, md.digest(input.getBytes())).toString(16).toUpperCase();
|
||||||
|
- } catch (Exception e) {
|
||||||
|
- return null;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /**
|
||||||
|
- * Check to see if global stats are enabled.
|
||||||
|
- * @param context
|
||||||
|
- * @return Whether or not stats collection is enabled.
|
||||||
|
- */
|
||||||
|
- public static boolean isStatsCollectionEnabled(Context context) {
|
||||||
|
- return Settings.System.getInt(context.getContentResolver(),
|
||||||
|
- Settings.System.STATS_COLLECTION, 1) != 0;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
- /**
|
||||||
|
- * Enabled or disable stats collection
|
||||||
|
- * @param context
|
||||||
|
- * @param enabled Boolean that sets collection being enabled.
|
||||||
|
- */
|
||||||
|
- public static void setStatsCollectionEnabled(Context context, boolean enabled) {
|
||||||
|
- int enable = (enabled) ? 1 : 0;
|
||||||
|
- Settings.System.putInt(context.getContentResolver(),
|
||||||
|
- Settings.System.STATS_COLLECTION, enable);
|
||||||
|
- }
|
||||||
|
-}
|
||||||
|
diff --git a/src/com/android/settings/cyanogenmod/PrivacySettings.java b/src/com/android/settings/cyanogenmod/PrivacySettings.java
|
||||||
|
index 49bc7b497..6c6021f76 100644
|
||||||
|
--- a/src/com/android/settings/cyanogenmod/PrivacySettings.java
|
||||||
|
+++ b/src/com/android/settings/cyanogenmod/PrivacySettings.java
|
||||||
|
@@ -54,7 +54,6 @@ public class PrivacySettings extends SettingsPreferenceFragment {
|
||||||
|
mBlacklist = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
- addPreferencesFromResource(R.xml.security_settings_cyanogenmod);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
--
|
||||||
|
2.15.0
|
||||||
|
|
@ -32,3 +32,5 @@ mv CVE-2016-3137/ANY/1.patch CVE-2016-3137/ANY/1.patch.dupe
|
|||||||
mv CVE-2016-0774/ANY/0.patch CVE-2016-0774/ANY/0.patch.disabled
|
mv CVE-2016-0774/ANY/0.patch CVE-2016-0774/ANY/0.patch.disabled
|
||||||
mv CVE-2016-8399/ANY/0.patch CVE-2016-8399/ANY/0.patch.disabled
|
mv CVE-2016-8399/ANY/0.patch CVE-2016-8399/ANY/0.patch.disabled
|
||||||
mv CVE-2016-6741/3.10/0.patch CVE-2016-6741/3.10/0.patch.disabled
|
mv CVE-2016-6741/3.10/0.patch CVE-2016-6741/3.10/0.patch.disabled
|
||||||
|
mv CVE-2014-0196/ANY/0.patch CVE-2014-0196/ANY/0.patch.disabled
|
||||||
|
mv CVE-2015-2922/ANY/0.patch CVE-2015-2922/ANY/0.patch.disabled
|
||||||
|
@ -4,7 +4,6 @@ git apply $cvePatches/CVE-2012-6657/ANY/0.patch
|
|||||||
git apply $cvePatches/CVE-2012-6701/ANY/0.patch
|
git apply $cvePatches/CVE-2012-6701/ANY/0.patch
|
||||||
git apply $cvePatches/CVE-2012-6704/ANY/0.patch
|
git apply $cvePatches/CVE-2012-6704/ANY/0.patch
|
||||||
git apply $cvePatches/CVE-2013-2015/3.4/0.patch
|
git apply $cvePatches/CVE-2013-2015/3.4/0.patch
|
||||||
git apply $cvePatches/CVE-2014-0196/ANY/0.patch
|
|
||||||
git apply $cvePatches/CVE-2014-1739/ANY/0.patch
|
git apply $cvePatches/CVE-2014-1739/ANY/0.patch
|
||||||
git apply $cvePatches/CVE-2014-2523/ANY/0.patch
|
git apply $cvePatches/CVE-2014-2523/ANY/0.patch
|
||||||
git apply $cvePatches/CVE-2014-4655/ANY/0.patch
|
git apply $cvePatches/CVE-2014-4655/ANY/0.patch
|
||||||
@ -22,7 +21,6 @@ git apply $cvePatches/CVE-2015-1593/ANY/0.patch
|
|||||||
git apply $cvePatches/CVE-2015-1805/3.4-^3.16/0.patch
|
git apply $cvePatches/CVE-2015-1805/3.4-^3.16/0.patch
|
||||||
git apply $cvePatches/CVE-2015-2041/ANY/0.patch
|
git apply $cvePatches/CVE-2015-2041/ANY/0.patch
|
||||||
git apply $cvePatches/CVE-2015-2686/ANY/0.patch
|
git apply $cvePatches/CVE-2015-2686/ANY/0.patch
|
||||||
git apply $cvePatches/CVE-2015-2922/ANY/0.patch
|
|
||||||
git apply $cvePatches/CVE-2015-3636/ANY/0.patch
|
git apply $cvePatches/CVE-2015-3636/ANY/0.patch
|
||||||
git apply $cvePatches/CVE-2015-7515/3.2-^4.4/1.patch
|
git apply $cvePatches/CVE-2015-7515/3.2-^4.4/1.patch
|
||||||
git apply $cvePatches/CVE-2015-7550/ANY/0.patch
|
git apply $cvePatches/CVE-2015-7550/ANY/0.patch
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#repo forall -c 'git add -A && git reset --hard' && rm -rf out && repo sync -j20 --force-sync
|
#repo forall -c 'git add -A && git reset --hard' && rm -rf out && repo sync -j20 --force-sync
|
||||||
|
|
||||||
#Apply all of our changes
|
#Apply all of our changes
|
||||||
#source ../../Scripts/LineageOS-11.0/00init.sh && source $scripts/Patch.sh && source $scripts/Deblob.sh && source $scripts/Patch_CVE.sh && source build/envsetup.sh
|
#source ../../Scripts/LineageOS-11.0/00init.sh && source $scripts/Patch.sh && source $scripts/Rebrand.sh && source $scripts/Deblob.sh && source $scripts/Patch_CVE.sh && source build/envsetup.sh
|
||||||
|
|
||||||
#Build!
|
#Build!
|
||||||
#brunch lineage_nex-userdebug
|
#brunch lineage_nex-userdebug
|
||||||
@ -69,6 +69,9 @@ export -f enhanceLocation;
|
|||||||
#
|
#
|
||||||
#START OF ROM CHANGES
|
#START OF ROM CHANGES
|
||||||
#
|
#
|
||||||
|
enter "packages/apps/Settings"
|
||||||
|
patch -p1 < $patches"android_packages_apps_Settings/0001-CMStats.patch"; #Remove CMStats
|
||||||
|
|
||||||
enter "vendor/cm"
|
enter "vendor/cm"
|
||||||
awk -i inplace '!/50-cm.sh/' config/common.mk; #Make sure our hosts is always used
|
awk -i inplace '!/50-cm.sh/' config/common.mk; #Make sure our hosts is always used
|
||||||
sed -i 's/CM_BUILDTYPE := UNOFFICIAL/CM_BUILDTYPE := dos/' config/common.mk; #Change buildtype
|
sed -i 's/CM_BUILDTYPE := UNOFFICIAL/CM_BUILDTYPE := dos/' config/common.mk; #Change buildtype
|
||||||
@ -84,6 +87,9 @@ patch -p1 < $patches"android_device_zte_nex/Fixes.patch"
|
|||||||
patch -p1 < $patches"android_device_zte_nex/Lower_DPI.patch"
|
patch -p1 < $patches"android_device_zte_nex/Lower_DPI.patch"
|
||||||
mv cm.mk lineage.mk
|
mv cm.mk lineage.mk
|
||||||
sed -i 's/cm_/lineage_/' lineage.mk vendorsetup.sh
|
sed -i 's/cm_/lineage_/' lineage.mk vendorsetup.sh
|
||||||
|
#In nex-vendor-blobs.mk
|
||||||
|
# "system/lib/libtime_genoff.so" -> "obj/lib/libtime_genoff.so"
|
||||||
|
# Remove "WCNSS_qcom_wlan_nv2.bin"
|
||||||
|
|
||||||
enter "kernel/zte/msm8930"
|
enter "kernel/zte/msm8930"
|
||||||
patch -p1 < $patches"android_kernel_zte_msm8930/MDP-Fix.patch"
|
patch -p1 < $patches"android_kernel_zte_msm8930/MDP-Fix.patch"
|
||||||
|
39
Scripts/LineageOS-11.0/Rebrand.sh
Normal file
39
Scripts/LineageOS-11.0/Rebrand.sh
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#DivestOS: A privacy oriented Android distribution
|
||||||
|
#Copyright (c) 2017 Spot Communications, Inc.
|
||||||
|
#
|
||||||
|
#This program 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.
|
||||||
|
#
|
||||||
|
#This program 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 this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#Updates select user facing strings
|
||||||
|
|
||||||
|
echo "Rebranding..."
|
||||||
|
|
||||||
|
cd $base"build"
|
||||||
|
sed -i 's|echo "ro.build.user=$USER"|echo "ro.build.user=emy"|' tools/buildinfo.sh; #Override build user
|
||||||
|
sed -i 's|echo "ro.build.host=`hostname`"|echo "ro.build.host=dosbm"|' tools/buildinfo.sh; #Override build host
|
||||||
|
|
||||||
|
cd $base"packages/apps/Settings"
|
||||||
|
sed -i '/.*cmlicense_title/s/LineageOS/DivestOS/' res/values*/cm_strings.xml
|
||||||
|
sed -i '/.*cmlicense_activity_title/s/LineageOS/DivestOS/' res/values*/cm_strings.xml
|
||||||
|
sed -i '/.*cmupdate_settings_title/s/LineageOS/DivestOS/' res/values*/cm_strings.xml
|
||||||
|
sed -i '/.*mod_version/s/LineageOS/DivestOS/' res/values*/cm_strings.xml
|
||||||
|
sed -i '/.*privacy_settings_cyanogenmod_category/s/LineageOS/DivestOS/' res/values*/cm_strings.xml
|
||||||
|
|
||||||
|
cd $base"vendor/cm"
|
||||||
|
sed -i 's|https://lineageos.org/legal|https://divestos.xyz/pages/about.html|' config/common.mk;
|
||||||
|
#sed -i '/.*ZIPFILE=/s/lineage/divestos/' build/envsetup.sh
|
||||||
|
rm -rf bootanimation #TODO: Create a boot animation
|
||||||
|
|
||||||
|
cd $base
|
||||||
|
echo "Rebranding complete!"
|
Loading…
Reference in New Issue
Block a user