From b048ff1e8c88e83abf472bf1fbc8dcc19af9ddcb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sebastian=20K=C3=BCrten?= <sebastian@mobanisto.de>
Date: Mon, 15 May 2023 15:35:51 +0200
Subject: [PATCH] Fix formatting for recent commits

---
 .../onionwrapper/AndroidLocationUtils.java    | 95 ++++++++++---------
 .../AndroidLocationUtilsFactory.java          |  6 +-
 .../onionwrapper/AndroidTorWrapper.java       |  2 +-
 .../onionwrapper/AbstractTorWrapper.java      |  2 +-
 .../CircumventionProviderFactory.java         |  6 +-
 .../onionwrapper/LocationUtils.java           | 46 ++++-----
 .../briarproject/onionwrapper/TorWrapper.java | 10 +-
 .../onionwrapper/JavaLocationUtils.java       | 24 ++---
 .../JavaLocationUtilsFactory.java             |  6 +-
 9 files changed, 99 insertions(+), 98 deletions(-)

diff --git a/onionwrapper-android/src/main/java/org/briarproject/onionwrapper/AndroidLocationUtils.java b/onionwrapper-android/src/main/java/org/briarproject/onionwrapper/AndroidLocationUtils.java
index 23e8b19..3d70a89 100644
--- a/onionwrapper-android/src/main/java/org/briarproject/onionwrapper/AndroidLocationUtils.java
+++ b/onionwrapper-android/src/main/java/org/briarproject/onionwrapper/AndroidLocationUtils.java
@@ -1,7 +1,5 @@
 package org.briarproject.onionwrapper;
 
-import static android.content.Context.TELEPHONY_SERVICE;
-
 import android.annotation.SuppressLint;
 import android.app.Application;
 import android.content.Context;
@@ -15,57 +13,60 @@ import java.util.logging.Logger;
 
 import javax.inject.Inject;
 
+import static android.content.Context.TELEPHONY_SERVICE;
+
 @NotNullByDefault
 class AndroidLocationUtils implements LocationUtils {
 
-    private static final Logger LOG =
-            Logger.getLogger(AndroidLocationUtils.class.getName());
+	private static final Logger LOG =
+			Logger.getLogger(AndroidLocationUtils.class.getName());
 
-    private final Context appContext;
+	private final Context appContext;
 
-    @Inject
-    AndroidLocationUtils(Application app) {
-        appContext = app.getApplicationContext();
-    }
+	@Inject
+	AndroidLocationUtils(Application app) {
+		appContext = app.getApplicationContext();
+	}
 
-    /**
-     * This guesses the current country from the first of these sources that
-     * succeeds (also in order of likelihood of being correct):
-     *
-     * <ul>
-     * <li>Phone network. This works even when no SIM card is inserted, or a
-     *     foreign SIM card is inserted.</li>
-     * <li>SIM card. This is only an heuristic and assumes the user is not
-     *     roaming.</li>
-     * <li>User locale. This is an even worse heuristic.</li>
-     * </ul>
-     *
-     * Note: this is very similar to <a href="https://android.googlesource.com/platform/frameworks/base/+/cd92588%5E/location/java/android/location/CountryDetector.java">
-     * this API</a> except it seems that Google doesn't want us to use it for
-     * some reason - both that class and {@code Context.COUNTRY_CODE} are
-     * annotated {@code @hide}.
-     */
-    @Override
-    @SuppressLint("DefaultLocale")
-    public String getCurrentCountry() {
-        String countryCode = getCountryFromPhoneNetwork();
-        if (!TextUtils.isEmpty(countryCode)) return countryCode.toUpperCase();
-        LOG.info("Falling back to SIM card country");
-        countryCode = getCountryFromSimCard();
-        if (!TextUtils.isEmpty(countryCode)) return countryCode.toUpperCase();
-        LOG.info("Falling back to user-defined locale");
-        return Locale.getDefault().getCountry();
-    }
+	/**
+	 * This guesses the current country from the first of these sources that
+	 * succeeds (also in order of likelihood of being correct):
+	 *
+	 * <ul>
+	 * <li>Phone network. This works even when no SIM card is inserted, or a
+	 *     foreign SIM card is inserted.</li>
+	 * <li>SIM card. This is only an heuristic and assumes the user is not
+	 *     roaming.</li>
+	 * <li>User locale. This is an even worse heuristic.</li>
+	 * </ul>
+	 * <p>
+	 * Note: this is very similar to
+	 * <a href="https://android.googlesource.com/platform/frameworks/base/+/cd92588%5E/location/java/android/location/CountryDetector.java">
+	 * this API</a> except it seems that Google doesn't want us to use it for
+	 * some reason - both that class and {@code Context.COUNTRY_CODE} are
+	 * annotated {@code @hide}.
+	 */
+	@Override
+	@SuppressLint("DefaultLocale")
+	public String getCurrentCountry() {
+		String countryCode = getCountryFromPhoneNetwork();
+		if (!TextUtils.isEmpty(countryCode)) return countryCode.toUpperCase();
+		LOG.info("Falling back to SIM card country");
+		countryCode = getCountryFromSimCard();
+		if (!TextUtils.isEmpty(countryCode)) return countryCode.toUpperCase();
+		LOG.info("Falling back to user-defined locale");
+		return Locale.getDefault().getCountry();
+	}
 
-    private String getCountryFromPhoneNetwork() {
-        Object o = appContext.getSystemService(TELEPHONY_SERVICE);
-        TelephonyManager tm = (TelephonyManager) o;
-        return tm == null ? "" : tm.getNetworkCountryIso();
-    }
+	private String getCountryFromPhoneNetwork() {
+		Object o = appContext.getSystemService(TELEPHONY_SERVICE);
+		TelephonyManager tm = (TelephonyManager) o;
+		return tm == null ? "" : tm.getNetworkCountryIso();
+	}
 
-    private String getCountryFromSimCard() {
-        Object o = appContext.getSystemService(TELEPHONY_SERVICE);
-        TelephonyManager tm = (TelephonyManager) o;
-        return tm == null ? "" : tm.getSimCountryIso();
-    }
+	private String getCountryFromSimCard() {
+		Object o = appContext.getSystemService(TELEPHONY_SERVICE);
+		TelephonyManager tm = (TelephonyManager) o;
+		return tm == null ? "" : tm.getSimCountryIso();
+	}
 }
