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

Commit 8d67d66b authored by Romain Hunault's avatar Romain Hunault Committed by Mohammed Althaf T
Browse files

Updater: Change default user-agent

Change-Id: Ie5d8624b4fa92012459a7c4e05494a926024bba0
parent 1adf50ec
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
package org.lineageos.updater.download;

import android.os.SystemClock;
import android.os.SystemProperties;

import android.util.Log;

import java.io.File;
@@ -32,6 +34,8 @@ import java.util.PriorityQueue;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.lineageos.updater.misc.Constants;

public class HttpURLConnectionClient implements DownloadClient {

    private final static String TAG = "HttpURLConnectionClient";
@@ -58,6 +62,11 @@ public class HttpURLConnectionClient implements DownloadClient {
            DownloadClient.DownloadCallback callback,
            boolean useDuplicateLinks) throws IOException {
        mClient = (HttpURLConnection) new URL(url).openConnection();

        String defaultUserAgent = mClient.getRequestProperty("User-Agent");
        String newUserAgent = defaultUserAgent + " eOS v" + SystemProperties.get(Constants.PROP_BUILD_VERSION);
        mClient.setRequestProperty("User-Agent", newUserAgent);

        mDestination = destination;
        mProgressListener = progressListener;
        mCallback = callback;