Add back LineageOS 11.0 support again

Why do I keep doing this?
This commit is contained in:
Tad 2018-03-31 19:03:43 -04:00
parent d47c58ba3b
commit 421cbe65b3
13 changed files with 1725 additions and 0 deletions

View File

@ -0,0 +1,77 @@
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- START OF UNNECESSARY REPO REMOVAL -->
<remove-project name="LineageOS/android_device_generic_mips" />
<remove-project name="LineageOS/android_device_generic_x86" />
<remove-project name="LineageOS/android_device_google_accessory_arduino" />
<remove-project name="LineageOS/android_device_google_accessory_demokit" />
<remove-project name="LineageOS/android_external_ant-wireless_ant_native" />
<remove-project name="LineageOS/android_external_ant-wireless_ant_service" />
<remove-project name="LineageOS/android_external_arduino" />
<remove-project name="LineageOS/android_hardware_samsung_slsi_exynos5" />
<remove-project name="LineageOS/android_hardware_ti_omap3" />
<remove-project name="LineageOS/android_hardware_ti_omap4xxx" />
<remove-project name="LineageOS/android_packages_apps_CMAccount" />
<remove-project name="LineageOS/android_packages_apps_CMBugreport" />
<remove-project name="LineageOS/android_packages_apps_CMUpdater" />
<remove-project name="LineageOS/android_packages_apps_Provision" />
<remove-project name="LineageOS/android_packages_apps_Stk" />
<remove-project name="LineageOS/android_packages_apps_VideoEditor" />
<remove-project name="LineageOS/android_packages_apps_VoiceDialer" />
<remove-project name="LineageOS/android_packages_apps_VoicePlus" />
<remove-project name="LineageOS/android_packages_inputmethods_OpenWnn" />
<remove-project name="LineageOS/android_packages_inputmethods_PinyinIME" />
<remove-project name="LineageOS/android_packages_screensavers_Basic" />
<remove-project name="LineageOS/android_packages_screensavers_PhotoTable" />
<remove-project name="LineageOS/android_packages_screensavers_WebView" />
<remove-project name="LineageOS/android_packages_wallpapers_Galaxy4" />
<remove-project name="LineageOS/android_packages_wallpapers_HoloSpiral" />
<remove-project name="LineageOS/android_packages_wallpapers_MagicSmoke" />
<remove-project name="LineageOS/android_packages_wallpapers_MusicVisualization" />
<remove-project name="LineageOS/android_packages_wallpapers_NoiseField" />
<remove-project name="LineageOS/android_packages_wallpapers_PhaseBeam" />
<remove-project name="LineageOS/android_packages_wallpapers_PhotoPhase" />
<remove-project name="device/generic/mini-emulator-armv7-a-neon" />
<remove-project name="device/generic/mini-emulator-mips" />
<remove-project name="device/generic/mini-emulator-x86" />
<remove-project name="platform/cts" />
<remove-project name="platform/developers/build" />
<remove-project name="platform/developers/demos" />
<remove-project name="platform/developers/docs" />
<remove-project name="platform/developers/samples/android" />
<remove-project name="platform/docs/source.android.com" />
<remove-project name="platform/packages/apps/OneTimeInitializer" />
<remove-project name="platform/prebuilts/clang/darwin-x86/3.1" />
<remove-project name="platform/prebuilts/clang/darwin-x86/3.2" />
<remove-project name="platform/prebuilts/clang/darwin-x86/arm/3.3" />
<remove-project name="platform/prebuilts/clang/darwin-x86/host/3.3" />
<remove-project name="platform/prebuilts/clang/darwin-x86/mips/3.3" />
<remove-project name="platform/prebuilts/clang/darwin-x86/x86/3.3" />
<remove-project name="platform/prebuilts/clang/linux-x86/mips/3.3" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.6" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/arm/arm-eabi-4.7" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.6" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/arm/arm-linux-androideabi-4.7" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/host/headers" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/host/i686-apple-darwin-4.2.1" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/mips/mipsel-linux-android-4.6" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/mips/mipsel-linux-android-4.7" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/x86/i686-linux-android-4.6" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/x86/i686-linux-android-4.7" />
<remove-project name="platform/prebuilts/gcc/darwin-x86/x86/x86_64-linux-android-4.7" />
<remove-project name="platform/prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.6" />
<remove-project name="platform/prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.7" />
<remove-project name="platform/prebuilts/python/darwin-x86/2.7.5" />
<remove-project name="platform/tools/emulator" />
<!-- END OF UNNECESSARY REPO REMOVAL -->
<!-- START OF DEVICE REPOS -->
<!-- Common -->
<project path="device/qcom/common" name="LineageOS/android_device_qcom_common" remote="github" revision="cm-11.0" />
<!-- ZTE (N800) nex -->
<project path="device/zte/nex" name="spock1104/android_device_zte_nex" remote="github" revision="cm11_newkern" />
<project path="kernel/zte/msm8930" name="spock1104/android_kernel_zte_msm8930" remote="github" revision="stockmod" />
<!-- END OF DEVICE REPOS -->
</manifest>

View File

@ -0,0 +1,39 @@
From b003bf4b46743dc3b1b566196e8ee9ece4c1ade0 Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Sun, 11 Dec 2016 22:15:28 -0500
Subject: [PATCH] Fixes
Change-Id: I53c657f52a7c8fd39655a9acba8e9c0a633fd329
---
BoardConfig.mk | 5 +++++
charger/Android.mk | 2 +-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/BoardConfig.mk b/BoardConfig.mk
index 726c947..c11a418 100644
--- a/BoardConfig.mk
+++ b/BoardConfig.mk
@@ -192,3 +192,8 @@ TW_FLASH_FROM_STORAGE := true
TW_BRIGHTNESS_PATH := /sys/class/leds/lcd-backlight/brightness
TW_MAX_BRIGHTNESS := 255
TW_INPUT_BLACKLIST := lis3dh_acc
+
+# Use retire fence from MDP driver
+TARGET_DISPLAY_USE_RETIRE_FENCE := true
+
+
diff --git a/charger/Android.mk b/charger/Android.mk
index 14c26dd..0fcc178 100644
--- a/charger/Android.mk
+++ b/charger/Android.mk
@@ -20,7 +20,7 @@ LOCAL_STATIC_LIBRARIES := libminui libpixelflinger_static libpng
ifeq ($(strip $(BOARD_CHARGER_ENABLE_SUSPEND)),true)
LOCAL_STATIC_LIBRARIES += libsuspend
endif
-LOCAL_STATIC_LIBRARIES += libz libstdc++ libcutils liblog libm libc
+LOCAL_STATIC_LIBRARIES += libz libstdc++ libcutils liblog libm libc libutils
include $(BUILD_EXECUTABLE)
--
2.9.3

View File

@ -0,0 +1,25 @@
From fc786df1d3a1f6012863f042f34b2bc0b9a0bd2f Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Sun, 11 Dec 2016 23:23:58 -0500
Subject: [PATCH] Change DPI
Change-Id: Ia9059e0b554fec09ab73f961b09cf6316aeaa9c9
---
system.prop | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/system.prop b/system.prop
index 4f7a90c..9cdb394 100644
--- a/system.prop
+++ b/system.prop
@@ -27,7 +27,7 @@ DEVICE_PROVISIONED=1
debug.sf.hw=1
debug.egl.hw=1
debug.composition.type=gpu
-ro.sf.lcd_density=240
+ro.sf.lcd_density=180
dalvik.vm.heapsize=36m
debug.enable.wl_log=1
debug.mdpcomp.maxlayer=4
--
2.9.3

View File