diff --git a/onionwrapper-android/src/main/java/org/briarproject/onionwrapper/AndroidLocationUtilsFactory.java b/onionwrapper-android/src/main/java/org/briarproject/onionwrapper/AndroidLocationUtilsFactory.java
index 0708ffa..b576a3c 100644
--- a/onionwrapper-android/src/main/java/org/briarproject/onionwrapper/AndroidLocationUtilsFactory.java
+++ b/onionwrapper-android/src/main/java/org/briarproject/onionwrapper/AndroidLocationUtilsFactory.java
@@ -7,8 +7,8 @@ import org.briarproject.nullsafety.NotNullByDefault;
 @NotNullByDefault
 public class AndroidLocationUtilsFactory {
 
-    public static LocationUtils createAndroidLocationUtils(Application app) {
-        return new AndroidLocationUtils(app);
-    }
+	public static LocationUtils createAndroidLocationUtils(Application app) {
+		return new AndroidLocationUtils(app);
+	}
 
 }
diff --git a/onionwrapper-android/src/main/java/org/briarproject/onionwrapper/AndroidTorWrapper.java b/onionwrapper-android/src/main/java/org/briarproject/onionwrapper/AndroidTorWrapper.java
index 9ddf657..26a6b73 100644
--- a/onionwrapper-android/src/main/java/org/briarproject/onionwrapper/AndroidTorWrapper.java
+++ b/onionwrapper-android/src/main/java/org/briarproject/onionwrapper/AndroidTorWrapper.java
@@ -133,7 +133,7 @@ public class AndroidTorWrapper extends AbstractTorWrapper {
 	}
 
 	@Override
