|
|
|
@ -31,6 +31,10 @@ import android.os.Build;
|
|
|
|
|
import android.text.format.DateUtils;
|
|
|
|
|
import android.util.Log;
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
import androidx.core.content.ContextCompat;
|
|
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
|
|
|
|
|
|
import org.fdroid.fdroid.data.Apk;
|
|
|
|
|
import org.fdroid.fdroid.installer.PrivilegedInstaller;
|
|
|
|
|
import org.fdroid.fdroid.net.ConnectivityMonitorService;
|
|
|
|
@ -44,10 +48,6 @@ import java.util.Random;
|
|
|
|
|
import java.util.Set;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
import androidx.annotation.Nullable;
|
|
|
|
|
import androidx.core.content.ContextCompat;
|
|
|
|
|
import androidx.preference.PreferenceManager;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Handles shared preferences for FDroid, looking after the names of
|
|
|
|
|
* preferences, default values and caching. Needs to be setup in the FDroidApp
|
|
|
|
@ -506,11 +506,11 @@ public final class Preferences implements SharedPreferences.OnSharedPreferenceCh
|
|
|
|
|
public int getProxyPort() {
|
|
|
|
|
final String port = preferences.getString(PREF_PROXY_PORT, String.valueOf(DEFAULT_PROXY_PORT));
|
|
|
|
|
try {
|
|
|
|
|
return Integer.parseInt(port);
|
|
|
|
|
return Math.min(Integer.parseInt(port), 65535);
|
|
|
|
|
} catch (NumberFormatException e) {
|
|
|
|
|
// hack until this can be a number-only preference
|
|
|
|
|
try {
|
|
|
|
|
return Integer.parseInt(port.replaceAll("[^0-9]", ""));
|
|
|
|
|
return Math.min(Integer.parseInt(port.replaceAll("[^0-9]", "")), 65535);
|
|
|
|
|
} catch (Exception e1) {
|
|
|
|
|
return DEFAULT_PROXY_PORT;
|
|
|
|
|
}
|
|
|
|
|