Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 596ee2e4 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Updater: Rename license id to ota anon hash

parent dde1696b
Loading
Loading
Loading
Loading
+7 −4
Original line number Diff line number Diff line
@@ -53,12 +53,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);
+4 −4
Original line number Diff line number Diff line
@@ -220,8 +220,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")
@@ -233,8 +233,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)