From 70ad6ff700f37e1bc7186084f6a9ac83ee3736bb Mon Sep 17 00:00:00 2001 From: Tad Date: Sat, 26 Aug 2017 15:11:54 -0400 Subject: [PATCH] Switch from CM to LAOS updater --- .../0001-Server.patch | 58 ------------------- .../0001-Server.patch | 33 +++++++++++ Scripts/LAOS-14.1_Patches.sh | 6 +- 3 files changed, 35 insertions(+), 62 deletions(-) delete mode 100644 Patches/LineageOS-14.1/android_packages_apps_CMUpdater/0001-Server.patch create mode 100644 Patches/LineageOS-14.1/android_packages_apps_Updater/0001-Server.patch diff --git a/Patches/LineageOS-14.1/android_packages_apps_CMUpdater/0001-Server.patch b/Patches/LineageOS-14.1/android_packages_apps_CMUpdater/0001-Server.patch deleted file mode 100644 index 4a6063fc..00000000 --- a/Patches/LineageOS-14.1/android_packages_apps_CMUpdater/0001-Server.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 1de0dbda5227a5f6be82df0575db75f354de486b Mon Sep 17 00:00:00 2001 -From: Tad -Date: Wed, 12 Jul 2017 05:18:42 -0400 -Subject: [PATCH] Switch to our update server - -Change-Id: Ia0faf61ab2dd3b300ac65841f1ce7e15d403552c ---- - .../updater/requests/UpdatesJsonObjectRequest.java | 3 ++- - src/com/cyanogenmod/updater/service/UpdateCheckService.java | 12 ++---------- - 2 files changed, 4 insertions(+), 11 deletions(-) - -diff --git a/src/com/cyanogenmod/updater/requests/UpdatesJsonObjectRequest.java b/src/com/cyanogenmod/updater/requests/UpdatesJsonObjectRequest.java -index 13d22b7..af9980b 100644 ---- a/src/com/cyanogenmod/updater/requests/UpdatesJsonObjectRequest.java -+++ b/src/com/cyanogenmod/updater/requests/UpdatesJsonObjectRequest.java -@@ -11,6 +11,7 @@ package com.cyanogenmod.updater.requests; - - import com.android.volley.AuthFailureError; - import com.android.volley.Response; -+import com.android.volley.Request; - import com.android.volley.toolbox.JsonObjectRequest; - import org.json.JSONObject; - -@@ -23,7 +24,7 @@ public class UpdatesJsonObjectRequest extends JsonObjectRequest { - - public UpdatesJsonObjectRequest(String url, String userAgent, JSONObject jsonRequest, - Response.Listener listener, Response.ErrorListener errorListener) { -- super(url, jsonRequest, listener, errorListener); -+ super(Request.Method.GET, url, jsonRequest, listener, errorListener); - mUserAgent = userAgent; - } - -diff --git a/src/com/cyanogenmod/updater/service/UpdateCheckService.java b/src/com/cyanogenmod/updater/service/UpdateCheckService.java -index 9fc81d6..18a3bf0 100644 ---- a/src/com/cyanogenmod/updater/service/UpdateCheckService.java -+++ b/src/com/cyanogenmod/updater/service/UpdateCheckService.java -@@ -200,16 +200,8 @@ public class UpdateCheckService extends IntentService - } - - private URI getServerURI() { -- String updateUri = SystemProperties.get("cm.updater.uri"); -- if (TextUtils.isEmpty(updateUri)) { -- updateUri = getString(R.string.conf_update_server_url_def); -- } -- -- String incrementalVersion = SystemProperties.get("ro.build.version.incremental"); -- updateUri += "/v1/" + Utils.getDeviceType() + "/" + -- Utils.getInstalledBuildType() + "/" + incrementalVersion; -- -- return URI.create(updateUri); -+ String incrementalVersion = SystemProperties.get("ro.build.version.incremental"); -+ return URI.create("https://divestos.xyz/updater.php?device=" + Utils.getDeviceType() + "&inc=" + incrementalVersion); - } - - private void getAvailableUpdates() { --- -2.13.2 - diff --git a/Patches/LineageOS-14.1/android_packages_apps_Updater/0001-Server.patch b/Patches/LineageOS-14.1/android_packages_apps_Updater/0001-Server.patch new file mode 100644 index 00000000..60a3e2ae --- /dev/null +++ b/Patches/LineageOS-14.1/android_packages_apps_Updater/0001-Server.patch @@ -0,0 +1,33 @@ +From 91f6cf3814a5d7e90068683f5526a8a6abc1b7fd Mon Sep 17 00:00:00 2001 +From: Tad +Date: Sat, 26 Aug 2017 16:06:23 -0400 +Subject: [PATCH] Switch to our update server + +Change-Id: I81967fd97e7c151100b93327501caf8d436a08e5 +--- + src/org/lineageos/updater/misc/Utils.java | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java +index f15be50..8e4fcb1 100644 +--- a/src/org/lineageos/updater/misc/Utils.java ++++ b/src/org/lineageos/updater/misc/Utils.java +@@ -144,14 +144,9 @@ public class Utils { + } + + public static String getServerURL(Context context) { +- String serverUrl = SystemProperties.get(Constants.PROP_UPDATER_URI); +- if (serverUrl.trim().isEmpty()) { +- serverUrl = context.getString(R.string.conf_update_server_url_def); +- } + String incrementalVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION_INCREMENTAL); + String device = SystemProperties.get(Constants.PROP_DEVICE); +- String type = SystemProperties.get(Constants.PROP_RELEASE_TYPE).toLowerCase(Locale.ROOT); +- return serverUrl + "/v1/" + device + "/" + type + "/" + incrementalVersion; ++ return "https://divestos.xyz/updater.php?device=" + device + "&inc=" + incrementalVersion; + } + + public static void triggerUpdate(Context context, String downloadId) { +-- +2.14.1 + diff --git a/Scripts/LAOS-14.1_Patches.sh b/Scripts/LAOS-14.1_Patches.sh index 9d944c09..947e1b46 100755 --- a/Scripts/LAOS-14.1_Patches.sh +++ b/Scripts/LAOS-14.1_Patches.sh @@ -104,10 +104,8 @@ rm -rf src/org/cyanogenmod/cmparts/cmstats/ res/xml/anonymous_stats.xml res/xml/ git fetch https://review.lineageos.org/LineageOS/android_packages_apps_CMParts refs/changes/15/113415/25 && git cherry-pick FETCH_HEAD #network traffic patch -p1 < $patches"android_packages_apps_CMParts/0001-Remove_Analytics.patch" #Remove the rest of CMStats -enter "packages/apps/CMUpdater" -patch -p1 < $patches"android_packages_apps_CMUpdater/0001-Server.patch" #Switch to our server -sed -i 's/CM_RELEASE_TYPE_DEFAULT = "UNOFFICIAL";/CM_RELEASE_TYPE_DEFAULT = "dos";/' src/com/cyanogenmod/updater/misc/Constants.java; #Change buildtype -sed -i 's/subStrings\[3\]\.length() < 7/subStrings\[3\]\.length() < 3/' src/com/cyanogenmod/updater/utils/Utils.java; #Fix not allowing buildtypes length < 7 +enter "packages/apps/Updater" +patch -p1 < $patches"android_packages_apps_Updater/0001-Server.patch" #Switch to our server enter "packages/apps/Dialer" sed -i 's/FLP_DEFAULT = FLP_GOOGLE;/FLP_DEFAULT = FLP_OPENSTREETMAP;/' src/com/android/dialer/lookup/LookupSettings.java; #Change default FLP to OpenStreetMap