diff --git a/src/org/lineageos/updater/UpdatesCheckReceiver.java b/src/org/lineageos/updater/UpdatesCheckReceiver.java index 8e47f07fdd4b9fbd2c847dea8e0a1e2650b3136a..7fe23a3fa7eed99a40679c9af27414facc74eb5a 100644 --- a/src/org/lineageos/updater/UpdatesCheckReceiver.java +++ b/src/org/lineageos/updater/UpdatesCheckReceiver.java @@ -54,12 +54,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 cd201c65b6085bdc388315db6d7bd533874327d1..e81795f8c33d8d545143ff7eb3bdadb93b8befa2 100644 --- a/src/org/lineageos/updater/misc/Utils.java +++ b/src/org/lineageos/updater/misc/Utils.java @@ -231,8 +231,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") @@ -244,8 +244,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)