-    public File getObfs4ExecutableFile() {
+	public File getObfs4ExecutableFile() {
 		return obfs4Lib.exists() ? obfs4Lib : super.getObfs4ExecutableFile();
 	}
 
diff --git a/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/AbstractTorWrapper.java b/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/AbstractTorWrapper.java
index 75c9acf..d857f02 100644
--- a/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/AbstractTorWrapper.java
+++ b/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/AbstractTorWrapper.java
@@ -107,7 +107,7 @@ abstract class AbstractTorWrapper implements EventHandler, TorWrapper {
 		return new File(torDirectory, "tor");
 	}
 
-    @Override
+	@Override
 	public File getObfs4ExecutableFile() {
 		return new File(torDirectory, "obfs4proxy");
 	}
diff --git a/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/CircumventionProviderFactory.java b/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/CircumventionProviderFactory.java
index e568e43..9ebc340 100644
--- a/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/CircumventionProviderFactory.java
+++ b/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/CircumventionProviderFactory.java
@@ -5,8 +5,8 @@ import org.briarproject.nullsafety.NotNullByDefault;
 @NotNullByDefault
 public class CircumventionProviderFactory {
 
-    public static CircumventionProvider createCircumventionProvider() {
-        return new CircumventionProviderImpl();
-    }
+	public static CircumventionProvider createCircumventionProvider() {
+		return new CircumventionProviderImpl();
+	}
 
 }
diff --git a/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/LocationUtils.java b/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/LocationUtils.java
index 637f515..34f9e2f 100644
--- a/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/LocationUtils.java
+++ b/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/LocationUtils.java
@@ -7,28 +7,28 @@ import java.util.Locale;
 @NotNullByDefault
 public interface LocationUtils {
 
-    /**
-     * Get the country the device is currently located in, or "" if it cannot
-     * be determined.
-     * <p>
-     * The country codes are formatted upper-case and as per <a href="
-     * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha 2</a>.
-     */
-    String getCurrentCountry();
+	/**
+	 * Get the country the device is currently located in, or "" if it cannot
+	 * be determined.
+	 * <p>
+	 * The country codes are formatted upper-case and as per <a href="
+	 * https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2">ISO 3166-1 alpha 2</a>.
+	 */
+	String getCurrentCountry();
 
-    /**
-     * Returns the name of the country for display in the UI
-     * or the isoCode if none could be found.
-     *
-     * @param isoCode The result from {@link #getCurrentCountry()}.
-     */
-    static String getCountryDisplayName(String isoCode) {
-        for (Locale locale : Locale.getAvailableLocales()) {
-            if (locale.getCountry().equalsIgnoreCase(isoCode)) {
-                return locale.getDisplayCountry();
-            }
-        }
-        // Name is unknown
-        return isoCode;
-    }
+	/**
+	 * Returns the name of the country for display in the UI
+	 * or the isoCode if none could be found.
+	 *
+	 * @param isoCode The result from {@link #getCurrentCountry()}.
+	 */
+	static String getCountryDisplayName(String isoCode) {
+		for (Locale locale : Locale.getAvailableLocales()) {
+			if (locale.getCountry().equalsIgnoreCase(isoCode)) {
+				return locale.getDisplayCountry();
+			}
+		}
+		// Name is unknown
+		return isoCode;
+	}
 }
diff --git a/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/TorWrapper.java b/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/TorWrapper.java
index 21d0510..ed04b3c 100644
--- a/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/TorWrapper.java
+++ b/onionwrapper-core/src/main/java/org/briarproject/onionwrapper/TorWrapper.java
@@ -18,7 +18,7 @@ public interface TorWrapper {
 
 	/**
 	 * Starts the Tor process, but does not yet connect to the Tor Network.
-     * Call {@link #enableNetwork(boolean)} for this.
+	 * Call {@link #enableNetwork(boolean)} for this.
 	 * <p>
 	 * This method must only be called once. To restart the Tor process, stop
 	 * this wrapper instance and then create a new instance.
@@ -100,10 +100,10 @@ public interface TorWrapper {
 	 */
 	void enableIpv6(boolean ipv6Only) throws IOException;
 
-    /**
-     * Returns the Obfs4 executable as a File for use with Moat.
-     */
-    File getObfs4ExecutableFile();
+	/**
+	 * Returns the Obfs4 executable as a File for use with Moat.
+	 */
+	File getObfs4ExecutableFile();
 
 	/**
 	 * The state of the Tor wrapper.
diff --git a/onionwrapper-java/src/main/java/org/briarproject/onionwrapper/JavaLocationUtils.java b/onionwrapper-java/src/main/java/org/briarproject/onionwrapper/JavaLocationUtils.java
index 033928a..2ee24cd 100644
--- a/onionwrapper-java/src/main/java/org/briarproject/onionwrapper/JavaLocationUtils.java
+++ b/onionwrapper-java/src/main/java/org/briarproject/onionwrapper/JavaLocationUtils.java
@@ -10,17 +10,17 @@ import javax.inject.Inject;
 @NotNullByDefault
 class JavaLocationUtils implements LocationUtils {
 
-    private static final Logger LOG =
-            Logger.getLogger(JavaLocationUtils.class.getName());
-
-    @Inject
-    JavaLocationUtils() {
-    }
-
-    @Override
-    public String getCurrentCountry() {
-        LOG.info("Using user-defined locale");
-        return Locale.getDefault().getCountry();
-    }
+	private static final Logger LOG =
+			Logger.getLogger(JavaLocationUtils.class.getName());
+
+	@Inject
+	JavaLocationUtils() {
+	}
+
+	@Override
+	public String getCurrentCountry() {
+		LOG.info("Using user-defined locale");
+		return Locale.getDefault().getCountry();
+	}
 
 }
diff --git a/onionwrapper-java/src/main/java/org/briarproject/onionwrapper/JavaLocationUtilsFactory.java b/onionwrapper-java/src/main/java/org/briarproject/onionwrapper/JavaLocationUtilsFactory.java
index 34b5f16..8fa2371 100644
--- a/onionwrapper-java/src/main/java/org/briarproject/onionwrapper/JavaLocationUtilsFactory.java
+++ b/onionwrapper-java/src/main/java/org/briarproject/onionwrapper/JavaLocationUtilsFactory.java
@@ -5,8 +5,8 @@ import org.briarproject.nullsafety.NotNullByDefault;
 @NotNullByDefault
 public class JavaLocationUtilsFactory {
 
-    public static LocationUtils createJavaLocationUtils() {
-        return new JavaLocationUtils();
-    }
+	public static LocationUtils createJavaLocationUtils() {
+		return new JavaLocationUtils();
+	}
 
 }
-- 
GitLab