@ -0,0 +1,24 @@
From f67900ad9370a7e7f0186b3f459dad2c74db7aae Mon Sep 17 00:00:00 2001
From: Tad <tad@spotco.us>
Date: Sun, 11 Dec 2016 23:15:20 -0500
Subject: [PATCH] Fixes
Change-Id: I55eb4f1af258b649ddc36bd822d9b28f9fd64ce9
---
include/linux/msm_mdp.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/linux/msm_mdp.h b/include/linux/msm_mdp.h
index 8f829ef..cf6d3d0 100644
--- a/include/linux/msm_mdp.h
+++ b/include/linux/msm_mdp.h
@@ -574,6 +574,7 @@ struct mdp_buf_sync {
uint32_t acq_fen_fd_cnt;
int *acq_fen_fd;
int *rel_fen_fd;
+ int *retire_fen_fd;
};
struct mdp_buf_fence {
--
2.9.3

View File

@ -0,0 +1,41 @@
From 526a26556b9069238ea7eecb9095cc672daef0e5 Mon Sep 17 00:00:00 2001
From: "H. Peter Anvin" <hpa@linux.intel.com>
Date: Thu, 7 Feb 2013 17:14:08 -0800
Subject: [PATCH] timeconst.pl: Eliminate Perl warning
commit 63a3f603413ffe82ad775f2d62a5afff87fd94a0 upstream.
defined(@array) is deprecated in Perl and gives off a warning.
Restructure the code to remove that warning.
[ hpa: it would be interesting to revert to the timeconst.bc script.
It appears that the failures reported by akpm during testing of
that script was due to a known broken version of make, not a problem
with bc. The Makefile rules could probably be restructured to avoid
the make bug, or it is probably old enough that it doesn't matter. ]
Reported-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
kernel/timeconst.pl | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/kernel/timeconst.pl b/kernel/timeconst.pl
index eb51d76..3f42652 100644
--- a/kernel/timeconst.pl
+++ b/kernel/timeconst.pl
@@ -369,10 +369,8 @@ (@)
die "Usage: $0 HZ\n";
}
- @val = @{$canned_values{$hz}};
- if (!defined(@val)) {
- @val = compute_values($hz);
- }
+ $cv = $canned_values{$hz};
+ @val = defined($cv) ? @$cv : compute_values($hz);
output($hz, @val);
}
exit 0;

View File

@ -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

View File

@ -0,0 +1,47 @@
#!/bin/bash
#DivestOS: A privacy oriented Android distribution
#Copyright (c) 2017-2018 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/>.
#Sets settings used by all other scripts
export androidWorkspace="/mnt/Drive-3/";
export base=$androidWorkspace"Build/LineageOS-11.0/";
export SIGNING_KEY_DIR=$androidWorkspace"Signing_Keys";
export OTA_PACKAGE_SIGNING_KEY=$SIGNING_KEY_DIR"/releasekey"
export prebuiltApps=$androidWorkspace"PrebuiltApps/";
export patches=$androidWorkspace"Patches/LineageOS-11.0/";
export cvePatchesLinux=$androidWorkspace"Patches/Linux/";
export cvePatchesAndroid=$androidWorkspace"Patches/Android/";
export dosWallpapers=$androidWorkspace"Patches/Wallpapers/";
export scripts=$androidWorkspace"Scripts/LineageOS-11.0/";
export cveScripts=$scripts"CVE_Patchers/";
export ANDROID_HOME="/home/$USER/Android/Sdk";
export KBUILD_BUILD_USER=emy
export KBUILD_BUILD_HOST=dosbm
export GRADLE_OPTS=-Xmx2048m
source $scripts"/Functions.sh"
unalias cp
unalias mv
unalias rm
unalias ln

View File

@ -0,0 +1,77 @@
#!/bin/bash
cd $base"kernel/zte/msm8930"
git apply $cvePatches/CVE-2012-6657/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-2013-2015/3.4/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-4655/ANY/0.patch
git apply $cvePatches/CVE-2014-4656/ANY/0.patch
git apply $cvePatches/CVE-2014-7822/3.2-^3.16/0.patch
git apply $cvePatches/CVE-2014-7970/3.4/2.patch
git apply $cvePatches/CVE-2014-8173/ANY/0.patch
git apply $cvePatches/CVE-2014-8709/ANY/0.patch
git apply $cvePatches/CVE-2014-9420/3.2-^3.18/1.patch
git apply $cvePatches/CVE-2014-9683/3.2-^3.18/1.patch
git apply $cvePatches/CVE-2014-9715/ANY/0.patch
git apply $cvePatches/CVE-2014-9870/ANY/0.patch
git apply $cvePatches/CVE-2014-9900/ANY/0.patch
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-2041/ANY/0.patch
git apply $cvePatches/CVE-2015-2686/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-7550/ANY/0.patch
git apply $cvePatches/CVE-2015-8937/ANY/0.patch
git apply $cvePatches/CVE-2015-8939/ANY/0.patch
git apply $cvePatches/CVE-2015-8944/ANY/0.patch
git apply $cvePatches/CVE-2016-0723/ANY/0.patch
git apply $cvePatches/CVE-2016-0774/ANY/1.patch
git apply $cvePatches/CVE-2016-0821/ANY/0.patch
git apply $cvePatches/CVE-2016-10233/ANY/0.patch
git apply $cvePatches/CVE-2016-2185/ANY/0.patch
git apply $cvePatches/CVE-2016-2186/ANY/0.patch
git apply $cvePatches/CVE-2016-2384/ANY/0.patch
git apply $cvePatches/CVE-2016-2544/ANY/0.patch
git apply $cvePatches/CVE-2016-2545/ANY/0.patch
git apply $cvePatches/CVE-2016-2546/ANY/0.patch
git apply $cvePatches/CVE-2016-2547/ANY/0.patch
git apply $cvePatches/CVE-2016-2549/ANY/0.patch
git apply $cvePatches/CVE-2016-3138/ANY/0.patch
git apply $cvePatches/CVE-2016-3854/ANY/0.patch
git apply $cvePatches/CVE-2016-4569/ANY/0.patch
git apply $cvePatches/CVE-2016-4578/ANY/0.patch
git apply $cvePatches/CVE-2016-5195/3.4/0.patch
git apply $cvePatches/CVE-2016-5829/ANY/0.patch
git apply $cvePatches/CVE-2016-6672/ANY/0.patch
git apply $cvePatches/CVE-2016-6753/ANY/0.patch
git apply $cvePatches/CVE-2016-6828/ANY/0.patch
git apply $cvePatches/CVE-2016-7915/ANY/0.patch
git apply $cvePatches/CVE-2016-8399/ANY/1.patch
git apply $cvePatches/CVE-2016-8404/ANY/0.patch
git apply $cvePatches/CVE-2016-8406/ANY/0.patch
git apply $cvePatches/CVE-2016-8650/ANY/0.patch
git apply $cvePatches/CVE-2016-9604/ANY/0.patch
git apply $cvePatches/CVE-2016-9793/ANY/0.patch
git apply $cvePatches/CVE-2017-0403/ANY/0.patch
git apply $cvePatches/CVE-2017-0404/ANY/0.patch
git apply $cvePatches/CVE-2017-0648/ANY/0.patch
git apply $cvePatches/CVE-2017-0710/ANY/0.patch
git apply $cvePatches/CVE-2017-0751/ANY/0.patch
git apply $cvePatches/CVE-2017-0786/ANY/0.patch
git apply $cvePatches/CVE-2017-1000251/3.4/1.patch
git apply $cvePatches/CVE-2017-13080/ANY/0.patch
git apply $cvePatches/CVE-2017-13080-Extra/ANY/0.patch
git apply $cvePatches/CVE-2017-13080-Extra/ANY/1.patch
git apply $cvePatches/CVE-2017-15265/ANY/0.patch
git apply $cvePatches/CVE-2017-2671/ANY/0.patch
git apply $cvePatches/CVE-2017-5970/ANY/0.patch
git apply $cvePatches/CVE-2017-6074/ANY/0.patch
git apply $cvePatches/CVE-2017-6345/ANY/0.patch
git apply $cvePatches/CVE-2017-6348/ANY/0.patch
git apply $cvePatches/CVE-2017-6951/ANY/0.patch
git apply $cvePatches/CVE-2017-7487/ANY/0.patch
git apply $cvePatches/CVE-2017-9242/ANY/0.patch
cd $base

