diff --git a/src/org/lineageos/updater/UpdatesCheckReceiver.java b/src/org/lineageos/updater/UpdatesCheckReceiver.java index 28fa7f32f12be4a500a4a232f3b0438ce4c8e6fc..a6860e2933063bf231c63d5da3ff98a98a9066d1 100644 --- a/src/org/lineageos/updater/UpdatesCheckReceiver.java +++ b/src/org/lineageos/updater/UpdatesCheckReceiver.java @@ -67,12 +67,15 @@ public class UpdatesCheckReceiver extends BroadcastReceiver { @Override public void onReceive(final Context context, Intent intent) { if (Intent.ACTION_BOOT_COMPLETED.equals(intent.getAction())) { - // Check if the current value is empty or null and set license id. + // Check if the current value is empty or null and set anon hash. String eLicenseID = Settings.Secure.getString(context.getContentResolver(), - Settings.Secure.E_LICENSE_ID); - if (eLicenseID == null || eLicenseID.isEmpty()) { + "e_license_id"); + String anonHash = Settings.Secure.getString(context.getContentResolver(), + Settings.Secure.OTA_ANON_HASH); + if (anonHash == null || anonHash.isEmpty()) { Settings.Secure.putString(context.getContentResolver(), - Settings.Secure.E_LICENSE_ID, Utils.generateRandomID()); + Settings.Secure.OTA_ANON_HASH, (eLicenseID != null && + !eLicenseID.isEmpty()) ? eLicenseID : Utils.generateRandomID()); } Utils.cleanupDownloadsDir(context); diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java index 086eb9084d7bba906a93d694b8698fd451974f8c..cc83ccd4b5b36e317725f2ec86e71dfa01f2b311 100644 --- a/src/org/lineageos/updater/misc/Utils.java +++ b/src/org/lineageos/updater/misc/Utils.java @@ -239,8 +239,8 @@ public class Utils { String device = SystemProperties.get(Constants.PROP_NEXT_DEVICE, SystemProperties.get(Constants.PROP_DEVICE)); String type = SystemProperties.get(Constants.PROP_RELEASE_TYPE).toLowerCase(Locale.ROOT); - String eLicenseID = Settings.Secure.getString(context.getContentResolver(), - Settings.Secure.E_LICENSE_ID); + String anonHash = Settings.Secure.getString(context.getContentResolver(), + Settings.Secure.OTA_ANON_HASH); String serverUrl = SystemProperties.get(Constants.PROP_UPDATER_URI); if (retrieveStatus(context) != null && retrieveStatus(context).equals("true") @@ -252,8 +252,8 @@ public class Utils { serverUrl = context.getString(R.string.updater_server_url); } - if (eLicenseID != null && !eLicenseID.isEmpty()) { - serverUrl += "?license_id=" + eLicenseID; + if (anonHash != null && !anonHash.isEmpty()) { + serverUrl += "?ota_anon_hash=" + anonHash; } return serverUrl.replace("{device}", device)