389
Scripts/LineageOS-11.0/Deblob.sh Executable file
View File

@ -0,0 +1,389 @@
#!/bin/bash
#DivestOS: A privacy oriented Android distribution
#Copyright (c) 2017-2018 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/>.
#Goal: Remove as many proprietary blobs without breaking core functionality
#Outcome: Increased battery/performance/privacy/security, Decreased ROM size
#TODO: Clean init*.rc files, Modularize, Remove more variants
#
#Device Status (Tested under LineageOS 14.1)
#
#Functioning as Expected: bacon, clark, mako, marlin, sailfish, thor
echo "Deblobbing..."
#
#START OF BLOBS ARRAY
#
#WARNING: STRAY DELIMITERS WILL RESULT IN FILE DELETIONS
blobs=""; #Delimited using "|"
makes="";
overlay="";
kernels=""; #Delimited using " "
#ACDB (Audio Configurations) [Qualcomm] XXX: Breaks audio output
#blobs=$blobs"acdb";
#ADSP/Hexagon (Hardware Audio Decoding) [Qualcomm]
#blobs=$blobs"adsprpcd|libadsprpc.so|libadsprpc.so|libfastcvadsp_stub.so|libfastcvopt.so|libadsp_fd_skel.so";
#Alipay (Payment Platform) [Alibaba]
blobs=$blobs"alipay.b00|alipay.b01|alipay.b02|alipay.b03|alipay.b04|alipay.b05|alipay.b06|alipay.mdt";
#aptX (Bluetooth Audio Compression Codec) [Qualcomm]
blobs=$blobs"|libaptX-1.0.0-rel-Android21-ARMv7A.so|libaptXHD-1.0.0-rel-Android21-ARMv7A.so|libaptXScheduler.so";
#ATFWD [Qualcomm]
blobs=$blobs"|ATFWD-daemon|atfwd.apk";
#AudioFX (Audio Effects) [Qualcomm] XXX: Breaks audio on some devices
#blobs=$blobs"|libqcbassboost.so|libqcreverb.so|libqcvirt.so";
#Camera
#Attempted, don't waste your time...
#FUN FACT: The Huawei Honor 5x ships with eight-hundred-and-thirty-five (*835*) proprietary camera blobs.
#blobs=$blobs"|";
#Clearkey (DRM) [Google]
blobs=$blobs"|libdrmclearkeyplugin.so";
#CMN (TrustZone?) [Qualcomm?]
#blobs=$blobs"|cmnlib.b00|cmnlib.b01|cmnlib.b02|cmnlib.b03|cmnlib.b04|cmnlib.b05|cmnlib.flist|cmnlib.mdt|cmnlib64.b00|cmnlib64.b01|cmnlib64.b02|cmnlib64.b03|cmnlib64.b04|cmnlib64.b05|cmnlib64.flist|cmnlib64.mdt";
#CNE (Automatic Cell/Wi-Fi Switching) [Qualcomm]
#blobs=$blobs"|libcneapiclient.so|libNimsWrap.so"; #XXX: Breaks radio
blobs=$blobs"|andsfCne.xml|ATT_profile1.xml|ATT_profile2.xml|ATT_profile3.xml|ATT_profile4.xml|ATT_profiles.xml|cnd|cneapiclient.jar|cneapiclient.xml|CNEService.apk|com.quicinc.cne.jar|com.quicinc.cne.xml|ConnectivityExt.jar|ConnectivityExt.xml|libcneconn.so|libcneqmiutils.so|libcne.so|libvendorconn.so|libwqe.so|profile1.xml|profile2.xml|profile3.xml|profile4.xml|profile5.xml|ROW_profile1.xml|ROW_profile2.xml|ROW_profile3.xml|ROW_profile4.xml|ROW_profile5.xml|ROW_profiles.xml|SwimConfig.xml|VZW_profile1.xml|VZW_profile2.xml|VZW_profile3.xml|VZW_profile4.xml|VZW_profile5.xml|VZW_profile6.xml|VZW_profiles.xml";
makes=$makes"libcnefeatureconfig";
#Diagnostics [Qualcomm]
blobs=$blobs"|[/]diag[/]|diag_callback_client|diag_dci_sample|diag_klog|diag_mdlog|diag_mdlog-getlogs|diag_mdlog-wrap|diag[/]mdm|diag_qshrink4_daemon|diag_socket_log|diag_uart_log|drmdiagapp|ibdrmdiag.so|ssr_diag|test_diag";
#Dirac (Audio Effects) [Dirac]
blobs=$blobs"|diracmobile.config|libDiracAPI_SHARED.so|libdirac.so|libdirac-appi.so";
#Discretix (DRM/HDCP) [Discretix Technologies]
blobs=$blobs"|discretix|DxHDCP.cfg|libDxHdcp.so";
blobs=$blobs"|dxhdcp2.b00|dxhdcp2.b01|dxhdcp2.b02|dxhdcp2.b03|dxhdcp2.mdt";
blobs=$blobs"|dxcprm.b00|dxcprm.b01|dxcprm.b02|dxcprm.b03|dxcprm.mdt";
#Display Color Tuning [Qualcomm]
blobs=$blobs"|colorservice.apk|com.qti.snapdragon.sdk.display.jar|com.qti.snapdragon.sdk.display.xml|libdisp-aba.so|libmm-abl-oem.so|libmm-abl.so|libmm-als.so|libmm-color-convertor.so|libmm-disp-apis.so|libmm-qdcm.so|libsd_sdk_display.so|mm-pp-daemon|mm-pp-dpps|PPPreference.apk";
#DivX (DRM) [DivX]
blobs=$blobs"|libDivxDrm.so|libSHIMDivxDrm.so";
#DPM (Data Power Management) [Qualcomm]
blobs=$blobs"|com.qti.dpmframework.jar|com.qti.dpmframework.xml|dpmapi.jar|dpmapi.xml|dpm.conf|dpmd|dpmserviceapp.apk|libdpmctmgr.so|libdpmfdmgr.so|libdpmframework.so|libdpmnsrm.so|libdpmtcm.so|NsrmConfiguration.xml|tcmclient.jar";
#DRM
blobs=$blobs"|lib-sec-disp.so|libSecureUILib.so|libsecureui.so|libsecureuisvc_jni.so|libsecureui_svcsock.so";
blobs=$blobs"|liboemcrypto.so|libtzdrmgenprov.so";
blobs=$blobs"|libpvr.so|librmp.so|libsi.so|libSSEPKCS11.so";
#Face Unlock [Google]
blobs=$blobs"|libfacenet.so|libfilterpack_facedetect.so|libfrsdk.so";
#GPS [Qualcomm]
#blobs=$blobs"|flp.conf|flp.default.so|flp.msm8084.so|flp.msm8960.so|gpsd|gps.msm8084.so|gps.msm8960.so|libflp.so|libgps.utils.so|libloc_api_v02.so|libloc_core.so|libloc_ds_api.so|libloc_eng.so|libloc_ext.so";
#HDCP (DRM)
blobs=$blobs"|libmm-hdcpmgr.so";
blobs=$blobs"|hdcp1.b00|hdcp1.b01|hdcp1.b02|hdcp1.b03|hdcp1.b04|hdcp1.b05|hdcp1.b06|hdcp1.mdt|tzhdcp.b00|tzhdcp.b01|tzhdcp.b02|tzhdcp.b03|tzhdcp.mdt";
#[HTC]
blobs=$blobs"|gptauuid.xml";
blobs=$blobs"|htc_drmprov.b00|htc_drmprov.b01|htc_drmprov.b02|htc_drmprov.b03|htc_drmprov.b04|htc_drmprov.b05|htc_drmprov.b06|htc_drmprov.mdt|gpsample.mbn";
#I/O Prefetcher [Qualcomm]
blobs=$blobs"|libqc-opt.so";
blobs=$blobs"|iop|libqti-iop-client.so|libqti-iop.so|QPerformance.jar";
#IMS (VoLTE/Wi-Fi Calling) [Qualcomm]
#blobs=$blobs"|ims.apk|ims.xml|libimsmedia_jni.so"; #IMS (Core) (To support carriers that have phased out 2G)
blobs=$blobs"|imscmlibrary.jar|imscmservice|imscm.xml|imsdatadaemon|imsqmidaemon|imssettings.apk|lib-imsdpl.so|lib-imscamera.so|libimscamera_jni.so|lib-imsqimf.so|lib-imsSDP.so|lib-imss.so|lib-imsvt.so|lib-imsxml.so"; #IMS
blobs=$blobs"|ims_rtp_daemon|lib-rtpcommon.so|lib-rtpcore.so|lib-rtpdaemoninterface.so|lib-rtpsl.so"; #RTP
blobs=$blobs"|lib-dplmedia.so|librcc.so|libvcel.so|libvoice-svc.so|qti_permissions.xml"; #Misc.
#blobs=$blobs"|volte_modem[/]";
#IPA (Internet Packet Accelerator) [Qualcomm]
#This is actually open source (excluding -diag)
#blobs=$blobs"|ipacm";
blobs=$blobs"|ipacm-diag";
#makes=$makes"|ipacm|IPACM_cfg.xml";
#kernels=$kernels" drivers/platform/msm/ipa";
#Keystore/TrustZone (HW Crypto) [Qualcomm]
#blobs=$blobs"|qseecomd|keystore.qcom.so|libdrmdecrypt.so|libdrmfs.so|libdrmtime.so|libQSEEComAPI.so|librpmb.so|libssd.so";
#blobs=$blobs"|keymaster.b00|keymaster.b01|keymaster.b02|keymaster.b03|keymaster.flist|keymaster.mdt";
#blobs=$blobs"|tzapps.b00|tzapps.b01|tzapps.b02|tzapps.b03|tzapps.mdt";
#Location (gpsOne/gpsOneXTRA/IZat/Lumicast/QUIP) [Qualcomm]
blobs=$blobs"|cacert_location.pem|com.qti.location.sdk.jar|com.qti.location.sdk.xml|com.qualcomm.location.apk|com.qualcomm.location.xml|com.qualcomm.services.location.apk|gpsone_daemon|izat.conf|izat.xt.srv.jar|izat.xt.srv.xml|libalarmservice_jni.so|libasn1cper.so|libasn1crt.so|libasn1crtx.so|libdataitems.so|libdrplugin_client.so|libDRPlugin.so|libevent_observer.so|libgdtap.so|libgeofence.so|libizat_core.so|liblbs_core.so|liblocationservice_glue.so|liblocationservice.so|libloc_ext.so|libloc_xtra.so|liblowi_client.so|liblowi_wifihal_nl.so|liblowi_wifihal.so|libquipc_os_api.so|libquipc_ulp_adapter.so|libulp2.so|libxtadapter.so|libxt_native.so|libxtwifi_ulp_adaptor.so|libxtwifi_zpp_adaptor.so|location-mq|loc_launcher|lowi.conf|lowi-server|slim_ap_daemon|slim_daemon|xtra_root_cert.pem|xtra_t_app.apk|xtwifi.conf|xtwifi-client|xtwifi-inet-agent";
overlay=$overlay"config_comboNetworkLocationProvider|config_enableFusedLocationOverlay|config_enableNetworkLocationOverlay|config_fusedLocationProviderPackageName|config_enableNetworkLocationOverlay|config_networkLocationProviderPackageName|com.qualcomm.location";
#Misc
blobs=$blobs"|libjni_latinime.so|libuiblur.so|libwifiscanner.so";
#[Motorola]
blobs=$blobs"|AppDirectedSMSProxy.apk|BuaContactAdapter.apk|batt_health|com.motorola.DirectedSMSProxy.xml|com.motorola.motosignature.jar|com.motorola.motosignature.xml|com.motorola.camera.xml|com.motorola.gallery.xml|com.motorola.msimsettings.xml|com.motorola.triggerenroll.xml|MotoDisplayFWProxy.apk|MotoSignatureApp.apk|TriggerEnroll.apk|TriggerTrainingService.apk";
makes=$makes"|com.motorola.cameraone.xml";
#Performance [Qualcomm]
#blobs=$blobs"|msm_irqbalance";
#Devices utilizing perfd won't hotplug cores without it
#Attempted to replace this with showp1984's msm_mpdecision, but the newer kernels simply don't have the mach_msm dependencies that are needed
#blobs=$blobs"|mpdecision|libqti-perfd-client.so|perfd|perf-profile0.conf|perf-profile1.conf|perf-profile2.conf|perf-profile3.conf|perf-profile4.conf|perf-profile5.conf";
#Playready (DRM) [Microsoft]
blobs=$blobs"|libtzplayready.so"
blobs=$blobs"|playread.b00|playread.b01|playread.b02|playread.b03|playread.mdt";
#Project Fi [Google]
blobs=$blobs"|Tycho.apk";
#Quickboot [Qualcomm]
blobs=$blobs"|QuickBoot.apk";
#QTI (Tethering Extensions) [Qualcomm]
blobs=$blobs"|libQtiTether.so|QtiTetherService.apk";
#RCS (Proprietary messaging protocol)
blobs=$blobs"|rcsimssettings.jar|rcsimssettings.xml|rcsservice.jar|rcsservice.xml|lib-imsrcscmclient.so|lib-ims-rcscmjni.so|lib-imsrcscmservice.so|lib-imsrcscm.so|lib-imsrcs.so|lib-rcsimssjni.so|lib-rcsjni.so"; #RCS
#SecProtect [Qualcomm]
blobs=$blobs"|SecProtect.apk";
#SecureUI Frontends
blobs=$blobs"|libHealthAuthClient.so|libHealthAuthJNI.so|libSampleAuthJNI.so|libSampleAuthJNIv1.so|libSampleExtAuthJNI.so|libSecureExtAuthJNI.so|libSecureSampleAuthClient.so";
#SoundFX [Sony]
blobs=$blobs"|libsonypostprocbundle.so|libsonysweffect.so";
#[Sprint]
blobs=$blobs"|com.android.omadm.service.xml|ConnMO.apk|CQATest.apk|DCMO.apk|DiagMon.apk|DMConfigUpdate.apk|DMService.apk|GCS.apk|HiddenMenu.apk|libdmengine.so|libdmjavaplugin.so|LifetimeData.apk|SprintDM.apk|SprintHM.apk|whitelist_com.android.omadm.service.xml";
#Thermal Throttling [Qualcomm]
#blobs=$blobs"|libthermalclient.so|libthermalioctl.so|thermal-engine";
#Time Service [Qualcomm]
#Requires that https://github.com/LineageOS/android_hardware_sony_timekeep be included in repo manifest
#blobs=$blobs"|libtime_genoff.so"; #XXX: Breaks radio
#blobs=$blobs"|libTimeService.so|time_daemon|TimeService.apk";
#Venus (Hardware Video Decoding) [Qualcomm]
#blobs=$blobs"|venus.b00|venus.b01|venus.b02|venus.b03|venus.b04|venus.mbn|venus.mdt";
#[Verizon]
blobs=$blobs"|com.qualcomm.location.vzw_library.jar|com.qualcomm.location.vzw_library.xml|com.verizon.apn.xml|com.verizon.embms.xml|com.verizon.hardware.telephony.ehrpd.jar|com.verizon.hardware.telephony.ehrpd.xml|com.verizon.hardware.telephony.lte.jar|com.verizon.hardware.telephony.lte.xml|com.verizon.ims.jar|com.verizon.ims.xml|com.verizon.provider.xml|com.vzw.vzwapnlib.xml|qti-vzw-ims-internal.jar|qti-vzw-ims-internal.xml|VerizonUnifiedSettings.jar|VZWAPNLib.apk|VZWAPNService.apk|VZWAVS.apk|VzwLcSilent.apk|vzw_msdc_api.apk|VzwOmaTrigger.apk|vzw_sso_permissions.xml";
#Voice Recognition
blobs=$blobs"|aonvr1.bin|aonvr2.bin|audiomonitor|es305_fw.bin|HotwordEnrollment.apk|HotwordEnrollmentRT5677.apk|libadpcmdec.so|liblistenhardware.so|liblistenjni.so|liblisten.so|liblistensoundmodel.so|libqvop-service.so|librecoglib.so|libsmwrapper.so|libsupermodel.so|libtrainingcheck.so|qvop-daemon|sound_trigger.primary.msm8916.so|sound_trigger.primary.msm8996.so";
#Vulkan [Qualcomm]
#blobs=$blobs"|libllvm-qgl.so|vulkan.msm*.so";
#Wfd (Wireless Display) [Qualcomm]
blobs=$blobs"|libmmparser_lite.so|libmmrtpdecoder.so|libmmrtpencoder.so|libmmwfdinterface.so|libmmwfdsinkinterface.so|libmmwfdsrcinterface.so|libwfdavenhancements.so|libwfdcommonutils.so|libwfdhdcpcp.so|libwfdmmsink.so|libwfdmmsrc.so|libwfdmmutils.so|libwfdnative.so|libwfdrtsp.so|libwfdservice.so|libwfdsm.so|libwfduibcinterface.so|libwfduibcsinkinterface.so|libwfduibcsink.so|libwfduibcsrcinterface.so|libwfduibcsrc.so|WfdCommon.jar|wfdconfigsink.xml|wfdconfig.xml|wfdservice|WfdService.apk";
#Widevine (DRM) [Google]
blobs=$blobs"|com.google.widevine.software.drm.jar|com.google.widevine.software.drm.xml|libdrmclearkeyplugin.so|libdrmwvmplugin.so|libmarlincdmplugin.so|libwvdrmengine.so|libwvdrm_L1.so|libwvdrm_L3.so|libwvm.so|libWVphoneAPI.so|libWVStreamControlAPI_L1.so|libWVStreamControlAPI_L3.so";
blobs=$blobs"|tzwidevine.b00|tzwidevine.b01|tzwidevine.b02|tzwidevine.b03|tzwidevine.mdt|tzwvcpybuf.b00|tzwvcpybuf.b01|tzwvcpybuf.b02|tzwvcpybuf.b03|tzwvcpybuf.flist|tzwvcpybuf.mdt|widevine.b00|widevine.b01|widevine.b02|widevine.b03|widevine.b04|widevine.b05|widevine.b06|widevine.mbn|widevine.mdt";
makes=$makes"|libshim_wvm";
#WiPower (Wireless Charging) [Qualcomm]
blobs=$blobs"|a4wpservice.apk|com.quicinc.wbc.jar|com.quicinc.wbcserviceapp.apk|com.quicinc.wbcservice.jar|com.quicinc.wbcservice.xml|com.quicinc.wbc.xml|libwbc_jni.so|wbc_hal.default.so";
makes=$makes"|android.wipower|android.wipower.xml|com.quicinc.wbcserviceapps|libwipower_jni|wipowerservice";
export blobs;
export makes;
export overlay;
export kernels;
#
#END OF BLOBS ARRAY
#
#
#START OF FUNCTIONS
#
deblobDevice() {
devicePath=$1;
cd $base$devicePath;
if [ "${PWD##*/}" == "flo" ] || [ "${PWD##*/}" == "mako" ] || [ "${PWD##*/}" == "kona-common" ] || [ "${PWD##*/}" == "n5110" ] || [ "${PWD##*/}" == "smdk4412-common" ] || [ "${PWD##*/}" == "hdx-common" ] || [ "${PWD##*/}" == "thor" ] || [ "${PWD##*/}" == "flounder" ]; then #Some devices don't need/like TimeKeep
replaceTime="false";
fi;
replaceTime="false"; #Temp disable replacement
if [ -f Android.mk ]; then
#Some devices store these in a dedicated firmware partition, others in /system/vendor/firmware, either way the following are just symlinks
#sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(CMN_SYMLINKS)//' Android.mk; #Remove CMN firmware
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(DXHDCP2_SYMLINKS)//' Android.mk; #Remove Discretix firmware
#sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(IMS_SYMLINKS)//' Android.mk; #Remove IMS firmware
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(PLAYREADY_SYMLINKS)//' Android.mk; #Remove Microsoft Playready firmware
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(WIDEVINE_SYMLINKS)//' Android.mk; #Remove Google Widevine firmware
sed -i '/ALL_DEFAULT_INSTALLED_MODULES/s/$(WV_SYMLINKS)//' Android.mk; #Remove Google Widevine firmware
fi;
if [ -f BoardConfig.mk ]; then
if [ -z "$replaceTime" ]; then
sed -i 's/BOARD_USES_QC_TIME_SERVICES := true/BOARD_USES_QC_TIME_SERVICES := false/' BoardConfig.mk; #Switch to Sony TimeKeep
if ! grep -q "BOARD_USES_QC_TIME_SERVICES := false" BoardConfig.mk; then echo "BOARD_USES_QC_TIME_SERVICES := false" >> BoardConfig.mk; fi; #Switch to Sony TimeKeep
fi;
sed -i 's/BOARD_USES_QCNE := true/BOARD_USES_QCNE := false/' BoardConfig.mk; #Disable CNE
sed -i 's/BOARD_USES_WIPOWER := true/BOARD_USES_WIPOWER := false/' BoardConfig.mk; #Disable WiPower
fi;
if [ -f device.mk ]; then
awk -i inplace '!/'$makes'/' device.mk; #Remove all shim references from device makefile
if [ -z "$replaceTime" ]; then
#Switch to Sony TimeKeep
echo "PRODUCT_PACKAGES += \\" >> device.mk;
echo " timekeep \\" >> device.mk;
echo " TimeKeep" >> device.mk;
fi;
fi;
if [ -f "${PWD##*/}".mk ] && [ "${PWD##*/}".mk != "sepolicy" ]; then
awk -i inplace '!/'$makes'/' "${PWD##*/}".mk; #Remove all shim references from device makefile
if [ -z "$replaceTime" ]; then
#Switch to Sony TimeKeep
echo "PRODUCT_PACKAGES += \\" >> "${PWD##*/}".mk;
echo " timekeep \\" >> "${PWD##*/}".mk;
echo " TimeKeep" >> "${PWD##*/}".mk;
fi;
fi;
if [ -f system.prop ]; then
awk -i inplace '!/persist.loc.nlp_name/' system.prop; #Disable QC Location Provider
sed -i 's/drm.service.enabled=true/drm.service.enabled=false/' system.prop;
if ! grep -q "drm.service.enabled=false" system.prop; then echo "drm.service.enabled=false" >> system.prop; fi; #Disable DRM server
sed -i 's/persist.bt.enableAptXHD=true/persist.bt.enableAptXHD=false/' system.prop; #Disable aptX
sed -i 's/persist.cne.feature=./persist.cne.feature=0/' system.prop; #Disable CNE
sed -i 's/persist.dpm.feature=./persist.dpm.feature=0/' system.prop; #Disable DPM
sed -i 's/persist.gps.qc_nlp_in_use=./persist.gps.qc_nlp_in_use=0/' system.prop; #Disable QC Location Provider
sed -i 's/persist.sys.dpmd.nsrm=./persist.sys.dpmd.nsrm=0/' system.prop; #Disable DPM
sed -i 's/persist.rcs.supported=./persist.rcs.supported=0/' system.prop; #Disable RCS
sed -i 's/ro.bluetooth.emb_wp_mode=true/ro.bluetooth.emb_wp_mode=false/' system.prop; #Disable WiPower
sed -i 's/ro.bluetooth.wipower=true/ro.bluetooth.wipower=false/' system.prop; #Disable WiPower
#Disable IMS
#sed -i 's/persist.data.iwlan.enable=true/persist.data.iwlan.enable=false/' system.prop;
#sed -i 's/persist.ims.volte=true/persist.ims.volte=false/' system.prop;
#sed -i 's/persist.ims.vt=true/persist.ims.vt=false/' system.prop;
#sed -i 's/persist.radio.calls.on.ims=true/persist.radio.calls.on.ims=false/' system.prop;
#sed -i 's/persist.radio.hw_mbn_update=./persist.radio.hw_mbn_update=0/' system.prop;
#sed -i 's/persist.radio.jbims=./persist.radio.jbims=0/' system.prop;
#sed -i 's/persist.radio.sw_mbn_update=./persist.radio.sw_mbn_update=0/' system.prop;
#sed -i 's/persist.radio.sw_mbn_volte=./persist.radio.sw_mbn_volte=0/' system.prop;
#sed -i 's/persist.radio.VT_ENABLE=./persist.radio.VT_ENABLE=0/' system.prop;
#sed -i 's/persist.radio.VT_HYBRID_ENABLE=./persist.radio.VT_HYBRID_ENABLE=0/' system.prop;
#sed -i 's/persist.volte_enabled_by_hw=./persist.volte_enabled_by_hw=0/' system.prop;
fi;
if [ -f configs/qmi_config.xml ]; then
sed -i 's|name="dpm_enabled" type="int"> 1 <|name="dpm_enabled" type="int"> 0 <|' configs/qmi_config.xml; #Disable DPM
fi;
if [ -f init/init_*.cpp ]; then
sed -i 's/property_set("persist.rcs.supported", ".");/property_set("persist.rcs.supported", "0");/' init/init_*.cpp; #Disable RCS
#Disable IMS
#sed -i 's/property_set("persist.ims.volte", "true");/property_set("persist.ims.volte", "false");/' init/init_*.cpp;
#sed -i 's/property_set("persist.ims.vt", "true");/property_set("persist.ims.vt", "false");/' init/init_*.cpp;
#sed -i 's/property_set("persist.radio.calls.on.ims", "true");/property_set("persist.radio.calls.on.ims", "false");/' init/init_*.cpp;
#sed -i 's/property_set("persist.radio.jbims", ".");/property_set("persist.radio.jbims", "0");/' init/init_*.cpp;
#sed -i 's/property_set("persist.radio.VT_ENABLE", ".");/property_set("persist.radio.VT_ENABLE", "0");/' init/init_*.cpp;
#sed -i 's/property_set("persist.radio.VT_HYBRID_ENABLE", ".");/property_set("persist.radio.VT_HYBRID_ENABLE", "0");/' init/init_*.cpp;
fi;
if [ -f overlay/frameworks/base/core/res/res/values/config.xml ]; then
awk -i inplace '!/'$overlay'/' overlay/frameworks/base/core/res/res/values/config.xml;
#sed -i 's|<bool name="config_enableWifiDisplay">true</bool>|<bool name="config_enableWifiDisplay">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
sed -i 's|<bool name="config_uiBlurEnabled">true</bool>|<bool name="config_uiBlurEnabled">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml; #Disable UIBlur
#Disable IMS
#sed -i 's|<bool name="config_carrier_volte_available">true</bool>|<bool name="config_carrier_volte_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
#sed -i 's|<bool name="config_carrier_vt_available">true</bool>|<bool name="config_carrier_vt_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
#sed -i 's|<bool name="config_device_volte_available">true</bool>|<bool name="config_device_volte_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
#sed -i 's|<bool name="config_device_vt_available">true</bool>|<bool name="config_device_vt_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
#sed -i 's|<bool name="config_device_wfc_ims_available">true</bool>|<bool name="config_device_wfc_ims_available">false</bool>|' overlay/frameworks/base/core/res/res/values/config.xml;
fi;
if [ -d sepolicy ]; then
if [ -z "$replaceTime" ]; then
#Switch to Sony TimeKeep
echo "allow system_app time_data_file:dir { create_dir_perms search };" >> sepolicy/system_app.te;
echo "allow system_app time_data_file:file create_file_perms;" >> sepolicy/system_app.te;
fi;
fi;
if [ -z "$replaceTime" ]; then sed -i 's|service time_daemon /system/bin/time_daemon|service timekeep /system/bin/timekeep restore\n oneshot|' init.*.rc rootdir/init.*.rc rootdir/etc/init.*.rc &> /dev/null || true; fi; #Switch to Sony TimeKeep
rm -f board/qcom-cne.mk product/qcom-cne.mk; #Remove CNE
rm -f rootdir/etc/init.qti.ims.sh rootdir/init.qti.ims.sh init.qti.ims.sh; #Remove IMS startup script
rm -rf IMSEnabler; #Remove IMS compatibility module
#rm -rf data-ipa-cfg-mgr; #Remove IPA
rm -rf libshimwvm libshims/wvm_shim.cpp; #Remove Google Widevine compatibility module
rm -rf board/qcom-wipower.mk product/qcom-wipower.mk; #Remove WiPower makefiles
if [ -f setup-makefiles.sh ]; then
awk -i inplace '!/'$blobs'/' *proprietary*.txt; #Remove all blob references from blob manifest
bash -c "cd $base$devicePath && ./setup-makefiles.sh"; #Update the makefiles
fi;
cd $base;
}
export -f deblobDevice;
deblobKernel() {
kernelPath=$1;
cd $base$kernelPath;
rm -rf $kernels;
cd $base;
}
export -f deblobKernel;
deblobVendors() {
cd $base;
find vendor -regextype posix-extended -regex '.*('$blobs')' -type f -delete; #Delete all blobs
}
export -f deblobVendors;
deblobVendor() {
makefile=$1;
cd $base;
awk -i inplace '!/'$blobs'/' $makefile; #Remove all blob references from makefile
}
export -f deblobVendor;
#
#END OF FUNCTIONS
#
#
#START OF DEBLOBBING
#
find device -maxdepth 2 -mindepth 2 -type d -exec bash -c 'deblobDevice "$0"' {} \; #Deblob all device directories
#find kernel -maxdepth 2 -mindepth 2 -type d -exec bash -c 'deblobKernel "$0"' {} \; #Deblob all kernel directories
find vendor -name "*vendor*.mk" -type f -exec bash -c 'deblobVendor "$0"' {} \; #Deblob all makefiles
deblobVendors; #Deblob entire vendor directory
rm -rf frameworks/av/drm/mediadrm/plugins/clearkey; #Remove Clearkey
rm -rf vendor/samsung/nodevice;
#
#END OF DEBLOBBING
#
#setup-makefiles doesn't execute properly for some devices, running it twice seems to fix whatever is wrong
cd device/asus/Z00T && ./setup-makefiles.sh && cd $base
cd device/lge/h850 && ./setup-makefiles.sh && cd $base
#Fixes marlin building, really janky (recursive symlinks) and probably not the best place for it [LAOS SPECIFIC]
cd vendor/google/marlin/proprietary;
ln -s . vendor;
ln -s . lib/lib;
ln -s . lib64/lib64;
ln -s . app/app;
ln -s . bin/bin;
ln -s . etc/etc;
ln -s . framework/framework;
ln -s . priv-app/priv-app;
cd $base;
echo "Deblobbing complete!"

View File

@ -0,0 +1,165 @@
#!/bin/bash
#DivestOS: A privacy oriented Android distribution
#Copyright (c) 2017-2018 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/>.
startPatcher() {
#$cvePatcher must be set!
java -jar $cvePatcher patch $base $androidWorkspace"Patches/" $cveScripts $1;
}
export -f startPatcher;
patchAllKernels() {
startPatcher "kernel_zte_nex";
}
export -f patchAllKernels;
enter() {
echo "================================================================================================"
dir=$1;
cd $base$dir;
echo "[ENTERING] "$dir;
}
export -f enter;
enterAndClear() {
enter $1;
gitReset;
}
export -f enterAndClear;
gitReset() {
git add -A && git reset --hard;
}
export -f gitReset;
resetWorkspace() {
repo forall -c 'git add -A && git reset --hard' && rm -rf packages/apps/{FDroid,GmsCore} out && repo sync -j20 --force-sync;
}
export -f resetWorkspace;
buildDevice() {
brunch lineage_$1-user;
}
export -f buildDevice;
buildAll() {
#Select devices are userdebug due to SELinux policy issues
brunch lineage_nex-userdebug;
}
export -f buildAll;
patchWorkspace() {
source $scripts/Patch.sh;
source $scripts/Rebrand.sh;
source $scripts/Deblob.sh;
source $scripts/Patch_CVE.sh;
source build/envsetup.sh;
}
export -f patchWorkspace;
compressRamdisks() {
if [ -f BoardConfig.mk ]; then
echo "LZMA_RAMDISK_TARGETS := boot,recovery" >> BoardConfig.mk;
echo "Enabled ramdisk compression";
fi;
}
export -f compressRamdisks;
enhanceLocation() {
cd $base$1;
#Enable GLONASS
#sed -i 's/#A_GLONASS_POS_PROTOCOL_SELECT/A_GLONASS_POS_PROTOCOL_SELECT/' gps.conf gps/gps.conf configs/gps.conf &>/dev/null || true;
#sed -i 's/A_GLONASS_POS_PROTOCOL_SELECT = 0.*/A_GLONASS_POS_PROTOCOL_SELECT = 15/' gps.conf gps/gps.conf configs/gps.conf &>/dev/null || true;
#sed -i 's|A_GLONASS_POS_PROTOCOL_SELECT=0.*</item>|A_GLONASS_POS_PROTOCOL_SELECT=15</item>|' overlay/frameworks/base/core/res/res/values-*/*.xml &>/dev/null || true;
#Recommended reading: https://wwws.nightwatchcybersecurity.com/2016/12/05/cve-2016-5341/
#XTRA: Only use specified URLs
sed -i 's|XTRA_SERVER_QUERY=1|XTRA_SERVER_QUERY=0|' gps.conf gps/gps.conf configs/gps.conf &>/dev/null || true;
sed -i 's|#XTRA_SERVER|XTRA_SERVER|' gps.conf gps/gps.conf configs/gps.conf &>/dev/null || true;
#XTRA: Enable HTTPS
sed -i 's|http://xtra|https://xtra|' overlay/frameworks/base/core/res/res/values-*/*.xml gps.conf gps/gps.conf configs/gps.conf &>/dev/null || true;
#XTRA: Use format version 3 if possible
if grep -sq "XTRA_VERSION_CHECK" gps.conf gps/gps.conf configs/gps.conf; then #Using hardware/qcom/gps OR precompiled blob OR device specific implementation
sed -i 's|XTRA_VERSION_CHECK=0|XTRA_VERSION_CHECK=1|' gps.conf gps/gps.conf configs/gps.conf &>/dev/null || true;
sed -i 's|xtra2.bin|xtra3grc.bin|' gps.conf gps/gps.conf configs/gps.conf &>/dev/null || true;
elif grep -sq "BOARD_VENDOR_QCOM_LOC_PDK_FEATURE_SET := true" BoardConfig.mk boards/*gps.mk; then
if ! grep -sq "USE_DEVICE_SPECIFIC_LOC_API := true" BoardConfig.mk boards/*gps.mk; then
if ! grep -sq "libloc" *proprietary*.txt; then #Using hardware/qcom/gps
sed -i 's|xtra2.bin|xtra3grc.bin|' gps.conf gps/gps.conf configs/gps.conf &>/dev/null || true;
fi;
fi;
fi;
echo "Enhanced location services for $1";
cd $base;
}
export -f enhanceLocation;
getDefconfig() {
if ls arch/arm/configs/lineage*defconfig 1> /dev/null 2>&1; then
defconfigPath="arch/arm/configs/lineage*defconfig";
elif ls arch/arm64/configs/lineage*defconfig 1> /dev/null 2>&1; then
defconfigPath="arch/arm64/configs/lineage*defconfig";
else
defconfigPath="arch/arm/configs/*defconfig arch/arm64/configs/*defconfig";
fi;
echo $defconfigPath;
#echo "Found defconfig at $defconfigPath"
}
export -f getDefconfig;
editKernelLocalversion() {
defconfigPath=$(getDefconfig)
sed -i 's/CONFIG_LOCALVERSION=".*"/CONFIG_LOCALVERSION="'$1'"/' $defconfigPath &>/dev/null || true;
}
export -f editKernelLocalversion;
hardenDefconfig() {
cd $base$1;
#Attempts to enable/disable supported options to increase security
#See https://kernsec.org/wiki/index.php/Kernel_Self_Protection_Project/Recommended_Settings
defconfigPath=$(getDefconfig)
#Enable supported options
#Disabled: CONFIG_DEBUG_SG (bootloops - https://patchwork.kernel.org/patch/8989981)
declare -a optionsYes=("CONFIG_ARM64_SW_TTBR0_PAN" "CONFIG_BUG" "CONFIG_BUG_ON_DATA_CORRUPTION" "CONFIG_CC_STACKPROTECTOR" "CONFIG_CC_STACKPROTECTOR_STRONG" "CONFIG_CPU_SW_DOMAIN_PAN" "CONFIG_DEBUG_CREDENTIALS" "CONFIG_DEBUG_KERNEL" "CONFIG_DEBUG_LIST" "CONFIG_DEBUG_NOTIFIERS" "CONFIG_DEBUG_RODATA" "CONFIG_DEBUG_WX" "CONFIG_FORTIFY_SOURCE" "CONFIG_GCC_PLUGIN_LATENT_ENTROPY" "CONFIG_GCC_PLUGIN_RANDSTRUCT" "CONFIG_GCC_PLUGINS" "CONFIG_GCC_PLUGIN_STRUCTLEAK" "CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL" "CONFIG_HARDENED_USERCOPY" "CONFIG_IO_STRICT_DEVMEM" "CONFIG_KAISER" "CONFIG_LEGACY_VSYSCALL_NONE" "CONFIG_PAGE_POISONING" "CONFIG_PAGE_POISONING_NO_SANITY" "CONFIG_PAGE_POISONING_ZERO" "CONFIG_PAGE_TABLE_ISOLATION" "CONFIG_PANIC_ON_OOPS" "CONFIG_RANDOMIZE_BASE" "CONFIG_REFCOUNT_FULL" "CONFIG_RETPOLINE" "CONFIG_SCHED_STACK_END_CHECK" "CONFIG_SECCOMP" "CONFIG_SECCOMP_FILTER" "CONFIG_SECURITY" "CONFIG_SECURITY_PERF_EVENTS_RESTRICT" "CONFIG_SECURITY_YAMA" "CONFIG_SECURITY_YAMA_STACKED" "CONFIG_SLAB_FREELIST_RANDOM" "CONFIG_SLAB_HARDENED" "CONFIG_SLUB_DEBUG" "CONFIG_STRICT_DEVMEM" "CONFIG_STRICT_KERNEL_RWX" "CONFIG_STRICT_MEMORY_RWX" "CONFIG_SYN_COOKIES" "CONFIG_UNMAP_KERNEL_AT_EL0" "CONFIG_VMAP_STACK")
for option in "${optionsYes[@]}"
do
sed -i 's/# '$option' is not set/'$option'=y/' $defconfigPath &>/dev/null || true;
#Some defconfigs are very minimal/not-autogenerated, so lets add the rest. Obviously most won't have any affect as they aren't supported.
if [[ $defconfigPath == *"lineage"* ]]; then
if ! grep -q $option"=y" $defconfigPath; then
echo $option"=y" | tee -a $defconfigPath > /dev/null;
fi;
fi;
done
#Disable supported options
#TODO: Disable earjack/uart debugger
declare -a optionsNo=("CONFIG_ACPI_CUSTOM_METHOD" "CONFIG_BINFMT_MISC" "CONFIG_COMPAT_BRK" "CONFIG_COMPAT_VDSO" "CONFIG_CP_ACCESS64" "CONFIG_DEVKMEM" "CONFIG_DEVMEM" "CONFIG_DEVPORT" "CONFIG_HIBERNATION" "CONFIG_INET_DIAG" "CONFIG_KEXEC" "CONFIG_LEGACY_PTYS" "CONFIG_MSM_BUSPM_DEV" "CONFIG_OABI_COMPAT" "CONFIG_PROC_KCORE" "CONFIG_PROC_VMCORE" "CONFIG_SECURITY_SELINUX_DISABLE" "CONFIG_SLAB_MERGE_DEFAULT")
for option in "${optionsNo[@]}"
do
sed -i 's/'$option'=y/# '$option' is not set/' $defconfigPath &>/dev/null || true;
done
#Extras
sed -i 's/CONFIG_DEFAULT_MMAP_MIN_ADDR=4096/CONFIG_DEFAULT_MMAP_MIN_ADDR=32768/' $defconfigPath &>/dev/null || true;
sed -i 's/CONFIG_LSM_MMAP_MIN_ADDR=4096/CONFIG_DEFAULT_MMAP_MIN_ADDR=32768/' $defconfigPath &>/dev/null || true;
editKernelLocalversion "-dos";
echo "Hardened defconfig for $1";
cd $base;
}
export -f hardenDefconfig;

94
Scripts/LineageOS-11.0/Patch.sh Executable file
View File

@ -0,0 +1,94 @@
#!/bin/bash
#DivestOS: A privacy oriented Android distribution
#Copyright (c) 2015-2018 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/>.
#Initialize aliases
#source ../../Scripts/LineageOS-11.0/00init.sh
#Delete Everything and Sync
#resetWorkspace
#Apply all of our changes
#patchWorkspace
#Build!
#buildDevice [device]
#buildAll
#Generate an incremental
#./build/tools/releasetools/ota_from_target_files --block -t 8 -i old.zip new.zip update.zip
#Generate firmware deblobber
#mka firmware_deblobber
#
#START OF PREPRATION
#
#Download some (non-executable) out-of-tree files for use later on
mkdir /tmp/ar
cd /tmp/ar
wget https://spotco.us/hosts -N #XXX: /hosts is built from non-commercial use files, switch to /hsc for release
#Accept all SDK licences, not normally needed but Gradle managed apps fail without it
mkdir -p "$ANDROID_HOME/licenses"
echo -e "\n8933bad161af4178b1185d1a37fbf41ea5269c55\nd56f5187479451eabf01fb78af6dfcb131a6481e" > "$ANDROID_HOME/licenses/android-sdk-license"
echo -e "\n84831b9409646a918e30573bab4c9c91346d8abd" > "$ANDROID_HOME/licenses/android-sdk-preview-license"
#
#END OF PREPRATION
#
#
#START OF ROM CHANGES
#
#top dir
cp -r $prebuiltApps"Fennec_DOS-Shim" $base"packages/apps/"; #Add a shim to install Fennec DOS without actually including the large APK
cp -r $prebuiltApps"android_vendor_FDroid_PrebuiltApps/." $base"vendor/fdroid_prebuilt/"; #Add the prebuilt apps
enter "packages/apps/Settings"
patch -p1 < $patches"android_packages_apps_Settings/0001-CMStats.patch"; #Remove CMStats
enter "vendor/cm"
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
#
#END OF ROM CHANGES
#
#
#START OF DEVICE CHANGES
#
enter "device/zte/nex"
patch -p1 < $patches"android_device_zte_nex/Fixes.patch"
patch -p1 < $patches"android_device_zte_nex/Lower_DPI.patch"
mv cm.mk lineage.mk
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"
patch -p1 < $patches"android_kernel_zte_msm8930/MDP-Fix.patch"
patch -p1 < $patches"android_kernel_zte_msm8930/Timeconst-Fix.patch"
#Make changes to all devices
cd $base
find "device" -maxdepth 2 -mindepth 2 -type d -exec bash -c 'enhanceLocation "$0"' {} \;
find "kernel" -maxdepth 2 -mindepth 2 -type d -exec bash -c 'hardenDefconfig "$0"' {} \;
cd $base
#
#END OF DEVICE CHANGES
#

View File

@ -0,0 +1,31 @@
#!/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/>.
#Attempts to patch kernels to be more secure
#Is this the best way to do it? No. Is it the proper way to do it? No. Do I wish device maintainers would do it? Yes. Is it better then nothing? YES!
echo "Patching CVEs..."
cd $base
for patcher in $cveScripts/*.sh; do
echo "Running " $patcher;
source $patcher;
done;
cd $base
echo "Patched CVEs!"

View File

@ -0,0 +1,43 @@
#!/bin/bash
#DivestOS: A privacy oriented Android distribution
#Copyright (c) 2017-2018 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..."
enter "bootable/recovery"
sed -i 's|Android Recovery|DivestOS Recovery|' *_ui.cpp;
enter "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
sed -i '/CM_TARGET_PACKAGE/s/lineage/coverage/' core/Makefile;
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 '/.*ZIPPATH=/s/lineage/coverage/' build/envsetup.sh;
rm -rf bootanimation #TODO: Create a boot animation
cd $base
echo "Rebranding complete!"